diff options
author | Steve French <smfrench@gmail.com> | 2016-09-26 15:23:08 -0400 |
---|---|---|
committer | Steve French <smfrench@gmail.com> | 2016-10-13 20:46:51 -0400 |
commit | 18dd8e1a65ddae2351d0f0d6dd4a334f441fc5fa (patch) | |
tree | de8dd8e2fa23c3c11c12e5a46bbea8f359a059bf | |
parent | 141891f4727c08829755be6c785e125d2e96c899 (diff) |
Do not send SMB3 SET_INFO request if nothing is changing
[CIFS] We had cases where we sent a SMB2/SMB3 setinfo request with all
timestamp (and DOS attribute) fields marked as 0 (ie do not change)
e.g. on chmod or chown.
Signed-off-by: Steve French <steve.french@primarydata.com>
CC: Stable <stable@vger.kernel.org>
-rw-r--r-- | fs/cifs/smb2inode.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/cifs/smb2inode.c b/fs/cifs/smb2inode.c index 4f0231e685a9..1238cd3552f9 100644 --- a/fs/cifs/smb2inode.c +++ b/fs/cifs/smb2inode.c | |||
@@ -266,9 +266,15 @@ smb2_set_file_info(struct inode *inode, const char *full_path, | |||
266 | struct tcon_link *tlink; | 266 | struct tcon_link *tlink; |
267 | int rc; | 267 | int rc; |
268 | 268 | ||
269 | if ((buf->CreationTime == 0) && (buf->LastAccessTime == 0) && | ||
270 | (buf->LastWriteTime == 0) && (buf->ChangeTime) && | ||
271 | (buf->Attributes == 0)) | ||
272 | return 0; /* would be a no op, no sense sending this */ | ||
273 | |||
269 | tlink = cifs_sb_tlink(cifs_sb); | 274 | tlink = cifs_sb_tlink(cifs_sb); |
270 | if (IS_ERR(tlink)) | 275 | if (IS_ERR(tlink)) |
271 | return PTR_ERR(tlink); | 276 | return PTR_ERR(tlink); |
277 | |||
272 | rc = smb2_open_op_close(xid, tlink_tcon(tlink), cifs_sb, full_path, | 278 | rc = smb2_open_op_close(xid, tlink_tcon(tlink), cifs_sb, full_path, |
273 | FILE_WRITE_ATTRIBUTES, FILE_OPEN, 0, buf, | 279 | FILE_WRITE_ATTRIBUTES, FILE_OPEN, 0, buf, |
274 | SMB2_OP_SET_INFO); | 280 | SMB2_OP_SET_INFO); |