summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMikulas Patocka <mpatocka@redhat.com>2020-07-23 10:42:09 -0400
committerMike Snitzer <snitzer@redhat.com>2020-07-23 14:39:37 -0400
commit5df96f2b9f58a5d2dc1f30fe7de75e197f2c25f2 (patch)
tree70d70eb0c263e130f3ec662cc6c1248cc8da77e6 /include
parent6958c1c640af8c3f40fa8a2eee3b5b905d95b677 (diff)
downloadlinux-rpi-5df96f2b9f58a5d2dc1f30fe7de75e197f2c25f2.tar.gz
linux-rpi-5df96f2b9f58a5d2dc1f30fe7de75e197f2c25f2.tar.bz2
linux-rpi-5df96f2b9f58a5d2dc1f30fe7de75e197f2c25f2.zip
dm integrity: fix integrity recalculation that is improperly skipped
Commit adc0daad366b62ca1bce3e2958a40b0b71a8b8b3 ("dm: report suspended device during destroy") broke integrity recalculation. The problem is dm_suspended() returns true not only during suspend, but also during resume. So this race condition could occur: 1. dm_integrity_resume calls queue_work(ic->recalc_wq, &ic->recalc_work) 2. integrity_recalc (&ic->recalc_work) preempts the current thread 3. integrity_recalc calls if (unlikely(dm_suspended(ic->ti))) goto unlock_ret; 4. integrity_recalc exits and no recalculating is done. To fix this race condition, add a function dm_post_suspending that is only true during the postsuspend phase and use it instead of dm_suspended(). Signed-off-by: Mikulas Patocka <mpatocka redhat com> Fixes: adc0daad366b ("dm: report suspended device during destroy") Cc: stable vger kernel org # v4.18+ Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Diffstat (limited to 'include')
-rw-r--r--include/linux/device-mapper.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h
index 8750f2dc5613..73dec4b5d5be 100644
--- a/include/linux/device-mapper.h
+++ b/include/linux/device-mapper.h
@@ -426,6 +426,7 @@ const char *dm_device_name(struct mapped_device *md);
int dm_copy_name_and_uuid(struct mapped_device *md, char *name, char *uuid);
struct gendisk *dm_disk(struct mapped_device *md);
int dm_suspended(struct dm_target *ti);
+int dm_post_suspending(struct dm_target *ti);
int dm_noflush_suspending(struct dm_target *ti);
void dm_accept_partial_bio(struct bio *bio, unsigned n_sectors);
union map_info *dm_get_rq_mapinfo(struct request *rq);