Skip to content

Commit 0a7a93d

Browse files
committed
Merge tag 'dm-6.7/dm-fixes-3' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm
Pull device mapper fixes from Mike Snitzer: - DM raid target (and MD raid) fix for reconfig_mutex MD deadlock that should have been merged along with recent v6.7-rc6 MD fixes (see MD related commits: f2d87a7^..b391133) - DM integrity target fix to avoid modifying immutable biovec in the integrity_metadata() edge case where kmalloc fails. - Fix drivers/md/Kconfig so DM_AUDIT depends on BLK_DEV_DM. - Update DM entry in MAINTAINERS to remove stale info. * tag 'dm-6.7/dm-fixes-3' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm: MAINTAINERS: remove stale info for DEVICE-MAPPER dm audit: fix Kconfig so DM_AUDIT depends on BLK_DEV_DM dm-integrity: don't modify bio's immutable bio_vec in integrity_metadata() dm-raid: delay flushing event_work() after reconfig_mutex is released
2 parents 55cb5f4 + 5d6f447 commit 0a7a93d

File tree

5 files changed

+18
-10
lines changed

5 files changed

+18
-10
lines changed

MAINTAINERS

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6050,10 +6050,8 @@ M: Mikulas Patocka <[email protected]>
60506050
60516051
60526052
S: Maintained
6053-
W: http://sources.redhat.com/dm
60546053
Q: http://patchwork.kernel.org/project/dm-devel/list/
60556054
T: git git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm.git
6056-
T: quilt http://people.redhat.com/agk/patches/linux/editing/
60576055
F: Documentation/admin-guide/device-mapper/
60586056
F: drivers/md/Kconfig
60596057
F: drivers/md/Makefile

drivers/md/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -660,6 +660,7 @@ config DM_ZONED
660660

661661
config DM_AUDIT
662662
bool "DM audit events"
663+
depends on BLK_DEV_DM
663664
depends on AUDIT
664665
help
665666
Generate audit events for device-mapper.

drivers/md/dm-integrity.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1755,11 +1755,12 @@ static void integrity_metadata(struct work_struct *w)
17551755
sectors_to_process = dio->range.n_sectors;
17561756

17571757
__bio_for_each_segment(bv, bio, iter, dio->bio_details.bi_iter) {
1758+
struct bio_vec bv_copy = bv;
17581759
unsigned int pos;
17591760
char *mem, *checksums_ptr;
17601761

17611762
again:
1762-
mem = bvec_kmap_local(&bv);
1763+
mem = bvec_kmap_local(&bv_copy);
17631764
pos = 0;
17641765
checksums_ptr = checksums;
17651766
do {
@@ -1768,7 +1769,7 @@ static void integrity_metadata(struct work_struct *w)
17681769
sectors_to_process -= ic->sectors_per_block;
17691770
pos += ic->sectors_per_block << SECTOR_SHIFT;
17701771
sector += ic->sectors_per_block;
1771-
} while (pos < bv.bv_len && sectors_to_process && checksums != checksums_onstack);
1772+
} while (pos < bv_copy.bv_len && sectors_to_process && checksums != checksums_onstack);
17721773
kunmap_local(mem);
17731774

17741775
r = dm_integrity_rw_tag(ic, checksums, &dio->metadata_block, &dio->metadata_offset,
@@ -1793,9 +1794,9 @@ static void integrity_metadata(struct work_struct *w)
17931794
if (!sectors_to_process)
17941795
break;
17951796

1796-
if (unlikely(pos < bv.bv_len)) {
1797-
bv.bv_offset += pos;
1798-
bv.bv_len -= pos;
1797+
if (unlikely(pos < bv_copy.bv_len)) {
1798+
bv_copy.bv_offset += pos;
1799+
bv_copy.bv_len -= pos;
17991800
goto again;
18001801
}
18011802
}

drivers/md/dm-raid.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3317,6 +3317,9 @@ static void raid_dtr(struct dm_target *ti)
33173317
mddev_lock_nointr(&rs->md);
33183318
md_stop(&rs->md);
33193319
mddev_unlock(&rs->md);
3320+
3321+
if (work_pending(&rs->md.event_work))
3322+
flush_work(&rs->md.event_work);
33203323
raid_set_free(rs);
33213324
}
33223325

drivers/md/md.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,14 @@ static struct module *md_cluster_mod;
8282

8383
static DECLARE_WAIT_QUEUE_HEAD(resync_wait);
8484
static struct workqueue_struct *md_wq;
85+
86+
/*
87+
* This workqueue is used for sync_work to register new sync_thread, and for
88+
* del_work to remove rdev, and for event_work that is only set by dm-raid.
89+
*
90+
* Noted that sync_work will grab reconfig_mutex, hence never flush this
91+
* workqueue whith reconfig_mutex grabbed.
92+
*/
8593
static struct workqueue_struct *md_misc_wq;
8694
struct workqueue_struct *md_bitmap_wq;
8795

@@ -6330,9 +6338,6 @@ static void __md_stop(struct mddev *mddev)
63306338
struct md_personality *pers = mddev->pers;
63316339
md_bitmap_destroy(mddev);
63326340
mddev_detach(mddev);
6333-
/* Ensure ->event_work is done */
6334-
if (mddev->event_work.func)
6335-
flush_workqueue(md_misc_wq);
63366341
spin_lock(&mddev->lock);
63376342
mddev->pers = NULL;
63386343
spin_unlock(&mddev->lock);

0 commit comments

Comments
 (0)