In pcs_cs_find_create(), when __lookup_cs() finds an existing cs
during the creation path, cs->lock is acquired but not released
before calling pcs_cs_destroy(cs) and jumping to 'again'.

This lock leak can trigger "BUG: workqueue leaked lock or atomic"
errors when called from the workqueue function fuse_complete_map_work().
Holding a spin_lock makes the kworker unschedulable, which violates
workqueue execution requirements.

Fixes: commit "fs: fuse: pcs: implement dislog"
https://virtuozzo.atlassian.net/browse/VSTOR-120551

Signed-off-by: Liu Kui <[email protected]>
---
 fs/fuse/kio/pcs/pcs_cs.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/fuse/kio/pcs/pcs_cs.c b/fs/fuse/kio/pcs/pcs_cs.c
index 275fc8bd218d..8f4011f2afd3 100644
--- a/fs/fuse/kio/pcs/pcs_cs.c
+++ b/fs/fuse/kio/pcs/pcs_cs.c
@@ -253,6 +253,7 @@ struct pcs_cs *pcs_cs_find_create(struct pcs_cs_set *csset, 
PCS_NODE_ID_T *id, P
        if (__lookup_cs(csset, id->val)) {
                spin_unlock(&csset->lock);
                cs->is_dead = 1;
+               spin_unlock(&cs->lock);
                pcs_cs_destroy(cs);
                goto again;
        }
-- 
2.39.5 (Apple Git-154)

_______________________________________________
Devel mailing list
[email protected]
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to