Device mapper and dm-mpath fixes
Subsystems (2)
cover Device mapper and dm-mpath fixes
Hello Mike,
The patches in this series are what I came up with while analyzing the soft and hard lockups reported by Laurence Oberman. Please consider these patches for kernel v4.14.
Thank you,
Bart.
Bart Van Assche (7):
dm: Fix the second dec_pending() argument in __split_and_process_bio()
dm: Fix printk() rate limiting code
dm-mpath: Do not lock up a CPU with requeuing activity
dm-mpath: Avoid that building with W=1 causes gcc 7 to complain about
fall-through
dm-mpath: Complain about unsupported __multipath_map_bio() return
values
dm-mpath: Retry BLK_STS_RESOURCE errors
dm-mpath: Make the dm-sq requeuing behavior consistent with the dm-mq
behavior
drivers/md/dm-mpath.c | 8 ++++++-- drivers/md/dm-rq.c | 9 +++++---- drivers/md/dm.c | 12 +----------- include/linux/device-mapper.h | 41 ++++++++++++----------------------------- 4 files changed, 24 insertions(+), 46 deletions(-)
Signature · 1 line
2.13.3
PATCH 1/7 dm: Fix the second dec_pending() argument in __split_and_process_bio()
Detected by sparse.
--- drivers/md/dm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/dm.c +1 -1
@@ -1523,7 +1523,7 @@ static void __split_and_process_bio(struct mapped_device *md, }/* drop the extra reference count */ -dec_pending (ci.io, error); +dec_pending (ci.io,errno_to_blk_status (error)); }/*----------------------------------------------------------------- * CRUD END
Signature · 1 line
2.13.3
Re: [PATCH 1/7] dm: Fix the second dec_pending() argument in __split_and_process_bio()
Looks good,
Re: [PATCH 1/7] dm: Fix the second dec_pending() argument in __split_and_process_bio()
In reply to Bart Van AsscheQuoted 21 lines · Bart Van Assche
Detected by sparse.
Fixes commit 4e4cbee93d56 ("block: switch bios to blk_status_t")Signed-off-by Bart Van Assche <[email protected]>Cc Christoph Hellwig <[email protected]>Cc Laurence Oberman <[email protected]>---
drivers/md/dm.c | 2 +-1 file changed, 1 insertion(+), 1 deletion(-)drivers/md/dm.c +0
-0@@ -1523,7 +1523,7 @@ static void __split_and_process_bio(struct mapped_device *md, }
/* drop the extra reference count */drivers/md/dm.c +1
-1-dec_pending (ci.io, error); +dec_pending (ci.io,errno_to_blk_status (error));
Quoted 3 lines
} /*-----------------------------------------------------------------
* CRUD END
Hello Bart
I applied and tested all patches except patch 2/7 (as discussed) I also still have the prior patch in place you sent me.
I built a new kernel on 4.13-rc3
The soft lockups are gone for me with 10 parallel writes. I also have not seen a hard lockup so far.
What is important to note is that if I use the [none] scheduler I am
still stable but I will sporadically get the ******
"[38071.773471] device-mapper: multipath: blk_get_request() returned -11 - requeuing
"
However that is not unexpected I guess.
The ( requeuing messages) do NOT show up with [mq-deadline] which is all I was testing with last night and yesterday. So when I said they are gone, that was specifically for [mq-deadline]
Patches look good and are helping. I will circle back and patch and test on Ming's kernel.
For the series except PATCH2/7 and including
[PATCH] block: Make blk_mq_delay_kick_requeue_list() rerun the queue at a quiet time
Thanks
Laurence
--
dm-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/dm-devel
Re: [PATCH 1/7] dm: Fix the second dec_pending() argument in __split_and_process_bio()
Quoted 2 lines · Laurence Oberman
The soft lockups are gone for me with 10 parallel writes. I also have not seen a hard lockup so far.
That's great news!
Quoted 6 lines
What is important to note is that if I use the [none] scheduler I am
still stable but I will sporadically get the ******
"[38071.773471] device-mapper: multipath:blk_get_request()returned -11 - requeuing"However that is not unexpected I guess.
Yes, this is expected.
Quoted 6 lines
For the series except PATCH2/7 and including
[PATCH] block: Make
blk_mq_delay_kick_requeue_list()rerun the queue at a quiet timeTested-by Laurence Oberman <[email protected]>
Thanks for the testing!
Bart.
PATCH 2/7 dm: Fix printk() rate limiting code
In reply to Bart Van AsscheUsing the same rate limiting state for different kinds of messages is wrong because this can cause a high frequency message to suppress a report of a low frequency message. Hence use a unique rate limiting state per message type.
--- drivers/md/dm.c | 10 ---------- include/linux/device-mapper.h | 41 ++++++++++++----------------------------- 2 files changed, 12 insertions(+), 39 deletions(-)
drivers/md/dm.c +0 -10
@@ -27,16 +27,6 @@#define DM_MSG_PREFIX "core" -#ifdef CONFIG_PRINTK -/* -* ratelimit state to be used in DMXXX_LIMIT(). -*/ -DEFINE_RATELIMIT_STATE (dm_ratelimit_state, -DEFAULT_RATELIMIT_INTERVAL , -DEFAULT_RATELIMIT_BURST ); -EXPORT_SYMBOL (dm_ratelimit_state); -#endif -/* * Cookies are numeric values sent with CHANGE and REMOVE * uevents while resuming, removing or renaming the device.
include/linux/device-mapper.h +12 -29
58 lines not on this page · raw message
Signature · 1 line
2.13.3
PATCH 3/7 dm-mpath: Do not lock up a CPU with requeuing activity
In reply to Bart Van AsscheWhen using the block layer in single queue mode, get_request() returns ERR_PTR(-EAGAIN) if the queue is dying and the REQ_NOWAIT flag has been passed to get_request(). Avoid that the kernel reports soft lockup complaints in this case due to continuous requeuing activity.
--- drivers/md/dm-mpath.c | 1 - 1 file changed, 1 deletion(-)
drivers/md/dm-mpath.c +0 -1
@@ -504,7 +504,6 @@ static int multipath_clone_and_map(struct dm_target *ti, struct request *rq,if (queue_dying) {atomic_inc (&m->pg_init_in_progress);activate_or_offline_path (pgpath); -return DM_MAPIO_REQUEUE ; }return DM_MAPIO_DELAY_REQUEUE ; }
Signature · 1 line
2.13.3
Re: [PATCH 3/7] dm-mpath: Do not lock up a CPU with requeuing activity
Quoted 5 lines · Bart Van Assche
When using the block layer in single queue mode,
get_request()returnsERR_PTR(-EAGAIN)if the queue is dying and theREQ_NOWAITflag has been passed toget_request(). Avoid that the kernel reports soft lockup complaints in this case due to continuous requeuing activity.
Looks good,
PATCH 4/7 dm-mpath: Avoid that building with W=1 causes gcc 7 to complain about fall-through
In reply to Bart Van Assche--- drivers/md/dm-mpath.c | 1 + 1 file changed, 1 insertion(+)
drivers/md/dm-mpath.c +1 -0
@@ -1379,6 +1379,7 @@ static void pg_init_done(void *data, int errors)case SCSI_DH_RETRY :/* Wait before retrying. */ delay_retry =1 ; +/* fall through */ case SCSI_DH_IMM_RETRY :case SCSI_DH_RES_TEMP_UNAVAIL :if (pg_init_limit_reached (m, pgpath))
Signature · 1 line
2.13.3
Re: [PATCH 4/7] dm-mpath: Avoid that building with W=1 causes gcc 7 to complain about fall-through
Quoted 11 lines · Bart Van Assche
Signed-off-by Bart Van Assche <[email protected]>Cc Laurence Oberman <[email protected]>--- drivers/md/dm-mpath.c | 1 + 1 file changed, 1 insertion(+)drivers/md/dm-mpath.c +0
-0
drivers/md/dm-mpath.c static void pg_init_done(void *data, int errors) · line 1385
Quoted 7 lines
drivers/md/dm-mpath.c +1
-0@@ -1379,6 +1379,7 @@ static void pg_init_done(void *data, int errors)case SCSI_DH_RETRY :/* Wait before retrying. */ delay_retry =1 ; +/* fall through */ case SCSI_DH_IMM_RETRY :case SCSI_DH_RES_TEMP_UNAVAIL :if (pg_init_limit_reached (m, pgpath))
I prefer /*FALLTHRU*/ over the less shouty lower case version, but either way this looks okay:
PATCH 5/7 dm-mpath: Complain about unsupported __multipath_map_bio() return values
In reply to Bart Van AsscheThe only behavior change introduced by this patch is that WARN_ON_ONCE() is called if __multipath_map_bio() would return an unsupported return value.
--- drivers/md/dm-mpath.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/md/dm-mpath.c +5 -0
@@ -632,6 +632,11 @@ static void process_queued_bios(struct work_struct *work)case DM_MAPIO_REMAPPED :generic_make_request (bio);break ; +case 0 : +break ; +default : +WARN_ONCE (true,"__multipath_map_bio() returned %d\n" , + r); } }blk_finish_plug (&plug);
Signature · 1 line
2.13.3
Re: [PATCH 5/7] dm-mpath: Complain about unsupported __multipath_map_bio() return values
Quoted 3 lines · Bart Van Assche
The only behavior change introduced by this patch is that
WARN_ON_ONCE()is called if__multipath_map_bio()would return an unsupported return value.
Looks good,
PATCH 6/7 dm-mpath: Retry BLK_STS_RESOURCE errors
In reply to Bart Van AsscheRetry requests instead of failing these if an out-of-memory error occurs or the block driver below dm-mpath is busy. This restores the v4.12 behavior of noretry_error(), namely that -ENOMEM results in a retry.
--- drivers/md/dm-mpath.c | 1 - 1 file changed, 1 deletion(-)
drivers/md/dm-mpath.c +0 -1
@@ -1463,7 +1463,6 @@ static int noretry_error(blk_status_t error)case BLK_STS_TARGET :case BLK_STS_NEXUS :case BLK_STS_MEDIUM : -case BLK_STS_RESOURCE :return 1 ; }
Signature · 1 line
2.13.3
Re: [PATCH 6/7] dm-mpath: Retry BLK_STS_RESOURCE errors
Quoted 4 lines · Bart Van Assche
Retry requests instead of failing these if an out-of-memory error occurs or the block driver below dm-mpath is busy. This restores the v4.12 behavior of
noretry_error(), namely that-ENOMEMresults in a retry.
Thanks,
not idea how the resource one leaked in.
PATCH 7/7 dm-mpath: Make the dm-sq requeuing behavior consistent with the dm-mq behavior
In reply to Bart Van AsscheDM_MAPIO_DELAY_REQUEUE causes dm-mq to requeue after a delay but causes dm-sq to requeue immediately. Make the behavior of dm-sq consistent with that of dm-mq.
--- drivers/md/dm-rq.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/md/dm-rq.c +5 -4
@@ -237,14 +237,14 @@ static void dm_end_request(struct request *clone, blk_status_t error)/* * Requeue the original request of a clone. */ -static void dm_old_requeue_request (struct request *rq) +static void dm_old_requeue_request (struct request *rq,unsigned long delay_ms) {struct request_queue *q = rq->q;unsigned long flags;spin_lock_irqsave (q->queue_lock, flags);blk_requeue_request (q, rq); -blk_run_queue_async (q); +blk_delay_queue (q, delay_ms);spin_unlock_irqrestore (q->queue_lock, flags); }
@@ -270,6 +270,7 @@ static void dm_requeue_original_request(struct dm_rq_target_io *tio, bool delay_struct mapped_device *md = tio->md;struct request *rq = tio->orig;int rw =rq_data_dir (rq); +unsigned long delay_ms = delay_requeue ?100 :0 ;rq_end_stats (md, rq);if (tio->clone) {
@@ -278,9 +279,9 @@ static void dm_requeue_original_request(struct dm_rq_target_io *tio, bool delay_ }if (!rq->q->mq_ops) -dm_old_requeue_request (rq); +dm_old_requeue_request (rq, delay_ms);else -dm_mq_delay_requeue_request (rq, delay_requeue ?100 /*ms*/ :0 ); +dm_mq_delay_requeue_request (rq, delay_ms);rq_completed (md, rw, false); }
Signature · 1 line
2.13.3
Re: [PATCH 7/7] dm-mpath: Make the dm-sq requeuing behavior consistent with the dm-mq behavior
Looks good,
Quoted 22 lines · Bart Van Assche
Hello Mike,
The patches in this series are what I came up with while analyzing the soft and hard lockups reported by Laurence Oberman. Please consider these patches for kernel v4.14.
Thank you,
Bart.
Bart Van Assche (7):
dm: Fix the seconddec_pending()argument in__split_and_process_bio()
dm: Fixprintk()rate limiting code
dm-mpath: Do not lock up a CPU with requeuing activity
dm-mpath: Avoid that building with W=1 causes gcc 7 to complain about
fall-through
dm-mpath: Complain about unsupported__multipath_map_bio()return
values
dm-mpath: RetryBLK_STS_RESOURCEerrors
dm-mpath: Make the dm-sq requeuing behavior consistent with the dm-mq
behavior
Quoted 5 lines
drivers/md/dm-mpath.c | 8 ++++++-- drivers/md/dm-rq.c | 9 +++++---- drivers/md/dm.c | 12 +----------- include/linux/device-mapper.h | 41 ++++++++++++----------------------------- 4 files changed, 24 insertions(+), 46 deletions(-)
Hey Bart,
Thanks for the patches. I'm currently on a leave of absence to recover from a nasty fall I had (broke my sacrum and dislocated my left thumb at the wrist)... so: I won't be getting to these patches for a couple weeks.
Mike