Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+15 -5
+1 -1
fs/gfs2/glock.h
··· 136 136 void (*lm_first_done) (struct gfs2_sbd *sdp); 137 137 void (*lm_recovery_result) (struct gfs2_sbd *sdp, unsigned int jid, 138 138 unsigned int result); 139 - void (*lm_unmount) (struct gfs2_sbd *sdp); 139 + void (*lm_unmount) (struct gfs2_sbd *sdp, bool clean); 140 140 void (*lm_withdraw) (struct gfs2_sbd *sdp); 141 141 void (*lm_put_lock) (struct gfs2_glock *gl); 142 142 int (*lm_lock) (struct gfs2_glock *gl, unsigned int req_state,
+12 -2
fs/gfs2/lock_dlm.c
··· 1438 1438 fs_err(sdp, "mount first_done error %d\n", error); 1439 1439 } 1440 1440 1441 - static void gdlm_unmount(struct gfs2_sbd *sdp) 1441 + /* 1442 + * gdlm_unmount - release our lockspace 1443 + * @sdp: the superblock 1444 + * @clean: Indicates whether or not the remaining nodes in the cluster should 1445 + * perform recovery. Recovery is necessary when a node withdraws and 1446 + * its journal remains dirty. Recovery isn't necessary when a node 1447 + * cleanly unmounts a filesystem. 1448 + */ 1449 + static void gdlm_unmount(struct gfs2_sbd *sdp, bool clean) 1442 1450 { 1443 1451 struct lm_lockstruct *ls = &sdp->sd_lockstruct; 1444 1452 ··· 1464 1456 release: 1465 1457 down_write(&ls->ls_sem); 1466 1458 if (ls->ls_dlm) { 1467 - dlm_release_lockspace(ls->ls_dlm, DLM_RELEASE_NORMAL); 1459 + dlm_release_lockspace(ls->ls_dlm, 1460 + clean ? DLM_RELEASE_NORMAL : 1461 + DLM_RELEASE_RECOVER); 1468 1462 ls->ls_dlm = NULL; 1469 1463 } 1470 1464 up_write(&ls->ls_sem);
+1 -1
fs/gfs2/ops_fstype.c
··· 1041 1041 { 1042 1042 const struct lm_lockops *lm = sdp->sd_lockstruct.ls_ops; 1043 1043 if (!gfs2_withdrawing_or_withdrawn(sdp) && lm->lm_unmount) 1044 - lm->lm_unmount(sdp); 1044 + lm->lm_unmount(sdp, true); 1045 1045 } 1046 1046 1047 1047 static int wait_on_journal(struct gfs2_sbd *sdp)
+1 -1
fs/gfs2/util.c
··· 339 339 340 340 if (lm->lm_unmount) { 341 341 fs_err(sdp, "telling LM to unmount\n"); 342 - lm->lm_unmount(sdp); 342 + lm->lm_unmount(sdp, false); 343 343 } 344 344 fs_err(sdp, "File system withdrawn\n"); 345 345 dump_stack();