[GFS2] journal recovery patch

This is one of the changes related to journal recovery I mentioned a
couple weeks ago.  We can get into a situation where there are only
readonly nodes currently mounting the fs, but there are journals that need
to be recovered.  Since the readonly nodes can't recover journals, the
next rw mounter needs to go through and check all journals and recover any
that are dirty (i.e. what the first node to mount the fs does).  This rw
mounter needs to skip the journals held by the existing readonly nodes.
Skipping those journals amounts to using the TRY flag on the journal locks
so acquiring the lock of a journal held by a readonly node will fail
instead of blocking indefinately.

Signed-off-by: David Teigland <teigland@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c
index 4538a1e..70745f3 100644
--- a/fs/gfs2/ops_fstype.c
+++ b/fs/gfs2/ops_fstype.c
@@ -444,8 +444,7 @@
 	if (sdp->sd_lockstruct.ls_first) {
 		unsigned int x;
 		for (x = 0; x < sdp->sd_journals; x++) {
-			error = gfs2_recover_journal(gfs2_jdesc_find(sdp, x),
-						     WAIT);
+			error = gfs2_recover_journal(gfs2_jdesc_find(sdp, x));
 			if (error) {
 				fs_err(sdp, "error recovering journal %u: %d\n",
 				       x, error);
@@ -455,7 +454,7 @@
 
 		gfs2_lm_others_may_mount(sdp);
 	} else if (!sdp->sd_args.ar_spectator) {
-		error = gfs2_recover_journal(sdp->sd_jdesc, WAIT);
+		error = gfs2_recover_journal(sdp->sd_jdesc);
 		if (error) {
 			fs_err(sdp, "error recovering my journal: %d\n", error);
 			goto fail_jinode_gh;
diff --git a/fs/gfs2/recovery.c b/fs/gfs2/recovery.c
index 68c8561..e91c2bd 100644
--- a/fs/gfs2/recovery.c
+++ b/fs/gfs2/recovery.c
@@ -418,7 +418,6 @@
 /**
  * gfs2_recover_journal - recovery a given journal
  * @jd: the struct gfs2_jdesc describing the journal
- * @wait: Don't return until the journal is clean (or an error is encountered)
  *
  * Acquire the journal's lock, check to see if the journal is clean, and
  * do recovery if necessary.
@@ -426,7 +425,7 @@
  * Returns: errno
  */
 
-int gfs2_recover_journal(struct gfs2_jdesc *jd, int wait)
+int gfs2_recover_journal(struct gfs2_jdesc *jd)
 {
 	struct gfs2_inode *ip = jd->jd_inode->u.generic_ip;
 	struct gfs2_sbd *sdp = ip->i_sbd;
@@ -441,12 +440,10 @@
 
 	/* Aquire the journal lock so we can do recovery */
 
-	error = gfs2_glock_nq_num(sdp,
-				  jd->jd_jid, &gfs2_journal_glops,
+	error = gfs2_glock_nq_num(sdp, jd->jd_jid, &gfs2_journal_glops,
 				  LM_ST_EXCLUSIVE,
-				  LM_FLAG_NOEXP |
-				  ((wait) ? 0 : LM_FLAG_TRY) |
-				  GL_NOCACHE, &j_gh);
+				  LM_FLAG_NOEXP | LM_FLAG_TRY | GL_NOCACHE,
+				  &j_gh);
 	switch (error) {
 	case 0:
 		break;
@@ -574,7 +571,7 @@
 			break;
 
 		if (jd != sdp->sd_jdesc)
-			gfs2_recover_journal(jd, NO_WAIT);
+			gfs2_recover_journal(jd);
 	}
 }
 
diff --git a/fs/gfs2/recovery.h b/fs/gfs2/recovery.h
index 50d7eb57..2484811 100644
--- a/fs/gfs2/recovery.h
+++ b/fs/gfs2/recovery.h
@@ -25,7 +25,7 @@
 
 int gfs2_find_jhead(struct gfs2_jdesc *jd,
 		    struct gfs2_log_header *head);
-int gfs2_recover_journal(struct gfs2_jdesc *gfs2_jd, int wait);
+int gfs2_recover_journal(struct gfs2_jdesc *gfs2_jd);
 void gfs2_check_journals(struct gfs2_sbd *sdp);
 
 #endif /* __RECOVERY_DOT_H__ */