]> git.baikalelectronics.ru Git - kernel.git/commit
dm: allow remove to be deferred
authorMikulas Patocka <mpatocka@redhat.com>
Fri, 1 Nov 2013 22:27:41 +0000 (18:27 -0400)
committerMike Snitzer <snitzer@redhat.com>
Sat, 9 Nov 2013 23:20:22 +0000 (18:20 -0500)
commitd1c48b6186eccfa4eecb6b1811c89caa393367ab
tree73d747f4422fe202868495d08ea5d189bc16bd79
parenta194f5dbb86da5b2e902e46f3cc33eadbeb10bf4
dm: allow remove to be deferred

This patch allows the removal of an open device to be deferred until
it is closed.  (Previously such a removal attempt would fail.)

The deferred remove functionality is enabled by setting the flag
DM_DEFERRED_REMOVE in the ioctl structure on DM_DEV_REMOVE or
DM_REMOVE_ALL ioctl.

On return from DM_DEV_REMOVE, the flag DM_DEFERRED_REMOVE indicates if
the device was removed immediately or flagged to be removed on close -
if the flag is clear, the device was removed.

On return from DM_DEV_STATUS and other ioctls, the flag
DM_DEFERRED_REMOVE is set if the device is scheduled to be removed on
closure.

A device that is scheduled to be deleted can be revived using the
message "@cancel_deferred_remove". This message clears the
DMF_DEFERRED_REMOVE flag so that the device won't be deleted on close.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
drivers/md/dm-ioctl.c
drivers/md/dm.c
drivers/md/dm.h
include/uapi/linux/dm-ioctl.h