path: root/tests/bugs/rpc/bug-954057.t
diff options
authorEmmanuel Dreyfus <>2015-06-07 21:32:32 +0200
committerVijay Bellur <>2015-06-09 06:24:47 -0700
commitc51eb694bce443ae7c0584b1545c14254569ae49 (patch)
treee478e1ecf698ec92ad61736522a70e96b57d5a0c /tests/bugs/rpc/bug-954057.t
parenta2a370db6db80e9365d0777701786ce706957f42 (diff)
Tests portability: umount(8)
1) Avoid hangs on unmounting NFS on NetBSD NetBSD umount(8) on a NFS mount whose server is gone will wait forever because umount(8) calls realpath(3) and tries to access the mount before it calls unmount(2). The non-portable, NetBSD-specific umount -R flag prevent that behavior. We therefore introduce UMOUNT_F, defined as "umount -f" on Linux and "umount -f -R" on NetBSD to take care of forced unmounts, especially in the NFS case. 2) Enforce usage of force_umount wrapper with timeout Whenever umount is used it should be wrapped in force_umount with tiemout handling. That saves us timing issues, and it handles the NetBSD NFS case. 3) Cleanup kernel cache flush. We used (cd $M0 && umount $M0 ) as a portable kernel cache flush trick, but it does not flush everything we need on Linux. Introduce a drop_cache() shell function that reverts to previously used echo 3 > /proc/sys/vm/drop_caches on Linux, and keeps (cd $M0 && umount $M0 ) on other systems. BUG: 1129939 Change-Id: Iab1f5a023405f1f7270c42b595573702ca1eb6f3 Signed-off-by: Emmanuel Dreyfus <> Reviewed-on: Tested-by: NetBSD Build System <> Reviewed-by: Kaleb KEITHLEY <> Tested-by: Gluster Build System <> Reviewed-by: Vijay Bellur <>
Diffstat (limited to 'tests/bugs/rpc/bug-954057.t')
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/bugs/rpc/bug-954057.t b/tests/bugs/rpc/bug-954057.t
index faaf261..65af274 100755
--- a/tests/bugs/rpc/bug-954057.t
+++ b/tests/bugs/rpc/bug-954057.t
@@ -8,7 +8,7 @@
# Note on re-reading $M0/new after enabling root-squash:
# Since we have readen it once, the file is present in various caches.
# In order to actually fail on second attempt we must:
-# 1) drop kernel cache, by ( cd $M0 ; umount $M0 )
+# 1) drop kernel cache
# 2) make sure FUSE does not cache the entry. This is also
# in the kernel, but not flushed by a failed umount.
# Using $GFS enforces this because it sets --entry-timeout=0
@@ -33,7 +33,7 @@ TEST cat $M0/new
TEST $CLI volume set $V0 performance.stat-prefetch off
TEST $CLI volume set $V0 server.root-squash enable
-( cd $M0 ; umount $M0 ) # fails but drops kernel cache
+drop_cache $M0
TEST ! mkdir $M0/other
TEST mkdir $M0/nobody/other
TEST cat $M0/file