Skip to content

Commit 9334c73

Browse files
author
Andreas Gruenbacher
committed
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>
1 parent 94f5648 commit 9334c73

4 files changed

Lines changed: 15 additions & 5 deletions

File tree

fs/gfs2/glock.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ struct lm_lockops {
136136
void (*lm_first_done) (struct gfs2_sbd *sdp);
137137
void (*lm_recovery_result) (struct gfs2_sbd *sdp, unsigned int jid,
138138
unsigned int result);
139-
void (*lm_unmount) (struct gfs2_sbd *sdp);
139+
void (*lm_unmount) (struct gfs2_sbd *sdp, bool clean);
140140
void (*lm_withdraw) (struct gfs2_sbd *sdp);
141141
void (*lm_put_lock) (struct gfs2_glock *gl);
142142
int (*lm_lock) (struct gfs2_glock *gl, unsigned int req_state,

fs/gfs2/lock_dlm.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1438,7 +1438,15 @@ static void gdlm_first_done(struct gfs2_sbd *sdp)
14381438
fs_err(sdp, "mount first_done error %d\n", error);
14391439
}
14401440

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)
14421450
{
14431451
struct lm_lockstruct *ls = &sdp->sd_lockstruct;
14441452

@@ -1456,7 +1464,9 @@ static void gdlm_unmount(struct gfs2_sbd *sdp)
14561464
release:
14571465
down_write(&ls->ls_sem);
14581466
if (ls->ls_dlm) {
1459-
dlm_release_lockspace(ls->ls_dlm, DLM_RELEASE_NORMAL);
1467+
dlm_release_lockspace(ls->ls_dlm,
1468+
clean ? DLM_RELEASE_NORMAL :
1469+
DLM_RELEASE_RECOVER);
14601470
ls->ls_dlm = NULL;
14611471
}
14621472
up_write(&ls->ls_sem);

fs/gfs2/ops_fstype.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1041,7 +1041,7 @@ void gfs2_lm_unmount(struct gfs2_sbd *sdp)
10411041
{
10421042
const struct lm_lockops *lm = sdp->sd_lockstruct.ls_ops;
10431043
if (!gfs2_withdrawing_or_withdrawn(sdp) && lm->lm_unmount)
1044-
lm->lm_unmount(sdp);
1044+
lm->lm_unmount(sdp, true);
10451045
}
10461046

10471047
static int wait_on_journal(struct gfs2_sbd *sdp)

fs/gfs2/util.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ void gfs2_withdraw(struct gfs2_sbd *sdp)
339339

340340
if (lm->lm_unmount) {
341341
fs_err(sdp, "telling LM to unmount\n");
342-
lm->lm_unmount(sdp);
342+
lm->lm_unmount(sdp, false);
343343
}
344344
fs_err(sdp, "File system withdrawn\n");
345345
dump_stack();

0 commit comments

Comments
 (0)