stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* FAILED: patch "[PATCH] RAID10: ignore discard error" failed to apply to 4.4-stable tree
@ 2016-11-09  8:58 gregkh
  2016-11-09  9:01 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: gregkh @ 2016-11-09  8:58 UTC (permalink / raw)
  To: shli, sitsofe; +Cc: stable


The patch below does not apply to the 4.4-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable@vger.kernel.org>.

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

>From 579ed34f7b751b8add233cba4cf755258dbdd60a Mon Sep 17 00:00:00 2001
From: Shaohua Li <shli@fb.com>
Date: Thu, 6 Oct 2016 14:13:52 -0700
Subject: [PATCH] RAID10: ignore discard error

This is the counterpart of raid10 fix. If a write error occurs, raid10
will try to rewrite the bio in small chunk size. If the rewrite fails,
raid10 will record the error in bad block. narrow_write_error will
always use WRITE for the bio, but actually it could be a discard. Since
discard bio hasn't payload, write the bio will cause different issues.
But discard error isn't fatal, we can safely ignore it. This is what
this patch does.

This issue should exist since discard is added, but only exposed with
recent arbitrary bio size feature.

Cc: Sitsofe Wheeler <sitsofe@gmail.com>
Cc: stable@vger.kernel.org (v3.6)
Signed-off-by: Shaohua Li <shli@fb.com>

diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index be1a9fca3b2d..39fddda2fef2 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -447,6 +447,9 @@ static void raid10_end_write_request(struct bio *bio)
 	struct r10conf *conf = r10_bio->mddev->private;
 	int slot, repl;
 	struct md_rdev *rdev = NULL;
+	bool discard_error;
+
+	discard_error = bio->bi_error && bio_op(bio) == REQ_OP_DISCARD;
 
 	dev = find_bio_disk(conf, r10_bio, bio, &slot, &repl);
 
@@ -460,7 +463,7 @@ static void raid10_end_write_request(struct bio *bio)
 	/*
 	 * this branch is our 'one mirror IO has finished' event handler:
 	 */
-	if (bio->bi_error) {
+	if (bio->bi_error && !discard_error) {
 		if (repl)
 			/* Never record new bad blocks to replacement,
 			 * just fail it.
@@ -503,7 +506,7 @@ static void raid10_end_write_request(struct bio *bio)
 		if (is_badblock(rdev,
 				r10_bio->devs[slot].addr,
 				r10_bio->sectors,
-				&first_bad, &bad_sectors)) {
+				&first_bad, &bad_sectors) && !discard_error) {
 			bio_put(bio);
 			if (repl)
 				r10_bio->devs[slot].repl_bio = IO_MADE_GOOD;


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: FAILED: patch "[PATCH] RAID10: ignore discard error" failed to apply to 4.4-stable tree
  2016-11-09  8:58 FAILED: patch "[PATCH] RAID10: ignore discard error" failed to apply to 4.4-stable tree gregkh
@ 2016-11-09  9:01 ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2016-11-09  9:01 UTC (permalink / raw)
  To: shli, sitsofe; +Cc: stable

On Wed, Nov 09, 2016 at 09:58:44AM +0100, gregkh@linuxfoundation.org wrote:
> 
> The patch below does not apply to the 4.4-stable tree.
> If someone wants it applied there, or to any other stable or longterm
> tree, then please email the backport, including the original git commit
> id to <stable@vger.kernel.org>.

Well, it applied, but it broke the build, so I dropped it.

thanks,

greg k-h


> ------------------ original commit in Linus's tree ------------------
> 
> >From 579ed34f7b751b8add233cba4cf755258dbdd60a Mon Sep 17 00:00:00 2001
> From: Shaohua Li <shli@fb.com>
> Date: Thu, 6 Oct 2016 14:13:52 -0700
> Subject: [PATCH] RAID10: ignore discard error
> 
> This is the counterpart of raid10 fix. If a write error occurs, raid10
> will try to rewrite the bio in small chunk size. If the rewrite fails,
> raid10 will record the error in bad block. narrow_write_error will
> always use WRITE for the bio, but actually it could be a discard. Since
> discard bio hasn't payload, write the bio will cause different issues.
> But discard error isn't fatal, we can safely ignore it. This is what
> this patch does.
> 
> This issue should exist since discard is added, but only exposed with
> recent arbitrary bio size feature.
> 
> Cc: Sitsofe Wheeler <sitsofe@gmail.com>
> Cc: stable@vger.kernel.org (v3.6)
> Signed-off-by: Shaohua Li <shli@fb.com>
> 
> diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
> index be1a9fca3b2d..39fddda2fef2 100644
> --- a/drivers/md/raid10.c
> +++ b/drivers/md/raid10.c
> @@ -447,6 +447,9 @@ static void raid10_end_write_request(struct bio *bio)
>  	struct r10conf *conf = r10_bio->mddev->private;
>  	int slot, repl;
>  	struct md_rdev *rdev = NULL;
> +	bool discard_error;
> +
> +	discard_error = bio->bi_error && bio_op(bio) == REQ_OP_DISCARD;
>  
>  	dev = find_bio_disk(conf, r10_bio, bio, &slot, &repl);
>  
> @@ -460,7 +463,7 @@ static void raid10_end_write_request(struct bio *bio)
>  	/*
>  	 * this branch is our 'one mirror IO has finished' event handler:
>  	 */
> -	if (bio->bi_error) {
> +	if (bio->bi_error && !discard_error) {
>  		if (repl)
>  			/* Never record new bad blocks to replacement,
>  			 * just fail it.
> @@ -503,7 +506,7 @@ static void raid10_end_write_request(struct bio *bio)
>  		if (is_badblock(rdev,
>  				r10_bio->devs[slot].addr,
>  				r10_bio->sectors,
> -				&first_bad, &bad_sectors)) {
> +				&first_bad, &bad_sectors) && !discard_error) {
>  			bio_put(bio);
>  			if (repl)
>  				r10_bio->devs[slot].repl_bio = IO_MADE_GOOD;
> 
> --
> To unsubscribe from this list: send the line "unsubscribe stable" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-11-09  9:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-09  8:58 FAILED: patch "[PATCH] RAID10: ignore discard error" failed to apply to 4.4-stable tree gregkh
2016-11-09  9:01 ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).