From: Linus Torvalds <torvalds@linux-foundation.org>
To: Tejun Heo <tj@kernel.org>
Cc: Jens Axboe <jaxboe@fusionio.com>, Christoph Hellwig <hch@lst.de>,
Neil Brown <neilb@suse.de>,
"David S. Miller" <davem@davemloft.net>,
linux-kernel@vger.kernel.org, linux-ide@vger.kernel.org,
kay.sievers@vrfy.org
Subject: Re: [PATCH 1/2] block: don't propagate unlisted DISK_EVENTs to userland
Date: Thu, 21 Apr 2011 10:25:35 -0700 [thread overview]
Message-ID: <BANLkTinwPt=aRSsh_Ppb8hLOaURh6mL2GQ@mail.gmail.com> (raw)
In-Reply-To: <20110421170826.GC15988@htj.dyndns.org>
Should I take these as patches, or through Jens/David/Who?
I'll happily take them as patches, but I'd also like to hear
confirmation from the people who saw the lock-up that it's gone now..
Linus
On Thu, Apr 21, 2011 at 10:08 AM, Tejun Heo <tj@kernel.org> wrote:
> DISK_EVENT_MEDIA_CHANGE is used for both userland visible event and
> internal event for revalidation of removeable devices. Some legacy
> drivers don't implement proper event detection and continuously
> generate events under certain circumstances. For example, ide-cd
> generates media changed continuously if there's no media in the drive,
> which can lead to infinite loop of events jumping back and forth
> between the driver and userland event handler.
>
> This patch updates disk event infrastructure such that it never
> propagates events not listed in disk->events to userland. Those
> events are processed the same for internal purposes but uevent
> generation is suppressed.
>
> This also ensures that userland only gets events which are advertised
> in the @events sysfs node lowering risk of confusion.
>
> Signed-off-by: Tejun Heo <tj@kernel.org>
> ---
> These two patches fix infinite MEDIA_CHANGE events problem reported w/
> ide-cd. I tried an alternate patch to implement proper check_events()
> for ide-cd but given the deprecated status of ide and the existence of
> fallback userland event polling, this minimal approach seems better.
>
> Thank you.
>
> block/genhd.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> Index: work/block/genhd.c
> ===================================================================
> --- work.orig/block/genhd.c
> +++ work/block/genhd.c
> @@ -1588,9 +1588,13 @@ static void disk_events_workfn(struct wo
>
> spin_unlock_irq(&ev->lock);
>
> - /* tell userland about new events */
> + /*
> + * Tell userland about new events. Only the events listed in
> + * @disk->events are reported. Unlisted events are processed the
> + * same internally but never get reported to userland.
> + */
> for (i = 0; i < ARRAY_SIZE(disk_uevents); i++)
> - if (events & (1 << i))
> + if (events & disk->events & (1 << i))
> envp[nr_events++] = disk_uevents[i];
>
> if (nr_events)
>
next prev parent reply other threads:[~2011-04-21 17:26 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-21 17:08 [PATCH 1/2] block: don't propagate unlisted DISK_EVENTs to userland Tejun Heo
2011-04-21 17:09 ` [PATCH 2/2] ide: unexport DISK_EVENT_MEDIA_CHANGE for ide-gd and ide-cd Tejun Heo
2011-04-21 17:14 ` David Miller
2011-04-21 17:25 ` Linus Torvalds [this message]
2011-04-21 17:27 ` [PATCH 1/2] block: don't propagate unlisted DISK_EVENTs to userland David Miller
2011-04-21 17:31 ` Jens Axboe
2011-04-21 17:46 ` Jens Axboe
2011-04-21 18:02 ` Shaun Ruffell
2011-04-21 18:10 ` Jens Axboe
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='BANLkTinwPt=aRSsh_Ppb8hLOaURh6mL2GQ@mail.gmail.com' \
--to=torvalds@linux-foundation.org \
--cc=davem@davemloft.net \
--cc=hch@lst.de \
--cc=jaxboe@fusionio.com \
--cc=kay.sievers@vrfy.org \
--cc=linux-ide@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=neilb@suse.de \
--cc=tj@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).