summaryrefslogtreecommitdiffstats
path: root/tests/basic
diff options
context:
space:
mode:
authorvmallika <vmallika@redhat.com>2016-02-10 06:39:22 +0530
committerRajesh Joseph <rjoseph@redhat.com>2016-03-10 02:43:24 -0800
commite0f71288d95469d7ae82473ef273c6ba43250a36 (patch)
tree3ec70fe1e5d6ece778ff3175b55db7470231a5e7 /tests/basic
parentecf6243bc435a00f3dd2495524cd6e48e2d56f72 (diff)
uss/gluster: generate gfid for snapshot files from snapname and gfid
If 'a' and 'b' are hardlinks, we need to generate a virtual gfid for these files so that the inode number for 'a' and 'b' are same. Generate gfid as below: gfid_of_a = MD5(snapname + back_end_gfid(a)) if '/dir1/a' and '/dir2/b' are hardlinks, then inode number should be same for all below files: /mnt/.snaps/snap1/dir1/a /mnt/.snaps/snap1/dir2/b /mnt/dir1/.snaps/snap1/a /mnt/dir2/.snaps/snap1/b Change-Id: Ifda793455610e554f3f1e4cbb90d44c02cda4b0f BUG: 1171703 Signed-off-by: vmallika <vmallika@redhat.com> Reviewed-on: http://review.gluster.org/9255 Smoke: Gluster Build System <jenkins@build.gluster.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Rajesh Joseph <rjoseph@redhat.com>
Diffstat (limited to 'tests/basic')
-rw-r--r--tests/basic/uss.t32
1 files changed, 30 insertions, 2 deletions
diff --git a/tests/basic/uss.t b/tests/basic/uss.t
index 7a4f043d260..55fab660aa2 100644
--- a/tests/basic/uss.t
+++ b/tests/basic/uss.t
@@ -41,7 +41,14 @@ TEST $GFS --volfile-server=$H0 --volfile-id=$V0 $M0;
for i in {1..10} ; do echo "file" > $M0/file$i ; done
+# Create file and hard-links
+TEST touch $M0/f1
+TEST mkdir $M0/dir
+TEST ln $M0/f1 $M0/f2
+TEST ln $M0/f1 $M0/dir/f3
+
TEST $CLI snapshot config activate-on-create enable
+TEST $CLI volume set $V0 features.uss enable;
TEST $CLI snapshot create snap1 $V0 no-timestamp;
@@ -49,6 +56,29 @@ for i in {11..20} ; do echo "file" > $M0/file$i ; done
TEST $CLI snapshot create snap2 $V0 no-timestamp;
+########### Test inode numbers ###########
+s1_f1_ino=$(STAT_INO $M0/.snaps/snap1/f1)
+TEST [ $s1_f1_ino != 0 ]
+
+# Inode number of f1 should be same as f2 f3 within snapshot
+EXPECT $s1_f1_ino STAT_INO $M0/.snaps/snap1/f2
+EXPECT $s1_f1_ino STAT_INO $M0/.snaps/snap1/dir/f3
+EXPECT $s1_f1_ino STAT_INO $M0/dir/.snaps/snap1/f3
+
+# Inode number of f1 in snap1 should be different from f1 in snap2
+tmp_ino=$(STAT_INO $M0/.snaps/snap2/f1)
+TEST [ $s1_f1_ino != $tmp_ino ]
+
+# Inode number of f1 in snap1 should be different from f1 in regular volume
+tmp_ino=$(STAT_INO $M0/f1)
+TEST [ $s1_f1_ino != $tmp_ino ]
+
+# Directory inode of snap1 should be different in each sub-dir
+s1_ino=$(STAT_INO $M0/.snaps/snap1)
+tmp_ino=$(STAT_INO $M0/dir/.snaps/snap1)
+TEST [ $s1_ino != $tmp_ino ]
+##########################################
+
mkdir $M0/dir1;
mkdir $M0/dir2;
@@ -80,8 +110,6 @@ TEST ! $CLI volume set $V0 features.snapshot-directory .
TEST ! $CLI volume set $V0 features.snapshot-directory ..
TEST ! $CLI volume set $V0 features.snapshot-directory .123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345
-TEST $CLI volume set $V0 features.uss enable;
-
EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M0
TEST $GFS --volfile-server=$H0 --volfile-id=$V0 $M0;