Re: [PATCH 3/3] nbd: Use invalidate_gendisk() helper on disconnect

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxx> 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.



[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux