Skip to contentSkip to conversation

gfs2: move msleep to sleepable context

PATCH Applied Alexander Aring 2 participants 2 messages Mar 31, 2025 – Apr 1, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 gfs2: move msleep to sleepable context

This patch moves the msleep_interruptible() out of the non-sleepable context by moving the ls->ls_recover_spin spinlock around so msleep_interruptible() will be called in a sleepable context.

Fixes 4a7727725dc7 ("GFS2: Fix recovery issues for spectators")

---
changes since v2:
- move the spinlock around to avoid schedule under spinlock

 fs/gfs2/lock_dlm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
fs/gfs2/lock_dlm.c +2 -1
index 58aeeae7ed8c..2c9172dd41e7 100644
@@ -996,14 +996,15 @@ static int control_mount(struct gfs2_sbd *sdp)
 		if (sdp->sd_args.ar_spectator) {
 			fs_info(sdp, "Recovery is required. Waiting for a "
 				"non-spectator to mount.\n");
+			spin_unlock(&ls->ls_recover_spin);
 			msleep_interruptible(1000);
 		} else {
 			fs_info(sdp, "control_mount wait1 block %u start %u "
 				"mount %u lvb %u flags %lx\n", block_gen,
 				start_gen, mount_gen, lvb_gen,
 				ls->ls_recover_flags);
+			spin_unlock(&ls->ls_recover_spin);
 		}
-		spin_unlock(&ls->ls_recover_spin);
 		goto restart;
 	}
 
Signature · 1 line
2.43.0
maintainer Applied
#1 lore raw
Quoted 37 lines · Alexander Aring

This patch moves the msleep_interruptible() out of the non-sleepable context by moving the ls->ls_recover_spin spinlock around so msleep_interruptible() will be called in a sleepable context.

Fixes 4a7727725dc7 ("GFS2: Fix recovery issues for spectators")

---
changes since v2:
- move the spinlock around to avoid schedule under spinlock

 fs/gfs2/lock_dlm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
fs/gfs2/lock_dlm.c +2 -2
index 58aeeae7ed8c..2c9172dd41e7 100644
@@ -996,14 +996,15 @@ static int control_mount(struct gfs2_sbd *sdp)
                if (sdp->sd_args.ar_spectator) {
                        fs_info(sdp, "Recovery is required. Waiting for a "
                                "non-spectator to mount.\n");
+                       spin_unlock(&ls->ls_recover_spin);
                        msleep_interruptible(1000);
                } else {
                        fs_info(sdp, "control_mount wait1 block %u start %u "
                                "mount %u lvb %u flags %lx\n", block_gen,
                                start_gen, mount_gen, lvb_gen,
                                ls->ls_recover_flags);
+                       spin_unlock(&ls->ls_recover_spin);
                }
-               spin_unlock(&ls->ls_recover_spin);
                goto restart;
        }
 
--
Quoted 1 line

2.43.0

Pushed to for-next, thanks.

Andreas