Re: [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]

 



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@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????y????b?????v?????{.n??????z??ay????????j???f????????????????:+v??????????zZ+??????"?!?
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[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