linux-stable/drivers/md
Li Lingfeng 62a4b137d8 dm: don't lock fs when the map is NULL in process of resume
commit 38d11da522 upstream.

Commit fa247089de ("dm: requeue IO if mapping table not yet available")
added a detection of whether the mapping table is available in the IO
submission process. If the mapping table is unavailable, it returns
BLK_STS_RESOURCE and requeues the IO.
This can lead to the following deadlock problem:

dm create                                      mount
ioctl(DM_DEV_CREATE_CMD)
ioctl(DM_TABLE_LOAD_CMD)
                               do_mount
                                vfs_get_tree
                                 ext4_get_tree
                                  get_tree_bdev
                                   sget_fc
                                    alloc_super
                                     // got &s->s_umount
                                     down_write_nested(&s->s_umount, ...);
                                   ext4_fill_super
                                    ext4_load_super
                                     ext4_read_bh
                                      submit_bio
                                      // submit and wait io end
ioctl(DM_DEV_SUSPEND_CMD)
dev_suspend
 do_resume
  dm_suspend
   __dm_suspend
    lock_fs
     freeze_bdev
      get_active_super
       grab_super
        // wait for &s->s_umount
        down_write(&s->s_umount);
  dm_swap_table
   __bind
    // set md->map(can't get here)

IO will be continuously requeued while holding the lock since mapping
table is NULL. At the same time, mapping table won't be set since the
lock is not available.
Like request-based DM, bio-based DM also has the same problem.

It's not proper to just abort IO if the mapping table not available.
So clear DM_SKIP_LOCKFS_FLAG when the mapping table is NULL, this
allows the DM table to be loaded and the IO submitted upon resume.

