diff mbox

[Utopic,v2] UBUNTU: SAUCE: Revert "sd: don't use scsi_setup_blk_pc_cmnd for flush requests"

Message ID 1412104416-4017-1-git-send-email-chris.j.arges@canonical.com
State New
Headers show

Commit Message

Chris J Arges Sept. 30, 2014, 7:13 p.m. UTC
BugLink: http://bugs.launchpad.net/bugs/1375452

This reverts commit 32f7682bb0f71eaf88388e05af00cbc14edc9bd7.
Note: this also keeps commit aac35036f7ab00b8cb2a4c99b42cffb33d98aa42.

Signed-off-by: Chris J Arges <chris.j.arges@canonical.com>

Conflicts:
	drivers/scsi/sd.c
---
 drivers/scsi/sd.c | 20 +++++++-------------
 1 file changed, 7 insertions(+), 13 deletions(-)

Comments

Chris J Arges Sept. 30, 2014, 8:11 p.m. UTC | #1
FYI, I've tested this v2 patch properly on the system and it does work.
--chris

On 09/30/2014 02:13 PM, Chris J Arges wrote:
> BugLink: http://bugs.launchpad.net/bugs/1375452
> 
> This reverts commit 32f7682bb0f71eaf88388e05af00cbc14edc9bd7.
> Note: this also keeps commit aac35036f7ab00b8cb2a4c99b42cffb33d98aa42.
> 
> Signed-off-by: Chris J Arges <chris.j.arges@canonical.com>
> 
> Conflicts:
> 	drivers/scsi/sd.c
> ---
>  drivers/scsi/sd.c | 20 +++++++-------------
>  1 file changed, 7 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
> index bb77c0e..c0f54d2 100644
> --- a/drivers/scsi/sd.c
> +++ b/drivers/scsi/sd.c
> @@ -830,20 +830,14 @@ static int sd_setup_write_same_cmnd(struct scsi_device *sdp, struct request *rq)
>  	return ret;
>  }
>  
> -static int sd_setup_flush_cmnd(struct scsi_cmnd *cmd)
> +static int scsi_setup_flush_cmnd(struct scsi_device *sdp, struct request *rq)
>  {
> -	struct request *rq = cmd->request;
> -
> -	/* flush requests don't perform I/O, zero the S/G table */
> -	memset(&cmd->sdb, 0, sizeof(cmd->sdb));
> -
> -	cmd->cmnd[0] = SYNCHRONIZE_CACHE;
> -	cmd->cmd_len = 10;
> -	cmd->transfersize = 0;
> -	cmd->allowed = SD_MAX_RETRIES;
> -
>  	rq->timeout = rq->q->rq_timeout * SD_FLUSH_TIMEOUT_MULTIPLIER;
> -	return BLKPREP_OK;
> +	rq->retries = SD_MAX_RETRIES;
> +	rq->cmd[0] = SYNCHRONIZE_CACHE;
> +	rq->cmd_len = 10;
> +
> +	return scsi_setup_blk_pc_cmnd(sdp, rq);
>  }
>  
>  static void sd_uninit_command(struct scsi_cmnd *SCpnt)
> @@ -883,7 +877,7 @@ static int sd_init_command(struct scsi_cmnd *SCpnt)
>  		ret = sd_setup_write_same_cmnd(sdp, rq);
>  		goto out;
>  	} else if (rq->cmd_flags & REQ_FLUSH) {
> -		ret = sd_setup_flush_cmnd(SCpnt);
> +		ret = scsi_setup_flush_cmnd(sdp, rq);
>  		goto out;
>  	}
>  	ret = scsi_setup_fs_cmnd(sdp, rq);
>
Stefan Bader Oct. 1, 2014, 7:19 a.m. UTC | #2
On 30.09.2014 21:13, Chris J Arges wrote:
> BugLink: http://bugs.launchpad.net/bugs/1375452
> 
> This reverts commit 32f7682bb0f71eaf88388e05af00cbc14edc9bd7.
> Note: this also keeps commit aac35036f7ab00b8cb2a4c99b42cffb33d98aa42.

I guess the rework of the function was just pulled in as a pre-requisite to
allow the change about timeout multiplier (which you now kept) apply cleanly.
And either we miss something that allows that rework or upstream has not found
the issue. It appears to be ok but I would hope to see the hyper-v side
verified, too. If that is easy to do...

-Stefan

> 
> Signed-off-by: Chris J Arges <chris.j.arges@canonical.com>
> 
> Conflicts:
> 	drivers/scsi/sd.c
> ---
>  drivers/scsi/sd.c | 20 +++++++-------------
>  1 file changed, 7 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
> index bb77c0e..c0f54d2 100644
> --- a/drivers/scsi/sd.c
> +++ b/drivers/scsi/sd.c
> @@ -830,20 +830,14 @@ static int sd_setup_write_same_cmnd(struct scsi_device *sdp, struct request *rq)
>  	return ret;
>  }
>  
> -static int sd_setup_flush_cmnd(struct scsi_cmnd *cmd)
> +static int scsi_setup_flush_cmnd(struct scsi_device *sdp, struct request *rq)
>  {
> -	struct request *rq = cmd->request;
> -
> -	/* flush requests don't perform I/O, zero the S/G table */
> -	memset(&cmd->sdb, 0, sizeof(cmd->sdb));
> -
> -	cmd->cmnd[0] = SYNCHRONIZE_CACHE;
> -	cmd->cmd_len = 10;
> -	cmd->transfersize = 0;
> -	cmd->allowed = SD_MAX_RETRIES;
> -
>  	rq->timeout = rq->q->rq_timeout * SD_FLUSH_TIMEOUT_MULTIPLIER;
> -	return BLKPREP_OK;
> +	rq->retries = SD_MAX_RETRIES;
> +	rq->cmd[0] = SYNCHRONIZE_CACHE;
> +	rq->cmd_len = 10;
> +
> +	return scsi_setup_blk_pc_cmnd(sdp, rq);
>  }
>  
>  static void sd_uninit_command(struct scsi_cmnd *SCpnt)
> @@ -883,7 +877,7 @@ static int sd_init_command(struct scsi_cmnd *SCpnt)
>  		ret = sd_setup_write_same_cmnd(sdp, rq);
>  		goto out;
>  	} else if (rq->cmd_flags & REQ_FLUSH) {
> -		ret = sd_setup_flush_cmnd(SCpnt);
> +		ret = scsi_setup_flush_cmnd(sdp, rq);
>  		goto out;
>  	}
>  	ret = scsi_setup_fs_cmnd(sdp, rq);
>
Chris J Arges Oct. 1, 2014, 12:16 p.m. UTC | #3
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


On 10/01/2014 02:19 AM, Stefan Bader wrote:
> On 30.09.2014 21:13, Chris J Arges wrote:
>> BugLink: http://bugs.launchpad.net/bugs/1375452
>> 
>> This reverts commit 32f7682bb0f71eaf88388e05af00cbc14edc9bd7. 
>> Note: this also keeps commit
>> aac35036f7ab00b8cb2a4c99b42cffb33d98aa42.
> 
> I guess the rework of the function was just pulled in as a
> pre-requisite to allow the change about timeout multiplier (which
> you now kept) apply cleanly. And either we miss something that
> allows that rework or upstream has not found the issue.

I also tested upstream and it works fine. This prereq patch that was
reverted was also a batch of many patches that change how the
functions are setup and called. So I suspect we'd need to pull in all
those changes for things to work properly. However for the sake of a
stable kernel we most likely just want to pull in the fixes.
- --chris

 It appears to be ok but I would hope to see the hyper-v side
