All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: Damien Le Moal <damien.lemoal@opensource.wdc.com>,
	linux-block@vger.kernel.org
Cc: Josef Bacik <josef@toxicpanda.com>
Subject: Re: [PATCH 4/4] block: null_blk: Improve device creation with configfs
Date: Tue, 19 Apr 2022 05:55:26 -0600	[thread overview]
Message-ID: <03583c5a-00fb-a6a0-9021-592f61c17d91@kernel.dk> (raw)
In-Reply-To: <20220419110038.3728406-5-damien.lemoal@opensource.wdc.com>

On 4/19/22 5:00 AM, Damien Le Moal wrote:
> Currently, the directory name used to create a nullb device through
> sysfs is not used as the device name, potentially causing headaches for
> users if devices are already created through the modprobe operation
> withe the nr_device module parameter not set to 0. E.g. a user can do
> "mkdir /sys/kernel/config/nullb/nullb0" to create a nullb device while
> /dev/nullb0 wasalready created from modprobe. In this case, the configfs
                ^^^

space

> nullb device will be named nullb1, causing confusion for the user.
> 
> Simplify this by using the configfs directory name as the nullb device
> name, always, unless another nullb device is already using the same
> name. E.g. if modprobe created nullb0, then:
> 
> $ mkdir /sys/kernel/config/nullb/nullb0
> mkdir: cannot create directory '/sys/kernel/config/nullb/nullb0': File
> exists
> 
> will be reported to th user.
> 
> To implement this, the function null_find_dev_by_name() is added to
> check for the existence of a nullb device with the name used for a new
> configfs device directory. nullb_group_make_item() uses this new
> function to check if the directory name can be used as the disk name.
> Finally, null_add_dev() is modified to use the device config item name
> as the disk name for new nullb device, for devices created using
> configfs. The naming of devices created though modprobe remains
> unchanged.
> 
> Of note is that it is possible for a user to create through configfs a
> nullb device with the same name as an existing device. E.g.

This is nice, and solves both the confusing part of having
pre-configured devices, but also using the actual directory name as the
device name even if they are not ordered.

Only odd bit is you can create a device name where a special file of
that name already exists, but I don't think that's solvable in a clean
way and we just need to ignore that. That's arguably a user error, don't
pick names that already exist.

-- 
Jens Axboe


  reply	other threads:[~2022-04-19 11:55 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-19 11:00 [PATCH 0/4] null_blk cleanup and device naming improvements Damien Le Moal
2022-04-19 11:00 ` [PATCH 1/4] block: null_blk: Fix code style issues Damien Le Moal
2022-04-19 11:00 ` [PATCH 2/4] block: null_blk: Cleanup device creation and deletion Damien Le Moal
2022-04-19 11:00 ` [PATCH 3/4] block: null_blk: Cleanup messages Damien Le Moal
2022-04-19 14:00   ` Johannes Thumshirn
2022-04-19 20:58     ` Damien Le Moal
2022-04-19 11:00 ` [PATCH 4/4] block: null_blk: Improve device creation with configfs Damien Le Moal
2022-04-19 11:55   ` Jens Axboe [this message]
2022-04-19 20:58     ` Damien Le Moal
2022-04-19 23:13       ` Damien Le Moal
2022-04-20  0:17         ` Jens Axboe
2022-04-20  0:47           ` Damien Le Moal

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=03583c5a-00fb-a6a0-9021-592f61c17d91@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=damien.lemoal@opensource.wdc.com \
    --cc=josef@toxicpanda.com \
    --cc=linux-block@vger.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 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.