mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Lukáš Czerner" <lczerner@redhat.com>
To: jiangyiwen <jiangyiwen@huawei.com>
Cc: axboe@kernel.dk, linux-kernel@vger.kernel.org,
	dm-devel@redhat.com, martin.petersen@oracle.com,
	xuejiufei@huawei.com, "Qijiang (Joseph,
	Euler)" <joseph.qi@huawei.com>
Subject: Re: [dm-devel] [PATCH] block: do not return -EOPNOTSUPP only when issue a discard request
Date: Wed, 3 Feb 2016 17:19:44 +0100 (CET)	[thread overview]
Message-ID: <alpine.LFD.2.00.1602031717520.30590@localhost.localdomain> (raw)
In-Reply-To: <56B1CE5C.10201@huawei.com>

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1834 bytes --]

On Wed, 3 Feb 2016, jiangyiwen wrote:

> Date: Wed, 3 Feb 2016 17:54:36 +0800
> From: jiangyiwen <jiangyiwen@huawei.com>
> To: axboe@kernel.dk, linux-kernel@vger.kernel.org
> Cc: dm-devel@redhat.com, martin.petersen@oracle.com,
>     Lukáš Czerner <lczerner@redhat.com>, xuejiufei@huawei.com,
>     "Qijiang (Joseph, Euler)" <joseph.qi@huawei.com>
> Subject: [dm-devel] [PATCH] block: do not return -EOPNOTSUPP only when issue a
>      discard request
> 
> commit 8af1954d172a("blkdev: Do not return -EOPNOTSUPP if discard
> is supported") only solve the situation of discard, because When
> applications issue a discard request to device, they can't expect
> deterministic behaviour. However, WRITE SAME should not ignore error
> with EOPNOTSUPP, because if applications issue WRITE SAME requests to
> device, it should return deterministic results to applications
> according to the T10 standard, or else it will cause an inconsistent
> state between upper layer and bottom layer.
> 
> So ignoring error with EOPNOTSUPP only in discard situation.
> 
> Signed-off-by: Yiwen Jiang <jiangyiwen@huawei.com>

Looks good.

Reviewed-by: Lukas Czerner <lczerner@redhat.com>

Thanks!
-Lukas

> ---
>  block/blk-lib.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/block/blk-lib.c b/block/blk-lib.c
> index 9ebf653..e4f02f1 100644
> --- a/block/blk-lib.c
> +++ b/block/blk-lib.c
> @@ -19,7 +19,9 @@ static void bio_batch_end_io(struct bio *bio)
>  {
>  	struct bio_batch *bb = bio->bi_private;
> 
> -	if (bio->bi_error && bio->bi_error != -EOPNOTSUPP)
> +	/* ignore -EOPNOTSUPP only when issue a discard request */
> +	if (bio->bi_error && (!(bio->bi_rw & REQ_DISCARD) ||
> +			(bio->bi_error != -EOPNOTSUPP)))
>  		bb->error = bio->bi_error;
>  	if (atomic_dec_and_test(&bb->done))
>  		complete(bb->wait);
> 

  reply	other threads:[~2016-02-03 16:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-03  9:54 jiangyiwen
2016-02-03 16:19 ` Lukáš Czerner [this message]
2016-02-03 22:00 ` Martin K. Petersen

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=alpine.LFD.2.00.1602031717520.30590@localhost.localdomain \
    --to=lczerner@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=dm-devel@redhat.com \
    --cc=jiangyiwen@huawei.com \
    --cc=joseph.qi@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=xuejiufei@huawei.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®