And here are the attachments. [doh!]
On Fri, Feb 12, 2010 at 06:55:22PM -0800, Mike Mackovitch wrote:
> On Fri, Feb 12, 2010 at 08:36:41PM -0500, Gordon Ross wrote:
> > Thanks for having a look. Yes, I'll be happy to take your changes.
> > (If I'm not careful, I may end up owning this "pile":)
>
> Cool, I've attached a small patch... it's mostly minor stuff.
> (Actually two small patches: one against the gate and one against
> your "fixwarn" version. One of my changes hits an ifdef right next
> to one of your changes.)
>
> The patch does also include one change to lock test #12 that I needed
> when I was testing running the Mac OS X NFSv4 client against a server
> that was constantly rebooting. Test #12 has the child take a lock and
> then the parent kills the child and checks that the lock has been
> released after a couple seconds. The problem I hit was that if the
> server goes down before the child's lock can be released, then the
> parent will mistakenly report that the test failed when it's really
> just waiting on the server to come back up. To get around that I added
> some calls to the parent to open/close/unlink a separate file before
> it checks that the child's lock has been released. These operations
> should hold up the parent long enough to allow the child's lock to be
> released even if the server was down at the time.
>
> Feedback is welcome from any NFS experts. :-)
>
> Thanks!
> --macko
> _______________________________________________
> nfs-discuss mailing list
> nfs-discuss at opensolaris.org
-------------- next part --------------
diff -r ba2cc26c2e5f lock/tlock.c
--- a/lock/tlock.c Tue Feb 24 11:53:55 2009 -0800
+++ b/lock/tlock.c Fri Feb 12 18:40:14 2010 -0800
@@ -1390,6 +1390,7 @@
{
if (who == PARENT) {
pid_t target;
+ char testfile2[256];
close(pidpipe[1]);
@@ -1408,6 +1409,12 @@
kill(target, SIGINT);
comment("Killed child process.");
sleep(wait_time);
+ comment("Opening/closing/unlinking another file.");
+ sprintf(&testfile2[0], "%s/otherfile%d", filepath, parentpid);
+ close(open(testfile2, O_RDWR|O_CREAT, 0666));
+ unlink(testfile2);
+ comment("Waiting a little more.");
+ sleep(wait_time);
test(12, 1, F_TLOCK, (off_t)0, (off_t)0, PASS, FATAL);
childfree(0);
close_testfile(DO_UNLINK);
diff -r ba2cc26c2e5f tests.init
--- a/tests.init Tue Feb 24 11:53:55 2009 -0800
+++ b/tests.init Fri Feb 12 18:40:14 2010 -0800
@@ -40,6 +40,7 @@
# SVR4
# Solaris 2.x
# HPUX
+# Mac OS X 10.5+
DASHN=
BLC=\\c
@@ -48,7 +49,7 @@
# SunOS 4.X
# Linux
# Tru64 UNIX
-# Mac OS X
+# Mac OS X <10.4
#DASHN=-n
#BLC=
@@ -214,9 +215,9 @@
#CC=gcc
# Use with Mac OS X
-#CFLAGS=`echo -DMACOSX -DNATIVE64 -DLARGE_LOCKS`
+#CFLAGS=`echo -DMACOSX -DMMAP -DSTDARG -DNATIVE64 -DLARGE_LOCKS
-DHAVE_SOCKLEN_T`
#MOUNT=/sbin/mount
#UMOUNT=/sbin/umount
-#LOCKTESTS=`echo tlock`
+#LOCKTESTS=`echo tlocklfs`
# -----------------------------------------------
diff -r ba2cc26c2e5f tools/dirdmp.c
--- a/tools/dirdmp.c Tue Feb 24 11:53:55 2009 -0800
+++ b/tools/dirdmp.c Fri Feb 12 18:40:14 2010 -0800
@@ -35,7 +35,7 @@
int argc;
char *argv[];
{
-#if defined(LINUX) || defined (AIX)
+#if defined(LINUX) || defined (AIX) || defined(MACOSX)
fprintf(stderr, "dirdmp is not supported on this platform.\n");
exit(1);
#else
@@ -44,10 +44,10 @@
while (argc--) {
print(*argv++);
}
-#endif /* LINUX || AIX */
+#endif /* LINUX || AIX || MACOSX */
}
-#if !(defined(LINUX) || defined(AIX))
+#if !(defined(LINUX) || defined(AIX) || defined(MACOSX))
static void
print(dir)
@@ -217,4 +217,4 @@
}
}
-#endif /* LINUX || AIX */
+#endif /* LINUX || AIX || MACOSX */
-------------- next part --------------
diff -ur cthon.orig/lock/tlock.c cthon.new/lock/tlock.c
--- cthon.orig/lock/tlock.c 2010-02-10 20:25:59.000000000 -0800
+++ cthon.new/lock/tlock.c 2010-02-12 14:50:35.000000000 -0800
@@ -1390,6 +1390,7 @@
{
if (who == PARENT) {
pid_t target;
+ char testfile2[256];
close(pidpipe[1]);
@@ -1408,6 +1409,12 @@
kill(target, SIGINT);
comment("Killed child process.");
sleep(wait_time);
+ comment("Opening/closing/unlinking another file.");
+ sprintf(&testfile2[0], "%s/otherfile%d", filepath, parentpid);
+ close(open(testfile2, O_RDWR|O_CREAT, 0666));
+ unlink(testfile2);
+ comment("Waiting a little more.");
+ sleep(wait_time);
test(12, 1, F_TLOCK, (off_t)0, (off_t)0, PASS, FATAL);
childfree(0);
close_testfile(DO_UNLINK);
diff -ur cthon.orig/tests.init cthon.new/tests.init
--- cthon.orig/tests.init 2009-12-22 12:18:48.000000000 -0800
+++ cthon.new/tests.init 2010-02-11 13:19:22.000000000 -0800
@@ -40,6 +40,7 @@
# SVR4
# Solaris 2.x
# HPUX
+# Mac OS X 10.5+
DASHN=
BLC=\\c
@@ -48,7 +49,7 @@
# SunOS 4.X
# Linux
# Tru64 UNIX
-# Mac OS X
+# Mac OS X <10.4
#DASHN=-n
#BLC=
@@ -214,9 +215,9 @@
#CC=gcc
# Use with Mac OS X
-#CFLAGS=`echo -DMACOSX -DNATIVE64 -DLARGE_LOCKS`
+#CFLAGS=`echo -DMACOSX -DMMAP -DSTDARG -DNATIVE64 -DLARGE_LOCKS
-DHAVE_SOCKLEN_T`
#MOUNT=/sbin/mount
#UMOUNT=/sbin/umount
-#LOCKTESTS=`echo tlock`
+#LOCKTESTS=`echo tlocklfs`
# -----------------------------------------------
diff -ur cthon.orig/tools/dirdmp.c cthon.new/tools/dirdmp.c
--- cthon.orig/tools/dirdmp.c 2010-02-10 20:25:59.000000000 -0800
+++ cthon.new/tools/dirdmp.c 2010-02-11 15:02:45.000000000 -0800
@@ -34,7 +34,7 @@
int
main(int argc, char *argv[])
{
-#if defined(LINUX) || defined (AIX)
+#if defined(LINUX) || defined (AIX) || defined(MACOSX)
fprintf(stderr, "dirdmp is not supported on this platform.\n");
return 1;
#else
@@ -44,10 +44,10 @@
print(*argv++);
}
return 0;
-#endif /* LINUX || AIX */
+#endif /* LINUX || AIX || MACOSX */
}
-#if !(defined(LINUX) || defined(AIX))
+#if !(defined(LINUX) || defined(AIX) || defined(MACOSX))
static void
print(dir)
@@ -217,4 +217,4 @@
}
}
-#endif /* LINUX || AIX */
+#endif /* LINUX || AIX || MACOSX */