]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
ksmbd: annotate oplock list traversals under m_lock
authorRunyu Xiao <runyu.xiao@seu.edu.cn>
Fri, 26 Jun 2026 15:31:53 +0000 (00:31 +0900)
committerSteve French <stfrench@microsoft.com>
Wed, 1 Jul 2026 02:29:46 +0000 (21:29 -0500)
session_fd_check() and ksmbd_reopen_durable_fd() walk ci->m_op_list with
list_for_each_entry_rcu() while holding ci->m_lock for write. That is
the local inode/oplock serializer, but the RCU-list iterator does not
currently tell lockdep about it.

Pass lockdep_is_held(&ci->m_lock) to these iterators so
CONFIG_PROVE_RCU_LIST can see the rwsem protection already in place.

This was found by our static analysis tool and then manually reviewed
against the current tree. The dynamic triage evidence is a
target-matched CONFIG_PROVE_RCU_LIST warning; the change is limited
to documenting the existing protection contract.

This is a lockdep annotation cleanup. It does not change oplock list
lifetime or durable-handle behavior.

Signed-off-by: Runyu Xiao <runyu.xiao@seu.edu.cn>
Acked-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/smb/server/vfs_cache.c

index fde22742d193b7211c1dd96637f1cfb2accfe8b8..525e9a3a2e9b8d86204e05f21edd50c44777aa1e 100644 (file)
@@ -1530,7 +1530,8 @@ static bool session_fd_check(struct ksmbd_tree_connect *tcon,
        conn = fp->conn;
        ci = fp->f_ci;
        down_write(&ci->m_lock);
-       list_for_each_entry_rcu(op, &ci->m_op_list, op_entry) {
+       list_for_each_entry_rcu(op, &ci->m_op_list, op_entry,
+                               lockdep_is_held(&ci->m_lock)) {
                if (op->conn != conn)
                        continue;
                ksmbd_conn_put(op->conn);
@@ -1685,7 +1686,8 @@ int ksmbd_reopen_durable_fd(struct ksmbd_work *work, struct ksmbd_file *fp)
 
        ci = fp->f_ci;
        down_write(&ci->m_lock);
-       list_for_each_entry_rcu(op, &ci->m_op_list, op_entry) {
+       list_for_each_entry_rcu(op, &ci->m_op_list, op_entry,
+                               lockdep_is_held(&ci->m_lock)) {
                if (op->conn)
                        continue;
                op->conn = ksmbd_conn_get(fp->conn);