From 3023a50c1410b4da457e86bed69c320760d37344 Mon Sep 17 00:00:00 2001 From: Vijaykumar M Date: Fri, 13 Dec 2013 14:18:16 +0530 Subject: dht: do not remove linkfile if file exist in cached sub volume Currently with rmdir, if a directory contains only the linkfiles we remove all the linkfiles and this is causing the problem when the cached sub volume is down and end-up with duplicate files showing on the mount point. Solution: Before removing a linkfile check if the files exists in cached subvolume. Change-Id: Iedffd0d9298ec8bb95d5ce27c341c9ade81f0d3c BUG: 1042725 Signed-off-by: Vijaykumar M Reviewed-on: http://review.gluster.org/6500 Tested-by: Gluster Build System Reviewed-by: Anand Avati --- tests/bugs/bug-1042725.t | 49 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 tests/bugs/bug-1042725.t (limited to 'tests') diff --git a/tests/bugs/bug-1042725.t b/tests/bugs/bug-1042725.t new file mode 100644 index 000000000..f3154e06d --- /dev/null +++ b/tests/bugs/bug-1042725.t @@ -0,0 +1,49 @@ +#!/bin/bash + +. $(dirname $0)/../include.rc +. $(dirname $0)/../volume.rc + +cleanup; + +#Basic checks +TEST glusterd +TEST pidof glusterd +TEST $CLI volume info + +#Create a distributed volume +TEST $CLI volume create $V0 $H0:$B0/${V0}{1..2}; +TEST $CLI volume start $V0 + +# Mount FUSE +TEST glusterfs -s $H0 --volfile-id $V0 $M0 + +#Create files +TEST mkdir $M0/foo +TEST touch $M0/foo/{1..20} +for file in {1..20}; do + ln $M0/foo/$file $M0/foo/${file}_linkfile; +done + +#Stop one of the brick +TEST kill_brick ${V0} ${H0} ${B0}/${V0}1 + +rm -rf $M0/foo 2>/dev/null +TEST stat $M0/foo + +touch $M0/foo/{1..20} 2>/dev/null +touch $M0/foo/{1..20}_linkfile 2>/dev/null + +TEST $CLI volume start $V0 force; +sleep 5 +function verify_duplicate { + count=`ls $M0/foo | sort | uniq --repeated | grep [0-9] -c` + echo $count +} +EXPECT 0 verify_duplicate + +TEST umount $M0 +TEST $CLI volume stop $V0 +TEST $CLI volume delete $V0; +TEST ! $CLI volume info $V0; + +cleanup; -- cgit