All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V2 2/2] block_dev: Add size check before doing async write on block device.
@ 2013-09-17  3:22 ` majianpeng
  0 siblings, 0 replies; 2+ messages in thread
From: majianpeng @ 2013-09-17  3:22 UTC (permalink / raw)
  To: axboe, viro; +Cc: LKML, linux-fsdevel

For async-write on block device,when disk removed,the vfs don't know.
It will continue do async-write.Add this check it will stop async-write
when disk removed.

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

diff --git a/fs/block_dev.c b/fs/block_dev.c
index 1173a4e..e308b52 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -1514,6 +1514,10 @@ ssize_t blkdev_aio_write(struct kiocb *iocb, const struct iovec *iov,
 	struct file *file = iocb->ki_filp;
 	struct blk_plug plug;
 	ssize_t ret;
+	loff_t size = i_size_read(file->f_mapping->host);
+
+	if (pos >= size)
+		return 0;
 
 	BUG_ON(iocb->ki_pos != pos);
 
-- 
1.8.4-rc0

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

* [PATCH V2 2/2] block_dev: Add size check before doing async write on block device.
@ 2013-09-17  3:22 ` majianpeng
  0 siblings, 0 replies; 2+ messages in thread
From: majianpeng @ 2013-09-17  3:22 UTC (permalink / raw)
  To: axboe, viro; +Cc: LKML, linux-fsdevel

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

For async-write on block device,when disk removed,the vfs don't know.
It will continue do async-write.Add this check it will stop async-write
when disk removed.

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

diff --git a/fs/block_dev.c b/fs/block_dev.c
index 1173a4e..e308b52 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -1514,6 +1514,10 @@ ssize_t blkdev_aio_write(struct kiocb *iocb, const struct iovec *iov,
 	struct file *file = iocb->ki_filp;
 	struct blk_plug plug;
 	ssize_t ret;
+	loff_t size = i_size_read(file->f_mapping->host);
+
+	if (pos >= size)
+		return 0;
 
 	BUG_ON(iocb->ki_pos != pos);
 
-- 
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¥

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

end of thread, other threads:[~2013-09-17  3:22 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 2/2] block_dev: Add size check before doing async write on block device majianpeng
2013-09-17  3:22 ` majianpeng

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.