path: root/fs
diff options
authorPavel Shilovsky <pshilov@microsoft.com>2019-09-26 12:31:20 -0700
committerSteve French <stfrench@microsoft.com>2019-09-26 16:42:44 -0500
commita016e2794fc3a245a91946038dd8f34d65e53cc3 (patch)
treed0426c430d8d65db4760e5c8cf6380ce6bb95230 /fs
parentff3ee62a55869b1a64266b5c15af16f2eb37c8a7 (diff)
CIFS: Fix oplock handling for SMB 2.1+ protocols
There may be situations when a server negotiates SMB 2.1 protocol version or higher but responds to a CREATE request with an oplock rather than a lease. Currently the client doesn't handle such a case correctly: when another CREATE comes in the server sends an oplock break to the initial CREATE and the client doesn't send an ack back due to a wrong caching level being set (READ instead of RWH). Missing an oplock break ack makes the server wait until the break times out which dramatically increases the latency of the second CREATE. Fix this by properly detecting oplocks when using SMB 2.1 protocol version and higher. Cc: <stable@vger.kernel.org> Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com> Signed-off-by: Steve French <stfrench@microsoft.com> Reviewed-by: Ronnie Sahlberg <lsahlber@redhat.com>
Diffstat (limited to 'fs')
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
index 3010066a8709..4c0922596467 100644
--- a/fs/cifs/smb2ops.c
+++ b/fs/cifs/smb2ops.c
@@ -3333,6 +3333,11 @@ smb21_set_oplock_level(struct cifsInodeInfo *cinode, __u32 oplock,
+ /* Check if the server granted an oplock rather than a lease */
+ return smb2_set_oplock_level(cinode, oplock, epoch,
+ purge_cache);
if (oplock & SMB2_LEASE_READ_CACHING_HE) {
new_oplock |= CIFS_CACHE_READ_FLG;
strcat(message, "R");

Privacy Policy