All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Do not wait for event on device without table.
@ 2010-01-28 13:27 Milan Broz
  0 siblings, 0 replies; only message in thread
From: Milan Broz @ 2010-01-28 13:27 UTC (permalink / raw)
  To: dm-devel; +Cc: Milan Broz

If there is DM device with no table present, do not
try to wait for change event. Otherwise it can
wait forever and block already removed device.

Simple reproducible:
  dmsetup create x --notable
  dmsetup wait x 0 &
  dmsetup remove x

Now it waits for device, which is no longer accesible through dm-ioctl.

Signed-off-by: Milan Broz <mbroz@redhat.com>
---
 drivers/md/dm-ioctl.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/drivers/md/dm-ioctl.c b/drivers/md/dm-ioctl.c
index 1d66932..a0ac379 100644
--- a/drivers/md/dm-ioctl.c
+++ b/drivers/md/dm-ioctl.c
@@ -1023,6 +1023,15 @@ static int dev_wait(struct dm_ioctl *param, size_t param_size)
 		return -ENXIO;
 
 	/*
+	 * Do not wait if no table present
+	 */
+	if (!(table = dm_get_live_or_inactive_table(md, param))) {
+		r = -ENXIO;
+		goto out;
+	}
+	dm_table_put(table);
+
+	/*
 	 * Wait for a notification event
 	 */
 	if (dm_wait_event(md, param->event_nr)) {
-- 
1.6.6

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2010-01-28 13:27 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-28 13:27 [PATCH] Do not wait for event on device without table Milan Broz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.