Re: [PATCH V2 11/20] block: move blk_unregister_queue() & device_del() after freeze wait

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

 



On Sat, Apr 19, 2025 at 06:08:30PM +0530, Nilay Shroff wrote:
> 
> 
> On 4/18/25 10:06 PM, Ming Lei wrote:
> > Move blk_unregister_queue() & device_del() after freeze wait, and prepare
> > for unifying elevator switch.
> > 
> > This way is just fine, since bdev has been unhashed at the beginning of
> > del_gendisk(), both blk_unregister_queue() & device_del() are dealing
> > with kobject & debugfs thing only.
> > 
> > Signed-off-by: Ming Lei <ming.lei@xxxxxxxxxx>
> > ---
> >  block/genhd.c | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> > 
> > diff --git a/block/genhd.c b/block/genhd.c
> > index d22fdc0d5383..86c3db5b9305 100644
> > --- a/block/genhd.c
> > +++ b/block/genhd.c
> > @@ -749,8 +749,6 @@ static int __del_gendisk(struct gendisk_data *data)
> >  		bdi_unregister(disk->bdi);
> >  	}
> >  
> > -	blk_unregister_queue(disk);
> > -
> >  	kobject_put(disk->part0->bd_holder_dir);
> >  	kobject_put(disk->slave_dir);
> >  	disk->slave_dir = NULL;
> > @@ -759,10 +757,12 @@ static int __del_gendisk(struct gendisk_data *data)
> >  	disk->part0->bd_stamp = 0;
> >  	sysfs_remove_link(block_depr, dev_name(disk_to_dev(disk)));
> >  	pm_runtime_set_memalloc_noio(disk_to_dev(disk), false);
> > -	device_del(disk_to_dev(disk));
> >  
> >  	blk_mq_freeze_queue_wait(q);
> >  
> > +	blk_unregister_queue(disk);
> > +	device_del(disk_to_dev(disk));
> > +
> >  	blk_throtl_cancel_bios(disk);
> >  
> >  	blk_sync_queue(q);
> As we first freeze the queue and then enter blk_unregister_queue which 
> deals with kobject/debufs, do we need to create memalloc GFP_NOIO scope
> while running blk_unregister_queue? I see that device_del already defines
> the GFP_NOIO scope. 

We actually need to do that with the read lock together.


Thanks,
Ming





[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