From: Jens Axboe <axboe@kernel.dk>
To: Tahsin Erdogan <tahsin@google.com>, linux-block@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] block: do not allow updates through sysfs until registration completes
Date: Wed, 15 Feb 2017 08:41:13 -0700 [thread overview]
Message-ID: <95afa7b1-86c2-34ff-3870-8a32412a3a45@kernel.dk> (raw)
In-Reply-To: <20170215032738.22689-1-tahsin@google.com>
On 02/14/2017 08:27 PM, Tahsin Erdogan wrote:
> When a new disk shows up, sysfs queue directory is created before elevator
> is registered. This allows a user to attempt a scheduler switch even though
> the initial registration hasn't completed yet.
>
> In one scenario, blk_register_queue() calls elv_register_queue() and
> right before cfq_registered_queue() is called, another process executes
> elevator_switch() and replaces q->elevator with deadline scheduler. When
> cfq_registered_queue() executes it interprets e->elevator_data as struct
> cfq_data even though it is actually struct deadline_data.
>
> Grab q->sysfs_lock in blk_register_queue() to synchronize with sysfs
> callers.
Thanks, this looks good to me - both the grabbing of the lock, and
the ordering wrt UDEV_ADD. Queued up.
--
Jens Axboe
prev parent reply other threads:[~2017-02-15 15:41 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-15 3:27 [PATCH] block: do not allow updates through sysfs until registration completes Tahsin Erdogan
2017-02-15 15:41 ` Jens Axboe [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=95afa7b1-86c2-34ff-3870-8a32412a3a45@kernel.dk \
--to=axboe@kernel.dk \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tahsin@google.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).