From owner-svn-src-projects@FreeBSD.ORG Wed Jan 1 01:46:58 2014 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id BEA89E38; Wed, 1 Jan 2014 01:46:58 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id A94CF1222; Wed, 1 Jan 2014 01:46:58 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s011kwMU089735; Wed, 1 Jan 2014 01:46:58 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s011ku84089718; Wed, 1 Jan 2014 01:46:56 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201401010146.s011ku84089718@svn.freebsd.org> From: Rick Macklem Date: Wed, 1 Jan 2014 01:46:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r260158 - in projects/nfsv4.1-server/sys: conf fs/nfs fs/nfsserver modules/krpc rpc X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Jan 2014 01:46:58 -0000 Author: rmacklem Date: Wed Jan 1 01:46:56 2014 New Revision: 260158 URL: http://svnweb.freebsd.org/changeset/base/260158 Log: Add backchannel support to the NFSv4.1 server. Added: projects/nfsv4.1-server/sys/rpc/clnt_bck.c (contents, props changed) Modified: projects/nfsv4.1-server/sys/conf/files projects/nfsv4.1-server/sys/fs/nfs/nfs.h projects/nfsv4.1-server/sys/fs/nfs/nfs_commonkrpc.c projects/nfsv4.1-server/sys/fs/nfs/nfs_commonsubs.c projects/nfsv4.1-server/sys/fs/nfs/nfs_var.h projects/nfsv4.1-server/sys/fs/nfs/nfsclstate.h projects/nfsv4.1-server/sys/fs/nfs/nfsport.h projects/nfsv4.1-server/sys/fs/nfs/nfsrvstate.h projects/nfsv4.1-server/sys/fs/nfsserver/nfs_nfsdkrpc.c projects/nfsv4.1-server/sys/fs/nfsserver/nfs_nfsdserv.c projects/nfsv4.1-server/sys/fs/nfsserver/nfs_nfsdstate.c projects/nfsv4.1-server/sys/modules/krpc/Makefile projects/nfsv4.1-server/sys/rpc/krpc.h projects/nfsv4.1-server/sys/rpc/svc.h projects/nfsv4.1-server/sys/rpc/svc_vc.c Modified: projects/nfsv4.1-server/sys/conf/files ============================================================================== --- projects/nfsv4.1-server/sys/conf/files Wed Jan 1 01:26:39 2014 (r260157) +++ projects/nfsv4.1-server/sys/conf/files Wed Jan 1 01:46:56 2014 (r260158) @@ -3749,6 +3749,7 @@ pci/viapm.c optional viapm pci rpc/auth_none.c optional krpc | nfslockd | nfsclient | nfsserver | nfscl | nfsd rpc/auth_unix.c optional krpc | nfslockd | nfsclient | nfscl | nfsd rpc/authunix_prot.c optional krpc | nfslockd | nfsclient | nfsserver | nfscl | nfsd +rpc/clnt_bck.c optional krpc | nfslockd | nfsserver | nfscl | nfsd rpc/clnt_dg.c optional krpc | nfslockd | nfsclient | nfscl | nfsd rpc/clnt_rc.c optional krpc | nfslockd | nfsclient | nfscl | nfsd rpc/clnt_vc.c optional krpc | nfslockd | nfsclient | nfsserver | nfscl | nfsd Modified: projects/nfsv4.1-server/sys/fs/nfs/nfs.h ============================================================================== --- projects/nfsv4.1-server/sys/fs/nfs/nfs.h Wed Jan 1 01:26:39 2014 (r260157) +++ projects/nfsv4.1-server/sys/fs/nfs/nfs.h Wed Jan 1 01:46:56 2014 (r260158) @@ -281,6 +281,7 @@ struct nfsreferral { #define LCL_GSSPRIVACY 0x00004000 #define LCL_ADMINREVOKED 0x00008000 #define LCL_RECLAIMCOMPLETE 0x00010000 +#define LCL_NFSV41 0x00020000 #define LCL_GSS LCL_KERBV /* Or of all mechs */ @@ -588,6 +589,7 @@ struct nfsrv_descript { uint32_t *nd_slotseq; /* ptr to slot seq# in req */ uint8_t nd_sessionid[NFSX_V4SESSIONID]; /* Session id */ uint32_t nd_slotid; /* Slotid for this RPC */ + SVCXPRT *nd_xprt; /* Server RPC handle */ }; #define nd_princlen nd_gssnamelen Modified: projects/nfsv4.1-server/sys/fs/nfs/nfs_commonkrpc.c ============================================================================== --- projects/nfsv4.1-server/sys/fs/nfs/nfs_commonkrpc.c Wed Jan 1 01:26:39 2014 (r260157) +++ projects/nfsv4.1-server/sys/fs/nfs/nfs_commonkrpc.c Wed Jan 1 01:46:56 2014 (r260158) @@ -58,6 +58,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include @@ -738,8 +739,12 @@ tryagain: } nd->nd_mrep = NULL; - stat = CLNT_CALL_MBUF(nrp->nr_client, &ext, procnum, nd->nd_mreq, - &nd->nd_mrep, timo); + if (clp != NULL && sep != NULL) + stat = clnt_bck_call(nrp->nr_client, &ext, procnum, + nd->nd_mreq, &nd->nd_mrep, timo, sep->nfsess_xprt); + else + stat = CLNT_CALL_MBUF(nrp->nr_client, &ext, procnum, + nd->nd_mreq, &nd->nd_mrep, timo); if (rep != NULL) { /* @@ -794,7 +799,8 @@ tryagain: nd->nd_md = nd->nd_mrep; nd->nd_dpos = NFSMTOD(nd->nd_md, caddr_t); nd->nd_repstat = 0; - if (nd->nd_procnum != NFSPROC_NULL) { + if (nd->nd_procnum != NFSPROC_NULL && + nd->nd_procnum != NFSV4PROC_CBNULL) { /* If sep == NULL, set it to the default in nmp. */ if (sep == NULL && nmp != NULL) sep = NFSMNT_MDSSESSION(nmp); @@ -826,11 +832,20 @@ tryagain: /* * If the first op is Sequence, free up the slot. */ - if (nmp != NULL && i == NFSV4OP_SEQUENCE && j != 0) + if ((nmp != NULL && i == NFSV4OP_SEQUENCE && j != 0) || + (clp != NULL && i == NFSV4OP_CBSEQUENCE && j != 0)) NFSCL_DEBUG(1, "failed seq=%d\n", j); - if (nmp != NULL && i == NFSV4OP_SEQUENCE && j == 0) { - NFSM_DISSECT(tl, uint32_t *, NFSX_V4SESSIONID + - 5 * NFSX_UNSIGNED); + if ((nmp != NULL && i == NFSV4OP_SEQUENCE && j == 0) || + (clp != NULL && i == NFSV4OP_CBSEQUENCE && j == 0) + ) { + if (i == NFSV4OP_SEQUENCE) + NFSM_DISSECT(tl, uint32_t *, + NFSX_V4SESSIONID + + 5 * NFSX_UNSIGNED); + else + NFSM_DISSECT(tl, uint32_t *, + NFSX_V4SESSIONID + + 4 * NFSX_UNSIGNED); mtx_lock(&sep->nfsess_mtx); tl += NFSX_V4SESSIONID / NFSX_UNSIGNED; retseq = fxdr_unsigned(uint32_t, *tl++); Modified: projects/nfsv4.1-server/sys/fs/nfs/nfs_commonsubs.c ============================================================================== --- projects/nfsv4.1-server/sys/fs/nfs/nfs_commonsubs.c Wed Jan 1 01:26:39 2014 (r260157) +++ projects/nfsv4.1-server/sys/fs/nfs/nfs_commonsubs.c Wed Jan 1 01:46:56 2014 (r260158) @@ -3744,9 +3744,36 @@ nfsv4_setsequence(struct nfsmount *nmp, struct nfsclsession *sep, int dont_replycache) { uint32_t *tl, slotseq = 0; + int error, maxslot, slotpos; + uint8_t sessionid[NFSX_V4SESSIONID]; + + error = nfsv4_sequencelookup(nmp, sep, &slotpos, &maxslot, &slotseq, + sessionid); + if (error != 0) + return; + KASSERT(maxslot >= 0, ("nfscl_setsequence neg maxslot")); + + /* Build the Sequence arguments. */ + NFSM_BUILD(tl, uint32_t *, NFSX_V4SESSIONID + 4 * NFSX_UNSIGNED); + bcopy(sessionid, tl, NFSX_V4SESSIONID); + tl += NFSX_V4SESSIONID / NFSX_UNSIGNED; + nd->nd_slotseq = tl; + *tl++ = txdr_unsigned(slotseq); + *tl++ = txdr_unsigned(slotpos); + *tl++ = txdr_unsigned(maxslot); + if (dont_replycache == 0) + *tl = newnfs_true; + else + *tl = newnfs_false; + nd->nd_flag |= ND_HASSEQUENCE; +} + +int +nfsv4_sequencelookup(struct nfsmount *nmp, struct nfsclsession *sep, + int *slotposp, int *maxslotp, uint32_t *slotseqp, uint8_t *sessionid) +{ int i, maxslot, slotpos; uint64_t bitval; - uint8_t sessionid[NFSX_V4SESSIONID]; /* Find an unused slot. */ slotpos = -1; @@ -3759,7 +3786,7 @@ nfsv4_setsequence(struct nfsmount *nmp, slotpos = i; sep->nfsess_slots |= bitval; sep->nfsess_slotseq[i]++; - slotseq = sep->nfsess_slotseq[i]; + *slotseqp = sep->nfsess_slotseq[i]; break; } bitval <<= 1; @@ -3770,10 +3797,11 @@ nfsv4_setsequence(struct nfsmount *nmp, * This RPC attempt will fail when it calls * newnfs_request(). */ - if ((nmp->nm_mountp->mnt_kern_flag & MNTK_UNMOUNTF) + if (nmp != NULL && + (nmp->nm_mountp->mnt_kern_flag & MNTK_UNMOUNTF) != 0) { mtx_unlock(&sep->nfsess_mtx); - return; + return (ESTALE); } /* Wake up once/sec, to check for a forced dismount. */ (void)mtx_sleep(&sep->nfsess_slots, &sep->nfsess_mtx, @@ -3789,21 +3817,9 @@ nfsv4_setsequence(struct nfsmount *nmp, } bcopy(sep->nfsess_sessionid, sessionid, NFSX_V4SESSIONID); mtx_unlock(&sep->nfsess_mtx); - KASSERT(maxslot >= 0, ("nfscl_setsequence neg maxslot")); - - /* Build the Sequence arguments. */ - NFSM_BUILD(tl, uint32_t *, NFSX_V4SESSIONID + 4 * NFSX_UNSIGNED); - bcopy(sessionid, tl, NFSX_V4SESSIONID); - tl += NFSX_V4SESSIONID / NFSX_UNSIGNED; - nd->nd_slotseq = tl; - *tl++ = txdr_unsigned(slotseq); - *tl++ = txdr_unsigned(slotpos); - *tl++ = txdr_unsigned(maxslot); - if (dont_replycache == 0) - *tl = newnfs_true; - else - *tl = newnfs_false; - nd->nd_flag |= ND_HASSEQUENCE; + *slotposp = slotpos; + *maxslotp = maxslot; + return (0); } /* Modified: projects/nfsv4.1-server/sys/fs/nfs/nfs_var.h ============================================================================== --- projects/nfsv4.1-server/sys/fs/nfs/nfs_var.h Wed Jan 1 01:26:39 2014 (r260157) +++ projects/nfsv4.1-server/sys/fs/nfs/nfs_var.h Wed Jan 1 01:46:56 2014 (r260158) @@ -292,6 +292,8 @@ int nfsv4_seqsession(uint32_t, uint32_t, void nfsv4_seqsess_cacherep(uint32_t, struct nfsslot *, int, struct mbuf **); void nfsv4_setsequence(struct nfsmount *, struct nfsrv_descript *, struct nfsclsession *, int); +int nfsv4_sequencelookup(struct nfsmount *, struct nfsclsession *, int *, + int *, uint32_t *, uint8_t *); void nfsv4_freeslot(struct nfsclsession *, int); /* nfs_clcomsubs.c */ Modified: projects/nfsv4.1-server/sys/fs/nfs/nfsclstate.h ============================================================================== --- projects/nfsv4.1-server/sys/fs/nfs/nfsclstate.h Wed Jan 1 01:26:39 2014 (r260157) +++ projects/nfsv4.1-server/sys/fs/nfs/nfsclstate.h Wed Jan 1 01:46:56 2014 (r260158) @@ -57,6 +57,7 @@ struct nfsclsession { struct mtx nfsess_mtx; struct nfsslot nfsess_cbslots[NFSV4_CBSLOTS]; nfsquad_t nfsess_clientid; + SVCXPRT *nfsess_xprt; /* For backchannel callback */ uint32_t nfsess_slotseq[64]; /* Max for 64bit nm_slots */ uint64_t nfsess_slots; uint32_t nfsess_sequenceid; Modified: projects/nfsv4.1-server/sys/fs/nfs/nfsport.h ============================================================================== --- projects/nfsv4.1-server/sys/fs/nfs/nfsport.h Wed Jan 1 01:26:39 2014 (r260157) +++ projects/nfsv4.1-server/sys/fs/nfs/nfsport.h Wed Jan 1 01:46:56 2014 (r260158) @@ -638,6 +638,7 @@ void nfsrvd_rcv(struct socket *, void *, #define NFSUNLOCKSOCKREQ(r) mtx_unlock(&((r)->nr_mtx)) #define NFSLOCKDS(d) mtx_lock(&((d)->nfsclds_mtx)) #define NFSUNLOCKDS(d) mtx_unlock(&((d)->nfsclds_mtx)) +#define NFSSESSIONMUTEXPTR(s) (&((s)->mtx)) #define NFSLOCKSESSION(s) mtx_lock(&((s)->mtx)) #define NFSUNLOCKSESSION(s) mtx_unlock(&((s)->mtx)) Modified: projects/nfsv4.1-server/sys/fs/nfs/nfsrvstate.h ============================================================================== --- projects/nfsv4.1-server/sys/fs/nfs/nfsrvstate.h Wed Jan 1 01:26:39 2014 (r260157) +++ projects/nfsv4.1-server/sys/fs/nfs/nfsrvstate.h Wed Jan 1 01:46:56 2014 (r260158) @@ -112,8 +112,22 @@ struct nfsclient { /* * Structure for an NFSv4.1 session. + * Locking rules for this structure. + * To add/delete one of these structures from the lists, you must lock + * both: NFSLOCKSESSION(session hashhead) and NFSLOCKSTATE() in that order. + * To traverse the lists looking for one of these, you must hold one + * of these two locks. + * The exception is if the thread holds the exclusive root sleep lock. + * In this case, all other nfsd threads are blocked, so locking the + * mutexes isn't required. + * When manipulating sess_refcnt, NFSLOCKSTATE() must be locked. + * When manipulating the fields withinsess_cbsess except nfsess_xprt, + * sess_cbsess.nfsess_mtx must be locked. + * When manipulating sess_slots and sess_cbsess.nfsess_xprt, + * NFSLOCKSESSION(session hashhead) must be locked. */ struct nfsdsession { + uint64_t sess_refcnt; /* Reference count. */ LIST_ENTRY(nfsdsession) sess_hash; /* Hash list of sessions. */ LIST_ENTRY(nfsdsession) sess_list; /* List of client sessions. */ struct nfsslot sess_slots[NFSV4_SLOTS]; @@ -129,8 +143,8 @@ struct nfsdsession { uint32_t sess_cbmaxresp; uint32_t sess_cbmaxrespcached; uint32_t sess_cbmaxops; - uint32_t sess_cbmaxslots; uint8_t sess_sessionid[NFSX_V4SESSIONID]; + struct nfsclsession sess_cbsess; /* Callback session. */ }; /* Modified: projects/nfsv4.1-server/sys/fs/nfsserver/nfs_nfsdkrpc.c ============================================================================== --- projects/nfsv4.1-server/sys/fs/nfsserver/nfs_nfsdkrpc.c Wed Jan 1 01:26:39 2014 (r260157) +++ projects/nfsv4.1-server/sys/fs/nfsserver/nfs_nfsdkrpc.c Wed Jan 1 01:46:56 2014 (r260158) @@ -98,7 +98,7 @@ SYSCTL_INT(_vfs_nfsd, OID_AUTO, server_m &nfs_maxvers, 0, "The highest version of NFS handled by the server"); static int nfs_proc(struct nfsrv_descript *, u_int32_t, struct socket *, - u_int64_t, struct nfsrvcache **); + u_int64_t, SVCXPRT *, struct nfsrvcache **); extern u_long sb_max_adj; extern int newnfs_numnfsd; @@ -252,7 +252,7 @@ nfssvc_program(struct svc_req *rqst, SVC } cacherep = nfs_proc(&nd, rqst->rq_xid, xprt->xp_socket, - xprt->xp_sockref, &rp); + xprt->xp_sockref, xprt, &rp); NFSLOCKV4ROOTMUTEX(); nfsv4_relref(&nfsd_suspend_lock); NFSUNLOCKV4ROOTMUTEX(); @@ -301,7 +301,7 @@ out: */ static int nfs_proc(struct nfsrv_descript *nd, u_int32_t xid, struct socket *so, - u_int64_t sockref, struct nfsrvcache **rpp) + u_int64_t sockref, SVCXPRT *xprt, struct nfsrvcache **rpp) { struct thread *td = curthread; int cacherep = RC_DOIT, isdgram, taglen = -1; @@ -357,6 +357,8 @@ nfs_proc(struct nfsrv_descript *nd, u_in * RC_DROPIT - just throw the request away */ if (cacherep == RC_DOIT) { + if ((nd->nd_flag & ND_NFSV41) != 0) + nd->nd_xprt = xprt; nfsrvd_dorpc(nd, isdgram, tagstr, taglen, minorvers, td); if ((nd->nd_flag & ND_NFSV41) != 0) { if (nd->nd_repstat != NFSERR_REPLYFROMCACHE && Modified: projects/nfsv4.1-server/sys/fs/nfsserver/nfs_nfsdserv.c ============================================================================== --- projects/nfsv4.1-server/sys/fs/nfsserver/nfs_nfsdserv.c Wed Jan 1 01:26:39 2014 (r260157) +++ projects/nfsv4.1-server/sys/fs/nfsserver/nfs_nfsdserv.c Wed Jan 1 01:46:56 2014 (r260158) @@ -666,10 +666,14 @@ nfsrvd_read(struct nfsrv_descript *nd, _ stp->ls_stateid.seqid = fxdr_unsigned(u_int32_t, *tl++); clientid.lval[0] = stp->ls_stateid.other[0] = *tl++; clientid.lval[1] = stp->ls_stateid.other[1] = *tl++; - if (nd->nd_flag & ND_IMPLIEDCLID) { - if (nd->nd_clientid.qval != clientid.qval) - printf("EEK! multiple clids\n"); + if ((nd->nd_flag & ND_IMPLIEDCLID) != 0) { + if ((nd->nd_flag & ND_NFSV41) != 0) + clientid.qval = nd->nd_clientid.qval; + else if (nd->nd_clientid.qval != clientid.qval) + printf("EEK1 multiple clids\n"); } else { + if ((nd->nd_flag & ND_NFSV41) != 0) + printf("EEK! no clientid from session\n"); nd->nd_flag |= ND_IMPLIEDCLID; nd->nd_clientid.qval = clientid.qval; } @@ -818,10 +822,14 @@ nfsrvd_write(struct nfsrv_descript *nd, stp->ls_stateid.seqid = fxdr_unsigned(u_int32_t, *tl++); clientid.lval[0] = stp->ls_stateid.other[0] = *tl++; clientid.lval[1] = stp->ls_stateid.other[1] = *tl++; - if (nd->nd_flag & ND_IMPLIEDCLID) { - if (nd->nd_clientid.qval != clientid.qval) - printf("EEK! multiple clids\n"); + if ((nd->nd_flag & ND_IMPLIEDCLID) != 0) { + if ((nd->nd_flag & ND_NFSV41) != 0) + clientid.qval = nd->nd_clientid.qval; + else if (nd->nd_clientid.qval != clientid.qval) + printf("EEK2 multiple clids\n"); } else { + if ((nd->nd_flag & ND_NFSV41) != 0) + printf("EEK! no clientid from session\n"); nd->nd_flag |= ND_IMPLIEDCLID; nd->nd_clientid.qval = clientid.qval; } @@ -2196,10 +2204,14 @@ nfsrvd_lock(struct nfsrv_descript *nd, _ stp->ls_opentolockseq = fxdr_unsigned(int, *tl++); clientid.lval[0] = *tl++; clientid.lval[1] = *tl++; - if (nd->nd_flag & ND_IMPLIEDCLID) { - if (nd->nd_clientid.qval != clientid.qval) - printf("EEK! multiple clids\n"); + if ((nd->nd_flag & ND_IMPLIEDCLID) != 0) { + if ((nd->nd_flag & ND_NFSV41) != 0) + clientid.qval = nd->nd_clientid.qval; + else if (nd->nd_clientid.qval != clientid.qval) + printf("EEK3 multiple clids\n"); } else { + if ((nd->nd_flag & ND_NFSV41) != 0) + printf("EEK! no clientid from session\n"); nd->nd_flag |= ND_IMPLIEDCLID; nd->nd_clientid.qval = clientid.qval; } @@ -2219,10 +2231,14 @@ nfsrvd_lock(struct nfsrv_descript *nd, _ stp->ls_seq = fxdr_unsigned(int, *tl); clientid.lval[0] = stp->ls_stateid.other[0]; clientid.lval[1] = stp->ls_stateid.other[1]; - if (nd->nd_flag & ND_IMPLIEDCLID) { - if (nd->nd_clientid.qval != clientid.qval) - printf("EEK! multiple clids\n"); + if ((nd->nd_flag & ND_IMPLIEDCLID) != 0) { + if ((nd->nd_flag & ND_NFSV41) != 0) + clientid.qval = nd->nd_clientid.qval; + else if (nd->nd_clientid.qval != clientid.qval) + printf("EEK4 multiple clids\n"); } else { + if ((nd->nd_flag & ND_NFSV41) != 0) + printf("EEK! no clientid from session\n"); nd->nd_flag |= ND_IMPLIEDCLID; nd->nd_clientid.qval = clientid.qval; } @@ -2368,10 +2384,14 @@ nfsrvd_lockt(struct nfsrv_descript *nd, tl += 2; clientid.lval[0] = *tl++; clientid.lval[1] = *tl; - if (nd->nd_flag & ND_IMPLIEDCLID) { - if (nd->nd_clientid.qval != clientid.qval) - printf("EEK! multiple clids\n"); + if ((nd->nd_flag & ND_IMPLIEDCLID) != 0) { + if ((nd->nd_flag & ND_NFSV41) != 0) + clientid.qval = nd->nd_clientid.qval; + else if (nd->nd_clientid.qval != clientid.qval) + printf("EEK5 multiple clids\n"); } else { + if ((nd->nd_flag & ND_NFSV41) != 0) + printf("EEK! no clientid from session\n"); nd->nd_flag |= ND_IMPLIEDCLID; nd->nd_clientid.qval = clientid.qval; } @@ -2479,10 +2499,14 @@ nfsrvd_locku(struct nfsrv_descript *nd, } clientid.lval[0] = stp->ls_stateid.other[0]; clientid.lval[1] = stp->ls_stateid.other[1]; - if (nd->nd_flag & ND_IMPLIEDCLID) { - if (nd->nd_clientid.qval != clientid.qval) - printf("EEK! multiple clids\n"); + if ((nd->nd_flag & ND_IMPLIEDCLID) != 0) { + if ((nd->nd_flag & ND_NFSV41) != 0) + clientid.qval = nd->nd_clientid.qval; + else if (nd->nd_clientid.qval != clientid.qval) + printf("EEK6 multiple clids\n"); } else { + if ((nd->nd_flag & ND_NFSV41) != 0) + printf("EEK! no clientid from session\n"); nd->nd_flag |= ND_IMPLIEDCLID; nd->nd_clientid.qval = clientid.qval; } @@ -2601,10 +2625,14 @@ nfsrvd_open(struct nfsrv_descript *nd, _ }; clientid.lval[0] = *tl++; clientid.lval[1] = *tl; - if (nd->nd_flag & ND_IMPLIEDCLID) { - if (nd->nd_clientid.qval != clientid.qval) - printf("EEK! multiple clids\n"); + if ((nd->nd_flag & ND_IMPLIEDCLID) != 0) { + if ((nd->nd_flag & ND_NFSV41) != 0) + clientid.qval = nd->nd_clientid.qval; + else if (nd->nd_clientid.qval != clientid.qval) + printf("EEK7 multiple clids\n"); } else { + if ((nd->nd_flag & ND_NFSV41) != 0) + printf("EEK! no clientid from session\n"); nd->nd_flag |= ND_IMPLIEDCLID; nd->nd_clientid.qval = clientid.qval; } @@ -2954,10 +2982,14 @@ nfsrvd_close(struct nfsrv_descript *nd, stp->ls_flags = NFSLCK_CLOSE; clientid.lval[0] = stp->ls_stateid.other[0]; clientid.lval[1] = stp->ls_stateid.other[1]; - if (nd->nd_flag & ND_IMPLIEDCLID) { - if (nd->nd_clientid.qval != clientid.qval) - printf("EEK! multiple clids\n"); + if ((nd->nd_flag & ND_IMPLIEDCLID) != 0) { + if ((nd->nd_flag & ND_NFSV41) != 0) + clientid.qval = nd->nd_clientid.qval; + else if (nd->nd_clientid.qval != clientid.qval) + printf("EEK8 multiple clids\n"); } else { + if ((nd->nd_flag & ND_NFSV41) != 0) + printf("EEK! no clientid from session\n"); nd->nd_flag |= ND_IMPLIEDCLID; nd->nd_clientid.qval = clientid.qval; } @@ -2994,10 +3026,14 @@ nfsrvd_delegpurge(struct nfsrv_descript NFSM_DISSECT(tl, u_int32_t *, 2 * NFSX_UNSIGNED); clientid.lval[0] = *tl++; clientid.lval[1] = *tl; - if (nd->nd_flag & ND_IMPLIEDCLID) { - if (nd->nd_clientid.qval != clientid.qval) - printf("EEK! multiple clids\n"); + if ((nd->nd_flag & ND_IMPLIEDCLID) != 0) { + if ((nd->nd_flag & ND_NFSV41) != 0) + clientid.qval = nd->nd_clientid.qval; + else if (nd->nd_clientid.qval != clientid.qval) + printf("EEK9 multiple clids\n"); } else { + if ((nd->nd_flag & ND_NFSV41) != 0) + printf("EEK! no clientid from session\n"); nd->nd_flag |= ND_IMPLIEDCLID; nd->nd_clientid.qval = clientid.qval; } @@ -3025,10 +3061,14 @@ nfsrvd_delegreturn(struct nfsrv_descript NFSBCOPY((caddr_t)tl, (caddr_t)stateid.other, NFSX_STATEIDOTHER); clientid.lval[0] = stateid.other[0]; clientid.lval[1] = stateid.other[1]; - if (nd->nd_flag & ND_IMPLIEDCLID) { - if (nd->nd_clientid.qval != clientid.qval) - printf("EEK! multiple clids\n"); + if ((nd->nd_flag & ND_IMPLIEDCLID) != 0) { + if ((nd->nd_flag & ND_NFSV41) != 0) + clientid.qval = nd->nd_clientid.qval; + else if (nd->nd_clientid.qval != clientid.qval) + printf("EEK10 multiple clids\n"); } else { + if ((nd->nd_flag & ND_NFSV41) != 0) + printf("EEK! no clientid from session\n"); nd->nd_flag |= ND_IMPLIEDCLID; nd->nd_clientid.qval = clientid.qval; } @@ -3086,10 +3126,14 @@ nfsrvd_openconfirm(struct nfsrv_descript stp->ls_flags = NFSLCK_CONFIRM; clientid.lval[0] = stp->ls_stateid.other[0]; clientid.lval[1] = stp->ls_stateid.other[1]; - if (nd->nd_flag & ND_IMPLIEDCLID) { - if (nd->nd_clientid.qval != clientid.qval) - printf("EEK! multiple clids\n"); + if ((nd->nd_flag & ND_IMPLIEDCLID) != 0) { + if ((nd->nd_flag & ND_NFSV41) != 0) + clientid.qval = nd->nd_clientid.qval; + else if (nd->nd_clientid.qval != clientid.qval) + printf("EEK11 multiple clids\n"); } else { + if ((nd->nd_flag & ND_NFSV41) != 0) + printf("EEK! no clientid from session\n"); nd->nd_flag |= ND_IMPLIEDCLID; nd->nd_clientid.qval = clientid.qval; } @@ -3162,10 +3206,14 @@ nfsrvd_opendowngrade(struct nfsrv_descri clientid.lval[0] = stp->ls_stateid.other[0]; clientid.lval[1] = stp->ls_stateid.other[1]; - if (nd->nd_flag & ND_IMPLIEDCLID) { - if (nd->nd_clientid.qval != clientid.qval) - printf("EEK! multiple clids\n"); + if ((nd->nd_flag & ND_IMPLIEDCLID) != 0) { + if ((nd->nd_flag & ND_NFSV41) != 0) + clientid.qval = nd->nd_clientid.qval; + else if (nd->nd_clientid.qval != clientid.qval) + printf("EEK12 multiple clids\n"); } else { + if ((nd->nd_flag & ND_NFSV41) != 0) + printf("EEK! no clientid from session\n"); nd->nd_flag |= ND_IMPLIEDCLID; nd->nd_clientid.qval = clientid.qval; } @@ -3205,10 +3253,14 @@ nfsrvd_renew(struct nfsrv_descript *nd, NFSM_DISSECT(tl, u_int32_t *, NFSX_HYPER); clientid.lval[0] = *tl++; clientid.lval[1] = *tl; - if (nd->nd_flag & ND_IMPLIEDCLID) { - if (nd->nd_clientid.qval != clientid.qval) - printf("EEK! multiple clids\n"); + if ((nd->nd_flag & ND_IMPLIEDCLID) != 0) { + if ((nd->nd_flag & ND_NFSV41) != 0) + clientid.qval = nd->nd_clientid.qval; + else if (nd->nd_clientid.qval != clientid.qval) + printf("EEK13 multiple clids\n"); } else { + if ((nd->nd_flag & ND_NFSV41) != 0) + printf("EEK! no clientid from session\n"); nd->nd_flag |= ND_IMPLIEDCLID; nd->nd_clientid.qval = clientid.qval; } @@ -3569,10 +3621,14 @@ nfsrvd_releaselckown(struct nfsrv_descri stp->ls_uid = nd->nd_cred->cr_uid; clientid.lval[0] = *tl++; clientid.lval[1] = *tl; - if (nd->nd_flag & ND_IMPLIEDCLID) { - if (nd->nd_clientid.qval != clientid.qval) - printf("EEK! multiple clids\n"); + if ((nd->nd_flag & ND_IMPLIEDCLID) != 0) { + if ((nd->nd_flag & ND_NFSV41) != 0) + clientid.qval = nd->nd_clientid.qval; + else if (nd->nd_clientid.qval != clientid.qval) + printf("EEK14 multiple clids\n"); } else { + if ((nd->nd_flag & ND_NFSV41) != 0) + printf("EEK! no clientid from session\n"); nd->nd_flag |= ND_IMPLIEDCLID; nd->nd_clientid.qval = clientid.qval; } @@ -3634,13 +3690,13 @@ nfsrvd_exchangeid(struct nfsrv_descript if (error != 0) goto nfsmout; if ((nd->nd_flag & ND_GSS) != 0) { - clp->lc_flags = LCL_GSS; + clp->lc_flags = LCL_GSS | LCL_NFSV41; if ((nd->nd_flag & ND_GSSINTEGRITY) != 0) clp->lc_flags |= LCL_GSSINTEGRITY; else if ((nd->nd_flag & ND_GSSPRIVACY) != 0) clp->lc_flags |= LCL_GSSPRIVACY; } else - clp->lc_flags = 0; + clp->lc_flags = LCL_NFSV41; if ((nd->nd_flag & ND_GSS) != 0 && nd->nd_princlen > 0) { clp->lc_flags |= LCL_NAME; clp->lc_namelen = nd->nd_princlen; @@ -3737,6 +3793,8 @@ nfsrvd_createsession(struct nfsrv_descri } sep = (struct nfsdsession *)malloc(sizeof(struct nfsdsession), M_NFSDSESSION, M_WAITOK | M_ZERO); + sep->sess_refcnt = 1; + mtx_init(&sep->sess_cbsess.nfsess_mtx, "nfscbsession", NULL, MTX_DEF); NFSM_DISSECT(tl, uint32_t *, NFSX_HYPER + 2 * NFSX_UNSIGNED); clientid.lval[0] = *tl++; clientid.lval[1] = *tl++; @@ -3769,7 +3827,7 @@ nfsrvd_createsession(struct nfsrv_descri sep->sess_cbmaxresp = fxdr_unsigned(uint32_t, *tl++); sep->sess_cbmaxrespcached = fxdr_unsigned(uint32_t, *tl++); sep->sess_cbmaxops = fxdr_unsigned(uint32_t, *tl++); - sep->sess_cbmaxslots = fxdr_unsigned(uint32_t, *tl++); + sep->sess_cbsess.nfsess_foreslots = fxdr_unsigned(uint32_t, *tl++); rdmacnt = fxdr_unsigned(uint32_t, *tl); if (rdmacnt > 1) { nd->nd_repstat = NFSERR_BADXDR; @@ -3809,7 +3867,7 @@ nfsrvd_createsession(struct nfsrv_descri *tl++ = txdr_unsigned(sep->sess_cbmaxresp); *tl++ = txdr_unsigned(sep->sess_cbmaxrespcached); *tl++ = txdr_unsigned(sep->sess_cbmaxops); - *tl++ = txdr_unsigned(sep->sess_cbmaxslots); + *tl++ = txdr_unsigned(sep->sess_cbsess.nfsess_foreslots); *tl++ = txdr_unsigned(1); *tl = txdr_unsigned(0); /* No RDMA. */ } Modified: projects/nfsv4.1-server/sys/fs/nfsserver/nfs_nfsdstate.c ============================================================================== --- projects/nfsv4.1-server/sys/fs/nfsserver/nfs_nfsdstate.c Wed Jan 1 01:26:39 2014 (r260157) +++ projects/nfsv4.1-server/sys/fs/nfsserver/nfs_nfsdstate.c Wed Jan 1 01:46:56 2014 (r260158) @@ -95,6 +95,8 @@ static int nfsrv_checkgrace(struct nfsrv static int nfsrv_docallback(struct nfsclient *clp, int procnum, nfsv4stateid_t *stateidp, int trunc, fhandle_t *fhp, struct nfsvattr *nap, nfsattrbit_t *attrbitp, NFSPROC_T *p); +static int nfsrv_cbcallargs(struct nfsrv_descript *nd, struct nfsclient *clp, + uint32_t callback, int op, const char *optag, struct nfsdsession **sepp); static u_int32_t nfsrv_nextclientindex(void); static u_int32_t nfsrv_nextstateindex(struct nfsclient *clp); static void nfsrv_markstable(struct nfsclient *clp); @@ -127,6 +129,9 @@ static void nfsrv_locklf(struct nfslockf static void nfsrv_unlocklf(struct nfslockfile *lfp); static struct nfsdsession *nfsrv_findsession(uint8_t *sessionid); static int nfsrv_freesession(struct nfsdsession *sep, uint8_t *sessionid); +static int nfsv4_setcbsequence(struct nfsrv_descript *nd, struct nfsclient *clp, + int dont_replycache, struct nfsdsession **sepp); +static int nfsv4_getcbsession(struct nfsclient *clp, struct nfsdsession **sepp); /* * Scan the client list for a match and either return the current one, @@ -148,6 +153,7 @@ nfsrv_setclient(struct nfsrv_descript *n /* * Check for state resource limit exceeded. */ +printf("in nfsrv_setcl\n"); if (nfsrv_openpluslock > NFSRV_V4STATELIMIT) { error = NFSERR_RESOURCE; goto out; @@ -205,6 +211,7 @@ nfsrv_setclient(struct nfsrv_descript *n NFSUNLOCKV4ROOTMUTEX(); confirmp->lval[1] = 0; error = NFSERR_NOENT; +printf("reconfirming\n"); goto out; } /* @@ -252,6 +259,7 @@ nfsrv_setclient(struct nfsrv_descript *n if (zapit) nfsrv_zapclient(clp, p); *new_clpp = NULL; +printf("new cl\n"); goto out; } @@ -367,6 +375,7 @@ nfsrv_setclient(struct nfsrv_descript *n NFSUNLOCKSTATE(); nfsrv_zapclient(clp, p); *new_clpp = NULL; +printf("new cl2\n"); goto out; } @@ -411,6 +420,7 @@ nfsrv_setclient(struct nfsrv_descript *n newnfsstats.srvclients++; nfsrv_openpluslock++; nfsrv_clients++; +printf("new cl3\n"); } NFSLOCKV4ROOTMUTEX(); nfsv4_unlock(&nfsv4rootfs_lock, 1); @@ -568,15 +578,39 @@ nfsrv_getclient(nfsquad_t clientid, int clp->lc_flags &= ~(LCL_NEEDSCONFIRM | LCL_DONTCLEAN); if (clp->lc_program) clp->lc_flags |= LCL_NEEDSCBNULL; +printf("prog=%d\n", clp->lc_program); /* For NFSv4.1, link the session onto the client. */ if (nsep != NULL) { +printf("nsep not null\n"); + /* Hold a reference on the xprt for a backchannel. */ + if ((nsep->sess_crflags & NFSV4CRSESS_CONNBACKCHAN) + != 0 && clp->lc_req.nr_client == NULL) { +printf("set backch\n"); + clp->lc_req.nr_client = (struct __rpc_client *) + clnt_bck_create(nd->nd_xprt->xp_socket, + cbprogram, NFSV4_CBVERS); +printf("cbcl=%p\n", clp->lc_req.nr_client); + if (clp->lc_req.nr_client != NULL) { + SVC_ACQUIRE(nd->nd_xprt); + nd->nd_xprt->xp_p2 = + clp->lc_req.nr_client->cl_private; + /* Disable idle timeout. */ + nd->nd_xprt->xp_idletimeout = 0; + nsep->sess_cbsess.nfsess_xprt = nd->nd_xprt; + } else + nsep->sess_crflags &= ~NFSV4CRSESS_CONNBACKCHAN; + } NFSBCOPY(sessid, nsep->sess_sessionid, NFSX_V4SESSIONID); + NFSBCOPY(sessid, nsep->sess_cbsess.nfsess_sessionid, + NFSX_V4SESSIONID); shp = NFSSESSIONHASH(nsep->sess_sessionid); NFSLOCKSESSION(shp); LIST_INSERT_HEAD(&shp->list, nsep, sess_hash); + NFSLOCKSTATE(); LIST_INSERT_HEAD(&clp->lc_session, nsep, sess_list); nsep->sess_clp = clp; + NFSUNLOCKSTATE(); NFSUNLOCKSESSION(shp); } } @@ -3835,9 +3869,7 @@ nfsrv_checkgrace(struct nfsrv_descript * { int error = 0; - if ((nfsrv_stablefirst.nsf_flags & NFSNSF_GRACEOVER) != 0 || - (nd != NULL && clp != NULL && (nd->nd_flag & ND_NFSV41) != 0 && - (clp->lc_flags & LCL_RECLAIMCOMPLETE) != 0)) { + if ((nfsrv_stablefirst.nsf_flags & NFSNSF_GRACEOVER) != 0) { if (flags & NFSLCK_RECLAIM) { error = NFSERR_NOGRACE; goto out; @@ -3847,6 +3879,12 @@ nfsrv_checkgrace(struct nfsrv_descript * error = NFSERR_GRACE; goto out; } + if (nd != NULL && clp != NULL && + (nd->nd_flag & ND_NFSV41) != 0 && + (clp->lc_flags & LCL_RECLAIMCOMPLETE) != 0) { + error = NFSERR_NOGRACE; + goto out; + } /* * If grace is almost over and we are still getting Reclaims, @@ -3877,6 +3915,7 @@ nfsrv_docallback(struct nfsclient *clp, struct ucred *cred; int error = 0; u_int32_t callback; + struct nfsdsession *sep = NULL; cred = newnfs_getcred(); NFSLOCKSTATE(); /* mostly for lc_cbref++ */ @@ -3891,7 +3930,12 @@ nfsrv_docallback(struct nfsclient *clp, * structure for newnfs_connect() to use. */ clp->lc_req.nr_prog = clp->lc_program; - clp->lc_req.nr_vers = NFSV4_CBVERS; +#ifdef notnow + if ((clp->lc_flags & LCL_NFSV41) != 0) + clp->lc_req.nr_vers = NFSV41_CBVERS; + else +#endif + clp->lc_req.nr_vers = NFSV4_CBVERS; /* * First, fill in some of the fields of nd and cr. @@ -3899,6 +3943,8 @@ nfsrv_docallback(struct nfsclient *clp, nd->nd_flag = ND_NFSV4; if (clp->lc_flags & LCL_GSS) nd->nd_flag |= ND_KERBV; + if ((clp->lc_flags & LCL_NFSV41) != 0) + nd->nd_flag |= ND_NFSV41; nd->nd_repstat = 0; cred->cr_uid = clp->lc_uid; cred->cr_gid = clp->lc_gid; @@ -3919,22 +3965,23 @@ nfsrv_docallback(struct nfsclient *clp, */ if (procnum == NFSV4OP_CBGETATTR) { nd->nd_procnum = NFSV4PROC_CBCOMPOUND; - (void) nfsm_strtom(nd, "CB Getattr", 10); - NFSM_BUILD(tl, u_int32_t *, 4 * NFSX_UNSIGNED); - *tl++ = txdr_unsigned(NFSV4_MINORVERSION); - *tl++ = txdr_unsigned(callback); - *tl++ = txdr_unsigned(1); - *tl = txdr_unsigned(NFSV4OP_CBGETATTR); - (void) nfsm_fhtom(nd, (u_int8_t *)fhp, NFSX_MYFH, 0); - (void) nfsrv_putattrbit(nd, attrbitp); + error = nfsrv_cbcallargs(nd, clp, callback, NFSV4OP_CBGETATTR, + "CB Getattr", &sep); + if (error != 0) { + mbuf_freem(nd->nd_mreq); + goto errout; + } + (void)nfsm_fhtom(nd, (u_int8_t *)fhp, NFSX_MYFH, 0); + (void)nfsrv_putattrbit(nd, attrbitp); } else if (procnum == NFSV4OP_CBRECALL) { nd->nd_procnum = NFSV4PROC_CBCOMPOUND; - (void) nfsm_strtom(nd, "CB Recall", 9); - NFSM_BUILD(tl, u_int32_t *, 5 * NFSX_UNSIGNED + NFSX_STATEID); - *tl++ = txdr_unsigned(NFSV4_MINORVERSION); - *tl++ = txdr_unsigned(callback); - *tl++ = txdr_unsigned(1); - *tl++ = txdr_unsigned(NFSV4OP_CBRECALL); + error = nfsrv_cbcallargs(nd, clp, callback, NFSV4OP_CBRECALL, + "CB Recall", &sep); + if (error != 0) { + mbuf_freem(nd->nd_mreq); + goto errout; + } + NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED + NFSX_STATEID); *tl++ = txdr_unsigned(stateidp->seqid); NFSBCOPY((caddr_t)stateidp->other, (caddr_t)tl, NFSX_STATEIDOTHER); @@ -3943,9 +3990,18 @@ nfsrv_docallback(struct nfsclient *clp, *tl = newnfs_true; else *tl = newnfs_false; - (void) nfsm_fhtom(nd, (u_int8_t *)fhp, NFSX_MYFH, 0); - } else { + (void)nfsm_fhtom(nd, (u_int8_t *)fhp, NFSX_MYFH, 0); + } else if (procnum == NFSV4PROC_CBNULL) { nd->nd_procnum = NFSV4PROC_CBNULL; + error = nfsv4_getcbsession(clp, &sep); + if (error != 0) { + mbuf_freem(nd->nd_mreq); + goto errout; + } + } else { + error = NFSERR_SERVERFAULT; + mbuf_freem(nd->nd_mreq); + goto errout; } /* @@ -3953,7 +4009,9 @@ nfsrv_docallback(struct nfsclient *clp, */ (void) newnfs_sndlock(&clp->lc_req.nr_lock); if (clp->lc_req.nr_client == NULL) { - if (nd->nd_procnum == NFSV4PROC_CBNULL) + if ((clp->lc_flags & LCL_NFSV41) != 0) + error = ECONNREFUSED; + else if (nd->nd_procnum == NFSV4PROC_CBNULL) error = newnfs_connect(NULL, &clp->lc_req, cred, NULL, 1); else @@ -3962,10 +4020,19 @@ nfsrv_docallback(struct nfsclient *clp, } newnfs_sndunlock(&clp->lc_req.nr_lock); if (!error) { - error = newnfs_request(nd, NULL, clp, &clp->lc_req, NULL, - NULL, cred, clp->lc_program, NFSV4_CBVERS, NULL, 1, NULL, - NULL); + if ((nd->nd_flag & ND_NFSV41) != 0) { + KASSERT(sep != NULL, ("sep NULL")); + error = newnfs_request(nd, NULL, clp, &clp->lc_req, + NULL, NULL, cred, clp->lc_program, + clp->lc_req.nr_vers, NULL, 1, NULL, + &sep->sess_cbsess); + nfsrv_freesession(sep, NULL); + } else + error = newnfs_request(nd, NULL, clp, &clp->lc_req, + NULL, NULL, cred, clp->lc_program, + clp->lc_req.nr_vers, NULL, 1, NULL, NULL); } +errout: NFSFREECRED(cred); /* @@ -3995,7 +4062,7 @@ nfsrv_docallback(struct nfsclient *clp, NFSUNLOCKSTATE(); if (nd->nd_repstat) error = nd->nd_repstat; - else if (procnum == NFSV4OP_CBGETATTR) + else if (error == 0 && procnum == NFSV4OP_CBGETATTR) error = nfsv4_loadattr(nd, NULL, nap, NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, p, NULL); @@ -4014,6 +4081,38 @@ nfsrv_docallback(struct nfsclient *clp, } /* + * Set up the compound RPC for the callback. + */ +static int +nfsrv_cbcallargs(struct nfsrv_descript *nd, struct nfsclient *clp, + uint32_t callback, int op, const char *optag, struct nfsdsession **sepp) +{ + uint32_t *tl; + int error, len; + + len = strlen(optag); + (void)nfsm_strtom(nd, optag, len); + NFSM_BUILD(tl, uint32_t *, 4 * NFSX_UNSIGNED); + if ((nd->nd_flag & ND_NFSV41) != 0) { + *tl++ = txdr_unsigned(NFSV41_MINORVERSION); + *tl++ = txdr_unsigned(callback); + *tl++ = txdr_unsigned(2); + *tl = txdr_unsigned(NFSV4OP_CBSEQUENCE); + error = nfsv4_setcbsequence(nd, clp, 1, sepp); + if (error != 0) + return (error); + NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED); + *tl = txdr_unsigned(op); + } else { + *tl++ = txdr_unsigned(NFSV4_MINORVERSION); + *tl++ = txdr_unsigned(callback); + *tl++ = txdr_unsigned(1); + *tl = txdr_unsigned(op); + } + return (0); +} + +/* * Return the next index# for a clientid. Mostly just increment and return * the next one, but... if the 32bit unsigned does actually wrap around, * it should be rebooted. @@ -5476,7 +5575,9 @@ nfsrv_checksequence(struct nfsrv_descrip { struct nfsdsession *sep; struct nfssessionhash *shp; + CLIENT *cl; int error; + SVCXPRT *savxprt; shp = NFSSESSIONHASH(nd->nd_sessionid); NFSLOCKSESSION(shp); @@ -5495,6 +5596,26 @@ nfsrv_checksequence(struct nfsrv_descrip nd->nd_flag |= ND_SAVEREPLY; /* Renew the lease. */ sep->sess_clp->lc_expiry = nfsrv_leaseexpiry(); + nd->nd_clientid.qval = sep->sess_clp->lc_clientid.qval; + nd->nd_flag |= ND_IMPLIEDCLID; + + /* + * If this session handles the backchannel, save the nd_xprt for this + * RPC, since this is the one being used. + */ + if (sep->sess_cbsess.nfsess_xprt != NULL && + (sep->sess_crflags & NFSV4CRSESS_CONNBACKCHAN) != 0) { + savxprt = sep->sess_cbsess.nfsess_xprt; + SVC_ACQUIRE(nd->nd_xprt); + nd->nd_xprt->xp_p2 = savxprt->xp_p2; + nd->nd_xprt->xp_idletimeout = 0; /* Disable timeout. */ + sep->sess_cbsess.nfsess_xprt = nd->nd_xprt; + SVC_RELEASE(savxprt); + } + + cl = sep->sess_clp->lc_req.nr_client; + if (cl == NULL) + *sflagsp |= NFSV4SEQ_CBPATHDOWN; NFSUNLOCKSESSION(shp); *sflagsp = 0; if (error == NFSERR_EXPIRED) { @@ -5616,8 +5737,16 @@ nfsrv_freesession(struct nfsdsession *se NFSLOCKSESSION(shp); } if (sep != NULL) { + NFSLOCKSTATE(); + sep->sess_refcnt--; + if (sep->sess_refcnt > 0) { + NFSUNLOCKSTATE(); + NFSUNLOCKSESSION(shp); + return (0); + } LIST_REMOVE(sep, sess_hash); LIST_REMOVE(sep, sess_list); + NFSUNLOCKSTATE(); } NFSUNLOCKSESSION(shp); if (sep == NULL) @@ -5625,6 +5754,8 @@ nfsrv_freesession(struct nfsdsession *se for (i = 0; i < NFSV4_SLOTS; i++) if (sep->sess_slots[i].nfssl_reply != NULL) m_freem(sep->sess_slots[i].nfssl_reply); + if (sep->sess_cbsess.nfsess_xprt != NULL) + SVC_RELEASE(sep->sess_cbsess.nfsess_xprt); free(sep, M_NFSDSESSION); return (0); } @@ -5678,3 +5809,64 @@ nfsrv_freestateid(struct nfsrv_descript return (error); } +/* + * Generate the xdr for an NFSv4.1 CBSequence Operation. + */ +static int +nfsv4_setcbsequence(struct nfsrv_descript *nd, struct nfsclient *clp, + int dont_replycache, struct nfsdsession **sepp) +{ + struct nfsdsession *sep; + uint32_t *tl, slotseq = 0; + int maxslot, slotpos; + uint8_t sessionid[NFSX_V4SESSIONID]; + int error; + + error = nfsv4_getcbsession(clp, sepp); + if (error != 0) + return (error); + sep = *sepp; + (void)nfsv4_sequencelookup(NULL, &sep->sess_cbsess, &slotpos, &maxslot, + &slotseq, sessionid); + KASSERT(maxslot >= 0, ("nfsv4_setcbsequence neg maxslot")); + + /* Build the Sequence arguments. */ + NFSM_BUILD(tl, uint32_t *, NFSX_V4SESSIONID + 5 * NFSX_UNSIGNED); + bcopy(sessionid, tl, NFSX_V4SESSIONID); + tl += NFSX_V4SESSIONID / NFSX_UNSIGNED; + nd->nd_slotseq = tl; + *tl++ = txdr_unsigned(slotseq); + *tl++ = txdr_unsigned(slotpos); + *tl++ = txdr_unsigned(maxslot); + if (dont_replycache == 0) + *tl++ = newnfs_true; + else + *tl++ = newnfs_false; + *tl = 0; /* No referring call list, for now. */ + nd->nd_flag |= ND_HASSEQUENCE; + return (0); +} + +/* + * Get a session for the callback. + */ +static int +nfsv4_getcbsession(struct nfsclient *clp, struct nfsdsession **sepp) +{ + struct nfsdsession *sep; + + NFSLOCKSTATE(); + LIST_FOREACH(sep, &clp->lc_session, sess_list) { + if ((sep->sess_crflags & NFSV4CRSESS_CONNBACKCHAN) != 0) + break; + } + if (sep == NULL) { + NFSUNLOCKSTATE(); + return (NFSERR_BADSESSION); + } + sep->sess_refcnt++; + *sepp = sep; + NFSUNLOCKSTATE(); + return (0); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-projects@FreeBSD.ORG Wed Jan 1 21:25:16 2014 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DA73B288; Wed, 1 Jan 2014 21:25:16 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id C1BF1169C; Wed, 1 Jan 2014 21:25:16 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s01LPGkx040687; Wed, 1 Jan 2014 21:25:16 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s01LPENv040670; Wed, 1 Jan 2014 21:25:14 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201401012125.s01LPENv040670@svn.freebsd.org> From: Marcel Moolenaar Date: Wed, 1 Jan 2014 21:25:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r260168 - in projects/altix2: . bin/ps bin/sh cddl/contrib/opensolaris/cmd/zdb cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/cmd/zhack cddl/contrib/opensolaris/cmd/zpool cdd... X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Jan 2014 21:25:16 -0000 Author: marcel Date: Wed Jan 1 21:25:13 2014 New Revision: 260168 URL: http://svnweb.freebsd.org/changeset/base/260168 Log: Merge ^/head@260167. Added: projects/altix2/contrib/gcc/ChangeLog.apple - copied unchanged from r260166, head/contrib/gcc/ChangeLog.apple projects/altix2/contrib/gcc/cp/ChangeLog.apple - copied unchanged from r260166, head/contrib/gcc/cp/ChangeLog.apple projects/altix2/lib/libc/sys/aio_fsync.2 - copied unchanged from r260166, head/lib/libc/sys/aio_fsync.2 projects/altix2/lib/msun/ld128/k_expl.h - copied unchanged from r260166, head/lib/msun/ld128/k_expl.h projects/altix2/lib/msun/ld80/k_expl.h - copied unchanged from r260166, head/lib/msun/ld80/k_expl.h projects/altix2/lib/msun/src/e_coshl.c - copied unchanged from r260166, head/lib/msun/src/e_coshl.c projects/altix2/lib/msun/src/e_sinhl.c - copied unchanged from r260166, head/lib/msun/src/e_sinhl.c projects/altix2/lib/msun/src/s_tanhl.c - copied unchanged from r260166, head/lib/msun/src/s_tanhl.c projects/altix2/sbin/fsck_ffs/globs.c - copied unchanged from r260166, head/sbin/fsck_ffs/globs.c Modified: projects/altix2/COPYRIGHT projects/altix2/bin/ps/ps.1 projects/altix2/bin/sh/input.c projects/altix2/cddl/contrib/opensolaris/cmd/zdb/zdb.8 projects/altix2/cddl/contrib/opensolaris/cmd/zdb/zdb.c projects/altix2/cddl/contrib/opensolaris/cmd/zdb/zdb_il.c projects/altix2/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c projects/altix2/cddl/contrib/opensolaris/cmd/zhack/zhack.c projects/altix2/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7 projects/altix2/cddl/contrib/opensolaris/cmd/zpool/zpool.8 projects/altix2/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c projects/altix2/cddl/contrib/opensolaris/cmd/zstreamdump/zstreamdump.1 projects/altix2/cddl/contrib/opensolaris/cmd/zstreamdump/zstreamdump.c projects/altix2/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c projects/altix2/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c projects/altix2/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h projects/altix2/contrib/binutils/gas/config/tc-ia64.c projects/altix2/contrib/binutils/opcodes/ia64-asmtab.c projects/altix2/contrib/gcc/ChangeLog.gcc43 projects/altix2/contrib/gcc/c-common.c projects/altix2/contrib/gcc/c-decl.c projects/altix2/contrib/gcc/c-opts.c projects/altix2/contrib/gcc/c-parser.c projects/altix2/contrib/gcc/c-tree.h projects/altix2/contrib/gcc/c-typeck.c projects/altix2/contrib/gcc/c.opt projects/altix2/contrib/gcc/cp/ChangeLog projects/altix2/contrib/gcc/cp/cp-gimplify.c projects/altix2/contrib/gcc/cp/cp-tree.def projects/altix2/contrib/gcc/cp/cp-tree.h projects/altix2/contrib/gcc/cp/decl.c projects/altix2/contrib/gcc/cp/dump.c projects/altix2/contrib/gcc/cp/g++spec.c projects/altix2/contrib/gcc/cp/init.c projects/altix2/contrib/gcc/cp/parser.c projects/altix2/contrib/gcc/cp/pt.c projects/altix2/contrib/gcc/cp/semantics.c projects/altix2/contrib/gcc/doc/extend.texi projects/altix2/contrib/gcc/doc/invoke.texi projects/altix2/contrib/gcc/dwarf2out.c projects/altix2/contrib/gcc/emit-rtl.c projects/altix2/contrib/gcc/final.c projects/altix2/contrib/gcc/libgcc2.c projects/altix2/contrib/gcc/libgcc2.h projects/altix2/contrib/gcc/loop-init.c projects/altix2/contrib/gcc/print-rtl.c projects/altix2/contrib/gcc/print-tree.c projects/altix2/contrib/gcc/reload1.c projects/altix2/contrib/gcc/rtl.def projects/altix2/contrib/gcc/rtl.h projects/altix2/contrib/gcc/stmt.c projects/altix2/contrib/gcc/toplev.c projects/altix2/contrib/gcc/toplev.h projects/altix2/contrib/gcc/tree-cfg.c projects/altix2/contrib/gcc/tree-ssa-address.c projects/altix2/contrib/gcc/tree.h projects/altix2/contrib/libc++/include/type_traits projects/altix2/etc/devd/usb.conf projects/altix2/etc/ntp.conf projects/altix2/gnu/usr.bin/gdb/kgdb/Makefile projects/altix2/gnu/usr.bin/gdb/kgdb/main.c projects/altix2/lib/libc/sys/Makefile.inc projects/altix2/lib/libc/sys/aio_mlock.2 projects/altix2/lib/libiconv_modules/BIG5/citrus_big5.c projects/altix2/lib/libiconv_modules/DECHanyu/citrus_dechanyu.c projects/altix2/lib/libiconv_modules/EUC/citrus_euc.c projects/altix2/lib/libiconv_modules/EUCTW/citrus_euctw.c projects/altix2/lib/libiconv_modules/GBK2K/citrus_gbk2k.c projects/altix2/lib/libiconv_modules/HZ/citrus_hz.c projects/altix2/lib/libiconv_modules/ISO2022/citrus_iso2022.c projects/altix2/lib/libiconv_modules/JOHAB/citrus_johab.c projects/altix2/lib/libiconv_modules/MSKanji/citrus_mskanji.c projects/altix2/lib/libiconv_modules/UES/citrus_ues.c projects/altix2/lib/libiconv_modules/UTF7/citrus_utf7.c projects/altix2/lib/libiconv_modules/UTF8/citrus_utf8.c projects/altix2/lib/libiconv_modules/VIQR/citrus_viqr.c projects/altix2/lib/libiconv_modules/ZW/citrus_zw.c projects/altix2/lib/libkvm/kvm.c projects/altix2/lib/libkvm/kvm_ia64.c projects/altix2/lib/libprocstat/zfs/Makefile projects/altix2/lib/libstand/Makefile projects/altix2/lib/msun/Makefile projects/altix2/lib/msun/Symbol.map projects/altix2/lib/msun/ld128/s_expl.c projects/altix2/lib/msun/ld80/s_expl.c projects/altix2/lib/msun/man/cosh.3 projects/altix2/lib/msun/man/sinh.3 projects/altix2/lib/msun/man/tanh.3 projects/altix2/lib/msun/src/e_cosh.c projects/altix2/lib/msun/src/e_sinh.c projects/altix2/lib/msun/src/imprecise.c projects/altix2/lib/msun/src/math.h projects/altix2/lib/msun/src/s_tanh.c projects/altix2/release/release.sh projects/altix2/sbin/camcontrol/camcontrol.8 projects/altix2/sbin/camcontrol/camcontrol.c projects/altix2/sbin/fsck_ffs/Makefile projects/altix2/sbin/fsck_ffs/dir.c projects/altix2/sbin/fsck_ffs/fsck.h projects/altix2/sbin/fsck_ffs/fsck_ffs.8 projects/altix2/sbin/fsck_ffs/fsutil.c projects/altix2/sbin/fsck_ffs/main.c projects/altix2/sbin/fsck_ffs/pass1.c projects/altix2/sbin/fsck_ffs/pass1b.c projects/altix2/sbin/fsck_ffs/suj.c projects/altix2/sbin/fsck_ffs/utilities.c projects/altix2/sbin/fsdb/Makefile projects/altix2/sbin/geom/class/mirror/geom_mirror.c projects/altix2/sbin/geom/class/mirror/gmirror.8 projects/altix2/sbin/pfctl/Makefile projects/altix2/sbin/pfctl/pfctl_altq.c projects/altix2/sbin/pfctl/pfctl_parser.c projects/altix2/sbin/pfctl/pfctl_parser.h projects/altix2/share/man/man4/run.4 projects/altix2/sys/Makefile projects/altix2/sys/amd64/amd64/pmap.c projects/altix2/sys/amd64/include/vmm.h (contents, props changed) projects/altix2/sys/amd64/vmm/intel/vmx.c projects/altix2/sys/amd64/vmm/intel/vmx.h projects/altix2/sys/amd64/vmm/intel/vmx_genassym.c projects/altix2/sys/amd64/vmm/intel/vmx_support.S projects/altix2/sys/amd64/vmm/io/vlapic.c projects/altix2/sys/amd64/vmm/io/vlapic.h projects/altix2/sys/amd64/vmm/io/vlapic_priv.h projects/altix2/sys/arm/arm/gic.c projects/altix2/sys/arm/arm/intr.c projects/altix2/sys/arm/arm/nexus.c projects/altix2/sys/arm/arm/pmap-v6.c projects/altix2/sys/arm/at91/at91.c projects/altix2/sys/arm/include/intr.h projects/altix2/sys/arm/versatile/sp804.c projects/altix2/sys/boot/ficl/Makefile projects/altix2/sys/boot/i386/Makefile.inc projects/altix2/sys/boot/i386/boot2/Makefile projects/altix2/sys/boot/i386/gptboot/Makefile projects/altix2/sys/boot/i386/gptzfsboot/Makefile projects/altix2/sys/boot/i386/zfsboot/Makefile projects/altix2/sys/boot/pc98/Makefile.inc projects/altix2/sys/boot/pc98/boot2/Makefile projects/altix2/sys/boot/usb/Makefile projects/altix2/sys/boot/usb/Makefile.test projects/altix2/sys/boot/userboot/ficl/Makefile projects/altix2/sys/boot/userboot/libstand/Makefile projects/altix2/sys/boot/zfs/Makefile projects/altix2/sys/boot/zfs/zfsimpl.c projects/altix2/sys/cddl/boot/zfs/zfsimpl.h projects/altix2/sys/cddl/contrib/opensolaris/common/zfs/zfeature_common.c projects/altix2/sys/cddl/contrib/opensolaris/common/zfs/zfeature_common.h projects/altix2/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c projects/altix2/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/bptree.c projects/altix2/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c projects/altix2/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/ddt.c projects/altix2/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c projects/altix2/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_diff.c projects/altix2/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c projects/altix2/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_traverse.c projects/altix2/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c projects/altix2/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c projects/altix2/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c projects/altix2/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_destroy.c projects/altix2/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c projects/altix2/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c projects/altix2/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c projects/altix2/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dbuf.h projects/altix2/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h projects/altix2/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h projects/altix2/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h projects/altix2/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev.h projects/altix2/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_disk.h projects/altix2/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h projects/altix2/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfeature.h projects/altix2/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_cache.c projects/altix2/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c projects/altix2/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c projects/altix2/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfeature.c projects/altix2/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c projects/altix2/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c projects/altix2/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c projects/altix2/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c projects/altix2/sys/cddl/dev/dtrace/dtrace_load.c projects/altix2/sys/conf/files projects/altix2/sys/conf/kern.pre.mk projects/altix2/sys/conf/options.arm projects/altix2/sys/dev/aac/aac.c projects/altix2/sys/dev/ahci/ahci.c projects/altix2/sys/dev/bge/if_bge.c projects/altix2/sys/dev/bxe/bxe.c projects/altix2/sys/dev/bxe/ecore_sp.c projects/altix2/sys/dev/ed/if_ed.c projects/altix2/sys/dev/ed/if_ed_3c503.c projects/altix2/sys/dev/ed/if_ed_pccard.c projects/altix2/sys/dev/ed/if_ed_rtl80x9.c projects/altix2/sys/dev/ed/if_edreg.h projects/altix2/sys/dev/ed/if_edvar.h projects/altix2/sys/dev/ed/tc5299jreg.h projects/altix2/sys/dev/en/midway.c projects/altix2/sys/dev/fb/boot_font.c projects/altix2/sys/dev/fb/gallant12x22.c projects/altix2/sys/dev/ipw/if_ipw.c projects/altix2/sys/dev/ipw/if_ipwvar.h projects/altix2/sys/dev/iscsi/icl.c projects/altix2/sys/dev/iwi/if_iwi.c projects/altix2/sys/dev/iwi/if_iwivar.h projects/altix2/sys/dev/iwn/if_iwn.c projects/altix2/sys/dev/iwn/if_iwn_chip_cfg.h projects/altix2/sys/dev/iwn/if_iwnvar.h projects/altix2/sys/dev/mcd/mcd.c projects/altix2/sys/dev/mpt/mpt.h projects/altix2/sys/dev/mpt/mpt_cam.c projects/altix2/sys/dev/mpt/mpt_pci.c projects/altix2/sys/dev/mpt/mpt_raid.c projects/altix2/sys/dev/my/if_my.c projects/altix2/sys/dev/nand/nand_id.c projects/altix2/sys/dev/oce/oce_if.c projects/altix2/sys/dev/ral/if_ral_pci.c projects/altix2/sys/dev/scc/scc_dev_z8530.c projects/altix2/sys/dev/sk/if_sk.c projects/altix2/sys/dev/sound/pci/maestro.c projects/altix2/sys/dev/tpm/tpm.c projects/altix2/sys/dev/usb/usbdevs projects/altix2/sys/dev/usb/wlan/if_run.c projects/altix2/sys/dev/usb/wlan/if_urtw.c projects/altix2/sys/dev/vt/vt_core.c projects/altix2/sys/dev/vt/vt_font.c projects/altix2/sys/dev/vxge/vxgehal/vxgehal-ring.c projects/altix2/sys/dev/wpi/if_wpi.c projects/altix2/sys/dev/wpi/if_wpivar.h projects/altix2/sys/geom/mirror/g_mirror.c projects/altix2/sys/geom/mirror/g_mirror.h projects/altix2/sys/geom/mirror/g_mirror_ctl.c projects/altix2/sys/geom/part/g_part.c projects/altix2/sys/geom/part/g_part.h projects/altix2/sys/geom/part/g_part_gpt.c projects/altix2/sys/ia64/ia64/dump_machdep.c projects/altix2/sys/kern/kern_cons.c projects/altix2/sys/kern/sched_4bsd.c projects/altix2/sys/kern/vfs_bio.c projects/altix2/sys/kern/vfs_cache.c projects/altix2/sys/modules/ath/Makefile projects/altix2/sys/modules/drm2/i915kms/Makefile projects/altix2/sys/modules/drm2/radeonkms/Makefile projects/altix2/sys/modules/ibcore/Makefile projects/altix2/sys/modules/ipfilter/Makefile projects/altix2/sys/modules/ipoib/Makefile projects/altix2/sys/modules/mlx4/Makefile projects/altix2/sys/modules/mlx4ib/Makefile projects/altix2/sys/modules/mlxen/Makefile projects/altix2/sys/modules/mthca/Makefile projects/altix2/sys/modules/wlan/Makefile projects/altix2/sys/net/ieee8023ad_lacp.c projects/altix2/sys/net/if_lagg.c projects/altix2/sys/net/if_lagg.h projects/altix2/sys/netgraph/netflow/netflow.c projects/altix2/sys/netgraph/netflow/netflow_v9.c projects/altix2/sys/netgraph/netflow/ng_netflow.c projects/altix2/sys/netgraph/ng_base.c projects/altix2/sys/netinet/in.c projects/altix2/sys/netinet/sctp_usrreq.c projects/altix2/sys/netinet/sctputil.c projects/altix2/sys/netinet6/nd6.c projects/altix2/sys/nfs/nfs_fha.c projects/altix2/sys/nfs/nfs_fha.h projects/altix2/sys/ofed/drivers/infiniband/hw/mlx4/Makefile projects/altix2/sys/ofed/drivers/net/mlx4/Makefile projects/altix2/sys/powerpc/powerpc/bus_machdep.c projects/altix2/sys/rpc/svc.c projects/altix2/sys/rpc/svc.h projects/altix2/sys/rpc/svc_dg.c projects/altix2/sys/rpc/svc_vc.c projects/altix2/sys/sys/copyright.h projects/altix2/sys/sys/gpt.h projects/altix2/sys/sys/param.h projects/altix2/sys/sys/pctrie.h projects/altix2/sys/ufs/ffs/ffs_alloc.c projects/altix2/sys/ufs/ufs/ufs_quota.c projects/altix2/sys/vm/vm_map.c projects/altix2/sys/vm/vm_page.c projects/altix2/sys/vm/vm_page.h projects/altix2/sys/vm/vm_phys.c projects/altix2/sys/vm/vm_reserv.c projects/altix2/tools/test/dtrace/Makefile projects/altix2/usr.bin/iscsictl/iscsictl.8 projects/altix2/usr.bin/netstat/if.c projects/altix2/usr.bin/netstat/route.c projects/altix2/usr.bin/rpcgen/rpc_main.c projects/altix2/usr.sbin/bhyve/acpi.c projects/altix2/usr.sbin/bhyve/acpi.h projects/altix2/usr.sbin/bhyve/bhyverun.c projects/altix2/usr.sbin/bhyve/mevent.c projects/altix2/usr.sbin/bhyve/mevent.h projects/altix2/usr.sbin/bhyve/mptbl.c projects/altix2/usr.sbin/bhyve/pm.c projects/altix2/usr.sbin/bhyve/pmtmr.c projects/altix2/usr.sbin/bhyvectl/bhyvectl.c projects/altix2/usr.sbin/bsnmpd/modules/snmp_hast/BEGEMOT-HAST-MIB.txt projects/altix2/usr.sbin/bsnmpd/modules/snmp_hast/hast_snmp.c projects/altix2/usr.sbin/bsnmpd/modules/snmp_hast/hast_tree.def projects/altix2/usr.sbin/makefs/cd9660/iso9660_rrip.c projects/altix2/usr.sbin/makefs/cd9660/iso9660_rrip.h Directory Properties: projects/altix2/ (props changed) projects/altix2/cddl/ (props changed) projects/altix2/cddl/contrib/opensolaris/ (props changed) projects/altix2/cddl/contrib/opensolaris/cmd/zfs/ (props changed) projects/altix2/contrib/binutils/ (props changed) projects/altix2/contrib/gcc/ (props changed) projects/altix2/contrib/libc++/ (props changed) projects/altix2/etc/ (props changed) projects/altix2/gnu/usr.bin/gdb/ (props changed) projects/altix2/lib/libc/ (props changed) projects/altix2/sbin/ (props changed) projects/altix2/share/man/man4/ (props changed) projects/altix2/sys/ (props changed) projects/altix2/sys/amd64/vmm/ (props changed) projects/altix2/sys/boot/ (props changed) projects/altix2/sys/cddl/contrib/opensolaris/ (props changed) projects/altix2/sys/conf/ (props changed) projects/altix2/usr.sbin/bhyve/ (props changed) projects/altix2/usr.sbin/bhyvectl/ (props changed) Modified: projects/altix2/COPYRIGHT ============================================================================== --- projects/altix2/COPYRIGHT Wed Jan 1 21:17:08 2014 (r260167) +++ projects/altix2/COPYRIGHT Wed Jan 1 21:25:13 2014 (r260168) @@ -4,7 +4,7 @@ The compilation of software known as FreeBSD is distributed under the following terms: -Copyright (c) 1992-2013 The FreeBSD Project. All rights reserved. +Copyright (c) 1992-2014 The FreeBSD Project. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions Modified: projects/altix2/bin/ps/ps.1 ============================================================================== --- projects/altix2/bin/ps/ps.1 Wed Jan 1 21:17:08 2014 (r260167) +++ projects/altix2/bin/ps/ps.1 Wed Jan 1 21:25:13 2014 (r260168) @@ -29,7 +29,7 @@ .\" @(#)ps.1 8.3 (Berkeley) 4/18/94 .\" $FreeBSD$ .\" -.Dd March 15, 2013 +.Dd December 27, 2013 .Dt PS 1 .Os .Sh NAME @@ -416,8 +416,9 @@ The process has reduced CPU scheduling p .It Li s The process is a session leader. .It Li V -The process is suspended during a -.Xr vfork 2 . +The process' parent is suspended during a +.Xr vfork 2 , +waiting for the process to exec or exit. .It Li W The process is swapped out. .It Li X Modified: projects/altix2/bin/sh/input.c ============================================================================== --- projects/altix2/bin/sh/input.c Wed Jan 1 21:17:08 2014 (r260167) +++ projects/altix2/bin/sh/input.c Wed Jan 1 21:25:13 2014 (r260168) @@ -228,7 +228,6 @@ preadbuffer(void) { char *p, *q; int more; - int something; char savec; if (parsefile->strpush) { @@ -252,24 +251,18 @@ again: q = p = parsefile->buf + (parsenextc - parsefile->buf); /* delete nul characters */ - something = 0; for (more = 1; more;) { switch (*p) { case '\0': p++; /* Skip nul */ goto check; - case '\t': - case ' ': - break; - case '\n': parsenleft = q - parsenextc; more = 0; /* Stop processing here */ break; default: - something = 1; break; } @@ -288,7 +281,8 @@ check: *q = '\0'; #ifndef NO_HISTORY - if (parsefile->fd == 0 && hist && something) { + if (parsefile->fd == 0 && hist && + parsenextc[strspn(parsenextc, " \t\n")] != '\0') { HistEvent he; INTOFF; history(hist, &he, whichprompt == 1 ? H_ENTER : H_ADD, Modified: projects/altix2/cddl/contrib/opensolaris/cmd/zdb/zdb.8 ============================================================================== --- projects/altix2/cddl/contrib/opensolaris/cmd/zdb/zdb.8 Wed Jan 1 21:17:08 2014 (r260167) +++ projects/altix2/cddl/contrib/opensolaris/cmd/zdb/zdb.8 Wed Jan 1 21:25:13 2014 (r260168) @@ -14,11 +14,12 @@ .\" .\" Copyright 2012, Richard Lowe. .\" Copyright (c) 2012, Marcelo Araujo . +.\" Copyright (c) 2012 by Delphix. All rights reserved. .\" All Rights Reserved. .\" .\" $FreeBSD$ .\" -.Dd May 10, 2012 +.Dd December 31, 2013 .Dt ZDB 8 .Os .Sh NAME @@ -29,27 +30,35 @@ .Op Fl CumdibcsDvhLXFPA .Op Fl e Op Fl p Ar path... .Op Fl t Ar txg +.Op Fl U Ar cache +.Op Fl M Ar inflight I/Os .Ar poolname .Op Ar object ... .Nm .Op Fl divPA .Op Fl e Op Fl p Ar path... +.Op Fl U Ar cache .Ar dataset .Op Ar object ... .Nm .Fl m Op Fl LXFPA .Op Fl t Ar txg .Op Fl e Op Fl p Ar path... +.Op Fl U Ar cache .Ar poolname .Nm .Fl R Op Fl A .Op Fl e Op Fl p Ar path... +.Op Fl U Ar cache +.Ar poolname .Ar poolname .Ar vdev Ns : Ns Ar offset Ns : Ns Ar size Ns Op Ns : Ns Ar flags .Nm .Fl S .Op Fl AP .Op Fl e Op Fl p Ar path... +.Op Fl U Ar cache +.Ar poolname .Ar poolname .Nm .Fl l @@ -205,6 +214,11 @@ flag specifies the path under which devi .It Fl F Attempt to make an unreadable pool readable by trying progressively older transactions. +.It Fl M Ar inflight I/Os +Limit the number of outstanding checksum I/Os to the specified value. +The default value is 200. This option affects the performance of the +.Fl c +option. .It Fl P Print numbers in an unscaled form more amenable to parsing, eg. 1000000 rather than 1M. @@ -218,9 +232,7 @@ options for a means to see the available transaction numbers. .It Fl U Ar cachefile Use a cache file other than -.Pa /etc/zfs/zpool.cache . -This option is only valid with -.Fl C +.Pa /boot/zfs/zpool.cache . .It Fl v Enable verbosity. Specify multiple times for increased verbosity. Modified: projects/altix2/cddl/contrib/opensolaris/cmd/zdb/zdb.c ============================================================================== --- projects/altix2/cddl/contrib/opensolaris/cmd/zdb/zdb.c Wed Jan 1 21:17:08 2014 (r260167) +++ projects/altix2/cddl/contrib/opensolaris/cmd/zdb/zdb.c Wed Jan 1 21:25:13 2014 (r260168) @@ -89,6 +89,7 @@ extern void dump_intent_log(zilog_t *); uint64_t *zopt_object = NULL; int zopt_objects = 0; libzfs_handle_t *g_zfs; +uint64_t max_inflight = 200; /* * These libumem hooks provide a reasonable set of defaults for the allocator's @@ -110,16 +111,17 @@ static void usage(void) { (void) fprintf(stderr, - "Usage: %s [-CumdibcsDvhLXFPA] [-t txg] [-e [-p path...]]" - "poolname [object...]\n" - " %s [-divPA] [-e -p path...] dataset [object...]\n" - " %s -m [-LXFPA] [-t txg] [-e [-p path...]]" - "poolname [vdev [metaslab...]]\n" - " %s -R [-A] [-e [-p path...]] poolname " - "vdev:offset:size[:flags]\n" - " %s -S [-PA] [-e [-p path...]] poolname\n" - " %s -l [-uA] device\n" - " %s -C [-A] [-U config]\n\n", + "Usage: %s [-CumdibcsDvhLXFPA] [-t txg] [-e [-p path...]] " + "[-U config] [-M inflight I/Os] poolname [object...]\n" + " %s [-divPA] [-e -p path...] [-U config] dataset " + "[object...]\n" + " %s -m [-LXFPA] [-t txg] [-e [-p path...]] [-U config] " + "poolname [vdev [metaslab...]]\n" + " %s -R [-A] [-e [-p path...]] poolname " + "vdev:offset:size[:flags]\n" + " %s -S [-PA] [-e [-p path...]] [-U config] poolname\n" + " %s -l [-uA] device\n" + " %s -C [-A] [-U config]\n\n", cmdname, cmdname, cmdname, cmdname, cmdname, cmdname, cmdname); (void) fprintf(stderr, " Dataset name must include at least one " @@ -164,6 +166,8 @@ usage(void) (void) fprintf(stderr, " -P print numbers in parseable form\n"); (void) fprintf(stderr, " -t -- highest txg to use when " "searching for uberblocks\n"); + (void) fprintf(stderr, " -M -- " + "specify the maximum number of checksumming I/Os [default is 200]"); (void) fprintf(stderr, "Specify an option more than once (e.g. -bb) " "to make only that option verbose\n"); (void) fprintf(stderr, "Default is to dump everything non-verbosely\n"); @@ -760,7 +764,7 @@ dump_dde(const ddt_t *ddt, const ddt_ent if (ddp->ddp_phys_birth == 0) continue; ddt_bp_create(ddt->ddt_checksum, ddk, ddp, &blk); - sprintf_blkptr(blkbuf, &blk); + snprintf_blkptr(blkbuf, sizeof (blkbuf), &blk); (void) printf("index %llx refcnt %llu %s %s\n", (u_longlong_t)index, (u_longlong_t)ddp->ddp_refcnt, types[p], blkbuf); @@ -1020,31 +1024,39 @@ blkid2offset(const dnode_phys_t *dnp, co } static void -sprintf_blkptr_compact(char *blkbuf, const blkptr_t *bp) +snprintf_blkptr_compact(char *blkbuf, size_t buflen, const blkptr_t *bp) { const dva_t *dva = bp->blk_dva; int ndvas = dump_opt['d'] > 5 ? BP_GET_NDVAS(bp) : 1; if (dump_opt['b'] >= 6) { - sprintf_blkptr(blkbuf, bp); + snprintf_blkptr(blkbuf, buflen, bp); return; } blkbuf[0] = '\0'; for (int i = 0; i < ndvas; i++) - (void) sprintf(blkbuf + strlen(blkbuf), "%llu:%llx:%llx ", + (void) snprintf(blkbuf + strlen(blkbuf), + buflen - strlen(blkbuf), "%llu:%llx:%llx ", (u_longlong_t)DVA_GET_VDEV(&dva[i]), (u_longlong_t)DVA_GET_OFFSET(&dva[i]), (u_longlong_t)DVA_GET_ASIZE(&dva[i])); - (void) sprintf(blkbuf + strlen(blkbuf), - "%llxL/%llxP F=%llu B=%llu/%llu", - (u_longlong_t)BP_GET_LSIZE(bp), - (u_longlong_t)BP_GET_PSIZE(bp), - (u_longlong_t)bp->blk_fill, - (u_longlong_t)bp->blk_birth, - (u_longlong_t)BP_PHYSICAL_BIRTH(bp)); + if (BP_IS_HOLE(bp)) { + (void) snprintf(blkbuf + strlen(blkbuf), + buflen - strlen(blkbuf), "B=%llu", + (u_longlong_t)bp->blk_birth); + } else { + (void) snprintf(blkbuf + strlen(blkbuf), + buflen - strlen(blkbuf), + "%llxL/%llxP F=%llu B=%llu/%llu", + (u_longlong_t)BP_GET_LSIZE(bp), + (u_longlong_t)BP_GET_PSIZE(bp), + (u_longlong_t)bp->blk_fill, + (u_longlong_t)bp->blk_birth, + (u_longlong_t)BP_PHYSICAL_BIRTH(bp)); + } } static void @@ -1069,7 +1081,7 @@ print_indirect(blkptr_t *bp, const zbook } } - sprintf_blkptr_compact(blkbuf, bp); + snprintf_blkptr_compact(blkbuf, sizeof (blkbuf), bp); (void) printf("%s\n", blkbuf); } @@ -1084,7 +1096,7 @@ visit_indirect(spa_t *spa, const dnode_p print_indirect(bp, zb, dnp); - if (BP_GET_LEVEL(bp) > 0) { + if (BP_GET_LEVEL(bp) > 0 && !BP_IS_HOLE(bp)) { uint32_t flags = ARC_WAIT; int i; blkptr_t *cbp; @@ -1209,7 +1221,7 @@ dump_dsl_dataset(objset_t *os, uint64_t zdb_nicenum(ds->ds_compressed_bytes, compressed); zdb_nicenum(ds->ds_uncompressed_bytes, uncompressed); zdb_nicenum(ds->ds_unique_bytes, unique); - sprintf_blkptr(blkbuf, &ds->ds_bp); + snprintf_blkptr(blkbuf, sizeof (blkbuf), &ds->ds_bp); (void) printf("\t\tdir_obj = %llu\n", (u_longlong_t)ds->ds_dir_obj); @@ -1254,7 +1266,7 @@ dump_bptree_cb(void *arg, const blkptr_t char blkbuf[BP_SPRINTF_LEN]; if (bp->blk_birth != 0) { - sprintf_blkptr(blkbuf, bp); + snprintf_blkptr(blkbuf, sizeof (blkbuf), bp); (void) printf("\t%s\n", blkbuf); } return (0); @@ -1292,7 +1304,7 @@ dump_bpobj_cb(void *arg, const blkptr_t char blkbuf[BP_SPRINTF_LEN]; ASSERT(bp->blk_birth != 0); - sprintf_blkptr_compact(blkbuf, bp); + snprintf_blkptr_compact(blkbuf, sizeof (blkbuf), bp); (void) printf("\t%s\n", blkbuf); return (0); } @@ -1791,8 +1803,9 @@ dump_dir(objset_t *os) zdb_nicenum(refdbytes, numbuf); if (verbosity >= 4) { - (void) sprintf(blkbuf, ", rootbp "); - (void) sprintf_blkptr(blkbuf + strlen(blkbuf), os->os_rootbp); + (void) snprintf(blkbuf, sizeof (blkbuf), ", rootbp "); + (void) snprintf_blkptr(blkbuf + strlen(blkbuf), + sizeof (blkbuf) - strlen(blkbuf), os->os_rootbp); } else { blkbuf[0] = '\0'; } @@ -1822,7 +1835,7 @@ dump_dir(objset_t *os) if (verbosity < 2) return; - if (os->os_rootbp->blk_birth == 0) + if (BP_IS_HOLE(os->os_rootbp)) return; dump_object(os, 0, verbosity, &print_header); @@ -1863,7 +1876,7 @@ dump_uberblock(uberblock_t *ub, const ch (u_longlong_t)ub->ub_timestamp, asctime(localtime(×tamp))); if (dump_opt['u'] >= 3) { char blkbuf[BP_SPRINTF_LEN]; - sprintf_blkptr(blkbuf, &ub->ub_rootbp); + snprintf_blkptr(blkbuf, sizeof (blkbuf), &ub->ub_rootbp); (void) printf("\trootbp = %s\n", blkbuf); } (void) printf(footer ? footer : ""); @@ -2154,16 +2167,68 @@ zdb_count_block(zdb_cb_t *zcb, zilog_t * bp, NULL, NULL, ZIO_FLAG_CANFAIL)), ==, 0); } +/* ARGSUSED */ +static void +zdb_blkptr_done(zio_t *zio) +{ + spa_t *spa = zio->io_spa; + blkptr_t *bp = zio->io_bp; + int ioerr = zio->io_error; + zdb_cb_t *zcb = zio->io_private; + zbookmark_t *zb = &zio->io_bookmark; + + zio_data_buf_free(zio->io_data, zio->io_size); + + mutex_enter(&spa->spa_scrub_lock); + spa->spa_scrub_inflight--; + cv_broadcast(&spa->spa_scrub_io_cv); + + if (ioerr && !(zio->io_flags & ZIO_FLAG_SPECULATIVE)) { + char blkbuf[BP_SPRINTF_LEN]; + + zcb->zcb_haderrors = 1; + zcb->zcb_errors[ioerr]++; + + if (dump_opt['b'] >= 2) + snprintf_blkptr(blkbuf, sizeof (blkbuf), bp); + else + blkbuf[0] = '\0'; + + (void) printf("zdb_blkptr_cb: " + "Got error %d reading " + "<%llu, %llu, %lld, %llx> %s -- skipping\n", + ioerr, + (u_longlong_t)zb->zb_objset, + (u_longlong_t)zb->zb_object, + (u_longlong_t)zb->zb_level, + (u_longlong_t)zb->zb_blkid, + blkbuf); + } + mutex_exit(&spa->spa_scrub_lock); +} + +/* ARGSUSED */ static int zdb_blkptr_cb(spa_t *spa, zilog_t *zilog, const blkptr_t *bp, const zbookmark_t *zb, const dnode_phys_t *dnp, void *arg) { zdb_cb_t *zcb = arg; - char blkbuf[BP_SPRINTF_LEN]; dmu_object_type_t type; boolean_t is_metadata; - if (bp == NULL) + if (dump_opt['b'] >= 5 && bp->blk_birth > 0) { + char blkbuf[BP_SPRINTF_LEN]; + snprintf_blkptr(blkbuf, sizeof (blkbuf), bp); + (void) printf("objset %llu object %llu " + "level %lld offset 0x%llx %s\n", + (u_longlong_t)zb->zb_objset, + (u_longlong_t)zb->zb_object, + (longlong_t)zb->zb_level, + (u_longlong_t)blkid2offset(dnp, bp, zb), + blkbuf); + } + + if (BP_IS_HOLE(bp)) return (0); type = BP_GET_TYPE(bp); @@ -2174,53 +2239,26 @@ zdb_blkptr_cb(spa_t *spa, zilog_t *zilog is_metadata = (BP_GET_LEVEL(bp) != 0 || DMU_OT_IS_METADATA(type)); if (dump_opt['c'] > 1 || (dump_opt['c'] && is_metadata)) { - int ioerr; size_t size = BP_GET_PSIZE(bp); - void *data = malloc(size); + void *data = zio_data_buf_alloc(size); int flags = ZIO_FLAG_CANFAIL | ZIO_FLAG_SCRUB | ZIO_FLAG_RAW; /* If it's an intent log block, failure is expected. */ if (zb->zb_level == ZB_ZIL_LEVEL) flags |= ZIO_FLAG_SPECULATIVE; - ioerr = zio_wait(zio_read(NULL, spa, bp, data, size, - NULL, NULL, ZIO_PRIORITY_ASYNC_READ, flags, zb)); - - free(data); - if (ioerr && !(flags & ZIO_FLAG_SPECULATIVE)) { - zcb->zcb_haderrors = 1; - zcb->zcb_errors[ioerr]++; + mutex_enter(&spa->spa_scrub_lock); + while (spa->spa_scrub_inflight > max_inflight) + cv_wait(&spa->spa_scrub_io_cv, &spa->spa_scrub_lock); + spa->spa_scrub_inflight++; + mutex_exit(&spa->spa_scrub_lock); - if (dump_opt['b'] >= 2) - sprintf_blkptr(blkbuf, bp); - else - blkbuf[0] = '\0'; - - (void) printf("zdb_blkptr_cb: " - "Got error %d reading " - "<%llu, %llu, %lld, %llx> %s -- skipping\n", - ioerr, - (u_longlong_t)zb->zb_objset, - (u_longlong_t)zb->zb_object, - (u_longlong_t)zb->zb_level, - (u_longlong_t)zb->zb_blkid, - blkbuf); - } + zio_nowait(zio_read(NULL, spa, bp, data, size, + zdb_blkptr_done, zcb, ZIO_PRIORITY_ASYNC_READ, flags, zb)); } zcb->zcb_readfails = 0; - if (dump_opt['b'] >= 5) { - sprintf_blkptr(blkbuf, bp); - (void) printf("objset %llu object %llu " - "level %lld offset 0x%llx %s\n", - (u_longlong_t)zb->zb_objset, - (u_longlong_t)zb->zb_object, - (longlong_t)zb->zb_level, - (u_longlong_t)blkid2offset(dnp, bp, zb), - blkbuf); - } - if (dump_opt['b'] < 5 && isatty(STDERR_FILENO) && gethrtime() > zcb->zcb_lastprint + NANOSEC) { uint64_t now = gethrtime(); @@ -2377,7 +2415,7 @@ count_block_cb(void *arg, const blkptr_t if (dump_opt['b'] >= 5) { char blkbuf[BP_SPRINTF_LEN]; - sprintf_blkptr(blkbuf, bp); + snprintf_blkptr(blkbuf, sizeof (blkbuf), bp); (void) printf("[%s] %s\n", "deferred free", blkbuf); } @@ -2433,6 +2471,18 @@ dump_block_stats(spa_t *spa) zcb.zcb_start = zcb.zcb_lastprint = gethrtime(); zcb.zcb_haderrors |= traverse_pool(spa, 0, flags, zdb_blkptr_cb, &zcb); + /* + * If we've traversed the data blocks then we need to wait for those + * I/Os to complete. We leverage "The Godfather" zio to wait on + * all async I/Os to complete. + */ + if (dump_opt['c']) { + (void) zio_wait(spa->spa_async_zio_root); + spa->spa_async_zio_root = zio_root(spa, NULL, NULL, + ZIO_FLAG_CANFAIL | ZIO_FLAG_SPECULATIVE | + ZIO_FLAG_GODFATHER); + } + if (zcb.zcb_haderrors) { (void) printf("\nError counts:\n\n"); (void) printf("\t%5s %s\n", "errno", "count"); @@ -2599,7 +2649,7 @@ zdb_ddt_add_cb(spa_t *spa, zilog_t *zilo avl_index_t where; zdb_ddt_entry_t *zdde, zdde_search; - if (bp == NULL) + if (BP_IS_HOLE(bp)) return (0); if (dump_opt['S'] > 1 && zb->zb_level == ZB_ROOT_LEVEL) { @@ -2766,7 +2816,7 @@ zdb_print_blkptr(blkptr_t *bp, int flags if (flags & ZDB_FLAG_BSWAP) byteswap_uint64_array((void *)bp, sizeof (blkptr_t)); - sprintf_blkptr(blkbuf, bp); + snprintf_blkptr(blkbuf, sizeof (blkbuf), bp); (void) printf("%s\n", blkbuf); } @@ -3202,7 +3252,7 @@ main(int argc, char **argv) dprintf_setup(&argc, argv); - while ((c = getopt(argc, argv, "bcdhilmsuCDRSAFLXevp:t:U:P")) != -1) { + while ((c = getopt(argc, argv, "bcdhilmM:suCDRSAFLXevp:t:U:P")) != -1) { switch (c) { case 'b': case 'c': @@ -3231,6 +3281,15 @@ main(int argc, char **argv) case 'v': verbose++; break; + case 'M': + max_inflight = strtoull(optarg, NULL, 0); + if (max_inflight == 0) { + (void) fprintf(stderr, "maximum number " + "of inflight I/Os must be greater " + "than 0\n"); + usage(); + } + break; case 'p': if (searchdirs == NULL) { searchdirs = umem_alloc(sizeof (char *), Modified: projects/altix2/cddl/contrib/opensolaris/cmd/zdb/zdb_il.c ============================================================================== --- projects/altix2/cddl/contrib/opensolaris/cmd/zdb/zdb_il.c Wed Jan 1 21:17:08 2014 (r260167) +++ projects/altix2/cddl/contrib/opensolaris/cmd/zdb/zdb_il.c Wed Jan 1 21:25:13 2014 (r260168) @@ -24,6 +24,10 @@ */ /* + * Copyright (c) 2013 by Delphix. All rights reserved. + */ + +/* * Print intent log header and statistics. */ @@ -47,7 +51,7 @@ print_log_bp(const blkptr_t *bp, const c { char blkbuf[BP_SPRINTF_LEN]; - sprintf_blkptr(blkbuf, bp); + snprintf_blkptr(blkbuf, sizeof (blkbuf), bp); (void) printf("%s%s\n", prefix, blkbuf); } @@ -132,6 +136,7 @@ zil_prt_rec_write(zilog_t *zilog, int tx if (lr->lr_common.lrc_reclen == sizeof (lr_write_t)) { (void) printf("%shas blkptr, %s\n", prefix, + !BP_IS_HOLE(bp) && bp->blk_birth >= spa_first_txg(zilog->zl_spa) ? "will claim" : "won't claim"); print_log_bp(bp, prefix); @@ -139,8 +144,6 @@ zil_prt_rec_write(zilog_t *zilog, int tx if (BP_IS_HOLE(bp)) { (void) printf("\t\t\tLSIZE 0x%llx\n", (u_longlong_t)BP_GET_LSIZE(bp)); - } - if (bp->blk_birth == 0) { bzero(buf, sizeof (buf)); (void) printf("%s\n", prefix); return; @@ -313,7 +316,8 @@ print_log_block(zilog_t *zilog, blkptr_t if (verbose >= 5) { (void) strcpy(blkbuf, ", "); - sprintf_blkptr(blkbuf + strlen(blkbuf), bp); + snprintf_blkptr(blkbuf + strlen(blkbuf), + sizeof (blkbuf) - strlen(blkbuf), bp); } else { blkbuf[0] = '\0'; } @@ -361,7 +365,7 @@ dump_intent_log(zilog_t *zilog) int verbose = MAX(dump_opt['d'], dump_opt['i']); int i; - if (zh->zh_log.blk_birth == 0 || verbose < 1) + if (BP_IS_HOLE(&zh->zh_log) || verbose < 1) return; (void) printf("\n ZIL header: claim_txg %llu, " Modified: projects/altix2/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c ============================================================================== --- projects/altix2/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Wed Jan 1 21:17:08 2014 (r260167) +++ projects/altix2/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Wed Jan 1 21:25:13 2014 (r260168) @@ -21,7 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012 by Delphix. All rights reserved. + * Copyright (c) 2013 by Delphix. All rights reserved. * Copyright 2012 Milan Jurik. All rights reserved. * Copyright (c) 2012, Joyent, Inc. All rights reserved. * Copyright (c) 2011-2012 Pawel Jakub Dawidek . @@ -2157,7 +2157,7 @@ static int us_type_bits[] = { USTYPE_SMB_USR, USTYPE_ALL }; -static char *us_type_names[] = { "posixgroup", "posxiuser", "smbgroup", +static char *us_type_names[] = { "posixgroup", "posixuser", "smbgroup", "smbuser", "all" }; typedef struct us_node { Modified: projects/altix2/cddl/contrib/opensolaris/cmd/zhack/zhack.c ============================================================================== --- projects/altix2/cddl/contrib/opensolaris/cmd/zhack/zhack.c Wed Jan 1 21:17:08 2014 (r260167) +++ projects/altix2/cddl/contrib/opensolaris/cmd/zhack/zhack.c Wed Jan 1 21:25:13 2014 (r260168) @@ -277,6 +277,9 @@ zhack_do_feature_stat(int argc, char **a dump_obj(os, spa->spa_feat_for_read_obj, "for_read"); dump_obj(os, spa->spa_feat_for_write_obj, "for_write"); dump_obj(os, spa->spa_feat_desc_obj, "descriptions"); + if (spa_feature_is_active(spa, SPA_FEATURE_ENABLED_TXG)) { + dump_obj(os, spa->spa_feat_enabled_txg_obj, "enabled_txg"); + } dump_mos(spa); spa_close(spa, FTAG); @@ -313,7 +316,9 @@ zhack_do_feature_enable(int argc, char * feature.fi_uname = "zhack"; feature.fi_mos = B_FALSE; feature.fi_can_readonly = B_FALSE; + feature.fi_activate_on_enable = B_FALSE; feature.fi_depends = nodeps; + feature.fi_feature = SPA_FEATURE_NONE; optind = 1; while ((c = getopt(argc, argv, "rmd:")) != -1) { @@ -371,7 +376,7 @@ feature_incr_sync(void *arg, dmu_tx_t *t zfeature_info_t *feature = arg; uint64_t refcount; - VERIFY0(feature_get_refcount(spa, feature, &refcount)); + VERIFY0(feature_get_refcount_from_disk(spa, feature, &refcount)); feature_sync(spa, feature, refcount + 1, tx); spa_history_log_internal(spa, "zhack feature incr", tx, "name=%s", feature->fi_guid); @@ -384,7 +389,7 @@ feature_decr_sync(void *arg, dmu_tx_t *t zfeature_info_t *feature = arg; uint64_t refcount; - VERIFY0(feature_get_refcount(spa, feature, &refcount)); + VERIFY0(feature_get_refcount_from_disk(spa, feature, &refcount)); feature_sync(spa, feature, refcount - 1, tx); spa_history_log_internal(spa, "zhack feature decr", tx, "name=%s", feature->fi_guid); @@ -411,6 +416,7 @@ zhack_do_feature_ref(int argc, char **ar feature.fi_mos = B_FALSE; feature.fi_desc = NULL; feature.fi_depends = nodeps; + feature.fi_feature = SPA_FEATURE_NONE; optind = 1; while ((c = getopt(argc, argv, "md")) != -1) { @@ -459,8 +465,8 @@ zhack_do_feature_ref(int argc, char **ar if (decr) { uint64_t count; - if (feature_get_refcount(spa, &feature, &count) == 0 && - count != 0) { + if (feature_get_refcount_from_disk(spa, &feature, + &count) == 0 && count != 0) { fatal(spa, FTAG, "feature refcount already 0: %s", feature.fi_guid); } Modified: projects/altix2/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7 ============================================================================== --- projects/altix2/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7 Wed Jan 1 21:17:08 2014 (r260167) +++ projects/altix2/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7 Wed Jan 1 21:25:13 2014 (r260168) @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 08, 2013 +.Dd December 31, 2013 .Dt ZPOOL-FEATURES 7 .Os .Sh NAME @@ -286,6 +286,76 @@ and will be returned to the .Sy enabled state when all datasets that use this feature are destroyed. +.It Sy enabled_txg +.Bl -column "READ\-ONLY COMPATIBLE" "com.delphix:enabled_txg" +.It GUID Ta com.delphix:enabled_txg +.It READ\-ONLY COMPATIBLE Ta yes +.It DEPENDENCIES Ta none +.El +.Pp +Once this feature is enabled ZFS records the transaction group number +in which new features are enabled. This has no user-visible impact, +but other features may depend on this feature. +.Pp +This feature becomes +.Sy active +as soon as it is enabled and will +never return to being +.Sy enabled . +.It Sy hole_birth +.Bl -column "READ\-ONLY COMPATIBLE" "com.delphix:hole_birth" +.It GUID Ta com.delphix:hole_birth +.It READ\-ONLY COMPATIBLE Ta no +.It DEPENDENCIES Ta enabled_txg +.El +.Pp +This feature improves performance of incremental sends +.Pq Dq zfs send -i +and receives for objects with many holes. +The most common case of +hole-filled objects is zvols. +.Pp +An incremental send stream from snapshot +.Sy A +to snapshot +.Sy B +contains information about every block that changed between +.Sy A +and +.Sy B . +Blocks which did not change between those snapshots can be +identified and omitted from the stream using a piece of metadata called +the 'block birth time', but birth times are not recorded for holes +.Pq blocks filled only with zeroes . +Since holes created after +.Sy A +cannot be +distinguished from holes created before +.Sy A , +information about every +hole in the entire filesystem or zvol is included in the send stream. +.Pp +For workloads where holes are rare this is not a problem. +However, when +incrementally replicating filesystems or zvols with many holes +.Pq for example a zvol formatted with another filesystem +a lot of time will +be spent sending and receiving unnecessary information about holes that +already exist on the receiving side. +.Pp +Once the +.Sy hole_birth +feature has been enabled the block birth times +of all new holes will be recorded. +Incremental sends between snapshots +created after this feature is enabled will use this new metadata to avoid +sending information about holes that already exist on the receiving side. +.Pp +This feature becomes +.Sy active +as soon as it is enabled and will +never return to being +.Sy enabled . .El .Sh SEE ALSO .Xr zpool 8 Modified: projects/altix2/cddl/contrib/opensolaris/cmd/zpool/zpool.8 ============================================================================== --- projects/altix2/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Wed Jan 1 21:17:08 2014 (r260167) +++ projects/altix2/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Wed Jan 1 21:25:13 2014 (r260168) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 14, 2013 +.Dd December 31, 2013 .Dt ZPOOL 8 .Os .Sh NAME @@ -141,6 +141,9 @@ .Cm remove .Ar pool device ... .Nm +.Cm reopen +.Ar pool +.Nm .Cm replace .Op Fl f .Ar pool device @@ -1431,6 +1434,13 @@ command. Non-redundant and devices cannot be removed from a pool. .It Xo .Nm +.Cm reopen +.Ar pool +.Xc +.Pp +Reopen all the vdevs associated with the pool. +.It Xo +.Nm .Cm replace .Op Fl f .Ar pool device Modified: projects/altix2/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c ============================================================================== --- projects/altix2/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Wed Jan 1 21:17:08 2014 (r260167) +++ projects/altix2/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Wed Jan 1 21:25:13 2014 (r260168) @@ -248,7 +248,7 @@ get_usage(zpool_help_t idx) { case HELP_REMOVE: return (gettext("\tremove ...\n")); case HELP_REOPEN: - return (""); /* Undocumented command */ + return (gettext("\treopen \n")); case HELP_SCRUB: return (gettext("\tscrub [-s] ...\n")); case HELP_STATUS: @@ -3720,22 +3720,37 @@ zpool_do_reguid(int argc, char **argv) * zpool reopen * * Reopen the pool so that the kernel can update the sizes of all vdevs. - * - * NOTE: This command is currently undocumented. If the command is ever - * exposed then the appropriate usage() messages will need to be made. */ int zpool_do_reopen(int argc, char **argv) { + int c; int ret = 0; zpool_handle_t *zhp; char *pool; + /* check options */ + while ((c = getopt(argc, argv, "")) != -1) { + switch (c) { + case '?': + (void) fprintf(stderr, gettext("invalid option '%c'\n"), + optopt); + usage(B_FALSE); + } + } + argc--; argv++; - if (argc != 1) - return (2); + if (argc < 1) { + (void) fprintf(stderr, gettext("missing pool name\n")); + usage(B_FALSE); + } + + if (argc > 1) { + (void) fprintf(stderr, gettext("too many arguments\n")); + usage(B_FALSE); + } pool = argv[0]; if ((zhp = zpool_open_canfail(g_zfs, pool)) == NULL) Modified: projects/altix2/cddl/contrib/opensolaris/cmd/zstreamdump/zstreamdump.1 ============================================================================== --- projects/altix2/cddl/contrib/opensolaris/cmd/zstreamdump/zstreamdump.1 Wed Jan 1 21:17:08 2014 (r260167) +++ projects/altix2/cddl/contrib/opensolaris/cmd/zstreamdump/zstreamdump.1 Wed Jan 1 21:25:13 2014 (r260168) @@ -18,10 +18,11 @@ .\" information: Portions Copyright [yyyy] [name of copyright owner] .\" .\" Copyright (c) 2009, Sun Microsystems, Inc. All Rights Reserved. +.\" Copyright (c) 2013, Delphix. All Rights Reserved. .\" .\" $FreeBSD$ .\" -.Dd November 26, 2011 +.Dd December 31, 2013 .Dt ZSTREAMDUMP 8 .Os .Sh NAME @@ -30,6 +31,7 @@ .Sh SYNOPSIS .Nm .Op Fl C +.Op Fl d .Op Fl v .Sh DESCRIPTION The @@ -43,6 +45,8 @@ The following options are supported: .Bl -tag -width indent .It Fl C Suppress the validation of checksums. +.It Fl d +Dump contents of blocks modified, implies verbose. .It Fl v Verbose. Dump all headers, not only begin and end headers. .El Modified: projects/altix2/cddl/contrib/opensolaris/cmd/zstreamdump/zstreamdump.c ============================================================================== --- projects/altix2/cddl/contrib/opensolaris/cmd/zstreamdump/zstreamdump.c Wed Jan 1 21:17:08 2014 (r260167) +++ projects/altix2/cddl/contrib/opensolaris/cmd/zstreamdump/zstreamdump.c Wed Jan 1 21:25:13 2014 (r260168) @@ -24,6 +24,11 @@ * Use is subject to license terms. */ +/* + * Copyright (c) 2013 by Delphix. All rights reserved. + */ + +#include #include #include #include @@ -34,6 +39,16 @@ #include #include +/* + * If dump mode is enabled, the number of bytes to print per line + */ +#define BYTES_PER_LINE 16 +/* + * If dump mode is enabled, the number of bytes to group together, separated + * by newlines or spaces + */ +#define DUMP_GROUPING 4 + uint64_t drr_record_count[DRR_NUMTYPES]; uint64_t total_write_size = 0; uint64_t total_stream_len = 0; @@ -45,9 +60,11 @@ boolean_t do_cksum = B_TRUE; static void usage(void) { - (void) fprintf(stderr, "usage: zstreamdump [-v] [-C] < file\n"); + (void) fprintf(stderr, "usage: zstreamdump [-v] [-C] [-d] < file\n"); (void) fprintf(stderr, "\t -v -- verbose\n"); (void) fprintf(stderr, "\t -C -- suppress checksum verification\n"); + (void) fprintf(stderr, "\t -d -- dump contents of blocks modified, " + "implies verbose\n"); exit(1); } @@ -75,6 +92,70 @@ ssread(void *buf, size_t len, zio_cksum_ return (outlen); } +/* + * Print part of a block in ASCII characters + */ +static void +print_ascii_block(char *subbuf, int length) +{ + int i; + + for (i = 0; i < length; i++) { + char char_print = isprint(subbuf[i]) ? subbuf[i] : '.'; + if (i != 0 && i % DUMP_GROUPING == 0) { + (void) printf(" "); + } + (void) printf("%c", char_print); + } + (void) printf("\n"); +} + +/* + * print_block - Dump the contents of a modified block to STDOUT + * + * Assume that buf has capacity evenly divisible by BYTES_PER_LINE + */ +static void +print_block(char *buf, int length) +{ + int i; + /* + * Start printing ASCII characters at a constant offset, after + * the hex prints. Leave 3 characters per byte on a line (2 digit + * hex number plus 1 space) plus spaces between characters and + * groupings + */ + int ascii_start = BYTES_PER_LINE * 3 + + BYTES_PER_LINE / DUMP_GROUPING + 2; + + for (i = 0; i < length; i += BYTES_PER_LINE) { + int j; + int this_line_length = MIN(BYTES_PER_LINE, length - i); + int print_offset = 0; + + for (j = 0; j < this_line_length; j++) { + int buf_offset = i + j; + + /* + * Separate every DUMP_GROUPING bytes by a space. + */ + if (buf_offset % DUMP_GROUPING == 0) { + print_offset += printf(" "); + } + + /* + * Print the two-digit hex value for this byte. + */ + unsigned char hex_print = buf[buf_offset]; + print_offset += printf("%02x ", hex_print); + } + + (void) printf("%*s", ascii_start - print_offset, " "); + + print_ascii_block(buf + i, this_line_length); + } +} + int main(int argc, char *argv[]) { *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-projects@FreeBSD.ORG Wed Jan 1 22:56:50 2014 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5DE2CCD3; Wed, 1 Jan 2014 22:56:50 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4888B1D47; Wed, 1 Jan 2014 22:56:50 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s01Muo2g075269; Wed, 1 Jan 2014 22:56:50 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s01MunBr075264; Wed, 1 Jan 2014 22:56:49 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201401012256.s01MunBr075264@svn.freebsd.org> From: Marcel Moolenaar Date: Wed, 1 Jan 2014 22:56:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r260176 - in projects/altix2/sys: ia64/include netgraph/netflow X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Jan 2014 22:56:50 -0000 Author: marcel Date: Wed Jan 1 22:56:49 2014 New Revision: 260176 URL: http://svnweb.freebsd.org/changeset/base/260176 Log: Merge ^/head@260175 Modified: projects/altix2/sys/ia64/include/atomic.h projects/altix2/sys/netgraph/netflow/netflow.c projects/altix2/sys/netgraph/netflow/netflow_v9.c projects/altix2/sys/netgraph/netflow/ng_netflow.c projects/altix2/sys/netgraph/netflow/ng_netflow.h Directory Properties: projects/altix2/ (props changed) projects/altix2/sys/ (props changed) Modified: projects/altix2/sys/ia64/include/atomic.h ============================================================================== --- projects/altix2/sys/ia64/include/atomic.h Wed Jan 1 22:51:19 2014 (r260175) +++ projects/altix2/sys/ia64/include/atomic.h Wed Jan 1 22:56:49 2014 (r260176) @@ -386,4 +386,32 @@ atomic_fetchadd_long(volatile u_long *p, return (value); } +/* + * atomic_swap_(volatile *p, v); + */ + +static __inline uint32_t +atomic_swap_32(volatile uint32_t *p, uint32_t v) +{ + uint32_t r; + + __asm __volatile ("xchg4 %0 = %3, %2;;" : "=r"(r), "=m"(*p) : + "r"(v), "m"(*p) : "memory"); + return (r); +} + +static __inline uint64_t +atomic_swap_64(volatile uint64_t *p, uint64_t v) +{ + uint64_t r; + + __asm __volatile ("xchg8 %0 = %3, %2;;" : "=r"(r), "=m"(*p) : + "r"(v), "m"(*p) : "memory"); + return (r); +} + +#define atomic_swap_int atomic_swap_32 +#define atomic_swap_long atomic_swap_64 +#define atomic_swap_ptr atomic_swap_64 + #endif /* ! _MACHINE_ATOMIC_H_ */ Modified: projects/altix2/sys/netgraph/netflow/netflow.c ============================================================================== --- projects/altix2/sys/netgraph/netflow/netflow.c Wed Jan 1 22:51:19 2014 (r260175) +++ projects/altix2/sys/netgraph/netflow/netflow.c Wed Jan 1 22:56:49 2014 (r260176) @@ -34,16 +34,13 @@ __FBSDID("$FreeBSD$"); #include "opt_inet6.h" #include "opt_route.h" #include +#include +#include #include #include #include #include -#include #include -#include - -#include -#include #include #include @@ -80,8 +77,8 @@ __FBSDID("$FreeBSD$"); /* Macros to shorten logical constructions */ /* XXX: priv must exist in namespace */ -#define INACTIVE(fle) (time_uptime - fle->f.last > priv->info.nfinfo_inact_t) -#define AGED(fle) (time_uptime - fle->f.first > priv->info.nfinfo_act_t) +#define INACTIVE(fle) (time_uptime - fle->f.last > priv->nfinfo_inact_t) +#define AGED(fle) (time_uptime - fle->f.first > priv->nfinfo_act_t) #define ISFREE(fle) (fle->f.packets == 0) /* @@ -149,54 +146,6 @@ ip6_hash(struct flow6_rec *r) } #endif -/* This is callback from uma(9), called on alloc. */ -static int -uma_ctor_flow(void *mem, int size, void *arg, int how) -{ - priv_p priv = (priv_p )arg; - - if (atomic_load_acq_32(&priv->info.nfinfo_used) >= CACHESIZE) - return (ENOMEM); - - atomic_add_32(&priv->info.nfinfo_used, 1); - - return (0); -} - -/* This is callback from uma(9), called on free. */ -static void -uma_dtor_flow(void *mem, int size, void *arg) -{ - priv_p priv = (priv_p )arg; - - atomic_subtract_32(&priv->info.nfinfo_used, 1); -} - -#ifdef INET6 -/* This is callback from uma(9), called on alloc. */ -static int -uma_ctor_flow6(void *mem, int size, void *arg, int how) -{ - priv_p priv = (priv_p )arg; - - if (atomic_load_acq_32(&priv->info.nfinfo_used6) >= CACHESIZE) - return (ENOMEM); - - atomic_add_32(&priv->info.nfinfo_used6, 1); - - return (0); -} - -/* This is callback from uma(9), called on free. */ -static void -uma_dtor_flow6(void *mem, int size, void *arg) -{ - priv_p priv = (priv_p )arg; - - atomic_subtract_32(&priv->info.nfinfo_used6, 1); -} -#endif - /* * Detach export datagram from priv, if there is any. * If there is no, allocate a new one. @@ -267,9 +216,9 @@ expire_flow(priv_p priv, fib_export_p fe if ((priv->export != NULL) && (version == IPVERSION)) { exp.item = get_export_dgram(priv, fe); if (exp.item == NULL) { - atomic_add_32(&priv->info.nfinfo_export_failed, 1); + priv->nfinfo_export_failed++; if (priv->export9 != NULL) - atomic_add_32(&priv->info.nfinfo_export9_failed, 1); + priv->nfinfo_export9_failed++; /* fle definitely contains IPv4 flow. */ uma_zfree_arg(priv->zone, fle, priv); return; @@ -284,7 +233,7 @@ expire_flow(priv_p priv, fib_export_p fe if (priv->export9 != NULL) { exp.item9 = get_export9_dgram(priv, fe, &exp.item9_opt); if (exp.item9 == NULL) { - atomic_add_32(&priv->info.nfinfo_export9_failed, 1); + priv->nfinfo_export9_failed++; if (version == IPVERSION) uma_zfree_arg(priv->zone, fle, priv); #ifdef INET6 @@ -317,8 +266,27 @@ void ng_netflow_copyinfo(priv_p priv, struct ng_netflow_info *i) { - /* XXX: atomic */ - memcpy((void *)i, (void *)&priv->info, sizeof(priv->info)); + i->nfinfo_bytes = counter_u64_fetch(priv->nfinfo_bytes); + i->nfinfo_packets = counter_u64_fetch(priv->nfinfo_packets); + i->nfinfo_bytes6 = counter_u64_fetch(priv->nfinfo_bytes6); + i->nfinfo_packets6 = counter_u64_fetch(priv->nfinfo_packets6); + i->nfinfo_sbytes = counter_u64_fetch(priv->nfinfo_sbytes); + i->nfinfo_spackets = counter_u64_fetch(priv->nfinfo_spackets); + i->nfinfo_sbytes6 = counter_u64_fetch(priv->nfinfo_sbytes6); + i->nfinfo_spackets6 = counter_u64_fetch(priv->nfinfo_spackets6); + i->nfinfo_act_exp = counter_u64_fetch(priv->nfinfo_act_exp); + i->nfinfo_inact_exp = counter_u64_fetch(priv->nfinfo_inact_exp); + + i->nfinfo_used = uma_zone_get_cur(priv->zone); + i->nfinfo_used6 = uma_zone_get_cur(priv->zone6); + + i->nfinfo_alloc_failed = priv->nfinfo_alloc_failed; + i->nfinfo_export_failed = priv->nfinfo_export_failed; + i->nfinfo_export9_failed = priv->nfinfo_export9_failed; + i->nfinfo_realloc_mbuf = priv->nfinfo_realloc_mbuf; + i->nfinfo_alloc_fibs = priv->nfinfo_alloc_fibs; + i->nfinfo_inact_t = priv->nfinfo_inact_t; + i->nfinfo_act_t = priv->nfinfo_act_t; } /* @@ -343,7 +311,7 @@ hash_insert(priv_p priv, struct flow_has fle = uma_zalloc_arg(priv->zone, priv, M_NOWAIT); if (fle == NULL) { - atomic_add_32(&priv->info.nfinfo_alloc_failed, 1); + priv->nfinfo_alloc_failed++; return (ENOMEM); } @@ -433,7 +401,7 @@ hash6_insert(priv_p priv, struct flow_ha fle6 = uma_zalloc_arg(priv->zone6, priv, M_NOWAIT); if (fle6 == NULL) { - atomic_add_32(&priv->info.nfinfo_alloc_failed, 1); + priv->nfinfo_alloc_failed++; return (ENOMEM); } @@ -526,13 +494,13 @@ ng_netflow_cache_init(priv_p priv) /* Initialize cache UMA zone. */ priv->zone = uma_zcreate("NetFlow IPv4 cache", - sizeof(struct flow_entry), uma_ctor_flow, uma_dtor_flow, NULL, - NULL, UMA_ALIGN_CACHE, 0); + sizeof(struct flow_entry), NULL, NULL, NULL, NULL, + UMA_ALIGN_CACHE, 0); uma_zone_set_max(priv->zone, CACHESIZE); #ifdef INET6 priv->zone6 = uma_zcreate("NetFlow IPv6 cache", - sizeof(struct flow6_entry), uma_ctor_flow6, uma_dtor_flow6, NULL, - NULL, UMA_ALIGN_CACHE, 0); + sizeof(struct flow6_entry), NULL, NULL, NULL, NULL, + UMA_ALIGN_CACHE, 0); uma_zone_set_max(priv->zone6, CACHESIZE); #endif @@ -558,6 +526,17 @@ ng_netflow_cache_init(priv_p priv) } #endif + priv->nfinfo_bytes = counter_u64_alloc(M_WAITOK); + priv->nfinfo_packets = counter_u64_alloc(M_WAITOK); + priv->nfinfo_bytes6 = counter_u64_alloc(M_WAITOK); + priv->nfinfo_packets6 = counter_u64_alloc(M_WAITOK); + priv->nfinfo_sbytes = counter_u64_alloc(M_WAITOK); + priv->nfinfo_spackets = counter_u64_alloc(M_WAITOK); + priv->nfinfo_sbytes6 = counter_u64_alloc(M_WAITOK); + priv->nfinfo_spackets6 = counter_u64_alloc(M_WAITOK); + priv->nfinfo_act_exp = counter_u64_alloc(M_WAITOK); + priv->nfinfo_inact_exp = counter_u64_alloc(M_WAITOK); + ng_netflow_v9_cache_init(priv); CTR0(KTR_NET, "ng_netflow startup()"); } @@ -594,7 +573,7 @@ ng_netflow_fib_init(priv_p priv, int fib /* Increase counter for statistics */ CTR3(KTR_NET, "ng_netflow(): fib %d setup to %p (%p)", fib, fe, priv_to_fib(priv, fib)); - atomic_fetchadd_32(&priv->info.nfinfo_alloc_fibs, 1); + priv->nfinfo_alloc_fibs++; } return (0); @@ -667,6 +646,17 @@ ng_netflow_cache_flush(priv_p priv) free(fe, M_NETGRAPH); } + counter_u64_free(priv->nfinfo_bytes); + counter_u64_free(priv->nfinfo_packets); + counter_u64_free(priv->nfinfo_bytes6); + counter_u64_free(priv->nfinfo_packets6); + counter_u64_free(priv->nfinfo_sbytes); + counter_u64_free(priv->nfinfo_spackets); + counter_u64_free(priv->nfinfo_sbytes6); + counter_u64_free(priv->nfinfo_spackets6); + counter_u64_free(priv->nfinfo_act_exp); + counter_u64_free(priv->nfinfo_inact_exp); + ng_netflow_v9_cache_flush(priv); } @@ -734,9 +724,8 @@ ng_netflow_flow_add(priv_p priv, fib_exp break; } - atomic_fetchadd_32(&priv->info.nfinfo_packets, 1); - /* XXX: atomic */ - priv->info.nfinfo_bytes += plen; + counter_u64_add(priv->nfinfo_packets, 1); + counter_u64_add(priv->nfinfo_bytes, plen); /* Find hash slot. */ hsh = &priv->hash[ip_hash(&r)]; @@ -756,7 +745,7 @@ ng_netflow_flow_add(priv_p priv, fib_exp TAILQ_REMOVE(&hsh->head, fle, fle_hash); expire_flow(priv, priv_to_fib(priv, fle->f.r.fib), fle, NG_QUEUE); - atomic_add_32(&priv->info.nfinfo_act_exp, 1); + counter_u64_add(priv->nfinfo_act_exp, 1); } } @@ -778,7 +767,7 @@ ng_netflow_flow_add(priv_p priv, fib_exp TAILQ_REMOVE(&hsh->head, fle, fle_hash); expire_flow(priv, priv_to_fib(priv, fle->f.r.fib), fle, NG_QUEUE); - atomic_add_32(&priv->info.nfinfo_act_exp, 1); + counter_u64_add(priv->nfinfo_act_exp, 1); } else { /* * It is the newest, move it to the tail, @@ -853,9 +842,8 @@ ng_netflow_flow6_add(priv_p priv, fib_ex r.r_ip_p = upper_proto; r.r_i_ifx = src_if_index; - atomic_fetchadd_32(&priv->info.nfinfo_packets6, 1); - /* XXX: atomic */ - priv->info.nfinfo_bytes6 += plen; + counter_u64_add(priv->nfinfo_packets6, 1); + counter_u64_add(priv->nfinfo_bytes6, plen); /* Find hash slot. */ hsh = &priv->hash6[ip6_hash(&r)]; @@ -878,7 +866,7 @@ ng_netflow_flow6_add(priv_p priv, fib_ex TAILQ_REMOVE(&hsh->head, fle, fle_hash); expire_flow(priv, priv_to_fib(priv, fle->f.r.fib), fle, NG_QUEUE); - atomic_add_32(&priv->info.nfinfo_act_exp, 1); + counter_u64_add(priv->nfinfo_act_exp, 1); } } @@ -901,7 +889,7 @@ ng_netflow_flow6_add(priv_p priv, fib_ex TAILQ_REMOVE(&hsh->head, fle, fle_hash); expire_flow(priv, priv_to_fib(priv, fle->f.r.fib), fle, NG_QUEUE); - atomic_add_32(&priv->info.nfinfo_act_exp, 1); + counter_u64_add(priv->nfinfo_act_exp, 1); } else { /* * It is the newest, move it to the tail, @@ -1119,12 +1107,12 @@ ng_netflow_expire(void *arg) struct flow_entry *fle, *fle1; struct flow_hash_entry *hsh; priv_p priv = (priv_p )arg; - uint32_t used; - int i; + int used, i; /* * Going through all the cache. */ + used = uma_zone_get_cur(priv->zone); for (hsh = priv->hash, i = 0; i < NBUCKETS; hsh++, i++) { /* * Skip entries, that are already being worked on. @@ -1132,7 +1120,6 @@ ng_netflow_expire(void *arg) if (mtx_trylock(&hsh->mtx) == 0) continue; - used = atomic_load_acq_32(&priv->info.nfinfo_used); TAILQ_FOREACH_SAFE(fle, &hsh->head, fle_hash, fle1) { /* * Interrupt thread wants this entry! @@ -1154,13 +1141,14 @@ ng_netflow_expire(void *arg) expire_flow(priv, priv_to_fib(priv, fle->f.r.fib), fle, NG_NOFLAGS); used--; - atomic_add_32(&priv->info.nfinfo_inact_exp, 1); + counter_u64_add(priv->nfinfo_inact_exp, 1); } } mtx_unlock(&hsh->mtx); } #ifdef INET6 + used = uma_zone_get_cur(priv->zone6); for (hsh = priv->hash6, i = 0; i < NBUCKETS; hsh++, i++) { struct flow6_entry *fle6; @@ -1170,7 +1158,6 @@ ng_netflow_expire(void *arg) if (mtx_trylock(&hsh->mtx) == 0) continue; - used = atomic_load_acq_32(&priv->info.nfinfo_used6); TAILQ_FOREACH_SAFE(fle, &hsh->head, fle_hash, fle1) { fle6 = (struct flow6_entry *)fle; /* @@ -1193,7 +1180,7 @@ ng_netflow_expire(void *arg) expire_flow(priv, priv_to_fib(priv, fle->f.r.fib), fle, NG_NOFLAGS); used--; - atomic_add_32(&priv->info.nfinfo_inact_exp, 1); + counter_u64_add(priv->nfinfo_inact_exp, 1); } } mtx_unlock(&hsh->mtx); Modified: projects/altix2/sys/netgraph/netflow/netflow_v9.c ============================================================================== --- projects/altix2/sys/netgraph/netflow/netflow_v9.c Wed Jan 1 22:51:19 2014 (r260175) +++ projects/altix2/sys/netgraph/netflow/netflow_v9.c Wed Jan 1 22:56:49 2014 (r260176) @@ -32,16 +32,13 @@ __FBSDID("$FreeBSD$"); #include "opt_inet6.h" #include "opt_route.h" #include +#include +#include #include #include #include #include -#include #include -#include - -#include -#include #include #include Modified: projects/altix2/sys/netgraph/netflow/ng_netflow.c ============================================================================== --- projects/altix2/sys/netgraph/netflow/ng_netflow.c Wed Jan 1 22:51:19 2014 (r260175) +++ projects/altix2/sys/netgraph/netflow/ng_netflow.c Wed Jan 1 22:56:49 2014 (r260176) @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -250,8 +251,8 @@ ng_netflow_constructor(node_p node) priv->node = node; /* Initialize timeouts to default values */ - priv->info.nfinfo_inact_t = INACTIVE_TIMEOUT; - priv->info.nfinfo_act_t = ACTIVE_TIMEOUT; + priv->nfinfo_inact_t = INACTIVE_TIMEOUT; + priv->nfinfo_act_t = ACTIVE_TIMEOUT; /* Set default config */ for (i = 0; i < NG_NETFLOW_MAXIFACES; i++) @@ -475,8 +476,8 @@ ng_netflow_rcvmsg (node_p node, item_p i set = (struct ng_netflow_settimeouts *)msg->data; - priv->info.nfinfo_inact_t = set->inactive_timeout; - priv->info.nfinfo_act_t = set->active_timeout; + priv->nfinfo_inact_t = set->inactive_timeout; + priv->nfinfo_act_t = set->active_timeout; break; } @@ -895,7 +896,7 @@ loopend: #endif /* Just in case of real reallocation in M_CHECK() / m_pullup() */ if (m != m_old) { - atomic_fetchadd_32(&priv->info.nfinfo_realloc_mbuf, 1); + priv->nfinfo_realloc_mbuf++; /* Restore ip/ipv6 pointer */ if (ip != NULL) ip = (struct ip *)(mtod(m, caddr_t) + l3_off); @@ -949,13 +950,13 @@ bypass: if (acct == 0) { /* Accounting failure */ if (ip != NULL) { - atomic_fetchadd_32(&priv->info.nfinfo_spackets, - 1); - priv->info.nfinfo_sbytes += m_length(m, NULL); + counter_u64_add(priv->nfinfo_spackets, 1); + counter_u64_add(priv->nfinfo_sbytes, + m->m_pkthdr.len); } else if (ip6 != NULL) { - atomic_fetchadd_32(&priv->info.nfinfo_spackets6, - 1); - priv->info.nfinfo_sbytes6 += m_length(m, NULL); + counter_u64_add(priv->nfinfo_spackets6, 1); + counter_u64_add(priv->nfinfo_sbytes6, + m->m_pkthdr.len); } } Modified: projects/altix2/sys/netgraph/netflow/ng_netflow.h ============================================================================== --- projects/altix2/sys/netgraph/netflow/ng_netflow.h Wed Jan 1 22:51:19 2014 (r260175) +++ projects/altix2/sys/netgraph/netflow/ng_netflow.h Wed Jan 1 22:56:49 2014 (r260176) @@ -33,7 +33,7 @@ #define _NG_NETFLOW_H_ #define NG_NETFLOW_NODE_TYPE "netflow" -#define NGM_NETFLOW_COOKIE 1309868867 +#define NGM_NETFLOW_COOKIE 1365756954 #define NGM_NETFLOW_V9_COOKIE 1349865386 #define NG_NETFLOW_MAXIFACES USHRT_MAX @@ -65,13 +65,15 @@ enum { /* This structure is returned by the NGM_NETFLOW_INFO message */ struct ng_netflow_info { uint64_t nfinfo_bytes; /* accounted IPv4 bytes */ - uint32_t nfinfo_packets; /* accounted IPv4 packets */ + uint64_t nfinfo_packets; /* accounted IPv4 packets */ uint64_t nfinfo_bytes6; /* accounted IPv6 bytes */ - uint32_t nfinfo_packets6; /* accounted IPv6 packets */ + uint64_t nfinfo_packets6; /* accounted IPv6 packets */ uint64_t nfinfo_sbytes; /* skipped IPv4 bytes */ - uint32_t nfinfo_spackets; /* skipped IPv4 packets */ + uint64_t nfinfo_spackets; /* skipped IPv4 packets */ uint64_t nfinfo_sbytes6; /* skipped IPv6 bytes */ - uint32_t nfinfo_spackets6; /* skipped IPv6 packets */ + uint64_t nfinfo_spackets6; /* skipped IPv6 packets */ + uint64_t nfinfo_act_exp; /* active expiries */ + uint64_t nfinfo_inact_exp; /* inactive expiries */ uint32_t nfinfo_used; /* used cache records */ uint32_t nfinfo_used6; /* used IPv6 cache records */ uint32_t nfinfo_alloc_failed; /* failed allocations */ @@ -79,12 +81,35 @@ struct ng_netflow_info { uint32_t nfinfo_export9_failed; /* failed exports */ uint32_t nfinfo_realloc_mbuf; /* reallocated mbufs */ uint32_t nfinfo_alloc_fibs; /* fibs allocated */ - uint32_t nfinfo_act_exp; /* active expiries */ - uint32_t nfinfo_inact_exp; /* inactive expiries */ uint32_t nfinfo_inact_t; /* flow inactive timeout */ uint32_t nfinfo_act_t; /* flow active timeout */ }; +/* Parse the info structure */ +#define NG_NETFLOW_INFO_TYPE { \ + { "IPv4 bytes", &ng_parse_uint64_type },\ + { "IPv4 packets", &ng_parse_uint64_type },\ + { "IPv6 bytes", &ng_parse_uint64_type },\ + { "IPv6 packets", &ng_parse_uint64_type },\ + { "IPv4 skipped bytes", &ng_parse_uint64_type },\ + { "IPv4 skipped packets", &ng_parse_uint64_type },\ + { "IPv6 skipped bytes", &ng_parse_uint64_type },\ + { "IPv6 skipped packets", &ng_parse_uint64_type },\ + { "Active expiries", &ng_parse_uint64_type },\ + { "Inactive expiries", &ng_parse_uint64_type },\ + { "IPv4 records used", &ng_parse_uint32_type },\ + { "IPv6 records used", &ng_parse_uint32_type },\ + { "Failed allocations", &ng_parse_uint32_type },\ + { "V5 failed exports", &ng_parse_uint32_type },\ + { "V9 failed exports", &ng_parse_uint32_type },\ + { "mbuf reallocations", &ng_parse_uint32_type },\ + { "fibs allocated", &ng_parse_uint32_type },\ + { "Inactive timeout", &ng_parse_uint32_type },\ + { "Active timeout", &ng_parse_uint32_type },\ + { NULL } \ +} + + /* This structure is returned by the NGM_NETFLOW_IFINFO message */ struct ng_netflow_ifinfo { uint32_t ifinfo_packets; /* number of packets for this iface */ @@ -282,30 +307,6 @@ struct flow6_entry { }; /* Parsing declarations */ -/* Parse the info structure */ -#define NG_NETFLOW_INFO_TYPE { \ - { "IPv4 bytes", &ng_parse_uint64_type },\ - { "IPv4 packets", &ng_parse_uint32_type },\ - { "IPv6 bytes", &ng_parse_uint64_type },\ - { "IPv6 packets", &ng_parse_uint32_type },\ - { "IPv4 skipped bytes", &ng_parse_uint64_type },\ - { "IPv4 skipped packets", &ng_parse_uint32_type },\ - { "IPv6 skipped bytes", &ng_parse_uint64_type },\ - { "IPv6 skipped packets", &ng_parse_uint32_type },\ - { "IPv4 records used", &ng_parse_uint32_type },\ - { "IPv6 records used", &ng_parse_uint32_type },\ - { "Failed allocations", &ng_parse_uint32_type },\ - { "V5 failed exports", &ng_parse_uint32_type },\ - { "V9 failed exports", &ng_parse_uint32_type },\ - { "mbuf reallocations", &ng_parse_uint32_type },\ - { "fibs allocated", &ng_parse_uint32_type },\ - { "Active expiries", &ng_parse_uint32_type },\ - { "Inactive expiries", &ng_parse_uint32_type },\ - { "Inactive timeout", &ng_parse_uint32_type },\ - { "Active timeout", &ng_parse_uint32_type },\ - { NULL } \ -} - /* Parse the ifinfo structure */ #define NG_NETFLOW_IFINFO_TYPE { \ { "packets", &ng_parse_uint32_type },\ @@ -408,7 +409,6 @@ struct netflow { node_p node; /* link to the node itself */ hook_p export; /* export data goes there */ hook_p export9; /* Netflow V9 export data goes there */ - struct ng_netflow_info info; struct callout exp_callout; /* expiry periodic job */ /* @@ -440,6 +440,25 @@ struct netflow { struct flow_hash_entry *hash6; #endif + /* Statistics. */ + counter_u64_t nfinfo_bytes; /* accounted IPv4 bytes */ + counter_u64_t nfinfo_packets; /* accounted IPv4 packets */ + counter_u64_t nfinfo_bytes6; /* accounted IPv6 bytes */ + counter_u64_t nfinfo_packets6; /* accounted IPv6 packets */ + counter_u64_t nfinfo_sbytes; /* skipped IPv4 bytes */ + counter_u64_t nfinfo_spackets; /* skipped IPv4 packets */ + counter_u64_t nfinfo_sbytes6; /* skipped IPv6 bytes */ + counter_u64_t nfinfo_spackets6; /* skipped IPv6 packets */ + counter_u64_t nfinfo_act_exp; /* active expiries */ + counter_u64_t nfinfo_inact_exp; /* inactive expiries */ + uint32_t nfinfo_alloc_failed; /* failed allocations */ + uint32_t nfinfo_export_failed; /* failed exports */ + uint32_t nfinfo_export9_failed; /* failed exports */ + uint32_t nfinfo_realloc_mbuf; /* reallocated mbufs */ + uint32_t nfinfo_alloc_fibs; /* fibs allocated */ + uint32_t nfinfo_inact_t; /* flow inactive timeout */ + uint32_t nfinfo_act_t; /* flow active timeout */ + /* Multiple FIB support */ fib_export_p *fib_data; /* vector to per-fib data */ uint16_t maxfibs; /* number of allocated fibs */ From owner-svn-src-projects@FreeBSD.ORG Thu Jan 2 23:17:49 2014 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4DDA5C8E; Thu, 2 Jan 2014 23:17:49 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 3A2CC1DF2; Thu, 2 Jan 2014 23:17:49 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s02NHnRm038719; Thu, 2 Jan 2014 23:17:49 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s02NHnrS038718; Thu, 2 Jan 2014 23:17:49 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201401022317.s02NHnrS038718@svn.freebsd.org> From: Rick Macklem Date: Thu, 2 Jan 2014 23:17:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r260209 - projects/nfsv4.1-server/sys/fs/nfsserver X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jan 2014 23:17:49 -0000 Author: rmacklem Date: Thu Jan 2 23:17:48 2014 New Revision: 260209 URL: http://svnweb.freebsd.org/changeset/base/260209 Log: Carry one missed patch over from the pre-updated source tree. Modified: projects/nfsv4.1-server/sys/fs/nfsserver/nfs_nfsdserv.c Modified: projects/nfsv4.1-server/sys/fs/nfsserver/nfs_nfsdserv.c ============================================================================== --- projects/nfsv4.1-server/sys/fs/nfsserver/nfs_nfsdserv.c Thu Jan 2 21:57:03 2014 (r260208) +++ projects/nfsv4.1-server/sys/fs/nfsserver/nfs_nfsdserv.c Thu Jan 2 23:17:48 2014 (r260209) @@ -3872,7 +3872,7 @@ nfsrvd_createsession(struct nfsrv_descri *tl = txdr_unsigned(0); /* No RDMA. */ } nfsmout: - if (nd->nd_repstat != 0) + if (nd->nd_repstat != 0 && sep != NULL) free(sep, M_NFSDSESSION); NFSEXITCODE2(error, nd); return (error); From owner-svn-src-projects@FreeBSD.ORG Fri Jan 3 02:22:45 2014 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id BD0B198E; Fri, 3 Jan 2014 02:22:45 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id A92761AA9; Fri, 3 Jan 2014 02:22:45 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s032MjMc013930; Fri, 3 Jan 2014 02:22:45 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s032MjUa013929; Fri, 3 Jan 2014 02:22:45 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201401030222.s032MjUa013929@svn.freebsd.org> From: Rick Macklem Date: Fri, 3 Jan 2014 02:22:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r260216 - projects/nfsv4.1-server/sys/fs/nfsserver X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Jan 2014 02:22:45 -0000 Author: rmacklem Date: Fri Jan 3 02:22:45 2014 New Revision: 260216 URL: http://svnweb.freebsd.org/changeset/base/260216 Log: Fix the callbacks for NFSv4.0, which were broken by a recent change for the NFSv4.1 backchannel callbacks. Modified: projects/nfsv4.1-server/sys/fs/nfsserver/nfs_nfsdstate.c Modified: projects/nfsv4.1-server/sys/fs/nfsserver/nfs_nfsdstate.c ============================================================================== --- projects/nfsv4.1-server/sys/fs/nfsserver/nfs_nfsdstate.c Fri Jan 3 00:51:02 2014 (r260215) +++ projects/nfsv4.1-server/sys/fs/nfsserver/nfs_nfsdstate.c Fri Jan 3 02:22:45 2014 (r260216) @@ -3993,10 +3993,12 @@ nfsrv_docallback(struct nfsclient *clp, (void)nfsm_fhtom(nd, (u_int8_t *)fhp, NFSX_MYFH, 0); } else if (procnum == NFSV4PROC_CBNULL) { nd->nd_procnum = NFSV4PROC_CBNULL; - error = nfsv4_getcbsession(clp, &sep); - if (error != 0) { - mbuf_freem(nd->nd_mreq); - goto errout; + if ((clp->lc_flags & LCL_NFSV41) != 0) { + error = nfsv4_getcbsession(clp, &sep); + if (error != 0) { + mbuf_freem(nd->nd_mreq); + goto errout; + } } } else { error = NFSERR_SERVERFAULT; From owner-svn-src-projects@FreeBSD.ORG Sat Jan 4 23:48:20 2014 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DF45F8DE; Sat, 4 Jan 2014 23:48:20 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id CAA731CDA; Sat, 4 Jan 2014 23:48:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s04NmKdK065144; Sat, 4 Jan 2014 23:48:20 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s04NmKrH065143; Sat, 4 Jan 2014 23:48:20 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201401042348.s04NmKrH065143@svn.freebsd.org> From: Marcel Moolenaar Date: Sat, 4 Jan 2014 23:48:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r260308 - projects/altix2/sys/ia64/sgisn X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jan 2014 23:48:20 -0000 Author: marcel Date: Sat Jan 4 23:48:20 2014 New Revision: 260308 URL: http://svnweb.freebsd.org/changeset/base/260308 Log: Replace SHUB_MMR_PIO_WSTAT0 and SHUB_MMR_PIO_WSTAT1 with a parameterized variant, called SHUB_MMR_PIO_WSTAT(x). On Shub2-based systems there are 4 slices instead of 2 and as such there are 4 PIO/MEM status registers. Modified: projects/altix2/sys/ia64/sgisn/sgisn_shub.h Modified: projects/altix2/sys/ia64/sgisn/sgisn_shub.h ============================================================================== --- projects/altix2/sys/ia64/sgisn/sgisn_shub.h Sat Jan 4 23:45:55 2014 (r260307) +++ projects/altix2/sys/ia64/sgisn/sgisn_shub.h Sat Jan 4 23:48:20 2014 (r260308) @@ -45,8 +45,7 @@ #define SHUB_MMR_PTC_CFG0 0x101a0000 #define SHUB_MMR_PTC_CFG1 0x101a0080 #define SHUB_MMR_RTC 0x101c0000 -#define SHUB_MMR_PIO_WSTAT0 0x20070200 -#define SHUB_MMR_PIO_WSTAT1 0x20070280 +#define SHUB_MMR_PIO_WSTAT(x) (0x20070200 + (x) * 0x80) /* 0<=x<4 */ #define SHUB_MMR_PTC 0x70000000 #endif /* _IA64_SGISN_SHUB_H_ */ From owner-svn-src-projects@FreeBSD.ORG Sat Jan 4 23:53:12 2014 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 45094BBC; Sat, 4 Jan 2014 23:53:12 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 303F11D45; Sat, 4 Jan 2014 23:53:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s04NrCFY067610; Sat, 4 Jan 2014 23:53:12 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s04NrBof067608; Sat, 4 Jan 2014 23:53:11 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201401042353.s04NrBof067608@svn.freebsd.org> From: Marcel Moolenaar Date: Sat, 4 Jan 2014 23:53:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r260309 - in projects/altix2/sys/ia64: ia64 include X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jan 2014 23:53:12 -0000 Author: marcel Date: Sat Jan 4 23:53:11 2014 New Revision: 260309 URL: http://svnweb.freebsd.org/changeset/base/260309 Log: Save the slice in which the CPU is located in the PCPU structure. We need to know that when we want to send PTC operations to the SHub. Modified: projects/altix2/sys/ia64/ia64/machdep.c projects/altix2/sys/ia64/include/pcpu.h Modified: projects/altix2/sys/ia64/ia64/machdep.c ============================================================================== --- projects/altix2/sys/ia64/ia64/machdep.c Sat Jan 4 23:48:20 2014 (r260308) +++ projects/altix2/sys/ia64/ia64/machdep.c Sat Jan 4 23:53:11 2014 (r260309) @@ -539,6 +539,7 @@ cpu_pcpu_setup(struct pcpu *pc, u_int ac if (r.sal_status != 0) return; pc->pc_md.sgisn_nasid = r.sal_result[0]; + pc->pc_md.sgisn_slice = r.sal_result[2]; r = ia64_sal_entry(SAL_SGISN_SN_INFO, 0, 0, 0, 0, 0, 0, 0); if (r.sal_status != 0) Modified: projects/altix2/sys/ia64/include/pcpu.h ============================================================================== --- projects/altix2/sys/ia64/include/pcpu.h Sat Jan 4 23:48:20 2014 (r260308) +++ projects/altix2/sys/ia64/include/pcpu.h Sat Jan 4 23:53:11 2014 (r260309) @@ -56,6 +56,7 @@ struct pcpu_md { uint32_t clock_mode; /* Clock ET mode */ uint32_t sgisn_nasid; uint64_t sgisn_ipip; + uint32_t sgisn_slice; uint32_t awake:1; /* CPU is awake? */ struct pcpu_stats stats; /* Interrupt stats. */ #ifdef _KERNEL