gfs2: check context on gfs2_glock_put
PATCH 1/1 gfs2: check context on gfs2_glock_put
This patch adds a might_sleep() call into gfs2_glock_put() which could sleep if last reference is released. A comment leaves a note for the programmer that the only reason why it might can sleep is that the DLM api is called which is currently sleepable context. Checking on sleepable context in gfs2_glock_put() will show us problems earlier instead of seeing issues only if the last put occurred.
--- fs/gfs2/glock.c | 3 +++ 1 file changed, 3 insertions(+)
fs/gfs2/glock.c +3 -0
@@ -294,6 +294,9 @@ void gfs2_glock_queue_put(struct gfs2_glock *gl)void gfs2_glock_put (struct gfs2_glock *gl) { +/* last put could call sleepable dlm api */ +might_sleep (); +if (lockref_put_or_lock (&gl->gl_lockref))return ;
Signature · 1 line
2.27.0
Andreas Gruenbacher
maintainerPATCH 1/1 gfs2: check context on gfs2_glock_put
Quoted 6 lines · Alexander Aring
This patch adds a
might_sleep()call intogfs2_glock_put()which could sleep if last reference is released. A comment leaves a note for the programmer that the only reason why it might can sleep is that the DLM api is called which is currently sleepable context. Checking on sleepable context ingfs2_glock_put()will show us problems earlier instead of seeing issues only if the last put occurred.
Thanks, I've pushed this to for-next.
Andreas