* [PATCH] ceph: Don't do set_layout for file which has been written.
@ 2013-07-11 2:04 majianpeng
2013-07-11 18:54 ` Sage Weil
0 siblings, 1 reply; 5+ messages in thread
From: majianpeng @ 2013-07-11 2:04 UTC (permalink / raw)
To: sage; +Cc: ceph-devel
Cephfs don't change the layout which has been written.So add this check
before do.
Signed-off-by: Jianpeng Ma <majianpeng@gmail.com>
---
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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] ceph: Don't do set_layout for file which has been written.
2013-07-11 2:04 [PATCH] ceph: Don't do set_layout for file which has been written majianpeng
@ 2013-07-11 18:54 ` Sage Weil
2013-07-12 0:51 ` majianpeng
0 siblings, 1 reply; 5+ messages in thread
From: Sage Weil @ 2013-07-11 18:54 UTC (permalink / raw)
To: majianpeng; +Cc: ceph-devel
On Thu, 11 Jul 2013, majianpeng wrote:
> 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
>
> Signed-off-by: Jianpeng Ma <majianpeng@gmail.com>
> ---
> 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????y????b?????v?????{.n??????z??ay????????j\a???f????????????????:+v????????\a??zZ+??????"?!?
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: Re: [PATCH] ceph: Don't do set_layout for file which has been written.
2013-07-11 18:54 ` Sage Weil
@ 2013-07-12 0:51 ` majianpeng
2013-07-12 21:00 ` Sage Weil
0 siblings, 1 reply; 5+ messages in thread
From: majianpeng @ 2013-07-12 0:51 UTC (permalink / raw)
To: sage; +Cc: ceph-devel
>On Thu, 11 Jul 2013, majianpeng wrote:
>> 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]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Re: [PATCH] ceph: Don't do set_layout for file which has been written.
2013-07-12 0:51 ` majianpeng
@ 2013-07-12 21:00 ` Sage Weil
2013-07-15 2:31 ` majianpeng
0 siblings, 1 reply; 5+ messages in thread
From: Sage Weil @ 2013-07-12 21:00 UTC (permalink / raw)
To: majianpeng; +Cc: ceph-devel
On Fri, 12 Jul 2013, majianpeng wrote:
> >On Thu, 11 Jul 2013, majianpeng wrote:
> >> 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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Re: [PATCH] ceph: Don't do set_layout for file which has been written.
2013-07-12 21:00 ` Sage Weil
@ 2013-07-15 2:31 ` majianpeng
0 siblings, 0 replies; 5+ messages in thread
From: majianpeng @ 2013-07-15 2:31 UTC (permalink / raw)
To: sage; +Cc: ceph-devel
>On Fri, 12 Jul 2013, majianpeng wrote:
>> >On Thu, 11 Jul 2013, majianpeng wrote:
>> >> 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.
>
OK, I see. Thanks your time!
Jianpeng
>sage
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-07-15 2:31 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-11 2:04 [PATCH] ceph: Don't do set_layout for file which has been written majianpeng
2013-07-11 18:54 ` Sage Weil
2013-07-12 0:51 ` majianpeng
2013-07-12 21:00 ` Sage Weil
2013-07-15 2:31 ` 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.