Re: [PATCH] cifs/smb3: directory sync should not return an error

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

 



On Thu, May 10, 2018 at 11:04:14AM -0500, Steve French via samba-technical wrote:
> As with NFS, which ignores sync on directory handles,
> fsync on a directory handle is a noop for CIFS/SMB3.
> Do not return an error on it.  It breaks some database
> apps otherwise.

Thanks for this. I now have an smbtorture test that
shows we handle flush on directories incorrectly.

Patch to follow.

Jeremy.

> -- 
> Thanks,
> 
> Steve

> From 6112a4967573f9a347f7abc02e80423851b73737 Mon Sep 17 00:00:00 2001
> From: Steve French <smfrench@xxxxxxxxx>
> Date: Thu, 10 May 2018 10:59:37 -0500
> Subject: [PATCH] smb3: directory sync should not return an error
> 
> As with NFS, which ignores sync on directory handles,
> fsync on a directory handle is a noop for CIFS/SMB3.
> Do not return an error on it.  It breaks some database
> apps otherwise.
> 
> Signed-off-by: Steve French <smfrench@xxxxxxxxx>
> CC: Stable <stable@xxxxxxxxxxxxxxx>
> ---
>  fs/cifs/cifsfs.c | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
> index ed8e181927d6..8e41186d9923 100644
> --- a/fs/cifs/cifsfs.c
> +++ b/fs/cifs/cifsfs.c
> @@ -1049,6 +1049,18 @@ ssize_t cifs_file_copychunk_range(unsigned int xid,
>  	return rc;
>  }
>  
> +/*
> + * Directory operations under CIFS/SMB2/SMB3 are synchronous, so fsync()
> + * is a dummy operation.
> + */
> +int cifs_dir_fsync(struct file *file, loff_t start, loff_t end, int datasync)
> +{
> +	cifs_dbg(FYI, "Sync directory - name: %pD datasync: 0x%x\n",
> +		 file, datasync);
> +
> +	return 0;
> +}
> +
>  static ssize_t cifs_copy_file_range(struct file *src_file, loff_t off,
>  				struct file *dst_file, loff_t destoff,
>  				size_t len, unsigned int flags)
> @@ -1183,6 +1195,7 @@ const struct file_operations cifs_dir_ops = {
>  	.copy_file_range = cifs_copy_file_range,
>  	.clone_file_range = cifs_clone_file_range,
>  	.llseek = generic_file_llseek,
> +	.fsync = cifs_dir_fsync,
>  };
>  
>  static void
> -- 
> 2.17.0
> 




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux