From: Shaohua Li <shli@kernel.org>
To: Tomasz Majchrzak <tomasz.majchrzak@intel.com>
Cc: linux-raid@vger.kernel.org, aleksey.obitotskiy@intel.com,
pawel.baldysiak@intel.com, artur.paszkiewicz@intel.com,
maksymilian.kunt@intel.com, mariusz.dabrowski@intel.com
Subject: Re: [PATCH 2/2] md: unblock array if bad blocks have been acknowledged
Date: Mon, 17 Oct 2016 17:24:46 -0700 [thread overview]
Message-ID: <20161018002446.GB106864@kernel.org> (raw)
In-Reply-To: <1476714580-15167-1-git-send-email-tomasz.majchrzak@intel.com>
On Mon, Oct 17, 2016 at 04:29:40PM +0200, Tomasz Majchrzak wrote:
> Once external metadata handler acknowledges all bad blocks (by writing
> to rdev 'bad_blocks' sysfs file), it requests to unblock the array.
> Check if all bad blocks are actually acknowledged as there might be a
> race if new bad blocks are notified at the same time. If all bad blocks
> are acknowledged, just unblock the array and continue. If not, ignore
> the request to unblock (do not fail an array). External metadata handler
> is expected to either process remaining bad blocks and try to unblock
> again or remove bad block support for a disk (which will cause disk to
> fail as in no-support case).
>
> Signed-off-by: Tomasz Majchrzak <tomasz.majchrzak@intel.com>
> Reviewed-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
> ---
> drivers/md/md.c | 43 ++++++++++++++++++++++++++++++++++++-------
> 1 file changed, 36 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/md/md.c b/drivers/md/md.c
> index f375d1b..81b4c33 100644
> --- a/drivers/md/md.c
> +++ b/drivers/md/md.c
> @@ -2629,19 +2629,48 @@ state_store(struct md_rdev *rdev, const char *buf, size_t len)
> set_bit(Blocked, &rdev->flags);
> err = 0;
> } else if (cmd_match(buf, "-blocked")) {
> - if (!test_bit(Faulty, &rdev->flags) &&
> + int unblock = 1;
> +
> + if ((test_bit(ExternalBbl, &rdev->flags) &&
> + rdev->badblocks.changed)) {
> + struct badblocks *bb = &rdev->badblocks;
> + int ack = 1;
> +
> + write_seqlock_irq(&bb->lock);
> + if (bb->unacked_exist) {
> + u64 *p = bb->page;
> + int i;
> +
> + for (i = 0; i < bb->count ; i++) {
> + if (!BB_ACK(p[i])) {
> + ack = 0;
> + break;
> + }
> + }
> + if (ack) {
> + bb->unacked_exist = 0;
> + bb->changed = 0;
> + }
> + }
> + write_sequnlock_irq(&bb->lock);
> + }
shouldn't this part be moved to badblocks.c?
Thanks,
Shaohua
prev parent reply other threads:[~2016-10-18 0:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-17 14:29 [PATCH 2/2] md: unblock array if bad blocks have been acknowledged Tomasz Majchrzak
2016-10-18 0:24 ` Shaohua Li [this message]
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=20161018002446.GB106864@kernel.org \
--to=shli@kernel.org \
--cc=aleksey.obitotskiy@intel.com \
--cc=artur.paszkiewicz@intel.com \
--cc=linux-raid@vger.kernel.org \
--cc=maksymilian.kunt@intel.com \
--cc=mariusz.dabrowski@intel.com \
--cc=pawel.baldysiak@intel.com \
--cc=tomasz.majchrzak@intel.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;
as well as URLs for NNTP newsgroup(s).