From c51eb694bce443ae7c0584b1545c14254569ae49 Mon Sep 17 00:00:00 2001 From: Emmanuel Dreyfus Date: Sun, 7 Jun 2015 21:32:32 +0200 Subject: 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: http://review.gluster.org/11114 Tested-by: NetBSD Build System Reviewed-by: Kaleb KEITHLEY Tested-by: Gluster Build System Reviewed-by: Vijay Bellur --- tests/features/unhashed-auto.t | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tests/features') diff --git a/tests/features/unhashed-auto.t b/tests/features/unhashed-auto.t index cba5b772106..ddebd03299d 100755 --- a/tests/features/unhashed-auto.t +++ b/tests/features/unhashed-auto.t @@ -63,7 +63,7 @@ EXPECT 'Started' volinfo_field $V0 'Status' TEST $GFS -s $H0 --volfile-id $V0 $M0 TEST mkdir $M0/dir TEST touch_files -TEST umount $M0 +EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M0 # Add a brick and do the fix-layout part of rebalance to update directory layouts # (including their directory commit hashes). @@ -82,7 +82,7 @@ TEST setfattr -x trusted.glusterfs.dht.commithash $B0/${V0}3 # correctly skipped the broadcast lookup that would have found them. TEST $GFS -s $H0 --volfile-id $V0 $M0 TEST [ $(count_files) -ne 100 ] -TEST umount $M0 +EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M0 # Do the fix-layout again to generate a new volume commit hash. TEST $CLI volume rebalance $V0 fix-layout start @@ -92,7 +92,7 @@ TEST wait_for_rebalance # the mismatch and did the broadcast lookup this time. TEST $GFS -s $H0 --volfile-id $V0 $M0 TEST [ $(count_files) -eq 100 ] -TEST umount $M0 +EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M0 # Do a *full* rebalance and verify that the directory commit hash changed. old_val=$(get_xattr $B0/${V0}1/dir) -- cgit