changeset 3669:4e8428f56972

6506393 brandz doesn't pass along many NFS mount options 6525656 one byte reads can hang in lx_ptm_read()
author edp
date Fri, 16 Feb 2007 13:58:10 -0800
parents dc5b9a9208ca
children 6338278a5e69
files usr/src/lib/brand/lx/lx_brand/common/mount.c usr/src/lib/brand/lx/lx_brand/sys/lx_mount.h usr/src/uts/common/brand/lx/io/lx_ptm.c
diffstat 3 files changed, 36 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/lib/brand/lx/lx_brand/common/mount.c	Fri Feb 16 13:39:57 2007 -0800
+++ b/usr/src/lib/brand/lx/lx_brand/common/mount.c	Fri Feb 16 13:58:10 2007 -0800
@@ -20,7 +20,7 @@
  */
 
 /*
- * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -355,10 +355,18 @@
 	    NFSMNT_HOSTNAME;
 
 	/* Translate some Linux mount flags into Solaris mount flags. */
+	if (lx_nmd->nmd_flags & LX_NFS_MOUNT_SOFT)
+		nfs_args->flags |= NFSMNT_SOFT;
 	if (lx_nmd->nmd_flags & LX_NFS_MOUNT_INTR)
 		nfs_args->flags |= NFSMNT_INT;
+	if (lx_nmd->nmd_flags & LX_NFS_MOUNT_POSIX)
+		nfs_args->flags |= NFSMNT_POSIX;
+	if (lx_nmd->nmd_flags & LX_NFS_MOUNT_NOCTO)
+		nfs_args->flags |= NFSMNT_NOCTO;
 	if (lx_nmd->nmd_flags & LX_NFS_MOUNT_NOAC)
 		nfs_args->flags |= NFSMNT_NOAC;
+	if (lx_nmd->nmd_flags & LX_NFS_MOUNT_NONLM)
+		nfs_args->flags |= NFSMNT_LLOCK;
 
 	if ((lx_nmd->nmd_flags & LX_NFS_MOUNT_VER3) != 0) {
 		(void) strcpy(fstype, "nfs3");
--- a/usr/src/lib/brand/lx/lx_brand/sys/lx_mount.h	Fri Feb 16 13:39:57 2007 -0800
+++ b/usr/src/lib/brand/lx/lx_brand/sys/lx_mount.h	Fri Feb 16 13:58:10 2007 -0800
@@ -19,7 +19,7 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -74,10 +74,14 @@
 #define	LX_NFS_MOUNT_KERBEROS		0x00000100
 #define	LX_NFS_MOUNT_NONLM		0x00000200
 #define	LX_NFS_MOUNT_BROKEN_SUID	0x00000400
-#define	LX_NFS_MOUNT_SUPPORTED		(LX_NFS_MOUNT_INTR | \
+#define	LX_NFS_MOUNT_SUPPORTED		(LX_NFS_MOUNT_SOFT | \
+					LX_NFS_MOUNT_INTR | \
+					LX_NFS_MOUNT_POSIX | \
+					LX_NFS_MOUNT_NOCTO | \
 					LX_NFS_MOUNT_NOAC | \
 					LX_NFS_MOUNT_TCP | \
-					LX_NFS_MOUNT_VER3)
+					LX_NFS_MOUNT_VER3 | \
+					LX_NFS_MOUNT_NONLM)
 
 #define	LX_NMD_DEFAULT_RSIZE		0
 #define	LX_NMD_DEFAULT_WSIZE		0
--- a/usr/src/uts/common/brand/lx/io/lx_ptm.c	Fri Feb 16 13:39:57 2007 -0800
+++ b/usr/src/uts/common/brand/lx/io/lx_ptm.c	Fri Feb 16 13:58:10 2007 -0800
@@ -19,7 +19,7 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -837,6 +837,25 @@
 
 	do {
 		/*
+		 * Before we actually attempt a read operation we need
+		 * to make sure there's some buffer space to actually
+		 * read in some data.  We do this because if we're in
+		 * pktio mode and the caller only requested one byte,
+		 * then we've already used up that one byte and we
+		 * don't want to pass this read request.  Doing a 0
+		 * byte read (unless there is a problem with the stream
+		 * head) always returns succcess.  Normally when a streams
+		 * read returns 0 bytes we interpret that as an EOF on
+		 * the stream (ie, the slave side has been opened and
+		 * closed) and we ignore it and re-try the read operation.
+		 * So if we pass on a 0 byte read here lx_ptm_read_loop()
+		 * will tell us to loop around and we'll end up in an
+		 * infinite loop.
+		 */
+		if (uiop->uio_resid == 0)
+			break;
+
+		/*
 		 * Serialize all reads.  We need to do this so that we can
 		 * properly emulate the behavior of master terminals on Linux.
 		 * In reality this serializaion should not pose any kind of