Fixes: fa247089de ("dm: requeue IO if mapping table not yet available")
Cc: stable@vger.kernel.org
Signed-off-by: Li Lingfeng <lilingfeng3@huawei.com>
Signed-off-by: Mike Snitzer <snitzer@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-05-11 23:11:35 +09:00
..
bcache bcache: Silence memcpy() run-time false positive warnings 2023-01-25 12:24:50 -08:00
persistent-data dm: change "unsigned" to "unsigned int" 2023-04-13 17:02:34 +02:00
dm-audit.c
dm-audit.h
dm-bio-prison-v1.c dm: change "unsigned" to "unsigned int" 2023-04-13 17:02:34 +02:00
dm-bio-prison-v1.h
dm-bio-prison-v2.c dm: change "unsigned" to "unsigned int" 2023-04-13 17:02:34 +02:00
dm-bio-prison-v2.h dm: change "unsigned" to "unsigned int" 2023-04-13 17:02:34 +02:00
dm-bio-record.h
dm-bufio.c dm: change "unsigned" to "unsigned int" 2023-04-13 17:02:34 +02:00
dm-builtin.c
dm-cache-background-tracker.c dm: change "unsigned" to "unsigned int" 2023-04-13 17:02:34 +02:00
dm-cache-background-tracker.h dm: change "unsigned" to "unsigned int" 2023-04-13 17:02:34 +02:00
dm-cache-block-types.h
dm-cache-metadata.c dm: change "unsigned" to "unsigned int" 2023-04-13 17:02:34 +02:00
dm-cache-metadata.h dm: change "unsigned" to "unsigned int" 2023-04-13 17:02:34 +02:00
dm-cache-policy-internal.h dm: change "unsigned" to "unsigned int" 2023-04-13 17:02:34 +02:00
dm-cache-policy-smq.c dm: change "unsigned" to "unsigned int" 2023-04-13 17:02:34 +02:00
dm-cache-policy.c dm: change "unsigned" to "unsigned int" 2023-04-13 17:02:34 +02:00
dm-cache-policy.h dm: change "unsigned" to "unsigned int" 2023-04-13 17:02:34 +02:00
dm-cache-target.c dm: change "unsigned" to "unsigned int" 2023-04-13 17:02:34 +02:00
dm-clone-metadata.c
dm-clone-metadata.h
dm-clone-target.c dm clone: call kmem_cache_destroy() in dm_clone_init() error path 2023-05-11 23:11:35 +09:00
dm-core.h dm: change "unsigned" to "unsigned int" 2023-04-13 17:02:34 +02:00
dm-crypt.c dm: change "unsigned" to "unsigned int" 2023-04-13 17:02:34 +02:00
dm-delay.c dm: change "unsigned" to "unsigned int" 2023-04-13 17:02:34 +02:00
dm-dust.c
dm-ebs-target.c dm: change "unsigned" to "unsigned int" 2023-04-13 17:02:34 +02:00
dm-era-target.c dm: change "unsigned" to "unsigned int" 2023-04-13 17:02:34 +02:00
dm-exception-store.c dm: change "unsigned" to "unsigned int" 2023-04-13 17:02:34 +02:00
dm-exception-store.h dm: change "unsigned" to "unsigned int" 2023-04-13 17:02:34 +02:00
dm-flakey.c dm flakey: fix a crash with invalid table line 2023-05-11 23:11:35 +09:00
dm-ima.c dm table: audit all dm_table_get_target() callers 2022-07-07 11:49:34 -04:00
dm-ima.h
dm-init.c dm init: add dm-mod.waitfor to wait for asynchronously probed block devices 2022-12-02 17:37:45 -05:00
dm-integrity.c dm integrity: call kmem_cache_destroy() in dm_integrity_init() error path 2023-05-11 23:11:35 +09:00
dm-io-rewind.c dm: change "unsigned" to "unsigned int" 2023-04-13 17:02:34 +02:00
dm-io-tracker.h
dm-io.c dm: change "unsigned" to "unsigned int" 2023-04-13 17:02:34 +02:00
dm-ioctl.c dm: don't lock fs when the map is NULL in process of resume 2023-05-11 23:11:35 +09:00
dm-kcopyd.c dm: change "unsigned" to "unsigned int" 2023-04-13 17:02:34 +02:00
dm-linear.c dm: change "unsigned" to "unsigned int" 2023-04-13 17:02:34 +02:00
dm-log-userspace-base.c dm: change "unsigned" to "unsigned int" 2023-04-13 17:02:34 +02:00
dm-log-userspace-transfer.c dm: change "unsigned" to "unsigned int" 2023-04-13 17:02:34 +02:00
dm-log-userspace-transfer.h
dm-log-writes.c dm: change "unsigned" to "unsigned int" 2023-04-13 17:02:34 +02:00
dm-log.c dm: change "unsigned" to "unsigned int" 2023-04-13 17:02:34 +02:00
dm-mpath.c dm: change "unsigned" to "unsigned int" 2023-04-13 17:02:34 +02:00
dm-mpath.h dm: change "unsigned" to "unsigned int" 2023-04-13 17:02:34 +02:00
dm-path-selector.c
dm-path-selector.h dm: change "unsigned" to "unsigned int" 2023-04-13 17:02:34 +02:00
dm-ps-historical-service-time.c
dm-ps-io-affinity.c dm: change "unsigned" to "unsigned int" 2023-04-13 17:02:34 +02:00
dm-ps-queue-length.c dm: change "unsigned" to "unsigned int" 2023-04-13 17:02:34 +02:00
dm-ps-round-robin.c dm: change "unsigned" to "unsigned int" 2023-04-13 17:02:34 +02:00
dm-ps-service-time.c dm: change "unsigned" to "unsigned int" 2023-04-13 17:02:34 +02:00
dm-raid.c dm: change "unsigned" to "unsigned int" 2023-04-13 17:02:34 +02:00
dm-raid1.c dm: change "unsigned" to "unsigned int" 2023-04-13 17:02:34 +02:00
dm-region-hash.c dm: change "unsigned" to "unsigned int" 2023-04-13 17:02:34 +02:00
dm-rq.c dm: change "unsigned" to "unsigned int" 2023-04-13 17:02:34 +02:00
dm-rq.h dm: change "unsigned" to "unsigned int" 2023-04-13 17:02:34 +02:00
dm-snap-persistent.c dm: change "unsigned" to "unsigned int" 2023-04-13 17:02:34 +02:00
dm-snap-transient.c dm: change "unsigned" to "unsigned int" 2023-04-13 17:02:34 +02:00
dm-snap.c dm: change "unsigned" to "unsigned int" 2023-04-13 17:02:34 +02:00
dm-stats.c dm: change "unsigned" to "unsigned int" 2023-04-13 17:02:34 +02:00
dm-stats.h dm: change "unsigned" to "unsigned int" 2023-04-13 17:02:34 +02:00
dm-stripe.c dm: change "unsigned" to "unsigned int" 2023-04-13 17:02:34 +02:00
dm-switch.c dm: change "unsigned" to "unsigned int" 2023-04-13 17:02:34 +02:00
dm-sysfs.c
dm-table.c blk-crypto: make blk_crypto_evict_key() return void 2023-05-11 23:10:50 +09:00
dm-target.c
dm-thin-metadata.c dm: change "unsigned" to "unsigned int" 2023-04-13 17:02:34 +02:00
dm-thin-metadata.h
dm-thin.c dm: change "unsigned" to "unsigned int" 2023-04-13 17:02:34 +02:00
dm-uevent.c dm: change "unsigned" to "unsigned int" 2023-04-13 17:02:34 +02:00
dm-uevent.h dm: change "unsigned" to "unsigned int" 2023-04-13 17:02:34 +02:00
dm-unstripe.c
dm-verity-fec.c dm: change "unsigned" to "unsigned int" 2023-04-13 17:02:34 +02:00
dm-verity-fec.h dm: change "unsigned" to "unsigned int" 2023-04-13 17:02:34 +02:00
dm-verity-loadpin.c dm: verity-loadpin: Only trust verity targets with enforcement 2022-09-07 16:37:27 -07:00
dm-verity-target.c dm verity: fix error handling for check_at_most_once on FEC 2023-05-11 23:11:35 +09:00
dm-verity-verify-sig.c
dm-verity-verify-sig.h
dm-verity.h dm: change "unsigned" to "unsigned int" 2023-04-13 17:02:34 +02:00
dm-writecache.c dm: change "unsigned" to "unsigned int" 2023-04-13 17:02:34 +02:00
dm-zero.c
dm-zone.c - Refactor DM core's mempool allocation so that it clearer by not 2022-08-02 14:21:25 -07:00
dm-zoned-metadata.c dm: improve shrinker debug names 2023-03-10 09:28:36 +01:00
dm-zoned-reclaim.c
dm-zoned-target.c dm-zoned: cleanup dmz_fixup_devices 2022-07-06 06:46:26 -06:00
dm-zoned.h dm/dm-zoned: Use the enum req_op type 2022-07-14 12:14:31 -06:00
dm.c dm: fix improper splitting for abnormal bios 2023-04-13 17:02:34 +02:00
dm.h dm: change "unsigned" to "unsigned int" 2023-04-13 17:02:34 +02:00
Kconfig md: select BLOCK_LEGACY_AUTOLOAD 2023-03-22 13:38:00 +01:00
Makefile hardening updates for v5.20-rc1 2022-08-02 14:38:59 -07:00
md-autodetect.c md: return the allocated devices from md_alloc 2022-08-02 17:22:46 -06:00
md-bitmap.c md/bitmap: Fix bitmap chunk size overflow issues 2022-11-14 09:35:50 -08:00
md-bitmap.h
md-cluster.c fs: dlm: remove DLM_LSFL_FS from uapi 2022-08-23 14:54:54 -05:00
md-cluster.h
md-faulty.c
md-linear.c
md-linear.h
md-multipath.c
md-multipath.h
md.c md: avoid signed overflow in slot_store() 2023-04-06 12:12:27 +02:00
md.h md: mark md_kick_rdev_from_array static 2022-12-02 11:21:01 -08:00
raid0.c md/raid0, raid10: Don't set discard sectors for request queue 2022-11-14 10:15:34 -08:00
raid0.h
raid1-10.c
raid1.c block: remove bio_set_op_attrs 2022-12-07 09:43:12 -07:00
raid1.h
raid5-cache.c md/raid5: use bdev_write_cache instead of open coding it 2022-11-14 10:15:35 -08:00
raid5-log.h md/raid5-ppl: Drop unused argument from ppl_handle_flush_request() 2022-08-02 17:14:31 -06:00
raid5-ppl.c md/raid5: use bdev_write_cache instead of open coding it 2022-11-14 10:15:35 -08:00
raid5.c md/raid5: Improve performance for sequential IO 2023-05-11 23:11:33 +09:00
raid5.h md/raid5: Cleanup prototype of raid5_get_active_stripe() 2022-09-22 00:05:04 -07:00
raid10.c md/raid10: fix null-ptr-deref in raid10_sync_request 2023-05-11 23:11:33 +09:00
raid10.h md/raid10: convert resync_lock to use seqlock 2022-09-22 00:05:05 -07:00