All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sage Weil <sage@inktank.com>
To: majianpeng <majianpeng@gmail.com>
Cc: ceph-devel <ceph-devel@vger.kernel.org>
Subject: Re: [PATCH] ceph: Don't do set_layout for file which has been written.
Date: Thu, 11 Jul 2013 11:54:51 -0700 (PDT)	[thread overview]
Message-ID: <alpine.DEB.2.00.1307111154260.5149@cobra.newdream.net> (raw)
In-Reply-To: <201307111004467716774@gmail.com>

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+??????"?!?

  reply	other threads:[~2013-07-11 18:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2013-07-12  0:51   ` majianpeng
2013-07-12 21:00     ` Sage Weil
2013-07-15  2:31       ` majianpeng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.00.1307111154260.5149@cobra.newdream.net \
    --to=sage@inktank.com \
    --cc=ceph-devel@vger.kernel.org \
    --cc=majianpeng@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.