From: NeilBrown <neilb@suse.de>
To: Lukasz Dorau <lukasz.dorau@intel.com>
Cc: linux-raid@vger.kernel.org, dan.j.williams@intel.com,
ed.ciechanowski@intel.com
Subject: Re: [PATCH] imsm: fix: correct checking volume's degradation
Date: Tue, 29 May 2012 09:35:58 +1000 [thread overview]
Message-ID: <20120529093558.571e8d95@notabene.brown> (raw)
In-Reply-To: <20120525130641.31750.43414.stgit@gklab-128-085.igk.intel.com>
[-- Attachment #1: Type: text/plain, Size: 1702 bytes --]
On Fri, 25 May 2012 15:06:41 +0200 Lukasz Dorau <lukasz.dorau@intel.com>
wrote:
> We do not check the return value of sysfs_get_ll() now. It is wrong.
> If reading of the sysfs "degraded" key does not succeed,
> the "new_degraded" variable will not be initiated
> and accidentally it can have the value of "degraded" variable.
> In that case the change of degradation will not be checked.
>
> It happens if mdadm is compiled with gcc's "-fstack-protector" option
> when one tries to stop a volume under reshape (e.g. OLCE).
> Reshape seems to be finished then (metadata is in normal/clean state)
> but it is not finished, it is broken and data are corrupted.
>
> Now we always check the return value of sysfs_get_ll().
> Even if reading of the sysfs "degraded" key does not succeed
> (rv == -1) the change of degradation will be checked.
>
> Signed-off-by: Lukasz Dorau <lukasz.dorau@intel.com>
> ---
> super-intel.c | 6 ++++--
> 1 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/super-intel.c b/super-intel.c
> index 6c87e20..07ab9ae 100644
> --- a/super-intel.c
> +++ b/super-intel.c
> @@ -10370,8 +10370,10 @@ int check_degradation_change(struct mdinfo *info,
> int degraded)
> {
> unsigned long long new_degraded;
> - sysfs_get_ll(info, NULL, "degraded", &new_degraded);
> - if (new_degraded != (unsigned long long)degraded) {
> + int rv;
> +
> + rv = sysfs_get_ll(info, NULL, "degraded", &new_degraded);
> + if ((rv == -1) || (new_degraded != (unsigned long long)degraded)) {
> /* check each device to ensure it is still working */
> struct mdinfo *sd;
> new_degraded = 0;
applied, thanks.
NeilBrown
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
prev parent reply other threads:[~2012-05-28 23:35 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-25 13:06 [PATCH] imsm: fix: correct checking volume's degradation Lukasz Dorau
2012-05-28 23:35 ` NeilBrown [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=20120529093558.571e8d95@notabene.brown \
--to=neilb@suse.de \
--cc=dan.j.williams@intel.com \
--cc=ed.ciechanowski@intel.com \
--cc=linux-raid@vger.kernel.org \
--cc=lukasz.dorau@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).