Skip to content

Commit

Permalink
GFS2: Prevent recovery before the local journal is set
Browse files Browse the repository at this point in the history
This patch uses a completion to prevent dlm's recovery process from
referencing and trying to recover a journal before a journal has been
opened.

Signed-off-by: Bob Peterson <[email protected]>
Signed-off-by: Steven Whitehouse <[email protected]>
  • Loading branch information
AstralBob authored and swhiteho committed Jun 2, 2014
1 parent 9dd868e commit 0e48e05
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions fs/gfs2/incore.h
Original file line number Diff line number Diff line change
Expand Up @@ -728,6 +728,8 @@ struct gfs2_sbd {
struct gfs2_holder sd_sc_gh;
struct gfs2_holder sd_qc_gh;

struct completion sd_journal_ready;

/* Daemon stuff */

struct task_struct *sd_logd_process;
Expand Down
3 changes: 3 additions & 0 deletions fs/gfs2/ops_fstype.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ static struct gfs2_sbd *init_sbd(struct super_block *sb)
INIT_LIST_HEAD(&sdp->sd_jindex_list);
spin_lock_init(&sdp->sd_jindex_spin);
mutex_init(&sdp->sd_jindex_mutex);
init_completion(&sdp->sd_journal_ready);

INIT_LIST_HEAD(&sdp->sd_quota_list);
mutex_init(&sdp->sd_quota_mutex);
Expand Down Expand Up @@ -796,6 +797,7 @@ static int init_inodes(struct gfs2_sbd *sdp, int undo)
goto fail_qinode;

error = init_journal(sdp, undo);
complete_all(&sdp->sd_journal_ready);
if (error)
goto fail;

Expand Down Expand Up @@ -1212,6 +1214,7 @@ static int fill_super(struct super_block *sb, struct gfs2_args *args, int silent
fail_locking:
init_locking(sdp, &mount_gh, UNDO);
fail_lm:
complete_all(&sdp->sd_journal_ready);
gfs2_gl_hash_clear(sdp);
gfs2_lm_unmount(sdp);
fail_debug:
Expand Down
3 changes: 3 additions & 0 deletions fs/gfs2/sys.c
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,9 @@ int gfs2_recover_set(struct gfs2_sbd *sdp, unsigned jid)
struct gfs2_jdesc *jd;
int rv;

/* Wait for our primary journal to be initialized */
wait_for_completion(&sdp->sd_journal_ready);

spin_lock(&sdp->sd_jindex_spin);
rv = -EBUSY;
if (sdp->sd_jdesc->jd_jid == jid)
Expand Down

0 comments on commit 0e48e05

Please sign in to comment.