diff options
author | Steve French <stfrench@microsoft.com> | 2018-08-02 20:28:18 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-09-05 09:29:41 +0200 |
commit | 1316a0cc27d11fa94c864f147f96ad1362e9876d (patch) | |
tree | 37c857dc560b17ed37978a55def08a8f8e47c580 /fs/cifs | |
parent | 25b981bfe192fd208ba04c81f4aa30ffb5141660 (diff) | |
download | linux-stable-1316a0cc27d11fa94c864f147f96ad1362e9876d.tar.gz linux-stable-1316a0cc27d11fa94c864f147f96ad1362e9876d.tar.bz2 linux-stable-1316a0cc27d11fa94c864f147f96ad1362e9876d.zip |
smb3: Do not send SMB3 SET_INFO if nothing changed
commit fd09b7d3b352105f08b8e02f7afecf7e816380ef upstream.
An earlier commit had a typo which prevented the
optimization from working:
commit 18dd8e1a65dd ("Do not send SMB3 SET_INFO request if nothing is changing")
Thank you to Metze for noticing this. Also clear a
reserved field in the FILE_BASIC_INFO struct we send
that should be zero (all the other fields in that
struct were set or cleared explicitly already in
cifs_set_file_info).
Reviewed-by: Pavel Shilovsky <pshilov@microsoft.com>
CC: Stable <stable@vger.kernel.org> # 4.9.x+
Reported-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/cifs')
-rw-r--r-- | fs/cifs/inode.c | 2 | ||||
-rw-r--r-- | fs/cifs/smb2inode.c | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index a2cfb33e85c1..9051b9dfd590 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c @@ -1122,6 +1122,8 @@ cifs_set_file_info(struct inode *inode, struct iattr *attrs, unsigned int xid, if (!server->ops->set_file_info) return -ENOSYS; + info_buf.Pad = 0; + if (attrs->ia_valid & ATTR_ATIME) { set_time = true; info_buf.LastAccessTime = diff --git a/fs/cifs/smb2inode.c b/fs/cifs/smb2inode.c index f22cbc0d1869..1eef1791d0c4 100644 --- a/fs/cifs/smb2inode.c +++ b/fs/cifs/smb2inode.c @@ -283,7 +283,7 @@ smb2_set_file_info(struct inode *inode, const char *full_path, int rc; if ((buf->CreationTime == 0) && (buf->LastAccessTime == 0) && - (buf->LastWriteTime == 0) && (buf->ChangeTime) && + (buf->LastWriteTime == 0) && (buf->ChangeTime == 0) && (buf->Attributes == 0)) return 0; /* would be a no op, no sense sending this */ |