Re: [PATCH] block, loop: Increment diskseq when releasing a loop device

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

 



On Wed, Jun 07, 2023 at 12:42:11AM -0700, Christoph Hellwig wrote:
> > +++ b/block/genhd.c
> > @@ -1502,3 +1502,4 @@ void inc_diskseq(struct gendisk *disk)
> >  {
> >  	disk->diskseq = atomic64_inc_return(&diskseq);
> >  }
> > +EXPORT_SYMBOL(inc_diskseq);
> 
> I really do not like exporting this as a lowlevel function.  If we
> increment the sequence it should be part of a higher level operation.

Fair!

> > --- a/drivers/block/loop.c
> > +++ b/drivers/block/loop.c
> > @@ -1205,6 +1205,12 @@ static void __loop_clr_fd(struct loop_device *lo, bool release)
> >  	if (!part_shift)
> >  		set_bit(GD_SUPPRESS_PART_SCAN, &lo->lo_disk->state);
> >  	mutex_lock(&lo->lo_mutex);
> > +
> > +	/*
> > +	 * Increment the disk sequence number, so that userspace knows this
> > +	 * device now points to something else.
> > +	 */
> > +	inc_diskseq(lo->lo_disk);
> 
> And I'm not sure why we even need this.  __loop_clr_fd
> already calls disk_force_media_change, which calls inc_diskseq.
> Why do we need an extra increment?

How does disk_force_media_change() call inc_diskseq()?  I don’t see any
calls in the source code.  I’m going to use systemtap to see if there is
an indirect call chain.
-- 
Sincerely,
Demi Marie Obenour (she/her/hers)
Invisible Things Lab

Attachment: signature.asc
Description: PGP signature


[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