Skip to content

Commit de74025

Browse files
piastrysmfrench
authored andcommitted
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>
1 parent f2cca6a commit de74025

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

fs/cifs/file.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -739,6 +739,15 @@ cifs_reopen_file(struct cifsFileInfo *cfile, bool can_flush)
739739
* to the server to get the new inode info.
740740
*/
741741

742+
/*
743+
* If the server returned a read oplock and we have mandatory brlocks,
744+
* set oplock level to None.
745+
*/
746+
if (server->ops->is_read_op(oplock) && cifs_has_mand_locks(cinode)) {
747+
cifs_dbg(FYI, "Reset oplock val from read to None due to mand locks\n");
748+
oplock = 0;
749+
}
750+
742751
server->ops->set_fid(cfile, &cfile->fid, oplock);
743752
if (oparms.reconnect)
744753
cifs_relock_file(cfile);

0 commit comments

Comments
 (0)