gfs2: Add clean argument to lm_unmount hook

Add a 'clean' argument to ->lm_unmount() that indicates whether the
filesystem is clean or needs recovery.  Set clean to true for normal
unmounts, and to false for withdraws.

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
This commit is contained in:
Andreas Gruenbacher
2025-07-17 02:03:28 +02:00
parent 94f56488c7
commit 9334c73fb1
4 changed files with 15 additions and 5 deletions

View File

@@ -136,7 +136,7 @@ struct lm_lockops {
void (*lm_first_done) (struct gfs2_sbd *sdp);
void (*lm_recovery_result) (struct gfs2_sbd *sdp, unsigned int jid,
unsigned int result);
void (*lm_unmount) (struct gfs2_sbd *sdp);
void (*lm_unmount) (struct gfs2_sbd *sdp, bool clean);
void (*lm_withdraw) (struct gfs2_sbd *sdp);
void (*lm_put_lock) (struct gfs2_glock *gl);
int (*lm_lock) (struct gfs2_glock *gl, unsigned int req_state,

View File

@@ -1438,7 +1438,15 @@ static void gdlm_first_done(struct gfs2_sbd *sdp)
fs_err(sdp, "mount first_done error %d\n", error);
}
static void gdlm_unmount(struct gfs2_sbd *sdp)
/*
* gdlm_unmount - release our lockspace
* @sdp: the superblock
* @clean: Indicates whether or not the remaining nodes in the cluster should
* perform recovery. Recovery is necessary when a node withdraws and
* its journal remains dirty. Recovery isn't necessary when a node
* cleanly unmounts a filesystem.
*/
static void gdlm_unmount(struct gfs2_sbd *sdp, bool clean)
{
struct lm_lockstruct *ls = &sdp->sd_lockstruct;
@@ -1456,7 +1464,9 @@ static void gdlm_unmount(struct gfs2_sbd *sdp)
release:
down_write(&ls->ls_sem);
if (ls->ls_dlm) {
dlm_release_lockspace(ls->ls_dlm, DLM_RELEASE_NORMAL);
dlm_release_lockspace(ls->ls_dlm,
clean ? DLM_RELEASE_NORMAL :
DLM_RELEASE_RECOVER);
ls->ls_dlm = NULL;
}
up_write(&ls->ls_sem);

View File

@@ -1041,7 +1041,7 @@ void gfs2_lm_unmount(struct gfs2_sbd *sdp)
{
const struct lm_lockops *lm = sdp->sd_lockstruct.ls_ops;
if (!gfs2_withdrawing_or_withdrawn(sdp) && lm->lm_unmount)
lm->lm_unmount(sdp);
lm->lm_unmount(sdp, true);
}
static int wait_on_journal(struct gfs2_sbd *sdp)

View File

@@ -339,7 +339,7 @@ void gfs2_withdraw(struct gfs2_sbd *sdp)
if (lm->lm_unmount) {
fs_err(sdp, "telling LM to unmount\n");
lm->lm_unmount(sdp);
lm->lm_unmount(sdp, false);
}
fs_err(sdp, "File system withdrawn\n");
dump_stack();