Skip to content

Commit

Permalink
ksmbd: only v2 leases handle the directory
Browse files Browse the repository at this point in the history
When smb2 leases is disable, ksmbd can send oplock break notification
and cause wait oplock break ack timeout. It may appear like hang when
accessing a directory. This patch make only v2 leases handle the
directory.

Cc: [email protected]
Signed-off-by: Namjae Jeon <[email protected]>
Signed-off-by: Steve French <[email protected]>
  • Loading branch information
namjaejeon authored and Steve French committed Jan 15, 2024
1 parent 38d20c6 commit 77bebd1
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions fs/smb/server/oplock.c
Original file line number Diff line number Diff line change
Expand Up @@ -1197,6 +1197,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;
Expand Down

0 comments on commit 77bebd1

Please sign in to comment.