Skip to content

Commit 8a2bcda

Browse files
committed
Merge tag 'for-6.18/dm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm
Pull device mapper fixes from Mikulas Patocka: - dm-pcache fixes - fix a regression with empty flush bios - dm-verity: fix unreliable memory allocation with GFP_NOWAIT * tag 'for-6.18/dm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm: dm-verity: fix unreliable memory allocation dm: fix failure when empty flush's bi_sector points beyond the device end dm-pcache: zero cache_info before default init dm-pcache: reuse meta_addr in pcache_meta_find_latest dm-pcache: allow built-in build and rename flush helper
2 parents ac3fd01 + fe680d8 commit 8a2bcda

File tree

7 files changed

+10
-14
lines changed

7 files changed

+10
-14
lines changed

drivers/md/dm-pcache/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
dm-pcache-y := dm_pcache.o cache_dev.o segment.o backing_dev.o cache.o cache_gc.o cache_writeback.o cache_segment.o cache_key.o cache_req.o
22

3-
obj-m += dm-pcache.o
3+
obj-$(CONFIG_DM_PCACHE) += dm-pcache.o

drivers/md/dm-pcache/cache.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ static void cache_info_init_default(struct pcache_cache *cache)
181181
{
182182
struct pcache_cache_info *cache_info = &cache->cache_info;
183183

184-
cache_info->header.seq = 0;
184+
memset(cache_info, 0, sizeof(*cache_info));
185185
cache_info->n_segs = cache->cache_dev->seg_num;
186186
cache_info_set_gc_percent(cache_info, PCACHE_CACHE_GC_PERCENT_DEFAULT);
187187
}
@@ -411,7 +411,7 @@ void pcache_cache_stop(struct dm_pcache *pcache)
411411
{
412412
struct pcache_cache *cache = &pcache->cache;
413413

414-
cache_flush(cache);
414+
pcache_cache_flush(cache);
415415

416416
cancel_delayed_work_sync(&cache->gc_work);
417417
flush_work(&cache->clean_work);

drivers/md/dm-pcache/cache.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ void cache_seg_put(struct pcache_cache_segment *cache_seg);
339339
void cache_seg_set_next_seg(struct pcache_cache_segment *cache_seg, u32 seg_id);
340340

341341
/* cache request*/
342-
int cache_flush(struct pcache_cache *cache);
342+
int pcache_cache_flush(struct pcache_cache *cache);
343343
void miss_read_end_work_fn(struct work_struct *work);
344344
int pcache_cache_handle_req(struct pcache_cache *cache, struct pcache_request *pcache_req);
345345

drivers/md/dm-pcache/cache_req.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -790,7 +790,7 @@ static int cache_write(struct pcache_cache *cache, struct pcache_request *pcache
790790
}
791791

792792
/**
793-
* cache_flush - Flush all ksets to persist any pending cache data
793+
* pcache_cache_flush - Flush all ksets to persist any pending cache data
794794
* @cache: Pointer to the cache structure
795795
*
796796
* This function iterates through all ksets associated with the provided `cache`
@@ -802,7 +802,7 @@ static int cache_write(struct pcache_cache *cache, struct pcache_request *pcache
802802
* the respective error code, preventing the flush operation from proceeding to
803803
* subsequent ksets.
804804
*/
805-
int cache_flush(struct pcache_cache *cache)
805+
int pcache_cache_flush(struct pcache_cache *cache)
806806
{
807807
struct pcache_cache_kset *kset;
808808
int ret;
@@ -827,7 +827,7 @@ int pcache_cache_handle_req(struct pcache_cache *cache, struct pcache_request *p
827827
struct bio *bio = pcache_req->bio;
828828

829829
if (unlikely(bio->bi_opf & REQ_PREFLUSH))
830-
return cache_flush(cache);
830+
return pcache_cache_flush(cache);
831831

832832
if (bio_data_dir(bio) == READ)
833833
return cache_read(cache, pcache_req);

drivers/md/dm-pcache/pcache_internal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ static inline void __must_check *pcache_meta_find_latest(struct pcache_meta_head
9999
/* Update latest if a more recent sequence is found */
100100
if (!latest || pcache_meta_seq_after(meta->seq, seq_latest)) {
101101
seq_latest = meta->seq;
102-
latest = (void *)header + (i * meta_max_size);
102+
latest = meta_addr;
103103
}
104104
}
105105

drivers/md/dm-verity-fec.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -320,11 +320,7 @@ static int fec_alloc_bufs(struct dm_verity *v, struct dm_verity_fec_io *fio)
320320
if (fio->bufs[n])
321321
continue;
322322

323-
fio->bufs[n] = mempool_alloc(&v->fec->prealloc_pool, GFP_NOWAIT);
324-
if (unlikely(!fio->bufs[n])) {
325-
DMERR("failed to allocate FEC buffer");
326-
return -ENOMEM;
327-
}
323+
fio->bufs[n] = mempool_alloc(&v->fec->prealloc_pool, GFP_NOIO);
328324
}
329325

330326
/* try to allocate the maximum number of buffers */

drivers/md/dm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2005,7 +2005,7 @@ static void dm_split_and_process_bio(struct mapped_device *md,
20052005
* linear target or multiple linear targets pointing to the same
20062006
* device), we can send the flush with data directly to it.
20072007
*/
2008-
if (map->flush_bypasses_map) {
2008+
if (bio->bi_iter.bi_size && map->flush_bypasses_map) {
20092009
struct list_head *devices = dm_table_get_devices(map);
20102010
if (devices->next == devices->prev)
20112011
goto send_preflush_with_data;

0 commit comments

Comments
 (0)