gfs2: Fix unlikely race in gdlm_put_lock
authorAndreas Gruenbacher <agruenba@redhat.com>
Wed, 6 Aug 2025 21:34:03 +0000 (23:34 +0200)
committerAndreas Gruenbacher <agruenba@redhat.com>
Fri, 12 Sep 2025 10:03:01 +0000 (12:03 +0200)
commit28c4d9bc0708956c1a736a9e49fee71b65deee81
tree2fb62e2c1ce82e7e5adf9828bd468f4d706eaea5
parent6ab26555c9ffef96c56ca16356e55ac5ab61ec93
gfs2: Fix unlikely race in gdlm_put_lock

In gdlm_put_lock(), there is a small window of time in which the
DFL_UNMOUNT flag has been set but the lockspace hasn't been released,
yet.  In that window, dlm may still call gdlm_ast() and gdlm_bast().
To prevent it from dereferencing freed glock objects, only free the
glock if the lockspace has actually been released.

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Reviewed-by: Andrew Price <anprice@redhat.com>
fs/gfs2/lock_dlm.c