linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Yongji Xie <xieyongji@bytedance.com>
Cc: Christoph Hellwig <hch@infradead.org>,
	Jens Axboe <axboe@kernel.dk>, Josef Bacik <josef@toxicpanda.com>,
	linux-block@vger.kernel.org, nbd@other.debian.org,
	yixingchen@bytedance.com
Subject: Re: [PATCH 3/3] nbd: Use invalidate_gendisk() helper on disconnect
Date: Mon, 13 Sep 2021 16:32:33 +0100	[thread overview]
Message-ID: <YT9vEVF0BxIv5qDS@infradead.org> (raw)
In-Reply-To: <CACycT3uo6GqLx8i=rtn9P2kaSGHjnNnamX3KR0Xgq_5QEhWWUA@mail.gmail.com>

On Mon, Sep 13, 2021 at 09:04:12PM +0800, Yongji Xie wrote:
> On Mon, Sep 13, 2021 at 8:43 PM Christoph Hellwig <hch@infradead.org> wrote:
> >
> > On Mon, Sep 13, 2021 at 07:25:57PM +0800, Xie Yongji wrote:
> > > +             invalidate_gendisk(nbd->disk);
> > > +             if (nbd->config->bytesize)
> > > +                     kobject_uevent(&nbd_to_dev(nbd)->kobj, KOBJ_CHANGE);
> >
> > I wonder if the invalidate helper should just use
> > set_capacity_and_notify to take care of the notification in the proper
> > way.  This adds an uevent to loop, and adds the RESIZE=1 argument to
> > nbd, but it feels like the right thing to do.
> 
> Looks like set_capacity_and_notify() would not do notification if we
> set capacity to zero.

True.

> How about calling kobject_uevent() directly in
> the helper?

That's probably and improvement over letting the driver do it, so let's
go with that for now instead of adding ever more work to your plate.

      reply	other threads:[~2021-09-13 15:49 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-13 11:25 [PATCH 0/3] Add invalidate_gendisk() helper for drivers to invalidate the gendisk Xie Yongji
2021-09-13 11:25 ` [PATCH 1/3] block: Add invalidate_gendisk() helper " Xie Yongji
2021-09-13 12:31   ` Christoph Hellwig
2021-09-13 13:16     ` Yongji Xie
2021-09-13 11:25 ` [PATCH 2/3] loop: Use invalidate_gendisk() helper to invalidate gendisk Xie Yongji
2021-09-13 12:34   ` Christoph Hellwig
2021-09-13 13:14     ` Yongji Xie
2021-09-13 11:25 ` [PATCH 3/3] nbd: Use invalidate_gendisk() helper on disconnect Xie Yongji
2021-09-13 12:41   ` Christoph Hellwig
2021-09-13 13:04     ` Yongji Xie
2021-09-13 15:32       ` Christoph Hellwig [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=YT9vEVF0BxIv5qDS@infradead.org \
    --to=hch@infradead.org \
    --cc=axboe@kernel.dk \
    --cc=josef@toxicpanda.com \
    --cc=linux-block@vger.kernel.org \
    --cc=nbd@other.debian.org \
    --cc=xieyongji@bytedance.com \
    --cc=yixingchen@bytedance.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).