From ed4feadc8c60fce1d8d99e0732351b92230d6321 Mon Sep 17 00:00:00 2001 From: vmallika Date: Wed, 10 Feb 2016 06:39:22 +0530 Subject: uss/gluster: generate gfid for snapshot files from snapname and gfid This is a backport of http://review.gluster.org/#/c/9255/ 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 Change-Id: I917b2fe2915d88f69700bc8c3283e9c613e13bb8 BUG: 1316099 Signed-off-by: vmallika Reviewed-on: http://review.gluster.org/13656 Smoke: Gluster Build System NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System Reviewed-by: Rajesh Joseph --- tests/basic/uss.t | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) (limited to 'tests/basic') 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; -- cgit