> verified, too. If that is easy to do...
> 
> -Stefan
> 
>> 
>> Signed-off-by: Chris J Arges <chris.j.arges@canonical.com>
>> 
>> Conflicts: drivers/scsi/sd.c --- drivers/scsi/sd.c | 20
>> +++++++------------- 1 file changed, 7 insertions(+), 13
>> deletions(-)
>> 
>> diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index
>> bb77c0e..c0f54d2 100644 --- a/drivers/scsi/sd.c +++
>> b/drivers/scsi/sd.c @@ -830,20 +830,14 @@ static int
>> sd_setup_write_same_cmnd(struct scsi_device *sdp, struct request
>> *rq) return ret; }
>> 
>> -static int sd_setup_flush_cmnd(struct scsi_cmnd *cmd) +static
>> int scsi_setup_flush_cmnd(struct scsi_device *sdp, struct request
>> *rq) { -	struct request *rq = cmd->request; - -	/* flush requests
>> don't perform I/O, zero the S/G table */ -	memset(&cmd->sdb, 0,
>> sizeof(cmd->sdb)); - -	cmd->cmnd[0] = SYNCHRONIZE_CACHE; -
>> cmd->cmd_len = 10; -	cmd->transfersize = 0; -	cmd->allowed =
>> SD_MAX_RETRIES; - rq->timeout = rq->q->rq_timeout *
>> SD_FLUSH_TIMEOUT_MULTIPLIER; -	return BLKPREP_OK; +	rq->retries =
>> SD_MAX_RETRIES; +	rq->cmd[0] = SYNCHRONIZE_CACHE; +	rq->cmd_len =
>> 10; + +	return scsi_setup_blk_pc_cmnd(sdp, rq); }
>> 
>> static void sd_uninit_command(struct scsi_cmnd *SCpnt) @@ -883,7
>> +877,7 @@ static int sd_init_command(struct scsi_cmnd *SCpnt) ret
>> = sd_setup_write_same_cmnd(sdp, rq); goto out; } else if
>> (rq->cmd_flags & REQ_FLUSH) { -		ret =
>> sd_setup_flush_cmnd(SCpnt); +		ret = scsi_setup_flush_cmnd(sdp,
>> rq); goto out; } ret = scsi_setup_fs_cmnd(sdp, rq);
>> 
> 
> 
> 
> 
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQEcBAEBAgAGBQJUK/CzAAoJEPNFAiJniEz2iA8IAIWEeoiuLGXQoFff53qV5+g7
e8BaCI5pU2C7cAF434M4oZS9ZAumuIRKT4CkNoM+UpAt86ooCmZw/2+hL/VBV9qm
GL6JAx0XjHbX1Xe6LvywrhtZ+todWqm+v/3IASemU444dM/OhlQE+Iz2Oc8corLE
/kTftDJ8+7Ml9P6JQ5P+01QUMAvbak7ZlFEl3J9cqH8pHkkXzSesX6JkbJvbPIAI
SZ1ioWxGu63C/m7ww/6kISu9/s4U1AOdFbVVaohtboM+Mtp789BS8M1Ysi043CGv
jUXWaZsUJuYMCJ5ajayO4z2VY7UVyc1LaWSr1AfsAoxYYLaMiEtb9WIU+4snAiY=
=+YlO
-----END PGP SIGNATURE-----
Tim Gardner Oct. 1, 2014, 12:56 p.m. UTC | #4

diff mbox

Patch

diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index bb77c0e..c0f54d2 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -830,20 +830,14 @@  static int sd_setup_write_same_cmnd(struct scsi_device *sdp, struct request *rq)
 	return ret;
 }
 
-static int sd_setup_flush_cmnd(struct scsi_cmnd *cmd)
+static int scsi_setup_flush_cmnd(struct scsi_device *sdp, struct request *rq)
 {
-	struct request *rq = cmd->request;
-
-	/* flush requests don't perform I/O, zero the S/G table */
-	memset(&cmd->sdb, 0, sizeof(cmd->sdb));
-
-	cmd->cmnd[0] = SYNCHRONIZE_CACHE;
-	cmd->cmd_len = 10;
-	cmd->transfersize = 0;
-	cmd->allowed = SD_MAX_RETRIES;
-
 	rq->timeout = rq->q->rq_timeout * SD_FLUSH_TIMEOUT_MULTIPLIER;
-	return BLKPREP_OK;
+	rq->retries = SD_MAX_RETRIES;
+	rq->cmd[0] = SYNCHRONIZE_CACHE;
+	rq->cmd_len = 10;
+
+	return scsi_setup_blk_pc_cmnd(sdp, rq);
 }
 
 static void sd_uninit_command(struct scsi_cmnd *SCpnt)
@@ -883,7 +877,7 @@  static int sd_init_command(struct scsi_cmnd *SCpnt)
 		ret = sd_setup_write_same_cmnd(sdp, rq);
 		goto out;
 	} else if (rq->cmd_flags & REQ_FLUSH) {
-		ret = sd_setup_flush_cmnd(SCpnt);
+		ret = scsi_setup_flush_cmnd(sdp, rq);
 		goto out;
 	}
 	ret = scsi_setup_fs_cmnd(sdp, rq);