linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Ming Lei <ming.lei@redhat.com>
Cc: Jens Axboe <axboe@fb.com>,
	linux-block@vger.kernel.org, reddot.rocks@gmail.com,
	Christoph Hellwig <hch@infradead.org>,
	linux-fsdevel@vger.kernel.org,
	Stefan Haberland <sth@linux.vnet.ibm.com>,
	Jan Hoeppner <hoeppner@linux.vnet.ibm.com>,
	Martin Schwidefsky <schwidefsky@de.ibm.com>,
	Heiko Carstens <heiko.carstens@de.ibm.com>,
	linux-s390@vger.kernel.org
Subject: Re: [PATCH] block: loop: remove & invalidate partitions when detaching
Date: Thu, 4 Jan 2018 04:38:03 -0800	[thread overview]
Message-ID: <20180104123803.GA8437@infradead.org> (raw)
In-Reply-To: <20180104103924.8814-1-ming.lei@redhat.com>

On Thu, Jan 04, 2018 at 06:39:24PM +0800, Ming Lei wrote:
> When detaching loop disk, neither we remove loop partitions, nor
> invalidate them. This way may cause data loss, and often confuse
> people.
> 
> This patch fixes the above issue by removing & invalidating loop
> partitions in loop_clr_fd(),

Please add a comment explaining the call (e.g. the weird loop
case of keeping unbound devices around).

Also dasd seems to implement this functionality by iterating over
all partitions and then calling ioctl_by_bdev(bdev, BLKPG, ..) on
it.  Please switch it to you new helper assuming there is a good
reason to even do this to start with.  CCing the maintainers to
confirm that.

And while you'e at it split the block and loop bits into separate
patches.

> +void del_gendisk_partitions(struct gendisk *disk)

Add a comment explanining the function, please.

>  	struct disk_part_iter piter;
>  	struct hd_struct *part;
>  
> -	blk_integrity_del(disk);
> -	disk_del_events(disk);
> -
>  	/* invalidate stuff */
>  	disk_part_iter_init(&piter, disk,
>  			     DISK_PITER_INCL_EMPTY | DISK_PITER_REVERSE);
> @@ -714,7 +711,17 @@ void del_gendisk(struct gendisk *disk)
>  	disk_part_iter_exit(&piter);
>  
>  	invalidate_partition(disk, 0);
> +}
> +EXPORT_SYMBOL(del_gendisk_partitions);

EXPORT_SYMBOL_GPL, please.

  reply	other threads:[~2018-01-04 12:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-04 10:39 [PATCH] block: loop: remove & invalidate partitions when detaching Ming Lei
2018-01-04 12:38 ` Christoph Hellwig [this message]
2018-01-06  9:02   ` Ming Lei

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=20180104123803.GA8437@infradead.org \
    --to=hch@infradead.org \
    --cc=axboe@fb.com \
    --cc=heiko.carstens@de.ibm.com \
    --cc=hoeppner@linux.vnet.ibm.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=ming.lei@redhat.com \
    --cc=reddot.rocks@gmail.com \
    --cc=schwidefsky@de.ibm.com \
    --cc=sth@linux.vnet.ibm.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).