Skip to contentSkip to conversation

gfs2: don't withdraw if init_threads() got interrupted

PATCH In review Alexander Aring 2 participants 2 messages Oct 31, 2023 – Nov 2, 2023 GFS2 file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gfs2: don't withdraw if init_threads() got interrupted

When interrupting a gfs2 mount process by e.g. SIGKILL it could be that kthread_create() returns -EINTR. If this happens we see on the kernel log:

[55942.843273] gfs2: fsid=gohan:gohan0.2: can't create logd thread: -4
[56186.441647] gfs2: fsid=gohan:gohan0: Trying to join cluster

"lock_dlm", "gohan:gohan0"

The issue is that we can never mount it again because gfs2 does not cleanup the lockspace and it returns -EEXIST without mounting anything:

[56186.443041] gfs2: fsid=gohan:gohan0: dlm_new_lockspace error -17

The issue is (so far I see on the code) that init_threads() can returns -4 (-EINTR) what we see above and then calls gfs2_withdraw_delayed(). This will set the SDF_WITHDRAWING and gfs2_lm_unmount() will then not call unmount and will never release the lockspace.

This patch just don't call gfs2_withdraw_delayed() if init_threads() returns -EINTR.

---
 fs/gfs2/ops_fstype.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
fs/gfs2/ops_fstype.c +7 -1
index 33ca04733e93..227e8b3c2abf 100644
@@ -1281,7 +1281,13 @@ static int gfs2_fill_super(struct super_block *sb, struct fs_context *fc)
 
 	if (!sb_rdonly(sb)) {
 		error = init_threads(sdp);
-		if (error) {
+		if (error == -EINTR) {
+			/* no setting of SDF_WITHDRAWING when
+			 * kthread_create() returns -EINTR to
+			 * allow lockspace getting released.
+			 */
+			goto fail_per_node;
+		} else if (error) {
 			gfs2_withdraw_delayed(sdp);
 			goto fail_per_node;
 		}
Signature · 1 line
2.39.3
#1 lore raw

Alex,

Quoted 2 lines · Alexander Aring

This patch just don't call gfs2_withdraw_delayed() if init_threads() returns -EINTR.

that's close, but calling gfs2_withdraw_delayed() actually never makes sense in this context. I'll follow up with a patch that describes why.

Thanks,
Andreas