All of lore.kernel.org
 help / color / mirror / Atom feed
From: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
To: James.Bottomley@suse.de
Cc: hch@lst.de, tj@kernel.org, jaxboe@fusionio.com,
	linux-fsdevel@vger.kernel.org, linux-scsi@vger.kernel.org,
	hare@suse.de
Subject: Re: [RFC PATCHSET block#for-2.6.36-post] block: convert to REQ_FLUSH/FUA
Date: Fri, 20 Aug 2010 00:37:14 +0900	[thread overview]
Message-ID: <20100820003348C.fujita.tomonori@lab.ntt.co.jp> (raw)
In-Reply-To: <1282141587.3035.6.camel@mulgrave.site>

On Wed, 18 Aug 2010 09:26:27 -0500
James Bottomley <James.Bottomley@suse.de> wrote:

> On Wed, 2010-08-18 at 11:53 +0200, Christoph Hellwig wrote:
> > On Mon, Aug 16, 2010 at 06:51:58PM +0200, Tejun Heo wrote:
> > > * scsi_error.c for some reason tests REQ_HARDBARRIER.  I think this
> > >   part can be dropped altogether but am not sure.
> > 
> > That was introduced by commit 77a4229719e511a0d38d9c355317ae1469adeb54
> > 
> > [SCSI] Retry commands with UNIT_ATTENTION sense codes to fix ext3/ext4 I/O error
> > 
> > which just went in this May.  Given that we now send barriers and
> > discards as FS requests I think it should be reverted, preferably
> > already during this cycle, in which the patches to send these requests
> > as FS type were added.
> 
> Right ... it was the quickest hack to get around the fact that we expect
> the caller to do error handling for BLOCK_PC requests and none of the
> block discard and barrier code expects to do this.
> 
> Once they all go as REQ_TYPE_FS, this code can be removed.

I think that I reverted it with the discard and flush conversion. No
idea why the code exists in the current git.


commit e96f6abe02fc3320d669985443e8c68ff8e83294
Author: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Date:   Fri Jul 9 09:38:26 2010 +0900

scsi-ml uses REQ_TYPE_BLOCK_PC for flush requests from file
systems. The definition of REQ_TYPE_BLOCK_PC is that we don't retry
requests even when we can (e.g. UNIT ATTENTION) and we send the
response to the callers (then the callers can decide what they want).
We need a workaround such as the commit
77a4229719e511a0d38d9c355317ae1469adeb54 to retry BLOCK_PC flush
requests. We will need the similar workaround for discard requests too
since SCSI-ml handle them as BLOCK_PC internally.

This uses REQ_TYPE_FS for flush requests from file systems instead of
REQ_TYPE_BLOCK_PC.

scsi-ml retries only REQ_TYPE_FS requests that have data to
transfer when we can retry them (e.g. UNIT_ATTENTION). However, we
also need to retry REQ_TYPE_FS requests without data because the
callers don't.

This also changes scsi_check_sense() to retry all the REQ_TYPE_FS
requests when appropriate. Thanks to scsi_noretry_cmd(),
REQ_TYPE_BLOCK_PC requests don't be retried as before.

Note that basically, this reverts the commit
77a4229719e511a0d38d9c355317ae1469adeb54 since now we use REQ_TYPE_FS
for flush requests.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
---
 drivers/scsi/scsi_error.c |   19 ++++---------------
 drivers/scsi/sd.c         |    2 --
 2 files changed, 4 insertions(+), 17 deletions(-)

diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index 1b88af8..2768bf6 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -307,20 +307,7 @@ static int scsi_check_sense(struct scsi_cmnd *scmd)
 		    (sshdr.asc == 0x04) && (sshdr.ascq == 0x02))
 			return FAILED;
 
-		if (scmd->request->cmd_flags & REQ_HARDBARRIER)
-			/*
-			 * barrier requests should always retry on UA
-			 * otherwise block will get a spurious error
-			 */
-			return NEEDS_RETRY;
-		else
-			/*
-			 * for normal (non barrier) commands, pass the
-			 * UA upwards for a determination in the
-			 * completion functions
-			 */
-			return SUCCESS;
-
+		return NEEDS_RETRY;
 		/* these three are not supported */
 	case COPY_ABORTED:
 	case VOLUME_OVERFLOW:
@@ -1336,7 +1323,9 @@ int scsi_noretry_cmd(struct scsi_cmnd *scmd)
 		 * assume caller has checked sense and determinted
 		 * the check condition was retryable.
 		 */
