public inbox for gfs2@lists.linux.dev
 help / color / mirror / Atom feed
From: Kevin Hao <haokexin@gmail.com>
To: Andreas Gruenbacher <agruenba@redhat.com>
Cc: gfs2@lists.linux.dev, "Rafael J. Wysocki" <rafael@kernel.org>,
	Pavel Machek <pavel@ucw.cz>
Subject: [PATCH 1/2] gfs2: Add missing set_freezable() for freezable kthread
Date: Mon, 18 Dec 2023 13:35:57 +0800	[thread overview]
Message-ID: <20231218053558.1200822-1-haokexin@gmail.com> (raw)

The kernel thread function gfs2_logd() and gfs2_quotad() invoke the
try_to_freeze() in its loop. But all the kernel threads are no-freezable
by default. So if we want to make a kernel thread to be freezable,
we have to invoke set_freezable() explicitly.

Signed-off-by: Kevin Hao <haokexin@gmail.com>
---
 fs/gfs2/log.c   | 1 +
 fs/gfs2/quota.c | 1 +
 2 files changed, 2 insertions(+)

diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c
index e5271ae87d1c..a268b69bb636 100644
--- a/fs/gfs2/log.c
+++ b/fs/gfs2/log.c
@@ -1297,6 +1297,7 @@ int gfs2_logd(void *data)
 	struct gfs2_sbd *sdp = data;
 	unsigned long t = 1;
 
+	set_freezable();
 	while (!kthread_should_stop()) {
 		if (gfs2_withdrawn(sdp))
 			break;
diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c
index fa47824acf13..173581736a6e 100644
--- a/fs/gfs2/quota.c
+++ b/fs/gfs2/quota.c
@@ -1583,6 +1583,7 @@ int gfs2_quotad(void *data)
 	unsigned long quotad_timeo = 0;
 	unsigned long t = 0;
 
+	set_freezable();
 	while (!kthread_should_stop()) {
 		if (gfs2_withdrawn(sdp))
 			break;
-- 
2.39.2


             reply	other threads:[~2023-12-18  5:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-18  5:35 Kevin Hao [this message]
2023-12-18  5:35 ` [PATCH 2/2] gfs2: Use wait_event_freezable_timeout() for freezable kthread Kevin Hao
2023-12-21 14:11   ` Andreas Gruenbacher
2023-12-21 14:10 ` [PATCH 1/2] gfs2: Add missing set_freezable() " Andreas Gruenbacher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231218053558.1200822-1-haokexin@gmail.com \
    --to=haokexin@gmail.com \
    --cc=agruenba@redhat.com \
    --cc=gfs2@lists.linux.dev \
    --cc=pavel@ucw.cz \
    --cc=rafael@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox