Merge branch 'for-2.6.36' of git://git.kernel.dk/linux-2.6-block
[cascardo/linux.git] / fs / gfs2 / ops_fstype.c
index fd4f894..4d4b1e8 100644 (file)
@@ -17,7 +17,6 @@
 #include <linux/namei.h>
 #include <linux/mount.h>
 #include <linux/gfs2_ondisk.h>
-#include <linux/slow-work.h>
 #include <linux/quotaops.h>
 
 #include "gfs2.h"
@@ -76,7 +75,7 @@ static struct gfs2_sbd *init_sbd(struct super_block *sb)
 
        sb->s_fs_info = sdp;
        sdp->sd_vfs = sb;
-
+       set_bit(SDF_NOJOURNALID, &sdp->sd_flags);
        gfs2_tune_init(&sdp->sd_tune);
 
        init_waitqueue_head(&sdp->sd_glock_wait);
@@ -673,7 +672,7 @@ static int gfs2_jindex_hold(struct gfs2_sbd *sdp, struct gfs2_holder *ji_gh)
                        break;
 
                INIT_LIST_HEAD(&jd->extent_list);
-               slow_work_init(&jd->jd_work, &gfs2_recover_ops);
+               INIT_WORK(&jd->jd_work, gfs2_recover_func);
                jd->jd_inode = gfs2_lookupi(sdp->sd_jindex, &name, 1);
                if (!jd->jd_inode || IS_ERR(jd->jd_inode)) {
                        if (!jd->jd_inode)
@@ -782,7 +781,8 @@ static int init_journal(struct gfs2_sbd *sdp, int undo)
        if (sdp->sd_lockstruct.ls_first) {
                unsigned int x;
                for (x = 0; x < sdp->sd_journals; x++) {
-                       error = gfs2_recover_journal(gfs2_jdesc_find(sdp, x));
+                       error = gfs2_recover_journal(gfs2_jdesc_find(sdp, x),
+                                                    true);
                        if (error) {
                                fs_err(sdp, "error recovering journal %u: %d\n",
                                       x, error);
@@ -792,7 +792,7 @@ static int init_journal(struct gfs2_sbd *sdp, int undo)
 
                gfs2_others_may_mount(sdp);
        } else if (!sdp->sd_args.ar_spectator) {
-               error = gfs2_recover_journal(sdp->sd_jdesc);
+               error = gfs2_recover_journal(sdp->sd_jdesc, true);
                if (error) {
                        fs_err(sdp, "error recovering my journal: %d\n", error);
                        goto fail_jinode_gh;
@@ -1050,7 +1050,8 @@ static int gfs2_lm_mount(struct gfs2_sbd *sdp, int silent)
                        ret = match_int(&tmp[0], &option);
                        if (ret || option < 0) 
                                goto hostdata_error;
-                       ls->ls_jid = option;
+                       if (test_and_clear_bit(SDF_NOJOURNALID, &sdp->sd_flags))
+                               ls->ls_jid = option;
                        break;
                case Opt_id:
                        /* Obsolete, but left for backward compat purposes */
@@ -1102,6 +1103,24 @@ void gfs2_lm_unmount(struct gfs2_sbd *sdp)
                lm->lm_unmount(sdp);
 }
 
+static int gfs2_journalid_wait(void *word)
+{
+       if (signal_pending(current))
+               return -EINTR;
+       schedule();
+       return 0;
+}
+
+static int wait_on_journal(struct gfs2_sbd *sdp)
+{
+       if (sdp->sd_args.ar_spectator)
+               return 0;
+       if (sdp->sd_lockstruct.ls_ops->lm_mount == NULL)
+               return 0;
+
+       return wait_on_bit(&sdp->sd_flags, SDF_NOJOURNALID, gfs2_journalid_wait, TASK_INTERRUPTIBLE);
+}
+
 void gfs2_online_uevent(struct gfs2_sbd *sdp)
 {
        struct super_block *sb = sdp->sd_vfs;
@@ -1194,6 +1213,10 @@ static int fill_super(struct super_block *sb, struct gfs2_args *args, int silent
        if (error)
                goto fail_locking;
 
+       error = wait_on_journal(sdp);
+       if (error)
+               goto fail_sb;
+
        error = init_inodes(sdp, DO);
        if (error)
                goto fail_sb;