[PATCH] ceph: Don't do set_layout for file which has been written.

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

 



Cephfs don't change the layout which has been written.So add this check
before do.

Signed-off-by: Jianpeng Ma <majianpeng@xxxxxxxxx>
---
 fs/ceph/ioctl.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/ceph/ioctl.c b/fs/ceph/ioctl.c
index e0b4ef3..cbea896 100644
--- a/fs/ceph/ioctl.c
+++ b/fs/ceph/ioctl.c
@@ -72,6 +72,9 @@ static long ceph_ioctl_set_layout(struct file *file, void __user *arg)
 	struct ceph_ioctl_layout nl;
 	int err;
 
+	/*Only for file which has never been written*/
+	if (i_size_read(inode) > 0 || ci->i_truncate_seq > 1)
+		return -ENOTEMPTY;
 	if (copy_from_user(&l, arg, sizeof(l)))
 		return -EFAULT;
 
-- 
1.8.1.2
?韬{.n?????%??檩??w?{.n????u朕?Ф?塄}?财??j:+v??????2??璀??摺?囤??z夸z罐?+?????w棹f





[Index of Archives]     [CEPH Users]     [Ceph Large]     [Information on CEPH]     [Linux BTRFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux