GFS2: Prevent recovery before the local journal is set
authorBob Peterson <rpeterso@redhat.com>
Mon, 2 Jun 2014 13:40:25 +0000 (09:40 -0400)
committerSteven Whitehouse <swhiteho@redhat.com>
Mon, 2 Jun 2014 18:12:06 +0000 (19:12 +0100)
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 <rpeterso@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
fs/gfs2/incore.h
fs/gfs2/ops_fstype.c
fs/gfs2/sys.c

index 2434a96f95df89c0634645253ff6de1abb0e865a..67d310c9ada3222ef1c08333397f65a29d1e454a 100644 (file)
@@ -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;
index be45c79f6745f204871fa87e1a07df1cc151478c..bc564c0d6d16f982d413b38cbb307de1f4d32cb0 100644 (file)
@@ -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);
@@ -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;
 
@@ -1212,6 +1214,7 @@ fail_sb:
 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:
index 7bc17edcb51f0bd049cea3887084126b028c8f6b..0e049f9574b565a53f1137036568d62ddcb0d7c8 100644 (file)
@@ -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)