]> Pileus Git - ~andy/linux/blobdiff - fs/ocfs2/super.c
ocfs2: add clustername to cluster connection
[~andy/linux] / fs / ocfs2 / super.c
index fcd595e5d2c7151c54dd27c759aa0ab3c488526c..5445d72eb8e524162c906af308208b81dbadc291 100644 (file)
@@ -2223,10 +2223,9 @@ static int ocfs2_initialize_super(struct super_block *sb,
        if (ocfs2_clusterinfo_valid(osb)) {
                osb->osb_stackflags =
                        OCFS2_RAW_SB(di)->s_cluster_info.ci_stackflags;
-               memcpy(osb->osb_cluster_stack,
+               strlcpy(osb->osb_cluster_stack,
                       OCFS2_RAW_SB(di)->s_cluster_info.ci_stack,
-                      OCFS2_STACK_LABEL_LEN);
-               osb->osb_cluster_stack[OCFS2_STACK_LABEL_LEN] = '\0';
+                      OCFS2_STACK_LABEL_LEN + 1);
                if (strlen(osb->osb_cluster_stack) != OCFS2_STACK_LABEL_LEN) {
                        mlog(ML_ERROR,
                             "couldn't mount because of an invalid "
@@ -2235,6 +2234,9 @@ static int ocfs2_initialize_super(struct super_block *sb,
                        status = -EINVAL;
                        goto bail;
                }
+               strlcpy(osb->osb_cluster_name,
+                       OCFS2_RAW_SB(di)->s_cluster_info.ci_cluster,
+                       OCFS2_CLUSTER_NAME_LEN + 1);
        } else {
                /* The empty string is identical with classic tools that
                 * don't know about s_cluster_info. */