[PATCH 2/2] block_dev: Add size check before doing async write on block device.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 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Ç+?·?®?­?+%?Ëÿ±éݶ¥?wÿº{.nÇ+?·¥?{±ýûz÷¥þ)í?æèw*jg¬±¨¶????Ý¢jÿ¾«þG«?éÿ¢¸¢·¦j:+v?¨?wèjØm¶?ÿþø¯ù®w¥þ?àþf£¢·h??â?úÿ?Ù¥





[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux