* [PATCH v2] dm mpath: add feature flag to control call to blk_abort_queue [not found] <20101117215541.GA7785@redhat.com> @ 2010-11-18 4:40 ` Mike Snitzer 2010-11-18 7:20 ` Mike Anderson 0 siblings, 1 reply; 14+ messages in thread From: Mike Snitzer @ 2010-11-18 4:40 UTC (permalink / raw) To: dm-devel; +Cc: linux-scsi, Mike Anderson, Mike Christie Add 'features' member to 'struct multipath' and introduce MPF_ABORT_QUEUE as the first feature flag. If "abort_queue_on_failure" is provided during mpath device configuration the MPF_ABORT_QUEUE feature flag will be set and blk_abort_queue() will be called during path failure to allow for lower latency path failures. But this feature has been disabled by default due to a race (between blk_abort_queue and scsi_request_fn) that can lead to list corruption, from: https://www.redhat.com/archives/dm-devel/2010-November/msg00085.html "the cmd gets blk_abort_queued/timedout run on it and the scsi eh somehow is able to complete and run scsi_queue_insert while scsi_request_fn is still trying to process the request." Signed-off-by: Mike Snitzer <snitzer@redhat.com> Cc: Mike Anderson <andmike@linux.vnet.ibm.com> Cc: Mike Christie <michaelc@cs.wisc.edu> --- drivers/md/dm-mpath.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) Index: linux-2.6/drivers/md/dm-mpath.c =================================================================== --- linux-2.6.orig/drivers/md/dm-mpath.c +++ linux-2.6/drivers/md/dm-mpath.c @@ -56,8 +56,14 @@ struct priority_group { struct list_head pgpaths; }; +/* + * Bits for the m->features + */ +#define MPF_ABORT_QUEUE 0 + /* Multipath context */ struct multipath { + unsigned long features; struct list_head list; struct dm_target *ti; @@ -146,7 +152,8 @@ static void deactivate_path(struct work_ struct pgpath *pgpath = container_of(work, struct pgpath, deactivate_path); - blk_abort_queue(pgpath->path.dev->bdev->bd_disk->queue); + if (test_bit(MPF_ABORT_QUEUE, &pgpath->pg->m->features)) + blk_abort_queue(pgpath->path.dev->bdev->bd_disk->queue); } static struct priority_group *alloc_priority_group(void) @@ -813,6 +820,11 @@ static int parse_features(struct arg_set continue; } + if (!strnicmp(param_name, MESG_STR("abort_queue_on_failure"))) { + set_bit(MPF_ABORT_QUEUE, &m->features); + continue; + } + if (!strnicmp(param_name, MESG_STR("pg_init_retries")) && (argc >= 1)) { r = read_param(_params + 1, shift(as), @@ -1382,11 +1394,14 @@ static int multipath_status(struct dm_ta DMEMIT("2 %u %u ", m->queue_size, m->pg_init_count); else { DMEMIT("%u ", m->queue_if_no_path + - (m->pg_init_retries > 0) * 2); + (m->pg_init_retries > 0) * 2 + + test_bit(MPF_ABORT_QUEUE, &m->features)); if (m->queue_if_no_path) DMEMIT("queue_if_no_path "); if (m->pg_init_retries) DMEMIT("pg_init_retries %u ", m->pg_init_retries); + if (test_bit(MPF_ABORT_QUEUE, &m->features)) + DMEMIT("abort_queue_on_failure "); } if (!m->hw_handler_name || type == STATUSTYPE_INFO) ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v2] dm mpath: add feature flag to control call to blk_abort_queue 2010-11-18 4:40 ` [PATCH v2] dm mpath: add feature flag to control call to blk_abort_queue Mike Snitzer @ 2010-11-18 7:20 ` Mike Anderson 2010-11-18 15:48 ` Mike Snitzer 2010-11-18 15:48 ` [PATCH v3] " Mike Snitzer 0 siblings, 2 replies; 14+ messages in thread From: Mike Anderson @ 2010-11-18 7:20 UTC (permalink / raw) To: Mike Snitzer; +Cc: dm-devel, linux-scsi, Mike Christie Mike S, Thanks for doing the refresh / update of the patch. I just did a quick test and did not see any issues but did have a couple of questions. Two questions: 1.) Should we bump the multipath targets version for this change? 2.) A general question on the length of the feature name "abort_queue_on_failure" while the descriptive name is nice I noticed if I have two features that the multipath output line starts wrapping. I guess we could make the feature name shorter, but eventually if we added more features the line would eventually wrap so a shorted name will just stop wrapping now. (I had a old experimental patch where I was trying to use the feature flags to control the selection of fast fail flags to use and if full recovery was done on the IO. The output was kinda messy, but that is to be expected with this type of text interface vs a attribute based alternative.) Thanks, -andmike -- Michael Anderson andmike@linux.vnet.ibm.com ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v2] dm mpath: add feature flag to control call to blk_abort_queue 2010-11-18 7:20 ` Mike Anderson @ 2010-11-18 15:48 ` Mike Snitzer 2010-11-18 15:48 ` [PATCH v3] " Mike Snitzer 1 sibling, 0 replies; 14+ messages in thread From: Mike Snitzer @ 2010-11-18 15:48 UTC (permalink / raw) To: Mike Anderson; +Cc: dm-devel, linux-scsi, Mike Christie On Thu, Nov 18 2010 at 2:20am -0500, Mike Anderson <andmike@linux.vnet.ibm.com> wrote: > Mike S, > > Thanks for doing the refresh / update of the patch. > I just did a quick test and did not see any issues but did have a couple > of questions. > > Two questions: > > 1.) Should we bump the multipath targets version for this change? Yes, not doing so was an oversight. I'll bump the version and post v3. > 2.) A general question on the length of the feature name > "abort_queue_on_failure" while the descriptive name is nice I noticed if > I have two features that the multipath output line starts wrapping. I > guess we could make the feature name shorter, but eventually if we added > more features the line would eventually wrap so a shorted name will just > stop wrapping now. I'm open to other suggestions for the feature name. I agree that we don't want feature names to get too long. But they do need to be descriptive. So we need to have some balance. I could've used "abort_q_on_failure" but I went for "queue" to maintain symmetry with "queue_if_no_path". Similarly, abbreviating "failure" to "fail" seemed like it didn't buy much (less clear?). *shrug* Maybe "abort_queue_on_fail" offers a better balance? As for the wrapping, I don't think there is anything we can do to avoid it (given the current interface). Thanks, Mike ^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH v3] dm mpath: add feature flag to control call to blk_abort_queue 2010-11-18 7:20 ` Mike Anderson 2010-11-18 15:48 ` Mike Snitzer @ 2010-11-18 15:48 ` Mike Snitzer 2010-11-18 19:16 ` (unknown), Mike Snitzer 2010-11-18 19:19 ` [PATCH v4] dm mpath: avoid call to blk_abort_queue by default Mike Snitzer 1 sibling, 2 replies; 14+ messages in thread From: Mike Snitzer @ 2010-11-18 15:48 UTC (permalink / raw) To: dm-devel; +Cc: linux-scsi, Mike Anderson, Mike Christie Add 'features' member to 'struct multipath' and introduce MPF_ABORT_QUEUE as the first feature flag. If "abort_queue_on_fail" is provided during mpath device configuration the MPF_ABORT_QUEUE feature flag will be set and blk_abort_queue() will be called during path failure to allow for lower latency path failures. But this feature has been disabled by default due to a race (between blk_abort_queue and scsi_request_fn) that can lead to list corruption, from: https://www.redhat.com/archives/dm-devel/2010-November/msg00085.html "the cmd gets blk_abort_queued/timedout run on it and the scsi eh somehow is able to complete and run scsi_queue_insert while scsi_request_fn is still trying to process the request." Signed-off-by: Mike Snitzer <snitzer@redhat.com> Cc: Mike Anderson <andmike@linux.vnet.ibm.com> Cc: Mike Christie <michaelc@cs.wisc.edu> --- drivers/md/dm-mpath.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) Index: linux-2.6/drivers/md/dm-mpath.c =================================================================== --- linux-2.6.orig/drivers/md/dm-mpath.c +++ linux-2.6/drivers/md/dm-mpath.c @@ -56,8 +56,14 @@ struct priority_group { struct list_head pgpaths; }; +/* + * Bits for the m->features + */ +#define MPF_ABORT_QUEUE 0 + /* Multipath context */ struct multipath { + unsigned long features; struct list_head list; struct dm_target *ti; @@ -146,7 +152,8 @@ static void deactivate_path(struct work_ struct pgpath *pgpath = container_of(work, struct pgpath, deactivate_path); - blk_abort_queue(pgpath->path.dev->bdev->bd_disk->queue); + if (test_bit(MPF_ABORT_QUEUE, &pgpath->pg->m->features)) + blk_abort_queue(pgpath->path.dev->bdev->bd_disk->queue); } static struct priority_group *alloc_priority_group(void) @@ -813,6 +820,11 @@ static int parse_features(struct arg_set continue; } + if (!strnicmp(param_name, MESG_STR("abort_queue_on_fail"))) { + set_bit(MPF_ABORT_QUEUE, &m->features); + continue; + } + if (!strnicmp(param_name, MESG_STR("pg_init_retries")) && (argc >= 1)) { r = read_param(_params + 1, shift(as), @@ -1382,11 +1394,14 @@ static int multipath_status(struct dm_ta DMEMIT("2 %u %u ", m->queue_size, m->pg_init_count); else { DMEMIT("%u ", m->queue_if_no_path + - (m->pg_init_retries > 0) * 2); + (m->pg_init_retries > 0) * 2 + + test_bit(MPF_ABORT_QUEUE, &m->features)); if (m->queue_if_no_path) DMEMIT("queue_if_no_path "); if (m->pg_init_retries) DMEMIT("pg_init_retries %u ", m->pg_init_retries); + if (test_bit(MPF_ABORT_QUEUE, &m->features)) + DMEMIT("abort_queue_on_fail "); } if (!m->hw_handler_name || type == STATUSTYPE_INFO) @@ -1655,7 +1670,7 @@ out: *---------------------------------------------------------------*/ static struct target_type multipath_target = { .name = "multipath", - .version = {1, 1, 1}, + .version = {1, 2, 0}, .module = THIS_MODULE, .ctr = multipath_ctr, .dtr = multipath_dtr, ^ permalink raw reply [flat|nested] 14+ messages in thread
* (unknown), 2010-11-18 15:48 ` [PATCH v3] " Mike Snitzer @ 2010-11-18 19:16 ` Mike Snitzer 2010-11-18 19:21 ` Mike Snitzer 2010-11-18 19:19 ` [PATCH v4] dm mpath: avoid call to blk_abort_queue by default Mike Snitzer 1 sibling, 1 reply; 14+ messages in thread From: Mike Snitzer @ 2010-11-18 19:16 UTC (permalink / raw) To: dm-devel; +Cc: linux-scsi diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c index 487ecda..723dc19 100644 --- a/drivers/md/dm-mpath.c +++ b/drivers/md/dm-mpath.c @@ -56,8 +56,14 @@ struct priority_group { struct list_head pgpaths; }; +/* + * Bits for the m->features + */ +#define MPF_ABORT_QUEUE 0 + /* Multipath context */ struct multipath { + unsigned long features; struct list_head list; struct dm_target *ti; @@ -813,6 +819,11 @@ static int parse_features(struct arg_set *as, struct multipath *m) continue; } + if (!strnicmp(param_name, MESG_STR("abort_queue_on_fail"))) { + set_bit(MPF_ABORT_QUEUE, &m->features); + continue; + } + if (!strnicmp(param_name, MESG_STR("pg_init_retries")) && (argc >= 1)) { r = read_param(_params + 1, shift(as), @@ -995,7 +1006,9 @@ static int fail_path(struct pgpath *pgpath) pgpath->path.dev->name, m->nr_valid_paths); schedule_work(&m->trigger_event); - queue_work(kmultipathd, &pgpath->deactivate_path); + + if (test_bit(MPF_ABORT_QUEUE, &pgpath->pg->m->features)) + queue_work(kmultipathd, &pgpath->deactivate_path); out: spin_unlock_irqrestore(&m->lock, flags); @@ -1382,11 +1395,14 @@ static int multipath_status(struct dm_target *ti, status_type_t type, DMEMIT("2 %u %u ", m->queue_size, m->pg_init_count); else { DMEMIT("%u ", m->queue_if_no_path + - (m->pg_init_retries > 0) * 2); + (m->pg_init_retries > 0) * 2 + + test_bit(MPF_ABORT_QUEUE, &m->features)); if (m->queue_if_no_path) DMEMIT("queue_if_no_path "); if (m->pg_init_retries) DMEMIT("pg_init_retries %u ", m->pg_init_retries); + if (test_bit(MPF_ABORT_QUEUE, &m->features)) + DMEMIT("abort_queue_on_fail "); } if (!m->hw_handler_name || type == STATUSTYPE_INFO) @@ -1490,6 +1506,10 @@ static int multipath_message(struct dm_target *ti, unsigned argc, char **argv) } else if (!strnicmp(argv[0], MESG_STR("fail_if_no_path"))) { r = queue_if_no_path(m, 0, 0); goto out; + } else if (!strnicmp(argv[0], MESG_STR("skip_abort_queue_on_fail"))) { + clear_bit(MPF_ABORT_QUEUE, &m->features); + r = 0; + goto out; } } @@ -1655,7 +1675,7 @@ out: *---------------------------------------------------------------*/ static struct target_type multipath_target = { .name = "multipath", - .version = {1, 1, 1}, + .version = {1, 2, 0}, .module = THIS_MODULE, .ctr = multipath_ctr, .dtr = multipath_dtr, ^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: 2010-11-18 19:16 ` (unknown), Mike Snitzer @ 2010-11-18 19:21 ` Mike Snitzer 0 siblings, 0 replies; 14+ messages in thread From: Mike Snitzer @ 2010-11-18 19:21 UTC (permalink / raw) To: dm-devel; +Cc: linux-scsi please ignore this patch... ^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH v4] dm mpath: avoid call to blk_abort_queue by default 2010-11-18 15:48 ` [PATCH v3] " Mike Snitzer 2010-11-18 19:16 ` (unknown), Mike Snitzer @ 2010-11-18 19:19 ` Mike Snitzer 2010-11-18 20:07 ` [PATCH v5] " Mike Snitzer 1 sibling, 1 reply; 14+ messages in thread From: Mike Snitzer @ 2010-11-18 19:19 UTC (permalink / raw) To: dm-devel; +Cc: linux-scsi, Mike Anderson, Mike Christie Multipath was previously made to use blk_abort_queue() to allow for lower latency path deactivation (commit 224cb3e9). The call to blk_abort_queue has proven to be unsafe, and is now disabled by default, due to a race (between blk_abort_queue and scsi_request_fn) that can lead to list corruption, from: https://www.redhat.com/archives/dm-devel/2010-November/msg00085.html "the cmd gets blk_abort_queued/timedout run on it and the scsi eh somehow is able to complete and run scsi_queue_insert while scsi_request_fn is still trying to process the request." It is expected that this race will be fixed in the near-term so it makes little since to remove all associated code. Providing control over the call to blk_abort_queue() facilitates continued testing and future flexibility to opt-in to lower latency path deactivation. Opting to enable this feature will emit a warning for the time being. Add 'features' member to 'struct multipath' and introduce MPF_ABORT_QUEUE as the first feature flag. If "abort_queue_on_fail" is provided during mpath device configuration the MPF_ABORT_QUEUE feature flag will be set and blk_abort_queue() will be called during path deactivation. The MPF_ABORT_QUEUE feature flag may be cleared using the "skip_abort_queue_on_fail" message. Signed-off-by: Mike Snitzer <snitzer@redhat.com> Cc: Mike Anderson <andmike@linux.vnet.ibm.com> Cc: Mike Christie <michaelc@cs.wisc.edu> --- drivers/md/dm-mpath.c | 27 ++++++++++++++++++++++++--- 1 files changed, 24 insertions(+), 3 deletions(-) v4: - revised the patch subject and header to emphaszie default to off - fixed missing m->lock locking when using test_bit() on m->features (MPF_ABORT_QUEUE is checked early in fail_path() to avoid queuing unnecessary work). - also added ability to clear MPF_ABORT_QUEUE feature flag via "skip_abort_queue_on_fail" message. v3: bumped target version and switched feature name from "abort_queue_on_failure" to "abort_queue_on_fail". diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c index 487ecda..ecec1af 100644 --- a/drivers/md/dm-mpath.c +++ b/drivers/md/dm-mpath.c @@ -56,8 +56,14 @@ struct priority_group { struct list_head pgpaths; }; +/* + * Bits for the m->features + */ +#define MPF_ABORT_QUEUE 0 + /* Multipath context */ struct multipath { + unsigned long features; struct list_head list; struct dm_target *ti; @@ -813,6 +819,12 @@ static int parse_features(struct arg_set *as, struct multipath *m) continue; } + if (!strnicmp(param_name, MESG_STR("abort_queue_on_fail"))) { + set_bit(MPF_ABORT_QUEUE, &m->features); + DMWARN("Enabling use of blk_abort_queue is unsafe."); + continue; + } + if (!strnicmp(param_name, MESG_STR("pg_init_retries")) && (argc >= 1)) { r = read_param(_params + 1, shift(as), @@ -995,7 +1007,9 @@ static int fail_path(struct pgpath *pgpath) pgpath->path.dev->name, m->nr_valid_paths); schedule_work(&m->trigger_event); - queue_work(kmultipathd, &pgpath->deactivate_path); + + if (test_bit(MPF_ABORT_QUEUE, &pgpath->pg->m->features)) + queue_work(kmultipathd, &pgpath->deactivate_path); out: spin_unlock_irqrestore(&m->lock, flags); @@ -1382,11 +1396,14 @@ static int multipath_status(struct dm_target *ti, status_type_t type, DMEMIT("2 %u %u ", m->queue_size, m->pg_init_count); else { DMEMIT("%u ", m->queue_if_no_path + - (m->pg_init_retries > 0) * 2); + (m->pg_init_retries > 0) * 2 + + test_bit(MPF_ABORT_QUEUE, &m->features)); if (m->queue_if_no_path) DMEMIT("queue_if_no_path "); if (m->pg_init_retries) DMEMIT("pg_init_retries %u ", m->pg_init_retries); + if (test_bit(MPF_ABORT_QUEUE, &m->features)) + DMEMIT("abort_queue_on_fail "); } if (!m->hw_handler_name || type == STATUSTYPE_INFO) @@ -1490,6 +1507,10 @@ static int multipath_message(struct dm_target *ti, unsigned argc, char **argv) } else if (!strnicmp(argv[0], MESG_STR("fail_if_no_path"))) { r = queue_if_no_path(m, 0, 0); goto out; + } else if (!strnicmp(argv[0], MESG_STR("skip_abort_queue_on_fail"))) { + clear_bit(MPF_ABORT_QUEUE, &m->features); + r = 0; + goto out; } } @@ -1655,7 +1676,7 @@ out: *---------------------------------------------------------------*/ static struct target_type multipath_target = { .name = "multipath", - .version = {1, 1, 1}, + .version = {1, 2, 0}, .module = THIS_MODULE, .ctr = multipath_ctr, .dtr = multipath_dtr, ^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v5] dm mpath: avoid call to blk_abort_queue by default 2010-11-18 19:19 ` [PATCH v4] dm mpath: avoid call to blk_abort_queue by default Mike Snitzer @ 2010-11-18 20:07 ` Mike Snitzer 2010-11-18 20:18 ` [dm-devel] " Alasdair G Kergon 0 siblings, 1 reply; 14+ messages in thread From: Mike Snitzer @ 2010-11-18 20:07 UTC (permalink / raw) To: dm-devel; +Cc: linux-scsi, Mike Anderson, Mike Christie Multipath was previously made to use blk_abort_queue() to allow for lower latency path deactivation (commit 224cb3e9). The call to blk_abort_queue has proven to be unsafe, and is now disabled by default, due to a race (between blk_abort_queue and scsi_request_fn) that can lead to list corruption, from: https://www.redhat.com/archives/dm-devel/2010-November/msg00085.html "the cmd gets blk_abort_queued/timedout run on it and the scsi eh somehow is able to complete and run scsi_queue_insert while scsi_request_fn is still trying to process the request." It is expected that this race will be fixed in the near-term so it makes little since to remove all associated code. Providing control over the call to blk_abort_queue() facilitates continued testing and future flexibility to opt-in to lower latency path deactivation. Opting to enable this feature will emit a warning for the time being. Add 'features' member to 'struct multipath' and introduce MPF_ABORT_QUEUE as the first feature flag. If "abort_queue_on_fail" is provided, via message or during mpath device configuration, the MPF_ABORT_QUEUE feature flag will be set and blk_abort_queue() will be called during path deactivation. The MPF_ABORT_QUEUE feature flag may be cleared using the "skip_abort_queue_on_fail" message. Signed-off-by: Mike Snitzer <snitzer@redhat.com> Cc: Mike Anderson <andmike@linux.vnet.ibm.com> Cc: Mike Christie <michaelc@cs.wisc.edu> --- drivers/md/dm-mpath.c | 46 +++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 43 insertions(+), 3 deletions(-) v5: - introduced abort_queue_on_fail() to perform m->lock locking around both set_bit and clear_bit - also added ability to set MPF_ABORT_QUEUE feature flag via "abort_queue_on_fail" message. v4: - revised the patch subject and header to emphaszie default to off - fixed missing m->lock locking when using test_bit() on m->features (MPF_ABORT_QUEUE is checked early in fail_path() to avoid queuing unnecessary work). - also added ability to clear MPF_ABORT_QUEUE feature flag via "skip_abort_queue_on_fail" message. v3: bumped target version and switched feature name from "abort_queue_on_failure" to "abort_queue_on_fail". diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c index 487ecda..a6f11c3 100644 --- a/drivers/md/dm-mpath.c +++ b/drivers/md/dm-mpath.c @@ -56,8 +56,14 @@ struct priority_group { struct list_head pgpaths; }; +/* + * Bits for the m->features + */ +#define MPF_ABORT_QUEUE 0 + /* Multipath context */ struct multipath { + unsigned long features; struct list_head list; struct dm_target *ti; @@ -414,6 +420,24 @@ static int queue_if_no_path(struct multipath *m, unsigned queue_if_no_path, return 0; } +static int abort_queue_on_fail(struct multipath *m, unsigned abort_queue_on_fail) +{ + unsigned long flags; + + spin_lock_irqsave(&m->lock, flags); + + if (abort_queue_on_fail) { + set_bit(MPF_ABORT_QUEUE, &m->features); + DMWARN("Enabling use of blk_abort_queue is unsafe."); + } else + clear_bit(MPF_ABORT_QUEUE, &m->features); + + spin_unlock_irqrestore(&m->lock, flags); + + return 0; +} + + /*----------------------------------------------------------------- * The multipath daemon is responsible for resubmitting queued ios. *---------------------------------------------------------------*/ @@ -813,6 +837,11 @@ static int parse_features(struct arg_set *as, struct multipath *m) continue; } + if (!strnicmp(param_name, MESG_STR("abort_queue_on_fail"))) { + r = abort_queue_on_fail(m, 1); + continue; + } + if (!strnicmp(param_name, MESG_STR("pg_init_retries")) && (argc >= 1)) { r = read_param(_params + 1, shift(as), @@ -995,7 +1024,9 @@ static int fail_path(struct pgpath *pgpath) pgpath->path.dev->name, m->nr_valid_paths); schedule_work(&m->trigger_event); - queue_work(kmultipathd, &pgpath->deactivate_path); + + if (test_bit(MPF_ABORT_QUEUE, &pgpath->pg->m->features)) + queue_work(kmultipathd, &pgpath->deactivate_path); out: spin_unlock_irqrestore(&m->lock, flags); @@ -1382,11 +1413,14 @@ static int multipath_status(struct dm_target *ti, status_type_t type, DMEMIT("2 %u %u ", m->queue_size, m->pg_init_count); else { DMEMIT("%u ", m->queue_if_no_path + - (m->pg_init_retries > 0) * 2); + (m->pg_init_retries > 0) * 2 + + test_bit(MPF_ABORT_QUEUE, &m->features)); if (m->queue_if_no_path) DMEMIT("queue_if_no_path "); if (m->pg_init_retries) DMEMIT("pg_init_retries %u ", m->pg_init_retries); + if (test_bit(MPF_ABORT_QUEUE, &m->features)) + DMEMIT("abort_queue_on_fail "); } if (!m->hw_handler_name || type == STATUSTYPE_INFO) @@ -1490,6 +1524,12 @@ static int multipath_message(struct dm_target *ti, unsigned argc, char **argv) } else if (!strnicmp(argv[0], MESG_STR("fail_if_no_path"))) { r = queue_if_no_path(m, 0, 0); goto out; + } else if (!strnicmp(argv[0], MESG_STR("abort_queue_on_fail"))) { + r = abort_queue_on_fail(m, 1); + goto out; + } else if (!strnicmp(argv[0], MESG_STR("skip_abort_queue_on_fail"))) { + r = abort_queue_on_fail(m, 0); + goto out; } } @@ -1655,7 +1695,7 @@ out: *---------------------------------------------------------------*/ static struct target_type multipath_target = { .name = "multipath", - .version = {1, 1, 1}, + .version = {1, 2, 0}, .module = THIS_MODULE, .ctr = multipath_ctr, .dtr = multipath_dtr, ^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [dm-devel] [PATCH v5] dm mpath: avoid call to blk_abort_queue by default 2010-11-18 20:07 ` [PATCH v5] " Mike Snitzer @ 2010-11-18 20:18 ` Alasdair G Kergon 2010-11-18 20:39 ` Mike Anderson 2010-11-18 21:48 ` [PATCH] dm mpath: disable call to blk_abort_queue and related code Mike Snitzer 0 siblings, 2 replies; 14+ messages in thread From: Alasdair G Kergon @ 2010-11-18 20:18 UTC (permalink / raw) To: Mike Snitzer; +Cc: dm-devel, Mike Christie, Mike Anderson, linux-scsi On Thu, Nov 18, 2010 at 03:07:33PM -0500, Mike Snitzer wrote: > It is expected that this race will be fixed in the near-term so it makes > little since to remove all associated code. Providing control over the > call to blk_abort_queue() facilitates continued testing and future > flexibility to opt-in to lower latency path deactivation. Opting to > enable this feature will emit a warning for the time being. Ah, but then the *feature* keyword - which is only going to be needed temporarily until it's fixed - becomes a permanent part of the interface... If it's broken, let's just disable it (#define-style) until it gets fixed. (And only if it doesn't get fixed in a reasonable amount of time, remove the code.) Alasdair ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [dm-devel] [PATCH v5] dm mpath: avoid call to blk_abort_queue by default 2010-11-18 20:18 ` [dm-devel] " Alasdair G Kergon @ 2010-11-18 20:39 ` Mike Anderson 2010-11-18 21:48 ` [PATCH] dm mpath: disable call to blk_abort_queue and related code Mike Snitzer 1 sibling, 0 replies; 14+ messages in thread From: Mike Anderson @ 2010-11-18 20:39 UTC (permalink / raw) To: Mike Snitzer, dm-devel, Mike Christie, linux-scsi Alasdair G Kergon <agk@redhat.com> wrote: > On Thu, Nov 18, 2010 at 03:07:33PM -0500, Mike Snitzer wrote: > > It is expected that this race will be fixed in the near-term so it makes > > little since to remove all associated code. Providing control over the > > call to blk_abort_queue() facilitates continued testing and future > > flexibility to opt-in to lower latency path deactivation. Opting to > > enable this feature will emit a warning for the time being. > > Ah, but then the *feature* keyword - which is only going to be needed > temporarily until it's fixed - becomes a permanent part of the interface... > > If it's broken, let's just disable it (#define-style) until it gets fixed. > (And only if it doesn't get fixed in a reasonable amount of time, remove the > code.) I understand that if its broken that we could #define it out in dm or we could #define the code in blk_abort_queue. I believe the thought was that post addressing the race issue that others may want control. As there maybe cases where the waking up of the error_handler and a extra abort may not be wanted in all cases. -andmike -- Michael Anderson andmike@linux.vnet.ibm.com ^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH] dm mpath: disable call to blk_abort_queue and related code 2010-11-18 20:18 ` [dm-devel] " Alasdair G Kergon 2010-11-18 20:39 ` Mike Anderson @ 2010-11-18 21:48 ` Mike Snitzer 2010-11-23 1:00 ` [PATCH v2] dm mpath: revert "dm: Call blk_abort_queue on failed paths" Mike Snitzer 1 sibling, 1 reply; 14+ messages in thread From: Mike Snitzer @ 2010-11-18 21:48 UTC (permalink / raw) To: dm-devel; +Cc: Mike Christie, Mike Anderson Multipath was previously made to use blk_abort_queue() to allow for lower latency path deactivation (commit 224cb3e9). The call to blk_abort_queue has proven to be unsafe due to a race (between blk_abort_queue and scsi_request_fn) that can lead to list corruption, from: https://www.redhat.com/archives/dm-devel/2010-November/msg00085.html "the cmd gets blk_abort_queued/timedout run on it and the scsi eh somehow is able to complete and run scsi_queue_insert while scsi_request_fn is still trying to process the request." It is hoped that this race will be fixed soon so it makes little sense to remove all associated code at this point. Signed-off-by: Mike Snitzer <snitzer@redhat.com> Cc: Mike Anderson <andmike@linux.vnet.ibm.com> Cc: Mike Christie <michaelc@cs.wisc.edu> --- drivers/md/dm-mpath.c | 13 +++++++++++++ 1 files changed, 13 insertions(+), 0 deletions(-) diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c index 487ecda..6292e41 100644 --- a/drivers/md/dm-mpath.c +++ b/drivers/md/dm-mpath.c @@ -24,6 +24,9 @@ #define DM_MSG_PREFIX "multipath" #define MESG_STR(x) x, sizeof(x) +/* Avoid calling blk_abort_queue until race with scsi_request_fn is fixed */ +#define MPATH_CALL_BLK_ABORT_QUEUE 0 + /* Path properties */ struct pgpath { struct list_head list; @@ -33,7 +36,9 @@ struct pgpath { unsigned fail_count; /* Cumulative failure count */ struct dm_path path; +#if MPATH_CALL_BLK_ABORT_QUEUE struct work_struct deactivate_path; +#endif struct work_struct activate_path; }; @@ -116,7 +121,9 @@ static struct workqueue_struct *kmultipathd, *kmpath_handlerd; static void process_queued_ios(struct work_struct *work); static void trigger_event(struct work_struct *work); static void activate_path(struct work_struct *work); +#if MPATH_CALL_BLK_ABORT_QUEUE static void deactivate_path(struct work_struct *work); +#endif /*----------------------------------------------- @@ -129,7 +136,9 @@ static struct pgpath *alloc_pgpath(void) if (pgpath) { pgpath->is_active = 1; +#if MPATH_CALL_BLK_ABORT_QUEUE INIT_WORK(&pgpath->deactivate_path, deactivate_path); +#endif INIT_WORK(&pgpath->activate_path, activate_path); } @@ -141,6 +150,7 @@ static void free_pgpath(struct pgpath *pgpath) kfree(pgpath); } +#if MPATH_CALL_BLK_ABORT_QUEUE static void deactivate_path(struct work_struct *work) { struct pgpath *pgpath = @@ -148,6 +158,7 @@ static void deactivate_path(struct work_struct *work) blk_abort_queue(pgpath->path.dev->bdev->bd_disk->queue); } +#endif static struct priority_group *alloc_priority_group(void) { @@ -995,7 +1006,9 @@ static int fail_path(struct pgpath *pgpath) pgpath->path.dev->name, m->nr_valid_paths); schedule_work(&m->trigger_event); +#if MPATH_CALL_BLK_ABORT_QUEUE queue_work(kmultipathd, &pgpath->deactivate_path); +#endif out: spin_unlock_irqrestore(&m->lock, flags); ^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v2] dm mpath: revert "dm: Call blk_abort_queue on failed paths" 2010-11-18 21:48 ` [PATCH] dm mpath: disable call to blk_abort_queue and related code Mike Snitzer @ 2010-11-23 1:00 ` Mike Snitzer 0 siblings, 0 replies; 14+ messages in thread From: Mike Snitzer @ 2010-11-23 1:00 UTC (permalink / raw) To: dm-devel; +Cc: Mike Christie, Mike Anderson This reverts commit 224cb3e981f1b2f9f93dbd49eaef505d17d894c2. Multipath was previously made to use blk_abort_queue() to allow for lower latency path deactivation. The call to blk_abort_queue has proven to be unsafe due to a race (between blk_abort_queue and scsi_request_fn) that can lead to list corruption, from: https://www.redhat.com/archives/dm-devel/2010-November/msg00085.html "the cmd gets blk_abort_queued/timedout run on it and the scsi eh somehow is able to complete and run scsi_queue_insert while scsi_request_fn is still trying to process the request." Signed-off-by: Mike Snitzer <snitzer@redhat.com> Cc: Mike Anderson <andmike@linux.vnet.ibm.com> Cc: Mike Christie <michaelc@cs.wisc.edu> --- drivers/md/dm-mpath.c | 12 ------------ 1 file changed, 12 deletions(-) v2: revert commit rather than #if 0 the code in question Index: linux-2.6/drivers/md/dm-mpath.c =================================================================== --- linux-2.6.orig/drivers/md/dm-mpath.c +++ linux-2.6/drivers/md/dm-mpath.c @@ -33,7 +33,6 @@ struct pgpath { unsigned fail_count; /* Cumulative failure count */ struct dm_path path; - struct work_struct deactivate_path; struct work_struct activate_path; }; @@ -116,7 +115,6 @@ static struct workqueue_struct *kmultipa static void process_queued_ios(struct work_struct *work); static void trigger_event(struct work_struct *work); static void activate_path(struct work_struct *work); -static void deactivate_path(struct work_struct *work); /*----------------------------------------------- @@ -129,7 +127,6 @@ static struct pgpath *alloc_pgpath(void) if (pgpath) { pgpath->is_active = 1; - INIT_WORK(&pgpath->deactivate_path, deactivate_path); INIT_WORK(&pgpath->activate_path, activate_path); } @@ -141,14 +138,6 @@ static void free_pgpath(struct pgpath *p kfree(pgpath); } -static void deactivate_path(struct work_struct *work) -{ - struct pgpath *pgpath = - container_of(work, struct pgpath, deactivate_path); - - blk_abort_queue(pgpath->path.dev->bdev->bd_disk->queue); -} - static struct priority_group *alloc_priority_group(void) { struct priority_group *pg; @@ -995,7 +984,6 @@ static int fail_path(struct pgpath *pgpa pgpath->path.dev->name, m->nr_valid_paths); schedule_work(&m->trigger_event); - queue_work(kmultipathd, &pgpath->deactivate_path); out: spin_unlock_irqrestore(&m->lock, flags); ^ permalink raw reply [flat|nested] 14+ messages in thread
* (unknown), @ 2012-01-19 13:00 Kasatkin, Dmitry 0 siblings, 0 replies; 14+ messages in thread From: Kasatkin, Dmitry @ 2012-01-19 13:00 UTC (permalink / raw) To: device-mapper development; +Cc: LKML, Linus Torvalds Hi, I rebased on the stop of latest mainline tree and now dmsetup fails... It says: "Failed to create notification semaphore: Function not implemented". I run strace and saw that dmsetup uses "semget" which returns -ENOSYS... Any ideas? - Dmitry ^ permalink raw reply [flat|nested] 14+ messages in thread
* (unknown) @ 2010-07-01 10:49 FUJITA Tomonori 0 siblings, 0 replies; 14+ messages in thread From: FUJITA Tomonori @ 2010-07-01 10:49 UTC (permalink / raw) To: axboe Cc: snitzer, hch, James.Bottomley, linux-scsi, dm-devel, fujita.tomonori, linux-kernel This patchset fixes page leak issue in discard commands with unprep facility that James posted: http://marc.info/?l=linux-scsi&m=127791727508214&w=2 The 1/3 patch adds unprep facility to the block layer (identical to what James posted). The 2/3 patch frees a page for discard commands by using the unprep facility. James' original patch doesn't work since it accesses to rq->bio in q->unprep_rq_fn. We hit oops since q->unprep_rq_fn is called when all the data buffer (req->bio and scsi_data_buffer) in the request is freed. I use rq->buffer to keep track of an allocated page as the block layer sets rq->buffer to the address of bio's page. scsi-ml (and llds) don't use rq->buffer (rq->buffer is set to NULL). So I can't say that I like it lots. Any other way to do that? The 3/3 path just removes the dead code. This is against Jens' for-2.6.36. The git tree is also available: git://git.kernel.org/pub/scm/linux/kernel/git/tomo/linux-2.6-misc.git unprep I'll update the discard FS request conversion on the top of this soon. But this can be applied independently (and fixes the memory leak). = block/blk-core.c | 25 +++++++++++++++++++++++++ block/blk-settings.c | 17 +++++++++++++++++ drivers/scsi/scsi_lib.c | 2 +- drivers/scsi/sd.c | 25 +++++++++++++++---------- include/linux/blkdev.h | 4 ++++ 5 files changed, 62 insertions(+), 11 deletions(-) ^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2012-01-19 13:00 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20101117215541.GA7785@redhat.com>
2010-11-18 4:40 ` [PATCH v2] dm mpath: add feature flag to control call to blk_abort_queue Mike Snitzer
2010-11-18 7:20 ` Mike Anderson
2010-11-18 15:48 ` Mike Snitzer
2010-11-18 15:48 ` [PATCH v3] " Mike Snitzer
2010-11-18 19:16 ` (unknown), Mike Snitzer
2010-11-18 19:21 ` Mike Snitzer
2010-11-18 19:19 ` [PATCH v4] dm mpath: avoid call to blk_abort_queue by default Mike Snitzer
2010-11-18 20:07 ` [PATCH v5] " Mike Snitzer
2010-11-18 20:18 ` [dm-devel] " Alasdair G Kergon
2010-11-18 20:39 ` Mike Anderson
2010-11-18 21:48 ` [PATCH] dm mpath: disable call to blk_abort_queue and related code Mike Snitzer
2010-11-23 1:00 ` [PATCH v2] dm mpath: revert "dm: Call blk_abort_queue on failed paths" Mike Snitzer
2012-01-19 13:00 (unknown), Kasatkin, Dmitry
-- strict thread matches above, loose matches on Subject: below --
2010-07-01 10:49 (unknown) FUJITA Tomonori
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).