ocfs2: mount shared volume without ha stack
[sfrench/cifs-2.6.git] / fs / ocfs2 / super.c
index ac61eeaf38374aa31ee739e2604f92a9832c40d5..71ea9ce71a6b8a88039ebec5d2b25145c1273197 100644 (file)
@@ -175,6 +175,7 @@ enum {
        Opt_dir_resv_level,
        Opt_journal_async_commit,
        Opt_err_cont,
+       Opt_nocluster,
        Opt_err,
 };
 
@@ -208,6 +209,7 @@ static const match_table_t tokens = {
        {Opt_dir_resv_level, "dir_resv_level=%u"},
        {Opt_journal_async_commit, "journal_async_commit"},
        {Opt_err_cont, "errors=continue"},
+       {Opt_nocluster, "nocluster"},
        {Opt_err, NULL}
 };
 
@@ -619,6 +621,13 @@ static int ocfs2_remount(struct super_block *sb, int *flags, char *data)
                goto out;
        }
 
+       tmp = OCFS2_MOUNT_NOCLUSTER;
+       if ((osb->s_mount_opt & tmp) != (parsed_options.mount_opt & tmp)) {
+               ret = -EINVAL;
+               mlog(ML_ERROR, "Cannot change nocluster option on remount\n");
+               goto out;
+       }
+
        tmp = OCFS2_MOUNT_HB_LOCAL | OCFS2_MOUNT_HB_GLOBAL |
                OCFS2_MOUNT_HB_NONE;
        if ((osb->s_mount_opt & tmp) != (parsed_options.mount_opt & tmp)) {
@@ -859,6 +868,7 @@ static int ocfs2_verify_userspace_stack(struct ocfs2_super *osb,
        }
 
        if (ocfs2_userspace_stack(osb) &&
+           !(osb->s_mount_opt & OCFS2_MOUNT_NOCLUSTER) &&
            strncmp(osb->osb_cluster_stack, mopt->cluster_stack,
                    OCFS2_STACK_LABEL_LEN)) {
                mlog(ML_ERROR,
@@ -1139,6 +1149,11 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent)
               osb->s_mount_opt & OCFS2_MOUNT_DATA_WRITEBACK ? "writeback" :
               "ordered");
 
+       if ((osb->s_mount_opt & OCFS2_MOUNT_NOCLUSTER) &&
+          !(osb->s_feature_incompat & OCFS2_FEATURE_INCOMPAT_LOCAL_MOUNT))
+               printk(KERN_NOTICE "ocfs2: The shared device (%s) is mounted "
+                      "without cluster aware mode.\n", osb->dev_str);
+
        atomic_set(&osb->vol_state, VOLUME_MOUNTED);
        wake_up(&osb->osb_mount_event);
 
@@ -1445,6 +1460,9 @@ static int ocfs2_parse_options(struct super_block *sb,
                case Opt_journal_async_commit:
                        mopt->mount_opt |= OCFS2_MOUNT_JOURNAL_ASYNC_COMMIT;
                        break;
+               case Opt_nocluster:
+                       mopt->mount_opt |= OCFS2_MOUNT_NOCLUSTER;
+                       break;
                default:
                        mlog(ML_ERROR,
                             "Unrecognized mount option \"%s\" "
@@ -1556,6 +1574,9 @@ static int ocfs2_show_options(struct seq_file *s, struct dentry *root)
        if (opts & OCFS2_MOUNT_JOURNAL_ASYNC_COMMIT)
                seq_printf(s, ",journal_async_commit");
 
+       if (opts & OCFS2_MOUNT_NOCLUSTER)
+               seq_printf(s, ",nocluster");
+
        return 0;
 }