From: Jeremy Allison <jra@samba.org>
To: Steve French <smfrench@gmail.com>
Cc: CIFS <linux-cifs@vger.kernel.org>,
linux-fsdevel <linux-fsdevel@vger.kernel.org>,
samba-technical <samba-technical@lists.samba.org>
Subject: Re: [PATCH] cifs/smb3: directory sync should not return an error
Date: Thu, 10 May 2018 09:37:17 -0700 [thread overview]
Message-ID: <20180510163717.GA23039@jra3> (raw)
In-Reply-To: <CAH2r5mt74Z7fGKu2esBk+sJzR=Qt=xRJ-oGgWztUcRDdXKD7ig@mail.gmail.com>
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@gmail.com>
> 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@gmail.com>
> CC: Stable <stable@vger.kernel.org>
> ---
> 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
>
next prev parent reply other threads:[~2018-05-10 16:55 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-10 16:04 [PATCH] cifs/smb3: directory sync should not return an error Steve French
2018-05-10 16:37 ` Jeremy Allison [this message]
2018-05-10 17:11 ` Pavel Shilovsky
2018-05-10 18:48 ` Jeremy Allison
2018-05-10 20:28 ` Steve French
2018-05-10 21:56 ` Steve French
2018-05-10 22:08 ` ronnie sahlberg
2018-05-10 22:12 ` Jeremy Allison
2018-05-10 22:25 ` Steve French
2018-05-10 23:06 ` Jeremy Allison
2018-05-10 21:01 ` ronnie sahlberg
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=20180510163717.GA23039@jra3 \
--to=jra@samba.org \
--cc=linux-cifs@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=samba-technical@lists.samba.org \
--cc=smfrench@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.