Fix a bug in deriving the FLUSH_TIMEOUT from the basic I/O timeout
Subsystems (2)
PATCH 1/1 Fix a bug in deriving the FLUSH_TIMEOUT from the basic I/O timeout
Commit ID: 7e660100d85af860e7ad763202fff717adcdaacd added code to derive the FLUSH_TIMEOUT from the basic I/O timeout. However, this patch did not use the basic I/O timeout of the device. Fix this bug.
--- drivers/scsi/sd.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/scsi/sd.c +3 -1
@@ -832,7 +832,9 @@ static int sd_setup_write_same_cmnd(struct scsi_device *sdp, struct request *rq)static int scsi_setup_flush_cmnd (struct scsi_device *sdp,struct request *rq) { - rq->timeout *=SD_FLUSH_TIMEOUT_MULTIPLIER ; +int timeout = sdp->request_queue->rq_timeout; + + rq->timeout = (timeout *SD_FLUSH_TIMEOUT_MULTIPLIER ); rq->retries =SD_MAX_RETRIES ; rq->cmd[0 ] =SYNCHRONIZE_CACHE ; rq->cmd_len =10 ;
Signature · 1 line
1.7.4.1
Quoted 14 lines · K. Y. Srinivasan
Commit ID:
7e660100d85af860e7ad763202fff717adcdaacdadded code to derive theFLUSH_TIMEOUTfrom the basic I/O timeout. However, this patch did not use the basic I/O timeout of the device. Fix this bug.Signed-off-by K. Y. Srinivasan <[email protected]>--- drivers/scsi/sd.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)drivers/scsi/sd.c +0
-0
drivers/scsi/sd.c static int sd_setup_write_same_cmnd(struct scsi_device *sdp, struct request *rq) · line 837
Quoted 7 lines
drivers/scsi/sd.c +3
-1@@ -832,7 +832,9 @@ static int sd_setup_write_same_cmnd(struct scsi_device *sdp, struct request *rq)static int scsi_setup_flush_cmnd (struct scsi_device *sdp,struct request *rq) { - rq->timeout *=SD_FLUSH_TIMEOUT_MULTIPLIER ; +int timeout = sdp->request_queue->rq_timeout; + + rq->timeout = (timeout *SD_FLUSH_TIMEOUT_MULTIPLIER );
Could you share where you found this to be a problem? It looks like a bug in block because all inbound requests being prepared should have a timeout set, so block would be the place to fix it.
I can't see how this can happen because we definitely add the timer after the request is prepared in my reading of the block code, unless I'm missing some path in block that violates this.
James
Quoted 30 lines
-----Original Message-----
From: James Bottomley [mailto:[email protected]]
Sent: Wednesday, June 4, 2014 10:02 AM
To: KY Srinivasan
Cc: [email protected]; [email protected]; [email protected]; [email protected]; linux- [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 1/1] [SCSI] Fix a bug in deriving theFLUSH_TIMEOUTfrom the basic I/O timeoutQuoted 16 lines · K. Y. Srinivasan
Commit ID:
7e660100d85af860e7ad763202fff717adcdaacdadded code to derive theFLUSH_TIMEOUTfrom the basic I/O timeout. However, this patch did not use the basic I/O timeout of the device. Fix this bug.Signed-off-by K. Y. Srinivasan <[email protected]>--- drivers/scsi/sd.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)drivers/scsi/sd.c index renamed from drivers/scsi/sd.c +0
-0e9689d5..54150b1 100644
drivers/scsi/sd.c +0
-0@@ -832,7 +832,9 @@ static int sd_setup_write_same_cmnd(struct scsi_device *sdp, struct request *rq)
Quoted 10 lines
drivers/scsi/sd.c static int sd_setup_write_same_cmnd(struct scsi_device *sdp, struct request *rq) · line 837
Quoted 6 lines
drivers/scsi/sd.c +3
-1static int scsi_setup_flush_cmnd (struct scsi_device *sdp,struct request *rq) { - rq->timeout *=SD_FLUSH_TIMEOUT_MULTIPLIER ; +int timeout = sdp->request_queue->rq_timeout; + + rq->timeout = (timeout *SD_FLUSH_TIMEOUT_MULTIPLIER );Could you share where you found this to be a problem? It looks like a bug in block because all inbound requests being prepared should have a timeout set, so block would be the place to fix it.
Perhaps; what I found was that the value in rq->timeout was 0 coming into this function and thus multiplying obviously has no effect.
Quoted 6 lines
I can't see how this can happen because we definitely add the timer after the request is prepared in my reading of the block code, unless I'm missing some path in block that violates this.
James
K. Y
Quoted 41 lines · KY Srinivasan
Quoted 30 lines
-----Original Message-----
From: James Bottomley [mailto:[email protected]]
Sent: Wednesday, June 4, 2014 10:02 AM
To: KY Srinivasan
Cc: [email protected]; [email protected]; [email protected]; [email protected]; linux- [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 1/1] [SCSI] Fix a bug in deriving theFLUSH_TIMEOUTfrom the basic I/O timeoutQuoted 16 lines · K. Y. Srinivasan
Commit ID:
7e660100d85af860e7ad763202fff717adcdaacdadded code to derive theFLUSH_TIMEOUTfrom the basic I/O timeout. However, this patch did not use the basic I/O timeout of the device. Fix this bug.Signed-off-by K. Y. Srinivasan <[email protected]>--- drivers/scsi/sd.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)drivers/scsi/sd.c index renamed from drivers/scsi/sd.c +0
-0e9689d5..54150b1 100644
drivers/scsi/sd.c +0
-0@@ -832,7 +832,9 @@ static int sd_setup_write_same_cmnd(struct scsi_device *sdp, struct request *rq)Quoted 10 lines
drivers/scsi/sd.c static int sd_setup_write_same_cmnd(struct scsi_device *sdp, struct request *rq) · line 837
Quoted 6 lines
drivers/scsi/sd.c +3
-1static int scsi_setup_flush_cmnd (struct scsi_device *sdp,struct request *rq) { - rq->timeout *=SD_FLUSH_TIMEOUT_MULTIPLIER ; +int timeout = sdp->request_queue->rq_timeout; + + rq->timeout = (timeout *SD_FLUSH_TIMEOUT_MULTIPLIER );Could you share where you found this to be a problem? It looks like a bug in block because all inbound requests being prepared should have a timeout set, so block would be the place to fix it.
Quoted 3 lines
Perhaps; what I found was that the value in
rq->timeoutwas 0 coming into this function and thus multiplying obviously has no effect.
I think you are right. We hit this problem because we are doing:
scsi_request_fn -> blk_peek_request -> sd_prep_fn -> scsi_setup_flush_cmnd.
At this time request->timeout is zero so the multiplication does nothing. See how sd_setup_write_same_cmnd will set the request->timeout at this time.
Then in scsi_request_fn we do:
scsi_request_fn -> blk_start_request -> blk_add_timer.
At this time it will set the request->timeout if something like req block pc users (like scsi_execute() or block/scsi_ioctl.c) or the write same code mentioned above have not set the timeout.
Quoted 67 lines
-----Original Message-----
From: Mike Christie [mailto:[email protected]]
Sent: Thursday, June 5, 2014 6:33 PM
To: KY Srinivasan
Cc: James Bottomley; [email protected]; [email protected]; [email protected]; [email protected]; linux- [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 1/1] [SCSI] Fix a bug in deriving theFLUSH_TIMEOUTfrom the basic I/O timeoutQuoted 41 lines · KY Srinivasan
Quoted 30 lines
-----Original Message-----
From: James Bottomley [mailto:[email protected]]
Sent: Wednesday, June 4, 2014 10:02 AM
To: KY Srinivasan
Cc: [email protected]; [email protected]; [email protected]; [email protected]; linux- [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 1/1] [SCSI] Fix a bug in deriving theFLUSH_TIMEOUTfrom the basic I/O timeoutQuoted 16 lines · K. Y. Srinivasan
Commit ID:
7e660100d85af860e7ad763202fff717adcdaacdadded code to derive theFLUSH_TIMEOUTfrom the basic I/O timeout. However, this patch did not use the basic I/O timeout of the device. Fix this bug.Signed-off-by K. Y. Srinivasan <[email protected]>--- drivers/scsi/sd.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)drivers/scsi/sd.c index renamed from drivers/scsi/sd.c +0
-0e9689d5..54150b1 100644
drivers/scsi/sd.c +0
-0@@ -832,7 +832,9 @@ static int sd_setup_write_same_cmnd(struct scsi_device *sdp, struct request *rq)Quoted 10 lines
drivers/scsi/sd.c static int sd_setup_write_same_cmnd(struct scsi_device *sdp, struct request *rq) · line 837
Quoted 6 lines
drivers/scsi/sd.c +3
-1static int scsi_setup_flush_cmnd (struct scsi_device *sdp,struct request *rq) { - rq->timeout *=SD_FLUSH_TIMEOUT_MULTIPLIER ; +int timeout = sdp->request_queue->rq_timeout; + + rq->timeout = (timeout *SD_FLUSH_TIMEOUT_MULTIPLIER );Could you share where you found this to be a problem? It looks like a bug in block because all inbound requests being prepared should have a timeout set, so block would be the place to fix it.
Quoted 3 lines
Perhaps; what I found was that the value in
rq->timeoutwas 0 coming into this function and thus multiplying obviously has no effect.I think you are right. We hit this problem because we are doing:
scsi_request_fn->blk_peek_request->sd_prep_fn->scsi_setup_flush_cmnd.At this time
request->timeoutis zero so the multiplication does nothing. See howsd_setup_write_same_cmndwill set therequest->timeoutat this time.
Quoted 7 lines
Then in
scsi_request_fnwe do:
scsi_request_fn->blk_start_request->blk_add_timer.At this time it will set the
request->timeoutif something like req block pc users (likescsi_execute()orblock/scsi_ioctl.c) or the write same code mentioned above have not set the timeout.
I don't think this is a recent change. Prior to this commit, we were setting the timeout value in this function; it just happened to be a different constant unrelated to the I/O timeout.
K. Y
Quoted 2 lines
Quoted 71 lines · KY Srinivasan
Quoted 71 lines
-----Original Message-----
From: Mike Christie [mailto:[email protected]]
Sent: Thursday, June 5, 2014 6:33 PM
To: KY Srinivasan
Cc: James Bottomley; [email protected]; [email protected]; [email protected]; [email protected]; linux- [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 1/1] [SCSI] Fix a bug in deriving theFLUSH_TIMEOUTfrom the basic I/O timeoutQuoted 41 lines · KY Srinivasan
Quoted 30 lines
-----Original Message-----
From: James Bottomley [mailto:[email protected]]
Sent: Wednesday, June 4, 2014 10:02 AM
To: KY Srinivasan
Cc: [email protected]; [email protected]; [email protected]; [email protected]; linux- [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 1/1] [SCSI] Fix a bug in deriving theFLUSH_TIMEOUTfrom the basic I/O timeoutQuoted 16 lines · K. Y. Srinivasan
Commit ID:
7e660100d85af860e7ad763202fff717adcdaacdadded code to derive theFLUSH_TIMEOUTfrom the basic I/O timeout. However, this patch did not use the basic I/O timeout of the device. Fix this bug.Signed-off-by K. Y. Srinivasan <[email protected]>--- drivers/scsi/sd.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)drivers/scsi/sd.c index renamed from drivers/scsi/sd.c +0
-0e9689d5..54150b1 100644
drivers/scsi/sd.c +0
-0@@ -832,7 +832,9 @@ static int sd_setup_write_same_cmnd(struct scsi_device *sdp, struct request *rq)Quoted 10 lines
drivers/scsi/sd.c static int sd_setup_write_same_cmnd(struct scsi_device *sdp, struct request *rq) · line 837
Quoted 6 lines
drivers/scsi/sd.c +3
-1static int scsi_setup_flush_cmnd (struct scsi_device *sdp,struct request *rq) { - rq->timeout *=SD_FLUSH_TIMEOUT_MULTIPLIER ; +int timeout = sdp->request_queue->rq_timeout; + + rq->timeout = (timeout *SD_FLUSH_TIMEOUT_MULTIPLIER );Could you share where you found this to be a problem? It looks like a bug in block because all inbound requests being prepared should have a timeout set, so block would be the place to fix it.
Quoted 3 lines
Perhaps; what I found was that the value in
rq->timeoutwas 0 coming into this function and thus multiplying obviously has no effect.I think you are right. We hit this problem because we are doing:
scsi_request_fn->blk_peek_request->sd_prep_fn->scsi_setup_flush_cmnd.At this time
request->timeoutis zero so the multiplication does nothing. See howsd_setup_write_same_cmndwill set therequest->timeoutat this time.Then in
scsi_request_fnwe do:
scsi_request_fn->blk_start_request->blk_add_timer.
Quoted 8 lines
Quoted 3 lines
At this time it will set the
request->timeoutif something like req block pc users (likescsi_execute()orblock/scsi_ioctl.c) or the write same code mentioned above have not set the timeout.I don't think this is a recent change. Prior to this commit, we were setting the timeout value in this function; it just happened to be a different constant unrelated to the I/O timeout.
Yeah, it looks like when 7e660100d85af860e7ad763202fff717adcdaacd was merged we were supposed to initialize it like in your patch in this thread.
I guess we could do your patch in this thread, or if we want the block layer to initialize the timeout before the prep_fn callout is called then we would need to have the blk-flush.c code to that when it sets up the request. If we do the latter, do we want the discard and write same code to initialize the request's timeout before the prep_fn callout is called too?
Quoted 84 lines · Mike Christie
Quoted 71 lines · KY Srinivasan
Quoted 71 lines
-----Original Message-----
From: Mike Christie [mailto:[email protected]]
Sent: Thursday, June 5, 2014 6:33 PM
To: KY Srinivasan
Cc: James Bottomley; [email protected]; [email protected]; [email protected]; [email protected]; linux- [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 1/1] [SCSI] Fix a bug in deriving theFLUSH_TIMEOUTfrom the basic I/O timeoutQuoted 41 lines · KY Srinivasan
Quoted 30 lines
-----Original Message-----
From: James Bottomley [mailto:[email protected]]
Sent: Wednesday, June 4, 2014 10:02 AM
To: KY Srinivasan
Cc: [email protected]; [email protected]; [email protected]; [email protected]; linux- [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 1/1] [SCSI] Fix a bug in deriving theFLUSH_TIMEOUTfrom the basic I/O timeoutQuoted 16 lines · K. Y. Srinivasan
Commit ID:
7e660100d85af860e7ad763202fff717adcdaacdadded code to derive theFLUSH_TIMEOUTfrom the basic I/O timeout. However, this patch did not use the basic I/O timeout of the device. Fix this bug.Signed-off-by K. Y. Srinivasan <[email protected]>--- drivers/scsi/sd.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)drivers/scsi/sd.c index renamed from drivers/scsi/sd.c +0
-0e9689d5..54150b1 100644
drivers/scsi/sd.c +0
-0@@ -832,7 +832,9 @@ static int sd_setup_write_same_cmnd(struct scsi_device *sdp, struct request *rq)Quoted 10 lines
drivers/scsi/sd.c static int sd_setup_write_same_cmnd(struct · line 838
Quoted 6 lines
drivers/scsi/sd.c +3
-1static int scsi_setup_flush_cmnd (struct scsi_device *sdp,struct request *rq) { - rq->timeout *=SD_FLUSH_TIMEOUT_MULTIPLIER ; +int timeout = sdp->request_queue->rq_timeout; + + rq->timeout = (timeout *SD_FLUSH_TIMEOUT_MULTIPLIER );Could you share where you found this to be a problem? It looks like a bug in block because all inbound requests being prepared should have a timeout set, so block would be the place to fix it.
Quoted 3 lines
Perhaps; what I found was that the value in
rq->timeoutwas 0 coming into this function and thus multiplying obviously has no effect.I think you are right. We hit this problem because we are doing:
scsi_request_fn->blk_peek_request->sd_prep_fn->scsi_setup_flush_cmnd.At this time
request->timeoutis zero so the multiplication does nothing. See howsd_setup_write_same_cmndwill set therequest->timeoutat this time.Then in
scsi_request_fnwe do:
scsi_request_fn->blk_start_request->blk_add_timer.Quoted 8 lines
Quoted 3 lines
At this time it will set the
request->timeoutif something like req block pc users (likescsi_execute()orblock/scsi_ioctl.c) or the write same code mentioned above have not set the timeout.I don't think this is a recent change. Prior to this commit, we were setting the timeout value in this function; it just happened to be a different constant unrelated to the I/O timeout.
Yeah, it looks like when
7e660100d85af860e7ad763202fff717adcdaacdwas merged we were supposed to initialize it like in your patch in this thread.
Quoted 6 lines
I guess we could do your patch in this thread, or if we want the block layer to initialize the timeout before the
prep_fncallout is called then we would need to have theblk-flush.ccode to that when it sets up the request. If we do the latter, do we want the discard and write same code to initialize the request's timeout before theprep_fncallout is called too?
I looked through the call chain; it seems to be intentional behaviour on the part of block. Just from an mq point of view, it would make better code if we unconditionally initialised rq->timeout early and allowed prep to modify it and then dumped the if(!req->timeout) in blk_add_timer(), but it's a marginal if condition that would compile to a conditional store on sensible architectures, so losing the conditional probably isn't worth worrying about.
Cc'd Jens for his opinion with the block patch
James
---
block/blk-core.c +1 -0
@@ -111,6 +111,7 @@ void blk_rq_init(struct request_queue *q, struct request *rq) rq->cmd = rq->__cmd; rq->cmd_len =BLK_MAX_CDB ; rq->tag =-1 ; + rq->timeout = q->rq_timeout; rq->start_time = jiffies;set_start_time_ns (rq); rq->part =NULL ;
block/blk-timeout.c +0 -7
@@ -180,13 +180,6 @@ void __blk_add_timer(struct request *req, struct list_head *timeout_list)BUG_ON (!list_empty (&req->timeout_list)); -/* -* Some LLDs, like scsi, peek at the timeout to prevent a -* command from being retried forever. -*/ -if (!req->timeout) - req->timeout = q->rq_timeout; - req->deadline = jiffies + req->timeout;if (timeout_list)list_add_tail (&req->timeout_list, timeout_list);
Jens Axboe
maintainerQuoted 100 lines · James Bottomley
Quoted 84 lines · Mike Christie
Quoted 71 lines · KY Srinivasan
Quoted 71 lines
-----Original Message-----
From: Mike Christie [mailto:[email protected]]
Sent: Thursday, June 5, 2014 6:33 PM
To: KY Srinivasan
Cc: James Bottomley; [email protected]; [email protected]; [email protected]; [email protected]; linux- [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 1/1] [SCSI] Fix a bug in deriving theFLUSH_TIMEOUTfrom the basic I/O timeoutQuoted 41 lines · KY Srinivasan
Quoted 30 lines
-----Original Message-----
From: James Bottomley [mailto:[email protected]]
Sent: Wednesday, June 4, 2014 10:02 AM
To: KY Srinivasan
Cc: [email protected]; [email protected]; [email protected]; [email protected]; linux- [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 1/1] [SCSI] Fix a bug in deriving theFLUSH_TIMEOUTfrom the basic I/O timeoutQuoted 16 lines · K. Y. Srinivasan
Commit ID:
7e660100d85af860e7ad763202fff717adcdaacdadded code to derive theFLUSH_TIMEOUTfrom the basic I/O timeout. However, this patch did not use the basic I/O timeout of the device. Fix this bug.Signed-off-by K. Y. Srinivasan <[email protected]>--- drivers/scsi/sd.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)drivers/scsi/sd.c index renamed from drivers/scsi/sd.c +0
-0e9689d5..54150b1 100644
drivers/scsi/sd.c +0
-0@@ -832,7 +832,9 @@ static int sd_setup_write_same_cmnd(struct scsi_device *sdp, struct request *rq)Quoted 10 lines
drivers/scsi/sd.c static int sd_setup_write_same_cmnd(struct · line 838
Quoted 6 lines
drivers/scsi/sd.c +3
-1static int scsi_setup_flush_cmnd (struct scsi_device *sdp,struct request *rq) { - rq->timeout *=SD_FLUSH_TIMEOUT_MULTIPLIER ; +int timeout = sdp->request_queue->rq_timeout; + + rq->timeout = (timeout *SD_FLUSH_TIMEOUT_MULTIPLIER );Could you share where you found this to be a problem? It looks like a bug in block because all inbound requests being prepared should have a timeout set, so block would be the place to fix it.
Quoted 3 lines
Perhaps; what I found was that the value in
rq->timeoutwas 0 coming into this function and thus multiplying obviously has no effect.I think you are right. We hit this problem because we are doing:
scsi_request_fn->blk_peek_request->sd_prep_fn->scsi_setup_flush_cmnd.At this time
request->timeoutis zero so the multiplication does nothing. See howsd_setup_write_same_cmndwill set therequest->timeoutat this time.Then in
scsi_request_fnwe do:
scsi_request_fn->blk_start_request->blk_add_timer.Quoted 8 lines
Quoted 3 lines
At this time it will set the
request->timeoutif something like req block pc users (likescsi_execute()orblock/scsi_ioctl.c) or the write same code mentioned above have not set the timeout.I don't think this is a recent change. Prior to this commit, we were setting the timeout value in this function; it just happened to be a different constant unrelated to the I/O timeout.
Yeah, it looks like when
7e660100d85af860e7ad763202fff717adcdaacdwas merged we were supposed to initialize it like in your patch in this thread.Quoted 6 lines
I guess we could do your patch in this thread, or if we want the block layer to initialize the timeout before the
prep_fncallout is called then we would need to have theblk-flush.ccode to that when it sets up the request. If we do the latter, do we want the discard and write same code to initialize the request's timeout before theprep_fncallout is called too?I looked through the call chain; it seems to be intentional behaviour on the part of block. Just from an mq point of view, it would make better code if we unconditionally initialised
rq->timeoutearly and allowed prep to modify it and then dumped theif(!req->timeout)inblk_add_timer(), but it's a marginal if condition that would compile to a conditional store on sensible architectures, so losing the conditional probably isn't worth worrying about.
Quoted 1 line
Cc'd Jens for his opinion with the block patch
I just committed this one earlier today:
http://git.kernel.dk/?p=linux-block.git;a=commit;h=f6be4fb4bcb396fc3b1c134b7863351972de081f
since I ran into the same thing on nvme. Either approach is fine with me, as they both allow override of the timeout before insertion. But we've always done the rq->timeout = 0 init, so I think we should just reinstate that behavior.
Signature · 1 line
Jens Axboe
Quoted 125 lines
-----Original Message-----
From: Jens Axboe [mailto:[email protected]]
Sent: Friday, June 6, 2014 11:23 AM
To: James Bottomley; [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; KY Srinivasan; linux- [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 1/1] [SCSI] Fix a bug in deriving theFLUSH_TIMEOUTfrom the basic I/O timeoutQuoted 10 lines · James Bottomley
Quoted 9 lines · Mike Christie
Quoted 8 lines · KY Srinivasan
Quoted 8 lines
-----Original Message-----
From: Mike Christie [mailto:[email protected]]
Sent: Thursday, June 5, 2014 6:33 PM
To: KY Srinivasan
Cc: James Bottomley; [email protected]; [email protected]; [email protected];Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
linux- [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 1/1] [SCSI] Fix a bug in deriving theFLUSH_TIMEOUTfrom the basic I/O timeoutQuoted 13 lines · KY Srinivasan
Quoted 13 lines
-----Original Message-----
From: James Bottomley [mailto:[email protected]]
Sent: Wednesday, June 4, 2014 10:02 AM
To: KY Srinivasan
Cc: [email protected]; [email protected]; [email protected]; [email protected]; linux- [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 1/1] [SCSI] Fix a bug in deriving theFLUSH_TIMEOUTfrom the basic I/O timeoutQuoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines · K. Y. Srinivasan
Quoted 1 line
Commit ID:
7e660100d85af860e7ad763202fff717adcdaacdaddedcode
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
to derive the
FLUSH_TIMEOUTfrom the basic I/O timeout.However,
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
this patch did not use the basic I/O timeout of the device. Fix this
bug.
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
drivers/scsi/sd.c static int
Quoted 11 lines
Signed-off-by K. Y. Srinivasan <[email protected]>--- drivers/scsi/sd.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)drivers/scsi/sd.c index renamed from drivers/scsi/sd.c +0
-0e9689d5..54150b1 100644
drivers/scsi/sd.c +0
-0@@ -832,7 +832,9 @@ static intsd_setup_write_same_cmnd(struct
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/scsi/sd.c static int · line 838
Quoted 8 lines
drivers/scsi/sd.c +3
-1scsi_device *sdp, struct request *rq) static int scsi_setup_flush_cmnd(struct scsi_device *sdp, struct request *rq) { - rq->timeout *= SD_FLUSH_TIMEOUT_MULTIPLIER; + int timeout = sdp->request_queue->rq_timeout; + + rq->timeout = (timeout *
SD_FLUSH_TIMEOUT_MULTIPLIER);Quoted 49 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
Quoted 4 lines
Could you share where you found this to be a problem? It looks like a bug in block because all inbound requests being prepared should have a timeout set, so block would be the place to fix it.
Perhaps; what I found was that the value in
rq->timeoutwas 0 coming into this function and thus multiplying obviously has no effect.Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
I think you are right. We hit this problem because we are doing:
scsi_request_fn->blk_peek_request->sd_prep_fn->scsi_setup_flush_cmnd.At this time
request->timeoutis zero so the multiplication does nothing. See howsd_setup_write_same_cmndwill set the request-timeout at this time.
Quoted 17 lines
Quoted 5 lines
Quoted 5 lines
Then in
scsi_request_fnwe do:
scsi_request_fn->blk_start_request->blk_add_timer.Quoted 8 lines
Quoted 3 lines
At this time it will set the
request->timeoutif something like req block pc users (likescsi_execute()orblock/scsi_ioctl.c) or the write same code mentioned above have not set the timeout.I don't think this is a recent change. Prior to this commit, we were setting the timeout value in this function; it just happened to be a different constant unrelated to the I/O timeout.
Yeah, it looks like when
7e660100d85af860e7ad763202fff717adcdaacdwas merged we were supposed to initialize it like in your patch in this thread.Quoted 6 lines
I guess we could do your patch in this thread, or if we want the block layer to initialize the timeout before the
prep_fncallout is called then we would need to have theblk-flush.ccode to that when it sets up the request. If we do the latter, do we want the discard and write same code to initialize the request's timeout before theprep_fncallout is called too?I looked through the call chain; it seems to be intentional behaviour on the part of block. Just from an mq point of view, it would make better code if we unconditionally initialised
rq->timeoutearly and allowed prep to modify it and then dumped theif(!req->timeout)inblk_add_timer(), but it's a marginal if condition that would compile to a conditional store on sensible architectures, so losing the conditional probably isn't worth worrying about.Quoted 1 line
Cc'd Jens for his opinion with the block patch
I just committed this one earlier today:
Quoted 7 lines
http://git.kernel.dk/?p=linux-
block.git;a=commit;h=f6be4fb4bcb396fc3b1c134b7863351972de081fsince I ran into the same thing on nvme. Either approach is fine with me, as they both allow override of the timeout before insertion. But we've always done the
rq->timeout= 0 init, so I think we should just reinstate that behavior.
James,
How is this being fixed now.
Regards,
K. Y
Quoted 150 lines
-----Original Message-----
From: [email protected] [mailto:driverdev- [email protected]] On Behalf Of KY Srinivasan
Sent: Friday, June 20, 2014 2:37 PM
To: Jens Axboe; James Bottomley; [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: RE: [PATCH 1/1] [SCSI] Fix a bug in deriving theFLUSH_TIMEOUTfrom the basic I/O timeoutQuoted 64 lines
-----Original Message-----
From: Jens Axboe [mailto:[email protected]]
Sent: Friday, June 6, 2014 11:23 AM
To: James Bottomley; [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; KY Srinivasan; linux- [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 1/1] [SCSI] Fix a bug in deriving theFLUSH_TIMEOUTfrom the basic I/O timeoutQuoted 10 lines · James Bottomley
Quoted 9 lines · Mike Christie
Quoted 8 lines · KY Srinivasan
Quoted 8 lines
-----Original Message-----
From: Mike Christie [mailto:[email protected]]
Sent: Thursday, June 5, 2014 6:33 PM
To: KY Srinivasan
Cc: James Bottomley; [email protected]; [email protected]; [email protected];Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
linux- [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 1/1] [SCSI] Fix a bug in deriving theFLUSH_TIMEOUTfrom the basic I/O timeoutQuoted 13 lines · KY Srinivasan
Quoted 13 lines
-----Original Message-----
From: James Bottomley [mailto:[email protected]]
Sent: Wednesday, June 4, 2014 10:02 AM
To: KY Srinivasan
Cc: [email protected]; [email protected]; [email protected]; [email protected]; linux- [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 1/1] [SCSI] Fix a bug in deriving theFLUSH_TIMEOUTfrom the basic I/O timeoutQuoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines · K. Y. Srinivasan
Quoted 1 line
Commit ID:
7e660100d85af860e7ad763202fff717adcdaacdaddedcode
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
to derive the
FLUSH_TIMEOUTfrom the basic I/O timeout.However,
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
this patch did not use the basic I/O timeout of the device. Fix this
bug.
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
drivers/scsi/sd.c static int
Quoted 11 lines
Signed-off-by K. Y. Srinivasan <[email protected]>--- drivers/scsi/sd.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)drivers/scsi/sd.c index renamed from drivers/scsi/sd.c +0
-0e9689d5..54150b1 100644
drivers/scsi/sd.c +0
-0@@ -832,7 +832,9 @@ static intsd_setup_write_same_cmnd(struct
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
drivers/scsi/sd.c +0
-0scsi_device *sdp, struct request *rq)Quoted 14 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
drivers/scsi/sd.c static int · line 838
Quoted 6 lines
drivers/scsi/sd.c +3
-1static int scsi_setup_flush_cmnd (struct scsi_device *sdp,struct request *rq) { - rq->timeout *=SD_FLUSH_TIMEOUT_MULTIPLIER ; +int timeout = sdp->request_queue->rq_timeout; + + rq->timeout = (timeout *
SD_FLUSH_TIMEOUT_MULTIPLIER);Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 4 lines
Could you share where you found this to be a problem? It looks like a bug in block because all inbound requests being prepared should have a timeout set, so block would be the place to fix it.
Perhaps; what I found was that the value in
rq->timeoutwas 0 coming into this function and thus multiplying obviously has noeffect.
Quoted 19 lines
Quoted 19 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 1 line
I think you are right. We hit this problem because we are doing:
scsi_request_fn->blk_peek_request->sd_prep_fn->scsi_setup_flush_cmnd.At this time
request->timeoutis zero so the multiplication does nothing. See howsd_setup_write_same_cmndwill set the request-timeout at this time.
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
Then in
scsi_request_fnwe do:
scsi_request_fn->blk_start_request->blk_add_timer.At this time it will set the
request->timeoutif something like req block pc users (likescsi_execute()orblock/scsi_ioctl.c) or the write same code mentioned above have not set the timeout.Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 4 lines
I don't think this is a recent change. Prior to this commit, we were setting the timeout value in this function; it just happened to be a different constant unrelated to the I/O timeout.
Yeah, it looks like when
7e660100d85af860e7ad763202fff717adcdaacdwas merged we were supposed to initialize it like in your patch in thisthread.
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
I guess we could do your patch in this thread, or if we want the block layer to initialize the timeout before the
prep_fncallout is called then we would need to have theblk-flush.ccode to that when it sets up the request. If we do the latter, do we want the discard and write same code to initialize the request's timeout before theprep_fncallout is called too?Quoted 7 lines
Quoted 7 lines
I looked through the call chain; it seems to be intentional behaviour on the part of block. Just from an mq point of view, it would make better code if we unconditionally initialised
rq->timeoutearly and allowed prep to modify it and then dumped theif(!req->timeout)inblk_add_timer(), but it's a marginal if condition that would compile to a conditional store on sensible architectures, so losing the conditional probably isn't worth worryingabout.
Quoted 5 lines
Quoted 2 lines
Cc'd Jens for his opinion with the block patch
I just committed this one earlier today:
Quoted 7 lines
http://git.kernel.dk/?p=linux-
block.git;a=commit;h=f6be4fb4bcb396fc3b1c134b7863351972de081fsince I ran into the same thing on nvme. Either approach is fine with me, as they both allow override of the timeout before insertion. But we've always done the
rq->timeout= 0 init, so I think we should just reinstate that behavior.
Quoted 7 lines
James,
How is this being fixed now.
Regards,
K. Y
I still see this problem. There was talk of fixing it elsewhere.
Regards,
K. Y
Quoted 5 lines
_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
In sd_sync_cache:
rq->timeout *= SD_FLUSH_TIMEOUT_MULTIPLIER;
Regardless of the baseline for the multiplication, a magic number of 2 is too arbitrary. That might work for an individual drive, but could be far too short for a RAID controller that runs into worst case error handling for the drives to which it is flushing (e.g., if its cache is volatile and the drives all have recoverable errors during writes). That time goes up with a bigger cache and with more fragmented write data in the cache requiring more individual WRITE commands.
A better value would be the Recommended Command Timeout field value reported in the REPORT SUPPORTED OPERATION CODES command, if reported by the device server. That is supposed to account for the worst case.
For cases where that is not reported, exposing the multiplier in sysfs would let the timeout for simple devices be set to smaller values than complex devices.
Also, in both sd_setup_flush_cmnd and sd_sync_cache:
cmd->cmnd[0] = SYNCHRONIZE_CACHE;
cmd->cmd_len = 10;SYNCHRONIZE CACHE (16) should be favored over SYNCHRONIZE CACHE (10) unless SYNCHRONIZE CACHE (10) is not supported.
---
Rob Elliott HP Server Storage
Quoted 2 lines · Robert (Server Storage)
SYNCHRONIZE CACHE (16) should be favored over SYNCHRONIZE CACHE (10) unless SYNCHRONIZE CACHE (10) is not supported.
I gues you mean (16) for the last occurance? What's the benefit of using SYNCHRONIZE CACHE (16) if we don't pass a LBA range?
Quoted 12 lines · Robert (Server Storage)
In
sd_sync_cache:rq->timeout *= SD_FLUSH_TIMEOUT_MULTIPLIER;Regardless of the baseline for the multiplication, a magic number of 2 is too arbitrary. That might work for an individual drive, but could be far too short for a RAID controller that runs into worst case error handling for the drives to which it is flushing (e.g., if its cache is volatile and the drives all have recoverable errors during writes). That time goes up with a bigger cache and with more fragmented write data in the cache requiring more individual WRITE commands.
RAID devices with gigabytes of cache are usually battery backed and lie about their cache type (they usually claim write through). This behaviour is exactly what we want because the flush is used to enforce write barriers for filesystem consistency, so we only want to flush volatile caches.
The rare case you cite, where the RAID device is volatile and having difficulty flushing, we do want a failure because otherwise the filesystem will become unusable and the system will live lock ... barriers are sent down frequently under normal filesystem operation.
The SCSI standards committees have been struggling with defining and detecting the difference between volatile and non-volatile cache and the heuristics we'd have to use to avoid annoying USB devices with detecting this don't look pretty. We always zero the SYNC_NV bit anyway, so even if the devices stopped lying, we'd be safe.
Quoted 9 lines
A better value would be the Recommended Command Timeout field value reported in the REPORT SUPPORTED OPERATION CODES command, if reported by the device server. That is supposed to account for the worst case.
For cases where that is not reported, exposing the multiplier in sysfs would let the timeout for simple devices be set to smaller values than complex devices.
Quoted 6 lines
Also, in both
sd_setup_flush_cmndandsd_sync_cache:cmd->cmnd[0] = SYNCHRONIZE_CACHE; cmd->cmd_len = 10;SYNCHRONIZE CACHE (16) should be favored over SYNCHRONIZE CACHE (10) unless SYNCHRONIZE CACHE (10) is not supported.
For what reason. We usually go for the safe alternatives, which is 10 byte commands because they have the widest testing and greatest level of support. We don't do range flushes currently, so there doesn't seem to be a practical different. If we did support range flushes, we'd likely only use SC(16) on >2TB devices.
James
Quoted 6 lines
From: James Bottomley [mailto:[email protected]]
On Fri, 2014-07-18 at 00:51 +0000, Elliott, Robert (Server Storage) wrote:
...
Quoted 7 lines
Quoted 7 lines
Also, in both
sd_setup_flush_cmndandsd_sync_cache:cmd->cmnd[0] = SYNCHRONIZE_CACHE; cmd->cmd_len = 10;SYNCHRONIZE CACHE (16) should be favored over SYNCHRONIZE CACHE (10) unless SYNCHRONIZE CACHE (10) is not supported.
(sorry - meant "unless ... 16 is not supported")
Quoted 7 lines
For what reason. We usually go for the safe alternatives, which is 10 byte commands because they have the widest testing and greatest level of support. We don't do range flushes currently, so there doesn't seem to be a practical different. If we did support range flushes, we'd likely only use SC(16) on >2TB devices.
James
A goal of the simplified SCSI feature set idea is to drop all the short CDBs that have larger, more capable equivalents - don't carry READ 6/10/12/16 and SYNCHRONIZE CACHE 10/16, just keep the 16-byte versions. With modern serial IU-based protocols, short CDBs don't save any transfer time. This will simplify design and testing on both initiator and target sides. Competing command sets like NVMe rightly point out that SCSI has too much legacy baggage - all you need for IO is one READ, one WRITE, and one FLUSH command.
That's why SBC-3 ended up with these warning notes for all the non-16 byte CDBs:
NOTE 15 - Migration from the SYNCHRONIZE CACHE (10) command to the SYNCHRONIZE CACHE (16) command is recommended for all implementations.
If the LBA field in SYNCHRONIZE CACHE went obsolete, then maybe SYNCHRONIZE CACHE (10) would be kept instead of (16), but that field is still present. So, (16) is the likely survivor.
---
Rob Elliott HP Server Storage
Quoted 8 lines · Robert (Server Storage)
Quoted 6 lines
From: James Bottomley [mailto:[email protected]]
On Fri, 2014-07-18 at 00:51 +0000, Elliott, Robert (Server Storage) wrote:
...
Quoted 1 line
Quoted 1 line
Quoted 8 lines
Quoted 6 lines
Quoted 6 lines
Also, in both
sd_setup_flush_cmndandsd_sync_cache:cmd->cmnd[0] = SYNCHRONIZE_CACHE; cmd->cmd_len = 10;SYNCHRONIZE CACHE (16) should be favored over SYNCHRONIZE CACHE (10) unless SYNCHRONIZE CACHE (10) is not supported.
(sorry - meant "unless ... 16 is not supported")
Yes, I guessed that?
Quoted 8 lines
Quoted 7 lines
For what reason. We usually go for the safe alternatives, which is 10 byte commands because they have the widest testing and greatest level of support. We don't do range flushes currently, so there doesn't seem to be a practical different. If we did support range flushes, we'd likely only use SC(16) on >2TB devices.
James
Quoted 8 lines
A goal of the simplified SCSI feature set idea is to drop all the short CDBs that have larger, more capable equivalents - don't carry READ 6/10/12/16 and SYNCHRONIZE CACHE 10/16, just keep the 16-byte versions. With modern serial IU-based protocols, short CDBs don't save any transfer time. This will simplify design and testing on both initiator and target sides. Competing command sets like NVMe rightly point out that SCSI has too much legacy baggage - all you need for IO is one READ, one WRITE, and one FLUSH command.
But that's not relevant to us. This is the problem of practical vs standards approaches. We have to support older and buggy devices. Most small USB storage sticks die if they see 16 byte CDB commands because their interpreters. The more "legacy baggage" the standards committee dumps, the greater the number of heuristics OSs have to have to cope with the plethora of odd devices.
Quoted 10 lines
That's why SBC-3 ended up with these warning notes for all the non-16 byte CDBs:
NOTE 15 - Migration from the SYNCHRONIZE CACHE (10) command to the SYNCHRONIZE CACHE (16) command is recommended for all implementations.
If the LBA field in SYNCHRONIZE CACHE went obsolete, then maybe SYNCHRONIZE CACHE (10) would be kept instead of (16), but that field is still present. So, (16) is the likely survivor.
OK, but look at it from our point of view: The reply above justifies why we prefer 10 byte CDBs over 16. If the standards body ever did remove SC(10) completely, then we'd have to have yet another heuristic to recognise devices that don't support SC(10), but until that day, using SC(10) alone works in all cases, so is the better path for the OS.
If you could, please get the standards body to recognise that the more command churn they introduce (in the name of rationalisation or whatever), the more problems they introduce for Operating Systems and the more likelihood (because of different people reading different revisions of standards) that we end up with compliance bugs in devices.
James
Quoted 62 lines · James Bottomley
Quoted 8 lines · Robert (Server Storage)
Quoted 6 lines
From: James Bottomley [mailto:[email protected]]
On Fri, 2014-07-18 at 00:51 +0000, Elliott, Robert (Server Storage) wrote:
...
Quoted 1 line
Quoted 1 line
Quoted 8 lines
Quoted 6 lines
Quoted 6 lines
Also, in both
sd_setup_flush_cmndandsd_sync_cache:cmd->cmnd[0] = SYNCHRONIZE_CACHE; cmd->cmd_len = 10;SYNCHRONIZE CACHE (16) should be favored over SYNCHRONIZE CACHE (10) unless SYNCHRONIZE CACHE (10) is not supported.
(sorry - meant "unless ... 16 is not supported")
Yes, I guessed that?
Quoted 8 lines
Quoted 7 lines
For what reason. We usually go for the safe alternatives, which is 10 byte commands because they have the widest testing and greatest level of support. We don't do range flushes currently, so there doesn't seem to be a practical different. If we did support range flushes, we'd likely only use SC(16) on >2TB devices.
James
Quoted 8 lines
A goal of the simplified SCSI feature set idea is to drop all the short CDBs that have larger, more capable equivalents - don't carry READ 6/10/12/16 and SYNCHRONIZE CACHE 10/16, just keep the 16-byte versions. With modern serial IU-based protocols, short CDBs don't save any transfer time. This will simplify design and testing on both initiator and target sides. Competing command sets like NVMe rightly point out that SCSI has too much legacy baggage - all you need for IO is one READ, one WRITE, and one FLUSH command.
But that's not relevant to us. This is the problem of practical vs standards approaches. We have to support older and buggy devices. Most small USB storage sticks die if they see 16 byte CDB commands because their interpreters. The more "legacy baggage" the standards committee dumps, the greater the number of heuristics OSs have to have to cope with the plethora of odd devices.
Quoted 10 lines
That's why SBC-3 ended up with these warning notes for all the non-16 byte CDBs:
NOTE 15 - Migration from the SYNCHRONIZE CACHE (10) command to the SYNCHRONIZE CACHE (16) command is recommended for all implementations.
If the LBA field in SYNCHRONIZE CACHE went obsolete, then maybe SYNCHRONIZE CACHE (10) would be kept instead of (16), but that field is still present. So, (16) is the likely survivor.
OK, but look at it from our point of view: The reply above justifies why we prefer 10 byte CDBs over 16. If the standards body ever did remove SC(10) completely, then we'd have to have yet another heuristic to recognise devices that don't support SC(10), but until that day, using SC(10) alone works in all cases, so is the better path for the OS.
Quoted 5 lines
If you could, please get the standards body to recognise that the more command churn they introduce (in the name of rationalisation or whatever), the more problems they introduce for Operating Systems and the more likelihood (because of different people reading different revisions of standards) that we end up with compliance bugs in devices.
From the term: "feature sets" I'm guessing T10 will follow what T13 does and have something like a VPD page with descriptors of feature sets supported. Each set has mandatory and optional commands, perhaps a similar categorization of mode and VPD pages as well. Such a "clean slate" for SCSI would make it simpler in the future, at least for what to put on the fast path. Perhaps some legacy support could be pushed to the user space.
For many technical areas "legacy" is a derogatory term, but not necessarily for storage!
Doug Gilbert
Quoted 1 line · KY Srinivasan
I still see this problem. There was talk of fixing it elsewhere.
Well, what we have right not is entirely broken, given that the block layer doesn't initialize ->timeout on TYPE_FS requeuests.
We either need to revert that initial commit or apply something like the attached patch as a quick fix.
Quoted 1 line
From
ecbf154d15f4022676219b9ff90e542d1db64392Mon Sep 17 00:00:00 2001
From: Christoph Hellwig <[email protected]>
Date: Fri, 18 Jul 2014 17:11:27 +0200
Subject: sd: set a non-zero timeout for flush requests
rq->timeout for TYPE_FS commands needs to be initialized by the driver, so we can't simply multiply it.
--- drivers/scsi/sd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/sd.c +1 -1
@@ -880,7 +880,7 @@ static int sd_setup_flush_cmnd(struct scsi_cmnd *cmd) cmd->transfersize =0 ; cmd->allowed =SD_MAX_RETRIES ; - rq->timeout *=SD_FLUSH_TIMEOUT_MULTIPLIER ; + rq->timeout =SD_TIMEOUT *SD_FLUSH_TIMEOUT_MULTIPLIER ;return BLKPREP_OK ; }
Signature · 1 line
1.9.1
_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Quoted 14 lines
-----Original Message-----
From: Christoph Hellwig ([email protected]) [mailto:[email protected]]
Sent: Friday, July 18, 2014 8:11 AM
To: KY Srinivasan
Cc: Jens Axboe; James Bottomley; [email protected]; Christoph Hellwig ([email protected]); [email protected]; [email protected]; [email protected]; linux- [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 1/1] [SCSI] Fix a bug in deriving theFLUSH_TIMEOUTfrom the basic I/O timeout
Quoted 8 lines
Quoted 1 line · KY Srinivasan
I still see this problem. There was talk of fixing it elsewhere.
Well, what we have right not is entirely broken, given that the block layer doesn't initialize ->timeout on
TYPE_FSrequeuests.We either need to revert that initial commit or apply something like the attached patch as a quick fix.
I had sent this exact patch sometime back:
http://www.spinics.net/lists/linux-scsi/msg75385.html
K. Y
Quoted 16 lines · KY Srinivasan
Quoted 16 lines
-----Original Message-----
From: Christoph Hellwig ([email protected]) [mailto:[email protected]]
Sent: Friday, July 18, 2014 8:11 AM
To: KY Srinivasan
Cc: Jens Axboe; James Bottomley; [email protected]; Christoph Hellwig ([email protected]); [email protected]; [email protected]; [email protected]; linux- [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 1/1] [SCSI] Fix a bug in deriving theFLUSH_TIMEOUTfrom the basic I/O timeoutQuoted 1 line · KY Srinivasan
I still see this problem. There was talk of fixing it elsewhere.
Quoted 8 lines
Quoted 5 lines
Well, what we have right not is entirely broken, given that the block layer doesn't initialize ->timeout on
TYPE_FSrequeuests.We either need to revert that initial commit or apply something like the attached patch as a quick fix.
I had sent this exact patch sometime back:
Actually, no you didn't. The difference is in the derivation of the timeout. Christoph's patch is absolute in terms of SD_TIMEOUT; yours is relative to the queue timeout setting ... I thought there was a reason for preferring the relative version.
James
Quoted 4 lines · James Bottomley
Actually, no you didn't. The difference is in the derivation of the timeout. Christoph's patch is absolute in terms of
SD_TIMEOUT; yours is relative to the queue timeout setting ... I thought there was a reason for preferring the relative version.
Yes, KYs version is better. It takes the base timeout drivers set on the request queue into account.
Quoted 36 lines
-----Original Message-----
From: James Bottomley [mailto:[email protected]]
Sent: Friday, July 18, 2014 9:57 AM
To: KY Srinivasan
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 1/1] [SCSI] Fix a bug in deriving theFLUSH_TIMEOUTfrom the basic I/O timeoutQuoted 22 lines · KY Srinivasan
Quoted 22 lines
-----Original Message-----
From: Christoph Hellwig ([email protected]) [mailto:[email protected]]
Sent: Friday, July 18, 2014 8:11 AM
To: KY Srinivasan
Cc: Jens Axboe; James Bottomley; [email protected]; Christoph Hellwig ([email protected]); [email protected]; [email protected]; [email protected]; linux- [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 1/1] [SCSI] Fix a bug in deriving theFLUSH_TIMEOUTfrom the basic I/O timeoutQuoted 1 line · KY Srinivasan
I still see this problem. There was talk of fixing it elsewhere.
Well, what we have right not is entirely broken, given that the block layer doesn't initialize ->timeout on
TYPE_FSrequeuests.We either need to revert that initial commit or apply something like the attached patch as a quick fix.
Quoted 8 lines
Quoted 3 lines
I had sent this exact patch sometime back:
Actually, no you didn't. The difference is in the derivation of the timeout. Christoph's patch is absolute in terms of
SD_TIMEOUT; yours is relative to the queue timeout setting ... I thought there was a reason for preferring the relative version.
You are right; sorry about that. I think my version is better since we do want to base the flush timeout relative to the basic timeout.
K. Y
Quoted 2 lines
James
[email protected]
Reviewed-by James BottomleyThis is what I plan to put in after it passes basic testing:
---
Quoted 1 line
From
bb617c9465b839d70ecbbc69002a20ccf5f935bdMon Sep 17 00:00:00 2001
From: "K. Y. Srinivasan" <[email protected]>
Date: Fri, 18 Jul 2014 19:12:58 +0200
Subject: sd: fix a bug in deriving the FLUSH_TIMEOUT from the basic I/O
timeout
Commit ID: 7e660100d85af860e7ad763202fff717adcdaacd added code to derive the FLUSH_TIMEOUT from the basic I/O timeout. However, this patch did not use the basic I/O timeout of the device. Fix this bug.
--- drivers/scsi/sd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/sd.c +1 -1
@@ -880,7 +880,7 @@ static int sd_setup_flush_cmnd(struct scsi_cmnd *cmd) cmd->transfersize =0 ; cmd->allowed =SD_MAX_RETRIES ; - rq->timeout =SD_TIMEOUT *SD_FLUSH_TIMEOUT_MULTIPLIER ; + rq->timeout = rq->q->rq_timeout *SD_FLUSH_TIMEOUT_MULTIPLIER ;return BLKPREP_OK ; }
Signature · 1 line
1.9.1
[email protected]
Reviewed-by James BottomleyQuoted 1 line · On Fri, Jul 18, 2014 at 10:12:38AM -0700, [email protected] wrote:
This is what I plan to put in after it passes basic testing:
And that one was on top of my previous version. One that applies against core-for-3.17 below:
---
Quoted 1 line
From
8a79783e5f72ec034a724e16c1f46604bd97bf68Mon Sep 17 00:00:00 2001
From: "K. Y. Srinivasan" <[email protected]>
Date: Fri, 18 Jul 2014 17:11:27 +0200
Subject: sd: fix a bug in deriving the FLUSH_TIMEOUT from the basic I/O
timeout
Commit ID: 7e660100d85af860e7ad763202fff717adcdaacd added code to derive the FLUSH_TIMEOUT from the basic I/O timeout. However, this patch did not use the basic I/O timeout of the device. Fix this bug.
--- drivers/scsi/sd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/sd.c +1 -1
@@ -880,7 +880,7 @@ static int sd_setup_flush_cmnd(struct scsi_cmnd *cmd) cmd->transfersize =0 ; cmd->allowed =SD_MAX_RETRIES ; - rq->timeout *=SD_FLUSH_TIMEOUT_MULTIPLIER ; + rq->timeout = rq->q->rq_timeout *SD_FLUSH_TIMEOUT_MULTIPLIER ;return BLKPREP_OK ; }
Signature · 1 line
1.9.1
Quoted 5 lines · K. Y. Srinivasan
Commit ID:
7e660100d85af860e7ad763202fff717adcdaacdadded code to derive theFLUSH_TIMEOUTfrom the basic I/O timeout. However, this patch did not use the basic I/O timeout of the device. Fix this bug.Signed-off-by K. Y. Srinivasan <[email protected]>
Looks good to me,
(it will need some changes to apply to my tree, but I'm happy to do that if I can get another review).
James, does this look fine to you?
James Bottomley
Reviewed-byQuoted 7 lines · Christoph Hellwig
Quoted 5 lines · K. Y. Srinivasan
Commit ID:
7e660100d85af860e7ad763202fff717adcdaacdadded code to derive theFLUSH_TIMEOUTfrom the basic I/O timeout. However, this patch did not use the basic I/O timeout of the device. Fix this bug.Signed-off-by K. Y. Srinivasan <[email protected]>
Quoted 8 lines
Looks good to me,
Reviewed-by Christoph Hellwig <[email protected]>(it will need some changes to apply to my tree, but I'm happy to do that if I can get another review).
James, does this look fine to you?
Yes:
James