Module Name:    src
Committed By:   pooka
Date:           Thu Aug 26 15:07:16 UTC 2010

Modified Files:
        src/tests/fs/common: fstest_nfs.c
        src/tests/fs/vfs: t_renamerace.c

Log Message:
Put the workaround for PR kern/43799 into the common nfs unmount routine.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/fs/common/fstest_nfs.c
cvs rdiff -u -r1.9 -r1.10 src/tests/fs/vfs/t_renamerace.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/fs/common/fstest_nfs.c
diff -u src/tests/fs/common/fstest_nfs.c:1.3 src/tests/fs/common/fstest_nfs.c:1.4
--- src/tests/fs/common/fstest_nfs.c:1.3	Fri Jul 30 16:15:05 2010
+++ src/tests/fs/common/fstest_nfs.c	Thu Aug 26 15:07:16 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: fstest_nfs.c,v 1.3 2010/07/30 16:15:05 pooka Exp $	*/
+/*	$NetBSD: fstest_nfs.c,v 1.4 2010/08/26 15:07:16 pooka Exp $	*/
 
 /*
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -196,11 +196,26 @@
 nfs_fstest_unmount(const atf_tc_t *tc, const char *path, int flags)
 {
 	struct nfstestargs *args = theargs;
-	int status;
+	int status, i, sverrno;
 
-	if (rump_sys_unmount(path, flags) == -1) {
-		return errno;
+	/*
+	 * NFS handles sillyrenames in an workqueue.  Some of them might
+	 * be still in the queue even if all user activity has ceased.
+	 * We try to unmount for 2 seconds to give them a chance
+	 * to flush out.
+	 *
+	 * PR kern/43799
+	 */
+	for (i = 0; i < 20; i++) {
+		if ((status = rump_sys_unmount(path, flags)) == 0)
+			break;
+		sverrno = errno;
+		if (sverrno != EBUSY)
+			break;
+		usleep(100000);
 	}
+	if (status == -1)
+		return sverrno;
 
 	/*
 	 * It's highly expected that the child will die next, so we

Index: src/tests/fs/vfs/t_renamerace.c
diff -u src/tests/fs/vfs/t_renamerace.c:1.9 src/tests/fs/vfs/t_renamerace.c:1.10
--- src/tests/fs/vfs/t_renamerace.c:1.9	Wed Aug 25 18:11:20 2010
+++ src/tests/fs/vfs/t_renamerace.c	Thu Aug 26 15:07:16 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_renamerace.c,v 1.9 2010/08/25 18:11:20 pooka Exp $	*/
+/*	$NetBSD: t_renamerace.c,v 1.10 2010/08/26 15:07:16 pooka Exp $	*/
 
 /*
  * Modified for rump and atf from a program supplied
@@ -115,14 +115,6 @@
 	 */
 	if (FSTYPE_LFS(tc))
 		abort();
-
-	/*
-	 * NFS sillyrename is broken and may linger on in the file system.
-	 * This sleep lets them finish so we don't get transient unmount
-	 * failures.
-	 */
-	if (FSTYPE_NFS(tc))
-		sleep(1);
 }
 
 static void

Reply via email to