Commit 97c2ec64 authored by Namjae Jeon's avatar Namjae Jeon Committed by Steve French

ksmbd: avoid to send duplicate lease break notifications

This patch fixes generic/011 when enable smb2 leases.

if ksmbd sends multiple notifications for a file, cifs increments
the reference count of the file but it does not decrement the count by
the failure of queue_work.
So even if the file is closed, cifs does not send a SMB2_CLOSE request.

Cc: stable@vger.kernel.org
Signed-off-by: default avatarNamjae Jeon <linkinjeon@kernel.org>
Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
parent cc00bc83
...@@ -613,14 +613,24 @@ static int oplock_break_pending(struct oplock_info *opinfo, int req_op_level) ...@@ -613,14 +613,24 @@ static int oplock_break_pending(struct oplock_info *opinfo, int req_op_level)
if (opinfo->op_state == OPLOCK_CLOSING) if (opinfo->op_state == OPLOCK_CLOSING)
return -ENOENT; return -ENOENT;
else if (!opinfo->is_lease && opinfo->level <= req_op_level) else if (opinfo->level <= req_op_level) {
if (opinfo->is_lease &&
opinfo->o_lease->state !=
(SMB2_LEASE_HANDLE_CACHING_LE |
SMB2_LEASE_READ_CACHING_LE))
return 1; return 1;
} }
}
if (!opinfo->is_lease && opinfo->level <= req_op_level) { if (opinfo->level <= req_op_level) {
if (opinfo->is_lease &&
opinfo->o_lease->state !=
(SMB2_LEASE_HANDLE_CACHING_LE |
SMB2_LEASE_READ_CACHING_LE)) {
wake_up_oplock_break(opinfo); wake_up_oplock_break(opinfo);
return 1; return 1;
} }
}
return 0; return 0;
} }
...@@ -887,7 +897,6 @@ static int oplock_break(struct oplock_info *brk_opinfo, int req_op_level) ...@@ -887,7 +897,6 @@ static int oplock_break(struct oplock_info *brk_opinfo, int req_op_level)
struct lease *lease = brk_opinfo->o_lease; struct lease *lease = brk_opinfo->o_lease;
atomic_inc(&brk_opinfo->breaking_cnt); atomic_inc(&brk_opinfo->breaking_cnt);
err = oplock_break_pending(brk_opinfo, req_op_level); err = oplock_break_pending(brk_opinfo, req_op_level);
if (err) if (err)
return err < 0 ? err : 0; return err < 0 ? err : 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment