All of lore.kernel.org
 help / color / mirror / Atom feed
From: majianpeng <majianpeng@gmail.com>
To: axboe <axboe@kernel.dk>, viro <viro@zeniv.linux.org.uk>
Cc: LKML <linux-kernel@vger.kernel.org>,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>
Subject: [PATCH V2 1/2] block: Set inode of block_device size to zero when delete gendisk.
Date: Tue, 17 Sep 2013 11:22:01 +0800	[thread overview]
Message-ID: <201309171121587796647@gmail.com> (raw)

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

WARNING: multiple messages have this Message-ID (diff)
From: majianpeng <majianpeng@gmail.com>
To: axboe <axboe@kernel.dk>, viro <viro@zeniv.linux.org.uk>
Cc: LKML <linux-kernel@vger.kernel.org>,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>
Subject: [PATCH V2 1/2] block: Set inode of block_device size to zero when delete gendisk.
Date: Tue, 17 Sep 2013 11:22:01 +0800	[thread overview]
Message-ID: <201309171121587796647@gmail.com> (raw)

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="us-ascii", Size: 928 bytes --]

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
ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

             reply	other threads:[~2013-09-17  3:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-17  3:22 majianpeng [this message]
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

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=201309171121587796647@gmail.com \
    --to=majianpeng@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.