ceph: Don't do set_layout for file which has been written.
PATCH 1/1 ceph: Don't do set_layout for file which has been written.
Cephfs don't change the layout which has been written.So add this check before do.
--- fs/ceph/ioctl.c | 3 +++ 1 file changed, 3 insertions(+)
fs/ceph/ioctl.c +3 -0
@@ -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 ;
Signature · 1 line
1.8.1.2
Quoted 2 lines · majianpeng
Cephfs don't change the layout which has been written.So add this check before do.
This could conceivaably change in the future, and I'm not sure there is harm is the MDS round trip to get the error code here...?
sage
Quoted 23 lines
Signed-off-by Jianpeng Ma <[email protected]>--- fs/ceph/ioctl.c | 3 +++ 1 file changed, 3 insertions(+)fs/ceph/ioctl.c +3
-0@@ -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 ;Signature · 2 lines
1.8.1.2 N????y????b?????v?????{.n??????z??ay????????j???f????????????????:+v??????????zZ+??????"?!?
Quoted 7 lines · majianpeng
Quoted 2 lines
Cephfs don't change the layout which has been written.So add this check before do.
This could conceivaably change in the future, and I'm not sure there is harm is the MDS round trip to get the error code here...?
Sorry, i can't understand what's your said. Can you explain in detail?
Thanks
Jianpeng Ma
[snip]
Quoted 8 lines · majianpeng
Quoted 7 lines · majianpeng
Quoted 2 lines
Cephfs don't change the layout which has been written.So add this check before do.
This could conceivaably change in the future, and I'm not sure there is harm is the MDS round trip to get the error code here...?
Sorry, i can't understand what's your said. Can you explain in detail?
Sorry. I mean that someday the MDS might be able to adjust the layout of an existing file. That is probably not something that will happen any time soon, though. It is probably worth merging this (along with the GETLAYOUT half) for now.
sage
Quoted 8 lines · majianpeng
Quoted 7 lines
Quoted 7 lines · majianpeng
Quoted 2 lines
Cephfs don't change the layout which has been written.So add this check before do.
This could conceivaably change in the future, and I'm not sure there is harm is the MDS round trip to get the error code here...?
Quoted 7 lines
Quoted 1 line
Sorry, i can't understand what's your said. Can you explain in detail?
Sorry. I mean that someday the MDS might be able to adjust the layout of an existing file. That is probably not something that will happen any time soon, though. It is probably worth merging this (along with the GETLAYOUT half) for now.
OK, I see. Thanks your time!
Jianpeng
Quoted 1 line
sage