diff options
| author | Andreas Gruenbacher <agruenba@redhat.com> | 2025-07-17 02:03:28 +0200 |
|---|---|---|
| committer | Andreas Gruenbacher <agruenba@redhat.com> | 2025-11-26 23:51:47 +0000 |
| commit | 9334c73fb16b183a6d4af09ce1d445f7f89b8d49 (patch) | |
| tree | d305ef50f08d207efd51a80e0f82150c73cff744 /fs/gfs2 | |
| parent | 94f56488c7e47579aae8f20323c43d27b7b5f4ef (diff) | |
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>
Diffstat (limited to 'fs/gfs2')
| -rw-r--r-- | fs/gfs2/glock.h | 2 | ||||
| -rw-r--r-- | fs/gfs2/lock_dlm.c | 14 | ||||
| -rw-r--r-- | fs/gfs2/ops_fstype.c | 2 | ||||
| -rw-r--r-- | fs/gfs2/util.c | 2 |
4 files changed, 15 insertions, 5 deletions
diff --git a/fs/gfs2/glock.h b/fs/gfs2/glock.h index d041b922b45e..dfbe06346b35 100644 --- a/fs/gfs2/glock.h +++ b/fs/gfs2/glock.h @@ -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, diff --git a/fs/gfs2/lock_dlm.c b/fs/gfs2/lock_dlm.c index 4f00af7dd256..c18e732a04bd 100644 --- a/fs/gfs2/lock_dlm.c +++ b/fs/gfs2/lock_dlm.c @@ -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); diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c index 1a2db8053da0..f748d320fa14 100644 --- a/fs/gfs2/ops_fstype.c +++ b/fs/gfs2/ops_fstype.c @@ -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) diff --git a/fs/gfs2/util.c b/fs/gfs2/util.c index 56412f63f3bb..27fdcbce2d75 100644 --- a/fs/gfs2/util.c +++ b/fs/gfs2/util.c @@ -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(); |
