svn commit: r234818 - in projects/nfsv4.1-client/sys/fs: nfs
nfsclient
Rick Macklem
rmacklem at FreeBSD.org
Sun Apr 29 22:01:23 UTC 2012
Author: rmacklem
Date: Sun Apr 29 22:01:23 2012
New Revision: 234818
URL: http://svn.freebsd.org/changeset/base/234818
Log:
Fix the NFSv4.1 client so that it doesn't ask for a persistent
session for read only mounts. Also, mark whether or not the
server has provided a persistent session for the MDS.
Modified:
projects/nfsv4.1-client/sys/fs/nfs/nfsport.h
projects/nfsv4.1-client/sys/fs/nfsclient/nfs_clrpcops.c
Modified: projects/nfsv4.1-client/sys/fs/nfs/nfsport.h
==============================================================================
--- projects/nfsv4.1-client/sys/fs/nfs/nfsport.h Sun Apr 29 20:27:44 2012 (r234817)
+++ projects/nfsv4.1-client/sys/fs/nfs/nfsport.h Sun Apr 29 22:01:23 2012 (r234818)
@@ -835,6 +835,7 @@ void newnfs_realign(struct mbuf **);
*/
#define NFSSTA_HASWRITEVERF 0x00040000 /* Has write verifier */
#define NFSSTA_GOTFSINFO 0x00100000 /* Got the fsinfo */
+#define NFSSTA_SESSPERSIST 0x08000000 /* Has a persistent session */
#define NFSSTA_TIMEO 0x10000000 /* Experiencing a timeout */
#define NFSSTA_LOCKTIMEO 0x20000000 /* Experiencing a lockd timeout */
#define NFSSTA_HASSETFSID 0x40000000 /* Has set the fsid */
@@ -860,6 +861,7 @@ void newnfs_realign(struct mbuf **);
#define NFSSETWRITEVERF(n) ((n)->nm_state |= NFSSTA_HASWRITEVERF)
#define NFSSETHASSETFSID(n) ((n)->nm_state |= NFSSTA_HASSETFSID)
#define NFSHASPNFSOPT(n) ((n)->nm_flag & NFSMNT_PNFS)
+#define NFSHASSESSPERSIST(n) ((n)->nm_state & NFSSTA_SESSPERSIST)
#define NFSHASPNFS(n) ((n)->nm_state & NFSSTA_PNFS)
/*
Modified: projects/nfsv4.1-client/sys/fs/nfsclient/nfs_clrpcops.c
==============================================================================
--- projects/nfsv4.1-client/sys/fs/nfsclient/nfs_clrpcops.c Sun Apr 29 20:27:44 2012 (r234817)
+++ projects/nfsv4.1-client/sys/fs/nfsclient/nfs_clrpcops.c Sun Apr 29 22:01:23 2012 (r234818)
@@ -4469,7 +4469,7 @@ int
nfsrpc_createsession(struct nfsmount *nmp, struct nfsclsession *sep,
uint32_t sequenceid, struct ucred *cred, NFSPROC_T *p)
{
- uint32_t *tl;
+ uint32_t crflags, *tl;
struct nfsrv_descript nfsd;
struct nfsrv_descript *nd = &nfsd;
int error, irdcnt;
@@ -4480,11 +4480,10 @@ nfsrpc_createsession(struct nfsmount *nm
*tl++ = sep->nfsess_clientid.lval[1];
*tl++ = txdr_unsigned(sequenceid);
printf("clseq0=0x%x\n",sequenceid);
+ crflags = (NFSMNT_RDONLY(nmp->nm_mountp) ? 0 : NFSV4CRSESS_PERSIST);
if (nfscl_enablecallb != 0 && nfs_numnfscbd > 0)
- *tl = txdr_unsigned(NFSV4CRSESS_PERSIST |
- NFSV4CRSESS_CONNBACKCHAN);
- else
- *tl = txdr_unsigned(NFSV4CRSESS_PERSIST);
+ crflags |= NFSV4CRSESS_CONNBACKCHAN;
+ *tl = txdr_unsigned(crflags);
/* Fill in fore channel attributes. */
NFSM_BUILD(tl, uint32_t *, 7 * NFSX_UNSIGNED);
@@ -4528,9 +4527,14 @@ printf("clseq0=0x%x\n",sequenceid);
bcopy(tl, sep->nfsess_sessionid, NFSX_V4SESSIONID);
tl += NFSX_V4SESSIONID / NFSX_UNSIGNED;
sep->nfsess_sequenceid = fxdr_unsigned(uint32_t, *tl++);
+ crflags = fxdr_unsigned(uint32_t, *tl);
printf("clseq=0x%x\n",sep->nfsess_sequenceid);
-printf("crfl=0x%x\n",fxdr_unsigned(uint32_t, *tl));
- /* Don't care about replied flags for now. */
+printf("crfl=0x%x\n",crflags);
+ if ((crflags & NFSV4CRSESS_PERSIST) != 0) {
+ NFSLOCKMNT(nmp);
+ nmp->nm_state |= NFSSTA_SESSPERSIST;
+ NFSUNLOCKMNT(nmp);
+ }
/* Get the fore channel slot count. */
NFSM_DISSECT(tl, uint32_t *, 7 * NFSX_UNSIGNED);
More information about the svn-src-projects
mailing list