Skip to contentSkip to conversation

: dm-table should check for valid queue

PATCH In review Stefan Bader 2 participants 2 messages Aug 10, 2006 – Aug 14, 2006 Device mapper

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 : dm-table should check for valid queue

Hi,

in some cases it is possible that bdev_get_queue() returns NULL. And there are some places where device-mapper just uses the returned pointer to call queue functions. The attached patch adds this to dm_table_unplug_all() and dm_table_flush_all(). I treated a device without a queue as sort of successfully flushed. Is this what would be expected?
Same problem with dm_table_any_congested() which I didn't change, yet. This function should probably also check before using q->backing_dev_info. But what effect should a missing queue have? Same as device is congested or not or let the call fail somehow?

Regards,
Stefan Bader

drivers/md/dm-table.c +1 -4
diff -Nurp linux-RHEL4/drivers/md/dm-table.c linux-RHEL4-BTM/drivers/md/dm-table.c
@@ -917,7 +917,7 @@ void dm_table_unplug_all(struct dm_table
 		struct dm_dev *dd = list_entry(d, struct dm_dev, list);
 		request_queue_t *q = bdev_get_queue(dd->bdev);
 
-		if (q && q->unplug_fn)
+		if (q->unplug_fn)
 			q->unplug_fn(q);
 	}
 }
@@ -932,9 +932,6 @@ int dm_table_flush_all(struct dm_table *
 		request_queue_t *q = bdev_get_queue(dd->bdev);
 		int err;
 
-		if (!q)
-			continue;
-
 		if (!q->issue_flush_fn)
 			err = -EOPNOTSUPP;
 		else
#1 lore raw
Quoted 2 lines · Stefan Bader

But what effect should a missing queue have? Same as device is congested or not or let the call fail somehow?

I'm curious - under what circumstances is this missing:
Is it intentional, or is it perhaps a race that needs fixing?

Alasdair

Signature · 1 line
[email protected]