summaryrefslogtreecommitdiffstats
path: root/fs/cifs/file.c
diff options
context:
space:
mode:
authorPavel Shilovsky <pshilov@microsoft.com>2016-10-12 00:34:07 +0200
committerSteve French <smfrench@gmail.com>2016-10-14 02:48:59 +0200
commitde74025052ef63852d80a444ea19f2bdd7bec63f (patch)
tree472bb2dd2be1ffcb96d6a7edd25e1831ad32fcd9 /fs/cifs/file.c
parentCIFS: Fix persistent handles re-opening on reconnect (diff)
downloadlinux-de74025052ef63852d80a444ea19f2bdd7bec63f.tar.xz
linux-de74025052ef63852d80a444ea19f2bdd7bec63f.zip
CIFS: Reset read oplock to NONE if we have mandatory locks after reopen
We are already doing the same thing for an ordinary open case: we can't keep read oplock on a file if we have mandatory byte-range locks because pagereading can conflict with these locks on a server. Fix it by setting oplock level to NONE. Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com> Signed-off-by: Steve French <smfrench@gmail.com>
Diffstat (limited to '')
-rw-r--r--fs/cifs/file.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index 07c14f9217cb..7f5f6176c6f1 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -739,6 +739,15 @@ reopen_success:
* to the server to get the new inode info.
*/
+ /*
+ * If the server returned a read oplock and we have mandatory brlocks,
+ * set oplock level to None.
+ */
+ if (server->ops->is_read_op(oplock) && cifs_has_mand_locks(cinode)) {
+ cifs_dbg(FYI, "Reset oplock val from read to None due to mand locks\n");
+ oplock = 0;
+ }
+
server->ops->set_fid(cfile, &cfile->fid, oplock);
if (oparms.reconnect)
cifs_relock_file(cfile);