diff options
| author | Shreyas Siravara <sshreyas@fb.com> | 2017-09-07 16:36:29 -0700 |
|---|---|---|
| committer | Shreyas Siravara <sshreyas@fb.com> | 2017-09-08 00:13:22 +0000 |
| commit | 5c2015a5d84f176d68d704c21602d7131ca7dfda (patch) | |
| tree | e1faace4f0342f0d94a1e818b82bb28a200d03b1 /tests/basic/hardlink-limit.t | |
| parent | 9423bc2223227661453a8afd5ab940048abeb008 (diff) | |
storage/posix: Add limit to number of hard links.
Summary:
Too may hard links blow up btrfs by exceeding max xattr size (recordign
pgfid for each hardlink). Add a limit to prevent this explosion.
This is a port D4682329 to 3.8
Reviewed By: sshreyas
Change-Id: I614a247834fb8f2b2743c0c67d11cefafff0dbaa
Reviewed-on: https://review.gluster.org/18232
Reviewed-by: Shreyas Siravara <sshreyas@fb.com>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Smoke: Gluster Build System <jenkins@build.gluster.org>
Diffstat (limited to 'tests/basic/hardlink-limit.t')
| -rw-r--r-- | tests/basic/hardlink-limit.t | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/basic/hardlink-limit.t b/tests/basic/hardlink-limit.t new file mode 100644 index 00000000000..e90a3ce427c --- /dev/null +++ b/tests/basic/hardlink-limit.t @@ -0,0 +1,44 @@ +#!/bin/bash + +. $(dirname $0)/../include.rc +. $(dirname $0)/../volume.rc +. $(dirname $0)/../dht.rc + +cleanup; + +TEST glusterd +TEST pidof glusterd +TEST $CLI volume info; + +TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}{1,2,3,4}; + +EXPECT "$V0" volinfo_field $V0 'Volume Name'; +EXPECT 'Created' volinfo_field $V0 'Status'; +EXPECT '4' brick_count $V0 + +TEST $CLI volume start $V0; +EXPECT 'Started' volinfo_field $V0 'Status'; +TEST $CLI volume set $V0 storage.max-hardlinks 3 +TEST glusterfs -s $H0 --volfile-id $V0 $M0; + +TEST dd if=/dev/zero of=$M0/testfile count=1 + +# max-hardlinks is 3, should be able to create 2 links. +TEST link $M0/testfile $M0/testfile.link1 +TEST link $M0/testfile $M0/testfile.link2 + +# But not 3. +TEST ! link $M0/testfile $M0/testfile.link3 +# If we remove one... +TEST rm $M0/testfile.link1 +# Now we can add one. +TEST link $M0/testfile $M0/testfile.link3 + +# But not another +TEST ! link $M0/testfile $M0/testfile.link4 + +# Unless we disable the limit... +TEST $CLI volume set $V0 storage.max-hardlinks 0 +TEST link $M0/testfile $M0/testfile.link4 + +cleanup; |
