linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V2 1/2] block: Set inode of block_device size to zero when delete gendisk.
@ 2013-09-17  3:22 majianpeng
  2013-09-25 15:56 ` Jeff Moyer
  0 siblings, 1 reply; 2+ messages in thread
From: majianpeng @ 2013-09-17  3:22 UTC (permalink / raw)
  To: axboe, viro; +Cc: LKML, linux-fsdevel

When remove gendisk, set the size of inode of block_device to zero.
This is mainly let the vfs know disk removed.

Signed-off-by: Jianpeng Ma <majianpeng@gmail.com>
---
 block/genhd.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/block/genhd.c b/block/genhd.c
index dadf42b..9a4c245 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -1369,6 +1369,12 @@ int invalidate_partition(struct gendisk *disk, int partno)
 	if (bdev) {
 		fsync_bdev(bdev);
 		res = __invalidate_device(bdev, true);
+		/*
+		 * When used buffer-mode on raw blockdevice,the disk removed.
+		 * But the vfs don't know.So tell the vfs size of disk
+		 * became zero, the buffer write can return
+		 */
+		i_size_write(bdev->bd_inode, 0);
 		bdput(bdev);
 	}
 	return res;
-- 
1.8.4-rc0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH V2 1/2] block: Set inode of block_device size to zero when delete gendisk.
  2013-09-17  3:22 [PATCH V2 1/2] block: Set inode of block_device size to zero when delete gendisk majianpeng
@ 2013-09-25 15:56 ` Jeff Moyer
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff Moyer @ 2013-09-25 15:56 UTC (permalink / raw)
  To: majianpeng; +Cc: axboe, viro, LKML, linux-fsdevel

majianpeng <majianpeng@gmail.com> writes:

> When remove gendisk, set the size of inode of block_device to zero.
> This is mainly let the vfs know disk removed.
>
> Signed-off-by: Jianpeng Ma <majianpeng@gmail.com>
Reviewed-by: Jeff Moyer <jmoyer@redhat.com>

> ---
>  block/genhd.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/block/genhd.c b/block/genhd.c
> index dadf42b..9a4c245 100644
> --- a/block/genhd.c
> +++ b/block/genhd.c
> @@ -1369,6 +1369,12 @@ int invalidate_partition(struct gendisk *disk, int partno)
>  	if (bdev) {
>  		fsync_bdev(bdev);
>  		res = __invalidate_device(bdev, true);
> +		/*
> +		 * When used buffer-mode on raw blockdevice,the disk removed.
> +		 * But the vfs don't know.So tell the vfs size of disk
> +		 * became zero, the buffer write can return
> +		 */
> +		i_size_write(bdev->bd_inode, 0);
>  		bdput(bdev);
>  	}
>  	return res;

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-09-25 15:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-17  3:22 [PATCH V2 1/2] block: Set inode of block_device size to zero when delete gendisk majianpeng
2013-09-25 15:56 ` Jeff Moyer

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).