diff --git a/fs/smb/server/oplock.c b/fs/smb/server/oplock.c index 562b180459a1..e0eb7cb2a525 100644 --- a/fs/smb/server/oplock.c +++ b/fs/smb/server/oplock.c @@ -1191,6 +1191,12 @@ int smb_grant_oplock(struct ksmbd_work *work, int req_op_level, u64 pid, bool prev_op_has_lease; __le32 prev_op_state = 0; + /* Only v2 leases handle the directory */ + if (S_ISDIR(file_inode(fp->filp)->i_mode)) { + if (!lctx || lctx->version != 2) + return 0; + } + opinfo = alloc_opinfo(work, pid, tid); if (!opinfo) return -ENOMEM;