From: Christoph Hellwig <hch@infradead.org>
To: Uday Shankar <ushankar@purestorage.com>
Cc: linux-block@vger.kernel.org, Jens Axboe <axboe@kernel.dk>
Subject: Re: [PATCH] block: emit disk ro uevent in device_add_disk()
Date: Fri, 4 Mar 2022 08:08:54 -0800 [thread overview]
Message-ID: <YiI5ls2Wuaocacc7@infradead.org> (raw)
In-Reply-To: <20220303175219.272938-1-ushankar@purestorage.com>
On Thu, Mar 03, 2022 at 10:52:20AM -0700, Uday Shankar wrote:
> Userspace learns of disk ro state via the change event emitted by
> set_disk_ro_uevent. This function has cyclic dependency with
> device_add_disk: the latter performs kobject initialization that is
> necessary for uevents to go through, but we want to set up properties
> like ro state before exposing the disk to userspace via device_add_disk.
>
> The usual workaround is to call set_disk_ro both before and after
> device_add_disk; the purpose of the "after" call is just to emit the
> uevent. Moreover, because set_disk_ro only emits a uevent when the ro
> state changes, set_disk_ro needs to be called twice in the "after"
> position to ensure that the ro state flips. See drivers/scsi/sd.c for an
> example of this pattern.
I don't see any such pattern there. I also don't see what the point
is. KOBJ_CHANGE uevents tell about a change in device state. But
if a device is marked read-only before disk_add that read-only
state is already visible by the time the device is added and thus
shows up in sysfs, and we do not need an extra notification.
next prev parent reply other threads:[~2022-03-04 16:08 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-03 17:52 [PATCH] block: emit disk ro uevent in device_add_disk() Uday Shankar
2022-03-04 16:08 ` Christoph Hellwig [this message]
2022-03-07 6:39 ` Hannes Reinecke
2022-03-07 20:54 ` Uday Shankar
2022-03-08 6:42 ` Hannes Reinecke
2022-03-08 6:47 ` Christoph Hellwig
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=YiI5ls2Wuaocacc7@infradead.org \
--to=hch@infradead.org \
--cc=axboe@kernel.dk \
--cc=linux-block@vger.kernel.org \
--cc=ushankar@purestorage.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).