From: Alexander Aring Date: Wed, 13 Oct 2021 10:02:00 -0400 Subject: [Cluster-devel] [PATCH gfs2/for-next] gfs2: check context on gfs2_glock_put Message-ID: <20211013140200.516387-1-aahringo@redhat.com> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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. Signed-off-by: Alexander Aring --- fs/gfs2/glock.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c index ccbfbc93e954..689dbe37fd91 100644 --- a/fs/gfs2/glock.c +++ b/fs/gfs2/glock.c @@ -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; -- 2.27.0