Blame SOURCES/bz1202831-mkfs_gfs2_Allow_longer_cluster_names.patch

db8e98
commit a523af584645a01bb4900b10d0c9232d0ae50339
db8e98
Author: Paul Evans <pevans@redhat.com>
db8e98
Date:   Wed Apr 22 17:43:26 2015 +0100
db8e98
db8e98
    mkfs.gfs2: Allow longer cluster names
db8e98
    
db8e98
    Increase the enforced limit for cluster name to 32 bytes and file
db8e98
    system name to 30 bytes for mkfs.gfs2 (was previously 16 + 16
db8e98
    bytes).
db8e98
    
db8e98
    Also increased this limit in tunegfs2 when labelling gfs2 file
db8e98
    systems.
db8e98
    
db8e98
    Updated the formation in the man pages along with adding a new test
db8e98
    case for mkfs.gfs2 to validate the increased cluster/file system
db8e98
    name support.
db8e98
    
db8e98
    Resolves: rhbz#1202831
db8e98
    Signed-off-by: Paul Evans <pevans@redhat.com>
db8e98
db8e98
diff --git a/gfs2/man/mkfs.gfs2.8 b/gfs2/man/mkfs.gfs2.8
db8e98
index ceb6f38..f480082 100644
db8e98
--- a/gfs2/man/mkfs.gfs2.8
db8e98
+++ b/gfs2/man/mkfs.gfs2.8
db8e98
@@ -101,9 +101,9 @@ bigger file systems will have bigger RGs for better performance.
db8e98
 The lock table field appropriate to the lock module you're using.
db8e98
 It is \fIclustername:fsname\fR.
db8e98
 Clustername must match that in cluster.conf; only members of this
db8e98
-cluster are permitted to use this file system.
db8e98
+cluster are permitted to use this file system (1 to 32 characters).
db8e98
 Fsname is a unique file system name used to distinguish this GFS2 file
db8e98
-system from others created (1 to 16 characters).  Lock_nolock doesn't
db8e98
+system from others created (1 to 30 characters).  Lock_nolock doesn't
db8e98
 use this field. Valid \fIclustername\fRs and \fIfsname\fRs may only contain
db8e98
 alphanumeric characters, hyphens (-) and underscores (_).
db8e98
 .TP
db8e98
diff --git a/gfs2/mkfs/main_mkfs.c b/gfs2/mkfs/main_mkfs.c
db8e98
index 0636f0b..3fab08c 100644
db8e98
--- a/gfs2/mkfs/main_mkfs.c
db8e98
+++ b/gfs2/mkfs/main_mkfs.c
db8e98
@@ -398,7 +398,7 @@ static void test_locking(const char *lockproto, const char *locktable)
db8e98
 
db8e98
 		if (c == locktable)
db8e98
 			die("%s %s\n", errprefix, _("cluster name is missing"));
db8e98
-		if (c - locktable > 16)
db8e98
+		if (c - locktable > 32)
db8e98
 			die("%s %s\n", errprefix, _("cluster name is too long"));
db8e98
 
db8e98
 		c++;
db8e98
@@ -406,7 +406,7 @@ static void test_locking(const char *lockproto, const char *locktable)
db8e98
 			die("%s %s\n", errprefix, _("contains more than one colon"));
db8e98
 		if (!strlen(c))
db8e98
 			die("%s %s\n", errprefix, _("file system name is missing"));
db8e98
-		if (strlen(c) > 16)
db8e98
+		if (strlen(c) > 30)
db8e98
 			die("%s %s\n", errprefix, _("file system name is too long"));
db8e98
 	} else {
db8e98
 		die( _("Invalid lock protocol: %s\n"), lockproto);
db8e98
diff --git a/gfs2/tune/super.c b/gfs2/tune/super.c
db8e98
index cbd0026..560ce68 100644
db8e98
--- a/gfs2/tune/super.c
db8e98
+++ b/gfs2/tune/super.c
db8e98
@@ -194,7 +194,7 @@ int change_locktable(struct tunegfs2 *tfs, const char *locktable)
db8e98
 			fprintf(stderr, "%s %s\n", errpre, _("missing colon"));
db8e98
 			return EX_DATAERR;
db8e98
 		}
db8e98
-		if (strlen(++fsname) > 16) {
db8e98
+		if (strlen(++fsname) > 30) {
db8e98
 			fprintf(stderr, "%s %s\n", errpre, _("file system name is too long"));
db8e98
 			return EX_DATAERR;
db8e98
 		}
db8e98
diff --git a/tests/mkfs.at b/tests/mkfs.at
db8e98
index 438184c..e25b6dc 100644
db8e98
--- a/tests/mkfs.at
db8e98
+++ b/tests/mkfs.at
db8e98
@@ -89,3 +89,11 @@ AT_SETUP([Min. quota change file size])
db8e98
 AT_KEYWORDS(mkfs.gfs2 mkfs)
db8e98
 GFS_FSCK_CHECK([$GFS_MKFS -p lock_nolock -c 1 $GFS_TGT])
db8e98
 AT_CLEANUP
db8e98
+
db8e98
+AT_SETUP([Incr. cluster/file system name validation])
db8e98
+AT_KEYWORDS(mkfs.gfs2 mkfs)
db8e98
+AT_CHECK([$GFS_MKFS -p lock_dlm -t "" $GFS_TGT], 255, [ignore], [ignore])
db8e98
+AT_CHECK([$GFS_MKFS -p lock_dlm -t "quite_long_cluster_name_test_here:intec34p" $GFS_TGT], 255, [ignore], [ignore])
db8e98
+AT_CHECK([$GFS_MKFS -p lock_dlm -t "financial_cluster:this_time_we_test_fs_naming_len" $GFS_TGT], 255, [ignore], [ignore])
db8e98
+GFS_FSCK_CHECK([$GFS_MKFS -p lock_dlm -t "a_really_long_named_cluster_here:concurrently_lets_check_fs_len" $GFS_TGT])
db8e98
+AT_CLEANUP