Forum | Documentation | Website | Blog

Skip to content
Snippets Groups Projects
Commit 48ef0ba1 authored by Ming Lei's avatar Ming Lei Committed by Mike Snitzer
Browse files

dm: restore synchronous close of device mapper block device


'dmsetup remove' and 'dmsetup remove_all' require synchronous bdev
release. Otherwise dm_lock_for_deletion() may return -EBUSY if the open
count is > 0, because the open count is dropped in dm_blk_close()
which occurs after fput() completes.

So if dm_blk_close() is delayed because of asynchronous fput(), this
device mapper device is skipped during remove, which is a regression.

Fix the issue by using __fput_sync().

Also, DM device removal has long supported being made asynchronous by
setting the DMF_DEFERRED_REMOVE flag on the DM device. So leverage
using async fput() in close_table_device() if DMF_DEFERRED_REMOVE flag
is set.

Reported-by: default avatarZhong Changhui <czhong@redhat.com>
Fixes: a28d893e

 ("md: port block device access to file")
Suggested-by: default avatarChristian Brauner <brauner@kernel.org>
Signed-off-by: default avatarMing Lei <ming.lei@redhat.com>
[snitzer: editted commit header, use fput() if DMF_DEFERRED_REMOVE set]
Signed-off-by: default avatarMike Snitzer <snitzer@kernel.org>
parent f141dde5
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment