linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Ming Lei <ming.lei@redhat.com>
Cc: Jens Axboe <axboe@kernel.dk>, Christoph Hellwig <hch@lst.de>,
	linux-block@vger.kernel.org
Subject: Re: [PATCH] block: always remove partitions from blk_drop_partitions()
Date: Wed, 15 Jul 2020 11:39:47 +0200	[thread overview]
Message-ID: <20200715093947.GA27731@lst.de> (raw)
In-Reply-To: <20200715083619.624249-1-ming.lei@redhat.com>

On Wed, Jul 15, 2020 at 04:36:19PM +0800, Ming Lei wrote:
> In theory, when GENHD_FL_NO_PART_SCAN is set, no partitions can be created
> on one disk. However, ioctl(BLKPG, BLKPG_ADD_PARTITION) doesn't check
> GENHD_FL_NO_PART_SCAN, so partitions still can be added even though
> GENHD_FL_NO_PART_SCAN is set.
> 
> So far blk_drop_partitions() only removes partitions when disk_part_scan_enabled()
> return true. This way can make ghost partition on loop device after changing/clearing
> FD in case that PARTSCAN is disabled, such as partitions can be added
> via 'parted' on loop disk even though GENHD_FL_NO_PART_SCAN is set.
> 
> Fix this issue by always removing partitions in blk_drop_partitions(), and
> this way is correct because the current code supposes that no partitions
> can be added in case of GENHD_FL_NO_PART_SCAN.

The changelog has a few overly long lines.

Otherwise:

Reviewed-by: Christoph Hellwig <hch@lst.de>

  reply	other threads:[~2020-07-15  9:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-15  8:36 [PATCH] block: always remove partitions from blk_drop_partitions() Ming Lei
2020-07-15  9:39 ` Christoph Hellwig [this message]
2020-07-15 15:14 ` Jens Axboe

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=20200715093947.GA27731@lst.de \
    --to=hch@lst.de \
    --cc=axboe@kernel.dk \
    --cc=linux-block@vger.kernel.org \
    --cc=ming.lei@redhat.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).