diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 07c14f9217cb873c40d30ac7516a3fc5babb5081..7f5f6176c6f15caff307e078320122141c119ab9 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c @@ -739,6 +739,15 @@ cifs_reopen_file(struct cifsFileInfo *cfile, bool can_flush) * 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);