summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorN Balachandran <nbalacha@redhat.com>2018-02-07 20:55:47 +0530
committerN Balachandran <nbalacha@redhat.com>2018-02-12 11:58:30 +0530
commitcc22bef0d1a41664ba98d333515cbb5fc1a2879f (patch)
tree076a5936bb771cc13bcbf3288c303d5f2d88cf88 /tests
parent8e1a9b6f081b54d87a614774b56fce85a9847b3d (diff)
tests/dht: Non-root can delete stale linkto files
Test to check that non-root users can delete stale linkto files > Change-Id: Ic9bc76bc485cab839927af60cfce78a058eee2e4 > BUG: 1542318 > Signed-off-by: N Balachandran <nbalacha@redhat.com> Change-Id: Ic9bc76bc485cab839927af60cfce78a058eee2e4 BUG: 1543487 Signed-off-by: N Balachandran <nbalacha@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/basic/distribute/non-root-unlink-stale-linkto.t51
1 files changed, 51 insertions, 0 deletions
diff --git a/tests/basic/distribute/non-root-unlink-stale-linkto.t b/tests/basic/distribute/non-root-unlink-stale-linkto.t
new file mode 100644
index 00000000000..d6c866ffc8e
--- /dev/null
+++ b/tests/basic/distribute/non-root-unlink-stale-linkto.t
@@ -0,0 +1,51 @@
+#!/bin/bash
+
+. $(dirname $0)/../../include.rc
+. $(dirname $0)/../../volume.rc
+. $(dirname $0)/../../nfs.rc
+. $(dirname $0)/../../common-utils.rc
+
+# Test overview:
+# Check that non-privileged users can also clean up stale linkto files
+#
+# 1. Use the current parallel-readdir behaviour of changing the DHT child subvols
+# in the graph to generate stale linkto files
+# 2. Access the file with the stale linkto file as a non-root user
+# 3. This should now succeed (returned EIO before commit 3fb1df7870e03c9de)
+
+USERNAME=user11
+cleanup
+
+TEST glusterd
+TEST pidof glusterd
+
+TEST $CLI volume create $V0 $H0:$B0/$V0-{1,2}
+TEST $CLI volume start $V0
+TEST $CLI volume set $V0 performance.parallel-readdir on
+
+# Mount using FUSE and create a file
+TEST glusterfs -s $H0 --volfile-id $V0 $M0
+
+# Create a file for testing
+TEST dd if=/dev/urandom of=$M0/FILE-1 count=1 bs=16k
+
+#Rename to create a linkto file
+TEST mv $M0/FILE-1 $M0/FILE-2
+
+# This should change the graph and cause the linkto values to become stale
+TEST $CLI volume set $V0 performance.parallel-readdir off
+
+$CLI volume set $V0 allow-insecure on
+
+
+TEST useradd -m $USERNAME
+
+#Use a fresh mount so as to trigger a lookup everywhere
+TEST glusterfs -s $H0 --volfile-id $V0 $M1
+TEST run_cmd_as_user $USERNAME "ls $M1/FILE-2"
+
+
+# Cleanup
+TEST userdel --force $USERNAME
+cleanup
+