stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Ethan Wilson <ethan.wilson@shiftmail.org>,
	NeilBrown <neilb@suse.de>
Subject: [PATCH 3.13 09/10] md/raid5: fix long-standing problem with bitmap handling on write failure.
Date: Mon, 27 Jan 2014 12:17:12 -0800	[thread overview]
Message-ID: <20140127201536.003082770@linuxfoundation.org> (raw)
In-Reply-To: <20140127201535.350372282@linuxfoundation.org>

3.13-stable review patch.  If anyone has any objections, please let me know.

------------------

From: NeilBrown <neilb@suse.de>

commit 9f97e4b128d2ea90a5f5063ea0ee3b0911f4c669 upstream.

Before a write starts we set a bit in the write-intent bitmap.
When the write completes we clear that bit if the write was successful
to all devices.  However if the write wasn't fully successful we
should not clear the bit.  If the faulty drive is subsequently
re-added, the fact that the bit is still set ensure that we will
re-write the data that is missing.

This logic is mediated by the STRIPE_DEGRADED flag - we only clear the
bitmap bit when this flag is not set.
Currently we correctly set the flag if a write starts when some
devices are failed or missing.  But we do *not* set the flag if some
device failed during the write attempt.
This is wrong and can result in clearing the bit inappropriately.

So: set the flag when a write fails.

This bug has been present since bitmaps were introduces, so the fix is
suitable for any -stable kernel.

Reported-by: Ethan Wilson <ethan.wilson@shiftmail.org>
Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/md/raid5.c |    1 +
 1 file changed, 1 insertion(+)

--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -2111,6 +2111,7 @@ static void raid5_end_write_request(stru
 			set_bit(R5_MadeGoodRepl, &sh->dev[i].flags);
 	} else {
 		if (!uptodate) {
+			set_bit(STRIPE_DEGRADED, &sh->state);
 			set_bit(WriteErrorSeen, &rdev->flags);
 			set_bit(R5_WriteError, &sh->dev[i].flags);
 			if (!test_and_set_bit(WantReplacement, &rdev->flags))



  parent reply	other threads:[~2014-01-27 20:17 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-27 20:17 [PATCH 3.13 00/10] 3.13.1-stable review Greg Kroah-Hartman
2014-01-27 20:17 ` [PATCH 3.13 01/10] GFS2: Increase i_writecount during gfs2_setattr_chown Greg Kroah-Hartman
2014-01-27 20:17 ` [PATCH 3.13 02/10] staging: comedi: fix result of memdup_user for user chanlist Greg Kroah-Hartman
2014-01-27 20:17 ` [PATCH 3.13 03/10] staging: comedi: addi_apci_1032: fix subdevice type/flags bug Greg Kroah-Hartman
2014-01-27 20:17 ` [PATCH 3.13 04/10] staging: comedi: adl_pci9111: fix incorrect irq passed to request_irq() Greg Kroah-Hartman
2014-01-27 20:17 ` [PATCH 3.13 05/10] mm: Make {,set}page_address() static inline if WANT_PAGE_VIRTUAL Greg Kroah-Hartman
2014-01-27 20:17 ` [PATCH 3.13 06/10] serial: amba-pl011: use port lock to guard control register access Greg Kroah-Hartman
2014-01-27 20:17 ` [PATCH 3.13 07/10] extcon: gpio: Request gpio pin before modifying its state Greg Kroah-Hartman
2014-01-27 20:17 ` [PATCH 3.13 08/10] ALSA: hda - Explicitly keep codec powered up in hdmi_present_sense Greg Kroah-Hartman
2014-01-27 20:17 ` Greg Kroah-Hartman [this message]
2014-01-27 20:17 ` [PATCH 3.13 10/10] md/raid5: close recently introduced race in stripe_head management Greg Kroah-Hartman
2014-01-28 17:41 ` [PATCH 3.13 00/10] 3.13.1-stable review Shuah Khan
2014-01-29 13:05   ` Greg Kroah-Hartman

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=20140127201536.003082770@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=ethan.wilson@shiftmail.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=neilb@suse.de \
    --cc=stable@vger.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 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).