public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
From: Josef Bacik <josef@toxicpanda.com>
To: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Cc: Jens Axboe <axboe@kernel.dk>,
	Chaitanya Kulkarni <chaitanyak@nvidia.com>,
	"linux-block@vger.kernel.org" <linux-block@vger.kernel.org>,
	"bvanassche@acm.org" <bvanassche@acm.org>
Subject: Re: Nullblk configfs oddities
Date: Tue, 3 May 2022 16:20:24 -0400	[thread overview]
Message-ID: <YnGOiIrhVkRfit8m@localhost.localdomain> (raw)
In-Reply-To: <c5418ac1-460f-348f-d7a3-d7c3a1aaad71@opensource.wdc.com>

On Tue, Apr 19, 2022 at 01:23:22PM +0900, Damien Le Moal wrote:
> On 4/19/22 07:24, Jens Axboe wrote:
> > On 4/18/22 4:21 PM, Chaitanya Kulkarni wrote:
> >> On 4/18/22 15:14, Jens Axboe wrote:
> >>> On 4/18/22 3:54 PM, Chaitanya Kulkarni wrote:
> >>>> On 4/18/22 14:38, Josef Bacik wrote:
> >>>>> Hello,
> >>>>>
> >>>>> I'm trying to add a test to fsperf and it requires the use of nullblk.  I'm
> >>>>> trying to use the configfs thing, and it's doing some odd things.  My basic
> >>>>> reproducer is
> >>>>>
> >>>>> modprobe null_blk
> >>>>> mkdir /sys/kernel/config/nullb/nullb0
> >>>>> echo some shit into the config
> >>>>> echo 1 > /sys/kernel/config/nullb/nullb0/power
> >>>>>
> >>>>> Now null_blk apparently defaults to nr_devices == 1, so it creates nullb0 on
> >>>>> modprobe.  But this doesn't show up in the configfs directory.  There's no way
> >>>>> to find this out until when I try to mkfs my nullb0 and it doesn't work.  The
> >>>>> above steps gets my device created at /dev/nullb1, but there's no actual way to
> >>>>> figure out that's what happened.  If I do something like
> >>>>> /sys/kernel/config/nullb/nullbfsperf I still just get nullb<number>, I don't get
> >>>>> my fancy name.
> >>>>>
> >>>>
> >>>> when you load module with default module parameter it will create a
> >>>> default device with no memory backed mode, that will not be visible in
> >>>> the configfs.
> >>>
> >>> Right, the problem is really that pre-configured devices (via nr_devices
> >>> being bigger than 0, which is the default) don't show up in configfs.
> >>> That, to me, is the real issue here, because it means you need to know
> >>> which ones are already setup before doing mkdir for a new one.
> >>>
> >>> On top of that, it's also odd that they don't show up there to begin
> >>> with.
> >>>
> >>
> >> it is indeed confusing, maybe we need to find a way to populate the
> >> configfs when loading the module? but I'm not sure if that is
> >> the right approach since configs ideally should be populated by
> >> user.
> >>
> >> OTOH we can make the memory_backed module param [1] so user can
> >> tentatively not use configfs and only rely on default configuration ?
> > 
> > Arguably configfs should just be disabled if loading with nr_devices
> > larger than 0, as it's a mess of an API as it stands. But probably too
> > late for that. The fact that we also have an option that's specific to
> > configfs just makes it even worse.
> > 
> > I don't know much about configfs, but pre-populating with the configured
> > devices and options would be ideal and completely solve this. I think
> > that would be the best solution given the current situation. Not that
> > it's THAT important, null_blk is a developer tool and as such can have
> > some sharper and rouger edges. Still would be nice to make it saner,
> > though.
> > 
> 
> I came up with this. It does prepopulate configfs nullb directory with the
> devices created on modprobe. But... doing an rmmod now always gives a
> "rmmod: ERROR: Module null_blk is in use" because configfs takes a ref on
> nullblk module for each entry. So the user now must do an rmdir of all
> prepopulated devices before doing rmmod. Not ideal. And messing up with
> the module references is probably not a good idea...
> 

I meant to reply to this previously, I tried this and it worked fine for me.
I'll leave it up to you guys if the new behavior is acceptable to you, but for
me this worked.  Thanks,

Josef

      parent reply	other threads:[~2022-05-03 20:21 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-18 21:38 Nullblk configfs oddities Josef Bacik
2022-04-18 21:54 ` Chaitanya Kulkarni
2022-04-18 22:02   ` Josef Bacik
2022-04-18 22:15     ` Chaitanya Kulkarni
2022-04-18 22:14   ` Jens Axboe
2022-04-18 22:21     ` Chaitanya Kulkarni
2022-04-18 22:24       ` Jens Axboe
2022-04-18 22:28         ` Josef Bacik
2022-04-19  4:23         ` Damien Le Moal
2022-04-19 14:49           ` Bart Van Assche
2022-05-03 20:20           ` Josef Bacik [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=YnGOiIrhVkRfit8m@localhost.localdomain \
    --to=josef@toxicpanda.com \
    --cc=axboe@kernel.dk \
    --cc=bvanassche@acm.org \
    --cc=chaitanyak@nvidia.com \
    --cc=damien.lemoal@opensource.wdc.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox