svn commit: r229056 - projects/nfsv4.1-client/sys/fs/nfsclient
Rick Macklem
rmacklem at FreeBSD.org
Sat Dec 31 01:06:51 UTC 2011
Author: rmacklem
Date: Sat Dec 31 01:06:51 2011
New Revision: 229056
URL: http://svn.freebsd.org/changeset/base/229056
Log:
Initialize the mutex in the nfsclsession structure inside the
nfsclclient structure. This mutex is used to serialize modifications
of fields in the nfsclsession structure.
Modified:
projects/nfsv4.1-client/sys/fs/nfsclient/nfs_clstate.c
Modified: projects/nfsv4.1-client/sys/fs/nfsclient/nfs_clstate.c
==============================================================================
--- projects/nfsv4.1-client/sys/fs/nfsclient/nfs_clstate.c Sat Dec 31 00:51:16 2011 (r229055)
+++ projects/nfsv4.1-client/sys/fs/nfsclient/nfs_clstate.c Sat Dec 31 01:06:51 2011 (r229056)
@@ -721,7 +721,9 @@ nfscl_getcl(struct mount *mp, struct ucr
idlen += sizeof (u_int64_t) + 16; /* 16 random bytes */
MALLOC(newclp, struct nfsclclient *,
sizeof (struct nfsclclient) + idlen - 1, M_NFSCLCLIENT,
- M_WAITOK);
+ M_WAITOK | M_ZERO);
+ mtx_init(&newclp->nfsc_mtx, "ClientID lock", NULL,
+ MTX_DEF | MTX_DUPOK);
}
NFSLOCKCLSTATE();
/*
@@ -731,8 +733,10 @@ nfscl_getcl(struct mount *mp, struct ucr
*/
if ((mp->mnt_kern_flag & MNTK_UNMOUNTF) != 0) {
NFSUNLOCKCLSTATE();
- if (newclp != NULL)
+ if (newclp != NULL) {
+ mtx_destroy(&newclp->nfsc_mtx);
free(newclp, M_NFSCLCLIENT);
+ }
return (EBADF);
}
clp = nmp->nm_clp;
@@ -742,7 +746,6 @@ nfscl_getcl(struct mount *mp, struct ucr
return (EACCES);
}
clp = newclp;
- NFSBZERO((caddr_t)clp, sizeof(struct nfsclclient) + idlen - 1);
clp->nfsc_idlen = idlen;
LIST_INIT(&clp->nfsc_owner);
TAILQ_INIT(&clp->nfsc_deleg);
@@ -761,8 +764,10 @@ nfscl_getcl(struct mount *mp, struct ucr
nfscl_start_renewthread(clp);
} else {
NFSUNLOCKCLSTATE();
- if (newclp != NULL)
- FREE((caddr_t)newclp, M_NFSCLCLIENT);
+ if (newclp != NULL) {
+ mtx_destroy(&newclp->nfsc_mtx);
+ free(newclp, M_NFSCLCLIENT);
+ }
}
NFSLOCKCLSTATE();
while ((clp->nfsc_flags & NFSCLFLAGS_HASCLIENTID) == 0 && !igotlock &&
More information about the svn-src-projects
mailing list