Skip to contentSkip to conversation

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

PATCH In review Andreas Gruenbacher 2 participants 4 messages Nov 2, 2023 GFS2 file system

lore
Share & tools
lore

Andreas Gruenbacher

author maintainer
#0 lore raw

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

In gfs2_fill_super(), when mounting a gfs2 filesystem is interrupted, kthread_create() can return -EINTR. When that happens, we roll back what has already been done and abort the mount.

Since commit a28dc123fa66, we also call gfs2_withdraw_delayed() in gfs2_fill_super(), but that only marks the filesystem as withdrawing and relies on a caller further up the stack to do the actual withdraw -- which doesn't exist in the gfs2_fill_super() case. Because the filesystem is marked as withdrawing / withdrawn, function gfs2_lm_unmount() doesn't release the dlm lockspace, so when we try to mount that filesystem again, we get:

gfs2: fsid=gohan:gohan0: Trying to join cluster "lock_dlm", "gohan:gohan0"
gfs2: fsid=gohan:gohan0: dlm_new_lockspace error -17

Fix this by getting rid of the ill-conceived gfs2_withdraw_delayed() in gfs2_fill_super().

Fixes a28dc123fa66 ("gfs2: init system threads before freeze lock")
---
 fs/gfs2/ops_fstype.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
fs/gfs2/ops_fstype.c +1 -3
index 2fa9baf61c3f..73ae5fcea0de 100644
@@ -1279,10 +1279,8 @@ static int gfs2_fill_super(struct super_block *sb, struct fs_context *fc)
 
 	if (!sb_rdonly(sb)) {
 		error = init_threads(sdp);
-		if (error) {
-			gfs2_withdraw_delayed(sdp);
+		if (error)
 			goto fail_per_node;
-		}
 	}
 
 	error = gfs2_freeze_lock_shared(sdp);
Signature · 1 line
2.41.0
#1 lore raw

Hi,

Quoted 13 lines · Andreas Gruenbacher

In gfs2_fill_super(), when mounting a gfs2 filesystem is interrupted, kthread_create() can return -EINTR. When that happens, we roll back what has already been done and abort the mount.

Since commit a28dc123fa66, we also call gfs2_withdraw_delayed() in gfs2_fill_super(), but that only marks the filesystem as withdrawing and relies on a caller further up the stack to do the actual withdraw -- which doesn't exist in the gfs2_fill_super() case. Because the filesystem is marked as withdrawing / withdrawn, function gfs2_lm_unmount() doesn't release the dlm lockspace, so when we try to mount that filesystem again, we get:

Quoted 8 lines

gfs2: fsid=gohan:gohan0: Trying to join cluster "lock_dlm", "gohan:gohan0"
gfs2: fsid=gohan:gohan0: dlm_new_lockspace error -17

Fix this by getting rid of the ill-conceived gfs2_withdraw_delayed() in gfs2_fill_super().

Fixes a28dc123fa66 ("gfs2: init system threads before freeze lock")

nitpik, this is not the right commit, calling gfs2_withdraw_delayed() was already been there before if init_threads() fails just in super.c

I was looking there as well..., but I am happy that this is fixed now.

- Alex

author maintainer
#2 lore raw
Quoted 20 lines · Alexander Aring

Hi,

Quoted 16 lines · Andreas Gruenbacher

In gfs2_fill_super(), when mounting a gfs2 filesystem is interrupted, kthread_create() can return -EINTR. When that happens, we roll back what has already been done and abort the mount.

Since commit a28dc123fa66, we also call gfs2_withdraw_delayed() in gfs2_fill_super(), but that only marks the filesystem as withdrawing and relies on a caller further up the stack to do the actual withdraw -- which doesn't exist in the gfs2_fill_super() case. Because the filesystem is marked as withdrawing / withdrawn, function gfs2_lm_unmount() doesn't release the dlm lockspace, so when we try to mount that filesystem again, we get:

gfs2: fsid=gohan:gohan0: Trying to join cluster "lock_dlm", "gohan:gohan0"
gfs2: fsid=gohan:gohan0: dlm_new_lockspace error -17

Quoted 8 lines
Quoted 5 lines

Fix this by getting rid of the ill-conceived gfs2_withdraw_delayed() in gfs2_fill_super().

Fixes a28dc123fa66 ("gfs2: init system threads before freeze lock")

nitpik, this is not the right commit, calling gfs2_withdraw_delayed() was already been there before if init_threads() fails just in super.c

Ah, so this problem was already introduced in commit 62dd0f98a0e5 ("gfs2: Flag a withdraw if init_threads() fails"). Thanks for pointing this out; I've looked up what that was supposed to fix and I've updated the description.

Andreas

#3 lore raw

Hi,

Quoted 28 lines · Andreas Gruenbacher
Quoted 26 lines · Alexander Aring

Hi,

Quoted 21 lines · Andreas Gruenbacher

In gfs2_fill_super(), when mounting a gfs2 filesystem is interrupted, kthread_create() can return -EINTR. When that happens, we roll back what has already been done and abort the mount.

Since commit a28dc123fa66, we also call gfs2_withdraw_delayed() in gfs2_fill_super(), but that only marks the filesystem as withdrawing and relies on a caller further up the stack to do the actual withdraw -- which doesn't exist in the gfs2_fill_super() case. Because the filesystem is marked as withdrawing / withdrawn, function gfs2_lm_unmount() doesn't release the dlm lockspace, so when we try to mount that filesystem again, we get:

gfs2: fsid=gohan:gohan0: Trying to join cluster "lock_dlm", "gohan:gohan0"
gfs2: fsid=gohan:gohan0: dlm_new_lockspace error -17

Fix this by getting rid of the ill-conceived gfs2_withdraw_delayed() in gfs2_fill_super().

Fixes a28dc123fa66 ("gfs2: init system threads before freeze lock")
Quoted 7 lines
Quoted 2 lines

nitpik, this is not the right commit, calling gfs2_withdraw_delayed() was already been there before if init_threads() fails just in super.c

Ah, so this problem was already introduced in commit 62dd0f98a0e5 ("gfs2: Flag a withdraw if init_threads() fails"). Thanks for pointing this out; I've looked up what that was supposed to fix and I've updated the description.

I looked into that commit, but this also fixes some ctrl-c issues pointed out by me... I am not sure if we are going back and forward here with ctrl-c issues.

- Alex