Commit fd09b7d3 authored by Steve French's avatar Steve French

smb3: Do not send SMB3 SET_INFO if nothing changed

An earlier commit had a typo which prevented the
optimization from working:

commit 18dd8e1a ("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: default avatarPavel Shilovsky <pshilov@microsoft.com>
CC: Stable <stable@vger.kernel.org> # 4.9.x+
Reported-by: default avatarStefan Metzmacher <metze@samba.org>
Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
parent d2586500
...@@ -1120,6 +1120,8 @@ cifs_set_file_info(struct inode *inode, struct iattr *attrs, unsigned int xid, ...@@ -1120,6 +1120,8 @@ cifs_set_file_info(struct inode *inode, struct iattr *attrs, unsigned int xid,
if (!server->ops->set_file_info) if (!server->ops->set_file_info)
return -ENOSYS; return -ENOSYS;
info_buf.Pad = 0;
if (attrs->ia_valid & ATTR_ATIME) { if (attrs->ia_valid & ATTR_ATIME) {
set_time = true; set_time = true;
info_buf.LastAccessTime = info_buf.LastAccessTime =
......
...@@ -283,7 +283,7 @@ smb2_set_file_info(struct inode *inode, const char *full_path, ...@@ -283,7 +283,7 @@ smb2_set_file_info(struct inode *inode, const char *full_path,
int rc; int rc;
if ((buf->CreationTime == 0) && (buf->LastAccessTime == 0) && if ((buf->CreationTime == 0) && (buf->LastAccessTime == 0) &&
(buf->LastWriteTime == 0) && (buf->ChangeTime) && (buf->LastWriteTime == 0) && (buf->ChangeTime == 0) &&
(buf->Attributes == 0)) (buf->Attributes == 0))
return 0; /* would be a no op, no sense sending this */ return 0; /* would be a no op, no sense sending this */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment