From: NeilBrown <neilb@suse.de>
To: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
Cc: linux-raid@vger.kernel.org, pawel.baldysiak@intel.com
Subject: Re: [PATCH RESEND] Monitor: fix for regression with container devices
Date: Wed, 11 Feb 2015 15:38:14 +1100 [thread overview]
Message-ID: <20150211153814.333cb17a@notabene.brown> (raw)
In-Reply-To: <1423476830-15635-1-git-send-email-artur.paszkiewicz@intel.com>
[-- Attachment #1: Type: text/plain, Size: 2426 bytes --]
On Mon, 9 Feb 2015 11:13:50 +0100 Artur Paszkiewicz
<artur.paszkiewicz@intel.com> wrote:
> This patch fixes 2 problems introduced by commit 9a518d8: not closing a
> file descriptor and ignoring container devices. Array state is always
> "inactive" for containers, so we make sure that the device is not a
> container by reading also the "level" sysfs entry.
>
> Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
> Reviewed-by: Pawel Baldysiak <pawel.baldysiak@intel.com>
> ---
> Monitor.c | 14 ++++++++++----
> 1 file changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/Monitor.c b/Monitor.c
> index 971d2ec..66d67ba 100644
> --- a/Monitor.c
> +++ b/Monitor.c
> @@ -483,11 +483,17 @@ static int check_array(struct state *st, struct mdstat_ent *mdstat,
> strncmp(buf,"inact",5) == 0) {
> if (fd >= 0)
> close(fd);
> - if (!st->err)
> - alert("DeviceDisappeared", dev, NULL, ainfo);
> - st->err++;
> - return 0;
> + fd = sysfs_open(st->devnm, NULL, "level");
> + if (fd < 0 || read(fd, buf, 10) != 0) {
> + if (fd >= 0)
> + close(fd);
> + if (!st->err)
> + alert("DeviceDisappeared", dev, NULL, ainfo);
> + st->err++;
> + return 0;
> + }
> }
> + close(fd);
> }
> fd = open(dev, O_RDONLY);
> if (fd < 0) {
Thanks for the patch.
I don't think I agree with the logic of using 'level' though.
For the sort of arrays that I need to ignore here, 'level' will be empty.
It would make sense to test 'metadata' though. If that starts 'external:',
then we don't want to ignore the array.
Could you confirm that this works please?
Thanks,
NeilBrown
diff --git a/Monitor.c b/Monitor.c
index 971d2ecbea72..6e085cb24993 100644
--- a/Monitor.c
+++ b/Monitor.c
@@ -483,11 +483,18 @@ static int check_array(struct state *st, struct mdstat_ent *mdstat,
strncmp(buf,"inact",5) == 0) {
if (fd >= 0)
close(fd);
- if (!st->err)
- alert("DeviceDisappeared", dev, NULL, ainfo);
- st->err++;
- return 0;
+ fd = sysfs_open(st->devnm, NULL, "metadata");
+ if (fd < 0 || read(fd, buf, 9) != 9 ||
+ strncmp(buf, "external:", 9) != 0) {
+ if (fd >= 0)
+ close(fd);
+ if (!st->err)
+ alert("DeviceDisappeared", dev, NULL, ainfo);
+ st->err++;
+ return 0;
+ }
}
+ close(fd);
}
fd = open(dev, O_RDONLY);
if (fd < 0) {
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 811 bytes --]
next prev parent reply other threads:[~2015-02-11 4:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-09 10:13 [PATCH RESEND] Monitor: fix for regression with container devices Artur Paszkiewicz
2015-02-11 4:38 ` NeilBrown [this message]
2015-02-13 15:29 ` Artur Paszkiewicz
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=20150211153814.333cb17a@notabene.brown \
--to=neilb@suse.de \
--cc=artur.paszkiewicz@intel.com \
--cc=linux-raid@vger.kernel.org \
--cc=pawel.baldysiak@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.