All of lore.kernel.org
 help / color / mirror / Atom feed
* [Cluster-devel] [PATCH gfs2/for-next] gfs2: check context on gfs2_glock_put
@ 2021-10-13 14:02 Alexander Aring
  2021-10-13 14:16 ` Andreas Gruenbacher
  0 siblings, 1 reply; 2+ messages in thread
From: Alexander Aring @ 2021-10-13 14:02 UTC (permalink / raw)
  To: cluster-devel.redhat.com

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 <aahringo@redhat.com>
---
 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



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [Cluster-devel] [PATCH gfs2/for-next] gfs2: check context on gfs2_glock_put
  2021-10-13 14:02 [Cluster-devel] [PATCH gfs2/for-next] gfs2: check context on gfs2_glock_put Alexander Aring
@ 2021-10-13 14:16 ` Andreas Gruenbacher
  0 siblings, 0 replies; 2+ messages in thread
From: Andreas Gruenbacher @ 2021-10-13 14:16 UTC (permalink / raw)
  To: cluster-devel.redhat.com

On Wed, Oct 13, 2021 at 4:02 PM Alexander Aring <aahringo@redhat.com> wrote:
> 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.

Thanks, I've pushed this to for-next.

Andreas



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-10-13 14:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-13 14:02 [Cluster-devel] [PATCH gfs2/for-next] gfs2: check context on gfs2_glock_put Alexander Aring
2021-10-13 14:16 ` Andreas Gruenbacher

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.