Commit 0e48e055 authored by Bob Peterson's avatar Bob Peterson Committed by Steven Whitehouse

GFS2: Prevent recovery before the local journal is set

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: default avatarBob Peterson <rpeterso@redhat.com>
Signed-off-by: default avatarSteven Whitehouse <swhiteho@redhat.com>
parent 9dd868e1
...@@ -728,6 +728,8 @@ struct gfs2_sbd { ...@@ -728,6 +728,8 @@ struct gfs2_sbd {
struct gfs2_holder sd_sc_gh; struct gfs2_holder sd_sc_gh;
struct gfs2_holder sd_qc_gh; struct gfs2_holder sd_qc_gh;
struct completion sd_journal_ready;
/* Daemon stuff */ /* Daemon stuff */
struct task_struct *sd_logd_process; struct task_struct *sd_logd_process;
......
...@@ -94,6 +94,7 @@ static struct gfs2_sbd *init_sbd(struct super_block *sb) ...@@ -94,6 +94,7 @@ static struct gfs2_sbd *init_sbd(struct super_block *sb)
INIT_LIST_HEAD(&sdp->sd_jindex_list); INIT_LIST_HEAD(&sdp->sd_jindex_list);
spin_lock_init(&sdp->sd_jindex_spin); spin_lock_init(&sdp->sd_jindex_spin);
mutex_init(&sdp->sd_jindex_mutex); mutex_init(&sdp->sd_jindex_mutex);
init_completion(&sdp->sd_journal_ready);
INIT_LIST_HEAD(&sdp->sd_quota_list); INIT_LIST_HEAD(&sdp->sd_quota_list);
mutex_init(&sdp->sd_quota_mutex); mutex_init(&sdp->sd_quota_mutex);
...@@ -796,6 +797,7 @@ static int init_inodes(struct gfs2_sbd *sdp, int undo) ...@@ -796,6 +797,7 @@ static int init_inodes(struct gfs2_sbd *sdp, int undo)
goto fail_qinode; goto fail_qinode;
error = init_journal(sdp, undo); error = init_journal(sdp, undo);
complete_all(&sdp->sd_journal_ready);
if (error) if (error)
goto fail; goto fail;
...@@ -1212,6 +1214,7 @@ static int fill_super(struct super_block *sb, struct gfs2_args *args, int silent ...@@ -1212,6 +1214,7 @@ static int fill_super(struct super_block *sb, struct gfs2_args *args, int silent
fail_locking: fail_locking:
init_locking(sdp, &mount_gh, UNDO); init_locking(sdp, &mount_gh, UNDO);
fail_lm: fail_lm:
complete_all(&sdp->sd_journal_ready);
gfs2_gl_hash_clear(sdp); gfs2_gl_hash_clear(sdp);
gfs2_lm_unmount(sdp); gfs2_lm_unmount(sdp);
fail_debug: fail_debug:
......
...@@ -407,6 +407,9 @@ int gfs2_recover_set(struct gfs2_sbd *sdp, unsigned jid) ...@@ -407,6 +407,9 @@ int gfs2_recover_set(struct gfs2_sbd *sdp, unsigned jid)
struct gfs2_jdesc *jd; struct gfs2_jdesc *jd;
int rv; int rv;
/* Wait for our primary journal to be initialized */
wait_for_completion(&sdp->sd_journal_ready);
spin_lock(&sdp->sd_jindex_spin); spin_lock(&sdp->sd_jindex_spin);
rv = -EBUSY; rv = -EBUSY;
if (sdp->sd_jdesc->jd_jid == jid) if (sdp->sd_jdesc->jd_jid == jid)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment