public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
From: Demi Marie Obenour <demi@invisiblethingslab.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: Jens Axboe <axboe@kernel.dk>,
	linux-block@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] block, loop: Increment diskseq when releasing a loop device
Date: Wed, 7 Jun 2023 11:23:00 -0400	[thread overview]
Message-ID: <ZICg2sxHQRRPW3Nc@itl-email> (raw)
In-Reply-To: <ZIA004HDuhoTQzY/@infradead.org>

[-- Attachment #1: Type: text/plain, Size: 1298 bytes --]

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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2023-06-07 15:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-01 22:26 [PATCH] block, loop: Increment diskseq when releasing a loop device Demi Marie Obenour
2023-06-07  7:42 ` Christoph Hellwig
2023-06-07 15:23   ` Demi Marie Obenour [this message]
2023-06-07 16:42     ` Demi Marie Obenour

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=ZICg2sxHQRRPW3Nc@itl-email \
    --to=demi@invisiblethingslab.com \
    --cc=axboe@kernel.dk \
    --cc=hch@infradead.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@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