This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch andyp-fsck_cx in repository gfs2-utils.
commit bfaaee54b7b9c8b9d2266eda6a0f00223c82d950 Author: Andrew Price anprice@redhat.com AuthorDate: Mon Aug 1 09:26:55 2022 +0100
fsck.gfs2: Pass fsck_options into preen_is_safe()
Signed-off-by: Andrew Price anprice@redhat.com --- gfs2/fsck/fs_recovery.c | 12 ++++++------ gfs2/fsck/fs_recovery.h | 2 +- gfs2/fsck/initialize.c | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/gfs2/fsck/fs_recovery.c b/gfs2/fsck/fs_recovery.c index 21917e7a..78c2b591 100644 --- a/gfs2/fsck/fs_recovery.c +++ b/gfs2/fsck/fs_recovery.c @@ -450,11 +450,11 @@ static int check_journal_seq_no(struct lgfs2_inode *ip, int fix) * mounted by other nodes in the cluster, which is dangerous and therefore, * we should warn the user to run fsck.gfs2 manually when it's safe. */ -int preen_is_safe(struct lgfs2_sbd *sdp, int preen, int force_check) +int preen_is_safe(struct lgfs2_sbd *sdp, const struct fsck_options * const _opts) { - if (!preen) /* If preen was not specified */ + if (!_opts->preen) return 1; /* not called by rc.sysinit--we're okay to preen */ - if (force_check) /* If check was forced by the user? */ + if (_opts->force) return 1; /* user's responsibility--we're okay to preen */ if (!memcmp(sdp->sd_lockproto + 5, "nolock", 6)) return 1; /* local file system--preen is okay */ @@ -504,7 +504,7 @@ static int recover_journal(struct lgfs2_inode *ip, int j, const struct fsck_opti log_err( _("Not fixing it due to the -n option.\n")); goto out; } - if (!preen_is_safe(sdp, _opts->preen, _opts->force)) { + if (!preen_is_safe(sdp, _opts)) { log_err(_("Journal #%d ("journal%d") is corrupt.\n"), j+1, j); log_err(_("I'm not fixing it because it may be unsafe:\n" @@ -548,7 +548,7 @@ static int recover_journal(struct lgfs2_inode *ip, int j, const struct fsck_opti log_err(_("not replaying due to the -n option.\n")); goto out; } - if (!preen_is_safe(sdp, _opts->preen, _opts->force)) { + if (!preen_is_safe(sdp, _opts)) { log_err( _("Journal #%d ("journal%d") is dirty\n"), j+1, j); log_err( _("I'm not replaying it because it may be unsafe:\n" "Locking protocol is not lock_nolock and " @@ -714,7 +714,7 @@ int replay_journals(struct fsck_cx *cx, const struct fsck_options * const _opts, if (!clean) dirty_journals++; if (!gave_msg && dirty_journals == 1 && !_opts->no && - preen_is_safe(sdp, _opts->preen, _opts->force)) { + preen_is_safe(sdp, _opts)) { gave_msg = 1; log_notice( _("Recovering journals (this may " "take a while)\n")); diff --git a/gfs2/fsck/fs_recovery.h b/gfs2/fsck/fs_recovery.h index 1b60c6a8..df37dc41 100644 --- a/gfs2/fsck/fs_recovery.h +++ b/gfs2/fsck/fs_recovery.h @@ -4,7 +4,7 @@ #include "libgfs2.h"
extern int replay_journals(struct fsck_cx *cx, const struct fsck_options * const _opts, int *clean_journals); -extern int preen_is_safe(struct lgfs2_sbd *sdp, int preen, int force_check); +extern int preen_is_safe(struct lgfs2_sbd *sdp, const struct fsck_options * const _opts);
extern int ji_update(struct lgfs2_sbd *sdp); extern int build_jindex(struct lgfs2_sbd *sdp); diff --git a/gfs2/fsck/initialize.c b/gfs2/fsck/initialize.c index dca68c0a..0342402a 100644 --- a/gfs2/fsck/initialize.c +++ b/gfs2/fsck/initialize.c @@ -1600,7 +1600,7 @@ int initialize(struct fsck_cx *cx, const struct fsck_options * const _opts, int return err;
/* Change lock protocol to be fsck_* instead of lock_* */ - if (!opts.no && preen_is_safe(sdp, _opts->preen, _opts->force)) { + if (!opts.no && preen_is_safe(sdp, _opts)) { if (block_mounters(sdp, 1)) { log_err( _("Unable to block other mounters\n")); return FSCK_USAGE; @@ -1653,7 +1653,7 @@ int initialize(struct fsck_cx *cx, const struct fsck_options * const _opts, int if (reconstruct_journals(sdp)) return FSCK_ERROR; } else if (replay_journals(cx, _opts, &clean_journals)) { - if (!opts.no && preen_is_safe(sdp, _opts->preen, _opts->force)) + if (!opts.no && preen_is_safe(sdp, _opts)) block_mounters(sdp, 0); stack; return FSCK_ERROR;