-		return (scmd->request->cmd_flags & REQ_FAILFAST_DEV);
+		if (scmd->request->cmd_flags & REQ_FAILFAST_DEV ||
+		    scmd->request->cmd_type == REQ_TYPE_BLOCK_PC)
+			return 1;
 	}
 
 	return 0;
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index e63b85a..108daea 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -477,8 +477,6 @@ static int scsi_setup_discard_cmnd(struct scsi_device *sdp, struct request *rq)
 
 static int scsi_setup_flush_cmnd(struct scsi_device *sdp, struct request *rq)
 {
-	/* for now, we use REQ_TYPE_BLOCK_PC. */
-	rq->cmd_type = REQ_TYPE_BLOCK_PC;
 	rq->timeout = SD_TIMEOUT;
 	rq->retries = SD_MAX_RETRIES;
 	rq->cmd[0] = SYNCHRONIZE_CACHE;
-- 
1.6.5


  parent reply	other threads:[~2010-08-19 15:37 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-16 16:51 [RFC PATCHSET block#for-2.6.36-post] block: convert to REQ_FLUSH/FUA Tejun Heo
2010-08-16 16:51 ` Tejun Heo
2010-08-16 16:51 ` [PATCH 1/5] block/loop: implement REQ_FLUSH/FUA support Tejun Heo
2010-08-16 16:51   ` Tejun Heo
2010-08-16 16:51 ` Tejun Heo
2010-08-16 16:52 ` [PATCH 2/5] virtio_blk: " Tejun Heo
2010-08-16 16:52 ` Tejun Heo
2010-08-16 16:52   ` Tejun Heo
2010-08-16 18:33   ` Christoph Hellwig
2010-08-17  8:17     ` Tejun Heo
2010-08-17 13:23       ` Christoph Hellwig
2010-08-17 16:22         ` Tejun Heo
2010-08-18 10:22         ` Rusty Russell
2010-08-17  1:16   ` Rusty Russell
2010-08-17  8:18     ` Tejun Heo
2010-08-19 15:14   ` [PATCH 2/5 UPDATED] virtio_blk: drop REQ_HARDBARRIER support Tejun Heo
2010-08-16 16:52 ` [PATCH 3/5] lguest: replace VIRTIO_F_BARRIER support with VIRTIO_F_FLUSH/FUA support Tejun Heo
2010-08-16 16:52 ` Tejun Heo
2010-08-16 16:52   ` Tejun Heo
2010-08-19 15:15   ` [PATCH 3/5] lguest: replace VIRTIO_F_BARRIER support with VIRTIO_F_FLUSH support Tejun Heo
2010-08-16 16:52 ` [PATCH 4/5] md: implment REQ_FLUSH/FUA support Tejun Heo
2010-08-16 16:52 ` Tejun Heo
2010-08-16 16:52   ` Tejun Heo
2010-08-24  5:41   ` Neil Brown
2010-08-25 11:22     ` [PATCH UPDATED " Tejun Heo
2010-08-25 11:42       ` Neil Brown
2010-08-16 16:52 ` [PATCH 5/5] dm: implement " Tejun Heo
2010-08-16 16:52   ` Tejun Heo
2010-08-16 19:02   ` Mike Snitzer
2010-08-17  9:33     ` Tejun Heo
2010-08-17 13:13       ` Christoph Hellwig
2010-08-17 14:07       ` Mike Snitzer
2010-08-17 16:51         ` Tejun Heo
2010-08-17 18:21           ` Mike Snitzer
2010-08-17 18:21             ` Mike Snitzer
2010-08-18  6:32             ` Tejun Heo
2010-08-19 10:32           ` Kiyoshi Ueda
2010-08-19 15:45             ` Tejun Heo
2010-08-16 16:52 ` Tejun Heo
2010-08-18  9:53 ` [RFC PATCHSET block#for-2.6.36-post] block: convert to REQ_FLUSH/FUA Christoph Hellwig
2010-08-18 14:26   ` James Bottomley
2010-08-18 14:33     ` Christoph Hellwig
2010-08-19 15:37     ` FUJITA Tomonori [this message]
2010-08-19 15:41       ` Christoph Hellwig
2010-08-19 15:56         ` FUJITA Tomonori
2010-08-23 16:47 ` Christoph Hellwig
2010-08-24  9:51   ` Lars Ellenberg
2010-08-24 15:45   ` Philipp Reisner
     [not found]     ` <20101022083511.GA7853@lst.de>
2010-10-23 11:18       ` [GIT PULL] convert DRBD " Philipp Reisner
2010-10-23 11:21         ` Christoph Hellwig
2010-10-23 16:48         ` Jens Axboe
2010-10-23 16:59           ` [PATCH] block: remove REQ_HARDBARRIER Christoph Hellwig
2010-10-23 17:17             ` Matthew Wilcox
2010-10-23 19:07             ` Jens Axboe
2010-10-24 11:58               ` Christoph Hellwig
2010-11-10 13:42               ` Christoph Hellwig
2010-11-10 13:59                 ` Jens Axboe
2010-10-23 19:08             ` Jens Axboe
2010-10-25  8:54             ` Tejun Heo
  -- strict thread matches above, loose matches on Subject: below --
2010-08-16 16:51 [RFC PATCHSET block#for-2.6.36-post] block: convert to REQ_FLUSH/FUA Tejun Heo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100820003348C.fujita.tomonori@lab.ntt.co.jp \
    --to=fujita.tomonori@lab.ntt.co.jp \
    --cc=James.Bottomley@suse.de \
    --cc=hare@suse.de \
    --cc=hch@lst.de \
    --cc=jaxboe@fusionio.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.