return -ENXIO;
if (!dm_suspended(md))
- r = dm_suspend(md);
+ r = dm_suspend(md, 1);
if (!r)
r = __dev_status(md, param);
if (new_map) {
/* Suspend if it isn't already suspended */
if (!dm_suspended(md))
- dm_suspend(md);
+ dm_suspend(md, 1);
r = dm_swap_table(md, new_map);
if (r) {
*/
#define DMF_BLOCK_IO 0
#define DMF_SUSPENDED 1
+#define DMF_FROZEN 2
struct mapped_device {
struct rw_semaphore io_lock;
return r;
}
+ set_bit(DMF_FROZEN, &md->flags);
+
/* don't bdput right now, we don't want the bdev
* to go away while it is locked.
*/
static void unlock_fs(struct mapped_device *md)
{
+ if (!test_bit(DMF_FROZEN, &md->flags))
+ return;
+
thaw_bdev(md->suspended_bdev, md->frozen_sb);
md->frozen_sb = NULL;
+ clear_bit(DMF_FROZEN, &md->flags);
}
/*
* dm_bind_table, dm_suspend must be called to flush any in
* flight bios and ensure that any further io gets deferred.
*/
-int dm_suspend(struct mapped_device *md)
+int dm_suspend(struct mapped_device *md, int do_lockfs)
{
struct dm_table *map = NULL;
DECLARE_WAITQUEUE(wait, current);
}
/* Flush I/O to the device. */
- r = lock_fs(md);
- if (r)
- goto out;
+ if (do_lockfs) {
+ r = lock_fs(md);
+ if (r)
+ goto out;
+ }
/*
* First we set the BLOCK_IO flag so no more ios will be mapped.
/*
* A device can still be used while suspended, but I/O is deferred.
*/
-int dm_suspend(struct mapped_device *md);
+int dm_suspend(struct mapped_device *md, int with_lockfs);
int dm_resume(struct mapped_device *md);
/*