linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jes Sorensen <Jes.Sorensen@redhat.com>
To: Sebastian Parschauer <sebastian.riemer@profitbricks.com>
Cc: linux-raid <linux-raid@vger.kernel.org>,
	Shaohua Li <shli@kernel.org>,
	Brassow Jonathan <jbrassow@redhat.com>,
	Artur Paszkiewicz <artur.paszkiewicz@intel.com>,
	NeilBrown <neilb@suse.com>,
	systemd-devel@freedesktop.org
Subject: Re: [PATCH 2/2] Manage: Inform udev about device removal when stopping
Date: Tue, 16 Feb 2016 12:41:56 -0500	[thread overview]
Message-ID: <wrfjio1oeemz.fsf@redhat.com> (raw)
In-Reply-To: <1455633877-4813-3-git-send-email-sebastian.riemer@profitbricks.com> (Sebastian Parschauer's message of "Tue, 16 Feb 2016 15:44:37 +0100")

Sebastian Parschauer <sebastian.riemer@profitbricks.com> writes:
> When stopping an MD device, then its device node /dev/mdX may still
> exist afterwards or it is recreated by udev. The next open() call
> can lead to creation of an inoperable MD device. The reason for
> this is that a change event (KOBJ_CHANGE) is announced to udev.
> So announce a removal event (KOBJ_REMOVE) to udev instead.
>
> This also overrides the change event sent by the kernel.
>
> Signed-off-by: Sebastian Parschauer <sebastian.riemer@profitbricks.com>
> ---
>  Manage.c |    6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/Manage.c b/Manage.c
> index 7e1b94b..bc89764 100644
> --- a/Manage.c
> +++ b/Manage.c
> @@ -494,13 +494,13 @@ done:
>  		goto out;
>  	}
>  	/* prior to 2.6.28, KOBJ_CHANGE was not sent when an md array
> -	 * was stopped, so We'll do it here just to be sure.  Drop any
> -	 * partitions as well...
> +	 * was stopped, it should be KOBJ_REMOVE instead, so we set the
> +	 * remove event here just to be sure. Drop any partitions as well...
>  	 */
>  	if (fd >= 0)
>  		ioctl(fd, BLKRRPART, 0);
>  	if (mdi)
> -		sysfs_uevent(mdi, "change");
> +		sysfs_uevent(mdi, "remove");

I am a little concerned about this change. You assume the kernel and
mdadm will be updated in sync, which is unlikely to happen. I believe
you need to match the kernel version and send the corresponding event
currectly for this to work correctly?

Jes

  reply	other threads:[~2016-02-16 17:41 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-16 14:44 [PATCH 0/2] md/mdadm: Inform udev about device removal when stopping Sebastian Parschauer
2016-02-16 14:44 ` [PATCH 1/2] md: " Sebastian Parschauer
2016-02-16 20:05   ` Shaohua Li
2016-02-16 20:43     ` NeilBrown
2016-02-17 11:24       ` Sebastian Parschauer
2016-02-17 22:57         ` NeilBrown
2016-02-16 14:44 ` [PATCH 2/2] Manage: " Sebastian Parschauer
2016-02-16 17:41   ` Jes Sorensen [this message]
2016-02-16 18:03     ` Sebastian Parschauer
2016-02-16 18:40       ` Hannes Reinecke
2016-02-16 18:52         ` Jes Sorensen
2016-02-16 20:46           ` NeilBrown
2016-02-16 22:02             ` Jes Sorensen
2016-02-17 10:31               ` Sebastian Parschauer
2016-02-17  7:03             ` Hannes Reinecke
2016-02-17 13:06               ` Jes Sorensen
2016-02-17 13:16                 ` Sebastian Parschauer
2016-02-17 17:33                   ` Jes Sorensen
  -- strict thread matches above, loose matches on Subject: below --
2016-02-16 15:47 Hannes Reinecke
2016-02-16 16:58 ` Sebastian Parschauer

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=wrfjio1oeemz.fsf@redhat.com \
    --to=jes.sorensen@redhat.com \
    --cc=artur.paszkiewicz@intel.com \
    --cc=jbrassow@redhat.com \
    --cc=linux-raid@vger.kernel.org \
    --cc=neilb@suse.com \
    --cc=sebastian.riemer@profitbricks.com \
    --cc=shli@kernel.org \
    --cc=systemd-devel@freedesktop.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).