Skip to content

Commit 7d9f924

Browse files
committed
gfs2: Add verbose option to check_journal_clean
Before this patch, function check_journal_clean would give messages related to journal recovery. That's fine for mount time, but when a node withdraws and forces replay that way, we don't want all those distracting and misleading messages. This patch adds a new parameter to make those messages optional. Signed-off-by: Bob Peterson <[email protected]> Reviewed-by: Andreas Gruenbacher <[email protected]>
1 parent 33dbd1e commit 7d9f924

File tree

3 files changed

+20
-9
lines changed

3 files changed

+20
-9
lines changed

fs/gfs2/ops_fstype.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -696,7 +696,7 @@ static int init_journal(struct gfs2_sbd *sdp, int undo)
696696
struct gfs2_jdesc *jd = gfs2_jdesc_find(sdp, x);
697697

698698
if (sdp->sd_args.ar_spectator) {
699-
error = check_journal_clean(sdp, jd);
699+
error = check_journal_clean(sdp, jd, true);
700700
if (error)
701701
goto fail_jinode_gh;
702702
continue;

fs/gfs2/util.c

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ void gfs2_assert_i(struct gfs2_sbd *sdp)
4646
*
4747
* Returns: 0 if the journal is clean or locked, else an error
4848
*/
49-
int check_journal_clean(struct gfs2_sbd *sdp, struct gfs2_jdesc *jd)
49+
int check_journal_clean(struct gfs2_sbd *sdp, struct gfs2_jdesc *jd,
50+
bool verbose)
5051
{
5152
int error;
5253
struct gfs2_holder j_gh;
@@ -57,23 +58,31 @@ int check_journal_clean(struct gfs2_sbd *sdp, struct gfs2_jdesc *jd)
5758
error = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED, LM_FLAG_NOEXP |
5859
GL_EXACT | GL_NOCACHE, &j_gh);
5960
if (error) {
60-
fs_err(sdp, "Error locking journal for spectator mount.\n");
61+
if (verbose)
62+
fs_err(sdp, "Error %d locking journal for spectator "
63+
"mount.\n", error);
6164
return -EPERM;
6265
}
6366
error = gfs2_jdesc_check(jd);
6467
if (error) {
65-
fs_err(sdp, "Error checking journal for spectator mount.\n");
68+
if (verbose)
69+
fs_err(sdp, "Error checking journal for spectator "
70+
"mount.\n");
6671
goto out_unlock;
6772
}
6873
error = gfs2_find_jhead(jd, &head, false);
6974
if (error) {
70-
fs_err(sdp, "Error parsing journal for spectator mount.\n");
75+
if (verbose)
76+
fs_err(sdp, "Error parsing journal for spectator "
77+
"mount.\n");
7178
goto out_unlock;
7279
}
7380
if (!(head.lh_flags & GFS2_LOG_HEAD_UNMOUNT)) {
7481
error = -EPERM;
75-
fs_err(sdp, "jid=%u: Journal is dirty, so the first mounter "
76-
"must not be a spectator.\n", jd->jd_jid);
82+
if (verbose)
83+
fs_err(sdp, "jid=%u: Journal is dirty, so the first "
84+
"mounter must not be a spectator.\n",
85+
jd->jd_jid);
7786
}
7887

7988
out_unlock:
@@ -223,7 +232,7 @@ static void signal_our_withdraw(struct gfs2_sbd *sdp)
223232
* Now wait until recovery is complete.
224233
*/
225234
for (tries = 0; tries < 10; tries++) {
226-
ret = check_journal_clean(sdp, sdp->sd_jdesc);
235+
ret = check_journal_clean(sdp, sdp->sd_jdesc, false);
227236
if (!ret)
228237
break;
229238
msleep(HZ);

fs/gfs2/util.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,9 @@ static inline void gfs2_metatype_set(struct buffer_head *bh, u16 type,
136136

137137
int gfs2_io_error_i(struct gfs2_sbd *sdp, const char *function,
138138
char *file, unsigned int line);
139-
int check_journal_clean(struct gfs2_sbd *sdp, struct gfs2_jdesc *jd);
139+
140+
extern int check_journal_clean(struct gfs2_sbd *sdp, struct gfs2_jdesc *jd,
141+
bool verbose);
140142

141143
#define gfs2_io_error(sdp) \
142144
gfs2_io_error_i((sdp), __func__, __FILE__, __LINE__);

0 commit comments

Comments
 (0)