[dm-devel] [PATCH] 6/5: Don't allow removing suspended devices
Kevin Corry
kevcorry at us.ibm.com
Tue Jun 22 15:52:33 UTC 2004
[I posted a similar patch about a week ago, but it seems that it never went
through to dm-devel. Here it is again, with proper reference counting added.]
dm-ioctl.c: Don't allow removing suspended devices. If a device is suspended
and then removed from the ioctl-interface hash-table, there's no longer any
way to reference the device to unsuspend it, and any I/O to that device will
be forever stuck on the pending queue.
--- diff/drivers/md/dm-ioctl.c 2004-06-22 10:23:57.000000000 -0500
+++ source/drivers/md/dm-ioctl.c 2004-06-22 10:30:43.520146736 -0500
@@ -622,6 +622,7 @@
static int dev_remove(struct dm_ioctl *param, size_t param_size)
{
struct hash_cell *hc;
+ struct mapped_device *md;
down_write(&_hash_lock);
hc = __find_device_hash_cell(param);
@@ -632,6 +633,16 @@
return -ENXIO;
}
+ md = hc->md;
+ dm_get(md);
+ if (dm_suspended(md)) {
+ DMERR("Cannot remove suspended device: %s", hc->name);
+ dm_put(md);
+ up_write(&_hash_lock);
+ return -EBUSY;
+ }
+ dm_put(md);
+
__hash_remove(hc);
up_write(&_hash_lock);
param->data_size = 0;
More information about the dm-devel
mailing list