]> Gentwo Git Trees - linux/.git/commitdiff
gfs2: Add clean argument to lm_unmount hook
authorAndreas Gruenbacher <agruenba@redhat.com>
Thu, 17 Jul 2025 00:03:28 +0000 (02:03 +0200)
committerAndreas Gruenbacher <agruenba@redhat.com>
Wed, 26 Nov 2025 23:51:47 +0000 (23:51 +0000)
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>
fs/gfs2/glock.h
fs/gfs2/lock_dlm.c
fs/gfs2/ops_fstype.c
fs/gfs2/util.c

index d041b922b45e3b3b0e5f648081f5d7b1f8ee7e1c..dfbe06346b35e7259772d3f3febe06486760ee5f 100644 (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,
index 4f00af7dd256b6fcf342f4929159bc21e699c9fa..c18e732a04bd199a43bbebf037c9b0f33820b7e1 100644 (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);
index 1a2db8053da04c6587bf7e753e70c3708f6dfa18..f748d320fa1489821c9edf34d363db2600886971 100644 (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)
index 56412f63f3bb9b10b7c7b627b5fc5caeaecdacfb..27fdcbce2d754671176ba51f1b3aaf5c77f9f3f2 100644 (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();