PERFORCE change 31843 for review
Peter Wemm
peter at FreeBSD.org
Sun May 25 00:51:55 PDT 2003
http://perforce.freebsd.org/chv.cgi?CH=31843
Change 31843 by peter at peter_daintree on 2003/05/25 00:51:40
IFC @31842
Affected files ...
.. //depot/projects/hammer/lib/libthr/arch/ia64/ia64/_curthread.c#2 integrate
.. //depot/projects/hammer/release/Makefile.inc.docports#4 integrate
.. //depot/projects/hammer/sys/dev/cardbus/cardbus_cis.c#7 integrate
.. //depot/projects/hammer/sys/dev/fxp/if_fxp.c#16 integrate
.. //depot/projects/hammer/sys/ia64/ia64/syscall.s#2 integrate
.. //depot/projects/hammer/sys/ia64/ia64/trap.c#10 integrate
.. //depot/projects/hammer/sys/ia64/include/cpu.h#6 integrate
.. //depot/projects/hammer/sys/ia64/include/cpufunc.h#5 integrate
.. //depot/projects/hammer/sys/nfsserver/nfs.h#2 integrate
.. //depot/projects/hammer/sys/nfsserver/nfs_serv.c#8 integrate
.. //depot/projects/hammer/sys/nfsserver/nfs_srvsubs.c#6 integrate
.. //depot/projects/hammer/usr.sbin/Makefile#16 integrate
.. //depot/projects/hammer/usr.sbin/ppp/ncpaddr.c#6 integrate
Differences ...
==== //depot/projects/hammer/lib/libthr/arch/ia64/ia64/_curthread.c#2 (text+ko) ====
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libthr/arch/ia64/ia64/_curthread.c,v 1.1 2003/04/20 03:06:42 marcel Exp $");
+__FBSDID("$FreeBSD: src/lib/libthr/arch/ia64/ia64/_curthread.c,v 1.2 2003/05/25 06:49:19 marcel Exp $");
#include <sys/types.h>
#include <sys/ucontext.h>
@@ -52,7 +52,7 @@
{
if (uc != NULL)
- uc->uc_mcontext.mc_gr[13] = (uint64_t)thread;
+ uc->uc_mcontext.mc_special.tp = (uint64_t)thread;
else
_tp = thread;
return (NULL);
==== //depot/projects/hammer/release/Makefile.inc.docports#4 (text+ko) ====
@@ -1,4 +1,4 @@
-# $FreeBSD: src/release/Makefile.inc.docports,v 1.17 2003/04/26 07:31:43 murray Exp $
+# $FreeBSD: src/release/Makefile.inc.docports,v 1.18 2003/05/25 03:41:41 kuriyama Exp $
#
# List of (dependent) ports that are minimally required to be
# checked out from CVS in order to get ${DOCPORTS} built and
@@ -66,7 +66,8 @@
MINIMALDOCPORTS+= ports/textproc/sed_inplace
.endif
.if ${MACHINE_ARCH} != "i386"
-MINIMALDOCPORTS+= ports/textproc/openjade
+MINIMALDOCPORTS+= ports/textproc/openjade \
+ ports/textproc/opensp
.else
MINIMALDOCPORTS+= ports/textproc/jade
.endif
==== //depot/projects/hammer/sys/dev/cardbus/cardbus_cis.c#7 (text+ko) ====
@@ -25,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/sys/dev/cardbus/cardbus_cis.c,v 1.36 2003/04/08 07:05:16 imp Exp $
+ * $FreeBSD: src/sys/dev/cardbus/cardbus_cis.c,v 1.37 2003/05/24 23:23:41 imp Exp $
*/
/*
@@ -423,8 +423,10 @@
if (type == SYS_RES_MEMORY) {
if (reg & TPL_BAR_REG_PREFETCHABLE)
dinfo->mprefetchable |= BARBIT(bar);
+#if 0
if (reg & TPL_BAR_REG_BELOW1MB)
dinfo->mbelow1mb |= BARBIT(bar);
+#endif
}
/*
==== //depot/projects/hammer/sys/dev/fxp/if_fxp.c#16 (text+ko) ====
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/fxp/if_fxp.c,v 1.179 2003/05/16 01:13:16 rwatson Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/fxp/if_fxp.c,v 1.180 2003/05/25 05:04:26 truckman Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -383,7 +383,7 @@
u_int32_t val;
u_int16_t data, myea[ETHER_ADDR_LEN / 2];
int i, rid, m1, m2, prefer_iomap, maxtxseg;
- int s;
+ int s, ipcbxmit_disable;
sc->dev = dev;
callout_handle_init(&sc->stat_ch);
@@ -582,9 +582,31 @@
* and later chips. Note: we need extended TXCB support
* too, but that's already enabled by the code above.
* Be careful to do this only on the right devices.
+ *
+ * At least some 82550 cards probed as "chip=0x12298086 rev=0x0d"
+ * truncate packets that end with an mbuf containing 1 to 3 bytes
+ * when used with this feature enabled in the previous version of the
+ * driver. This problem appears to be fixed now that the driver
+ * always sets the hardware parse bit in the IPCB structure, which
+ * the "Intel 8255x 10/100 Mbps Ethernet Controller Family Open
+ * Source Software Developer Manual" says is necessary in the
+ * cases where packet truncation was observed.
+ *
+ * The device hint "hint.fxp.UNIT_NUMBER.ipcbxmit_disable"
+ * allows this feature to be disabled at boot time.
+ *
+ * If fxp is not compiled into the kernel, this feature may also
+ * be disabled at run time:
+ * # kldunload fxp
+ * # kenv hint.fxp.0.ipcbxmit_disable=1
+ * # kldload fxp
*/
- if (sc->revision == FXP_REV_82550 || sc->revision == FXP_REV_82550_C) {
+ if (resource_int_value("fxp", device_get_unit(dev), "ipcbxmit_disable",
+ &ipcbxmit_disable) != 0)
+ ipcbxmit_disable = 0;
+ if (ipcbxmit_disable == 0 && (sc->revision == FXP_REV_82550 ||
+ sc->revision == FXP_REV_82550_C)) {
sc->rfa_size = sizeof (struct fxp_rfa);
sc->tx_cmd = FXP_CB_COMMAND_IPCBXMIT;
sc->flags |= FXP_FLAG_EXT_RFA;
@@ -1277,6 +1299,23 @@
txp = sc->fxp_desc.tx_last->tx_next;
/*
+ * A note in Appendix B of the Intel 8255x 10/100 Mbps
+ * Ethernet Controller Family Open Source Software
+ * Developer Manual says:
+ * Using software parsing is only allowed with legal
+ * TCP/IP or UDP/IP packets.
+ * ...
+ * For all other datagrams, hardware parsing must
+ * be used.
+ * Software parsing appears to truncate ICMP and
+ * fragmented UDP packets that contain one to three
+ * bytes in the second (and final) mbuf of the packet.
+ */
+ if (sc->flags & FXP_FLAG_EXT_RFA)
+ txp->tx_cb->ipcb_ip_activation_high =
+ FXP_IPCB_HARDWAREPARSING_ENABLE;
+
+ /*
* Deal with TCP/IP checksum offload. Note that
* in order for TCP checksum offload to work,
* the pseudo header checksum must have already
@@ -1287,8 +1326,6 @@
if (mb_head->m_pkthdr.csum_flags) {
if (mb_head->m_pkthdr.csum_flags & CSUM_DELAY_DATA) {
- txp->tx_cb->ipcb_ip_activation_high =
- FXP_IPCB_HARDWAREPARSING_ENABLE;
txp->tx_cb->ipcb_ip_schedule =
FXP_IPCB_TCPUDP_CHECKSUM_ENABLE;
if (mb_head->m_pkthdr.csum_flags & CSUM_TCP)
==== //depot/projects/hammer/sys/ia64/ia64/syscall.s#2 (text+ko) ====
@@ -23,7 +23,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $FreeBSD: src/sys/ia64/ia64/syscall.s,v 1.1 2003/05/15 07:51:22 marcel Exp $
+ * $FreeBSD: src/sys/ia64/ia64/syscall.s,v 1.2 2003/05/24 22:53:10 marcel Exp $
*/
#include <sys/syscall.h>
@@ -242,9 +242,6 @@
.prologue
.unwabi @svr4, 'E'
.save rp, r0
-
- rsm psr.i
- ;;
{ .mmi
mov r16=ar.rsc
mov ar.rsc=0
@@ -380,7 +377,7 @@
;;
}
{ .mlx
- ssm psr.dfh|psr.ac|psr.i
+ ssm psr.dfh|psr.ac
movl gp=__gp
;;
}
@@ -473,20 +470,20 @@
}
{ .mmi
loadrs
- mov r14=ar.k5
+ mov ar.k7=r31
mov sp=r16
;;
}
{ .mmi
mov r30=ar.bspstore
;;
- mov ar.bspstore=r21
+ mov r14=ar.k5
dep r30=0,r30,0,9
;;
}
{ .mmi
mov ar.k6=r30
- mov ar.k7=r31
+ mov ar.bspstore=r21
mov r13=r23
;;
}
==== //depot/projects/hammer/sys/ia64/ia64/trap.c#10 (text+ko) ====
@@ -1,4 +1,4 @@
-/* $FreeBSD: src/sys/ia64/ia64/trap.c,v 1.76 2003/05/16 21:26:41 marcel Exp $ */
+/* $FreeBSD: src/sys/ia64/ia64/trap.c,v 1.78 2003/05/25 01:01:28 marcel Exp $ */
/* From: src/sys/alpha/alpha/trap.c,v 1.33 */
/* $NetBSD: trap.c,v 1.31 1998/03/26 02:21:46 thorpej Exp $ */
@@ -343,11 +343,10 @@
int i, user;
u_int sticks;
- user = ((framep->tf_special.psr & IA64_PSR_CPL) == IA64_PSR_CPL_USER);
+ user = ((framep->tf_special.iip >> 61) < 5) ? 1 : 0;
/* Short-circuit break instruction based system calls. */
- if (vector == IA64_VEC_BREAK && user &&
- framep->tf_special.ifa == 0x100000) {
+ if (vector == IA64_VEC_BREAK && framep->tf_special.ifa == 0x100000) {
break_syscall(framep);
return;
}
==== //depot/projects/hammer/sys/ia64/include/cpu.h#6 (text+ko) ====
@@ -1,4 +1,4 @@
-/* $FreeBSD: src/sys/ia64/include/cpu.h,v 1.30 2003/05/24 00:17:34 marcel Exp $ */
+/* $FreeBSD: src/sys/ia64/include/cpu.h,v 1.31 2003/05/24 21:16:19 marcel Exp $ */
/* From: NetBSD: cpu.h,v 1.18 1997/09/23 23:17:49 mjacob Exp */
/*
@@ -63,8 +63,7 @@
/* XXX */
#define TRAPF_PC(tf) ((tf)->tf_special.iip)
-#define TRAPF_USERMODE(framep) \
- (((framep)->tf_special.psr & IA64_PSR_CPL) == IA64_PSR_CPL_USER)
+#define TRAPF_USERMODE(tf) ((TRAPF_PC(tf) >> 61) < 5)
/*
* CTL_MACHDEP definitions.
==== //depot/projects/hammer/sys/ia64/include/cpufunc.h#5 (text+ko) ====
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/sys/ia64/include/cpufunc.h,v 1.16 2003/04/29 09:50:03 marcel Exp $
+ * $FreeBSD: src/sys/ia64/include/cpufunc.h,v 1.17 2003/05/24 21:44:24 marcel Exp $
*/
#ifndef _MACHINE_CPUFUNC_H_
@@ -193,13 +193,14 @@
register_t psr;
__asm __volatile ("mov %0=psr;;" : "=r"(psr));
disable_intr();
- return (psr);
+ return ((psr & IA64_PSR_I) ? 1 : 0);
}
static __inline void
-intr_restore(critical_t psr)
+intr_restore(register_t ie)
{
- __asm __volatile ("mov psr.l=%0;; srlz.d" :: "r"(psr));
+ if (ie)
+ enable_intr();
}
#endif /* _KERNEL */
==== //depot/projects/hammer/sys/nfsserver/nfs.h#2 (text+ko) ====
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs.h 8.4 (Berkeley) 5/1/95
- * $FreeBSD: src/sys/nfsserver/nfs.h,v 1.68 2002/07/24 22:27:35 peter Exp $
+ * $FreeBSD: src/sys/nfsserver/nfs.h,v 1.69 2003/05/25 06:17:33 truckman Exp $
*/
#ifndef _NFSSERVER_NFS_H_
@@ -332,7 +332,8 @@
int netaddr_match(int, union nethostaddr *, struct sockaddr *);
int nfs_namei(struct nameidata *, fhandle_t *, int,
struct nfssvc_sock *, struct sockaddr *, struct mbuf **,
- caddr_t *, struct vnode **, struct thread *, int);
+ caddr_t *, struct vnode **, int, struct vattr *, int *,
+ struct thread *, int);
void nfsm_adj(struct mbuf *, int, int);
int nfsm_mbuftouio(struct mbuf **, struct uio *, int, caddr_t *);
void nfsrv_initcache(void);
==== //depot/projects/hammer/sys/nfsserver/nfs_serv.c#8 (text+ko) ====
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/nfsserver/nfs_serv.c,v 1.133 2003/04/24 04:31:25 alc Exp $");
+__FBSDID("$FreeBSD: src/sys/nfsserver/nfs_serv.c,v 1.134 2003/05/25 06:17:33 truckman Exp $");
/*
* nfs version 2 and 3 server calls to vnode ops
@@ -467,7 +467,7 @@
nd.ni_cnd.cn_nameiop = LOOKUP;
nd.ni_cnd.cn_flags = LOCKLEAF | SAVESTART;
error = nfs_namei(&nd, fhp, len, slp, nam, &md, &dpos,
- &dirp, td, pubflag);
+ &dirp, v3, &dirattr, &dirattr_ret, td, pubflag);
/*
* namei failure, only dirp to cleanup. Clear out garbarge from
@@ -476,9 +476,6 @@
if (error) {
if (dirp) {
- if (v3)
- dirattr_ret = VOP_GETATTR(dirp, &dirattr, cred,
- td);
vrele(dirp);
dirp = NULL;
}
@@ -551,9 +548,6 @@
}
if (dirp) {
- if (v3)
- dirattr_ret = VOP_GETATTR(dirp, &dirattr, cred,
- td);
vrele(dirp);
dirp = NULL;
}
@@ -1630,15 +1624,10 @@
* prior to calling nfsm_reply ( which might goto nfsmout ).
*/
error = nfs_namei(&nd, fhp, len, slp, nam, &md, &dpos,
- &dirp, td, FALSE);
- if (dirp) {
- if (v3) {
- dirfor_ret = VOP_GETATTR(dirp, &dirfor, cred,
- td);
- } else {
- vrele(dirp);
- dirp = NULL;
- }
+ &dirp, v3, &dirfor, &dirfor_ret, td, FALSE);
+ if (dirp && !v3) {
+ vrele(dirp);
+ dirp = NULL;
}
if (error) {
nfsm_reply(NFSX_WCCDATA(v3));
@@ -1809,9 +1798,25 @@
if (exclusive_flag && !error &&
bcmp(cverf, (caddr_t)&vap->va_atime, NFSX_V3CREATEVERF))
error = EEXIST;
- diraft_ret = VOP_GETATTR(dirp, &diraft, cred, td);
- vrele(dirp);
- dirp = NULL;
+ if (dirp == nd.ni_dvp)
+ diraft_ret = VOP_GETATTR(dirp, &diraft, cred, td);
+ else {
+ /* Drop the other locks to avoid deadlock. */
+ if (nd.ni_dvp) {
+ if (nd.ni_dvp == nd.ni_vp)
+ vrele(nd.ni_dvp);
+ else
+ vput(nd.ni_dvp);
+ }
+ if (nd.ni_vp)
+ vput(nd.ni_vp);
+ nd.ni_dvp = NULL;
+ nd.ni_vp = NULL;
+
+ vn_lock(dirp, LK_EXCLUSIVE | LK_RETRY, td);
+ diraft_ret = VOP_GETATTR(dirp, &diraft, cred, td);
+ VOP_UNLOCK(dirp, 0, td);
+ }
}
ereply:
nfsm_reply(NFSX_SRVFH(v3) + NFSX_FATTR(v3) + NFSX_WCCDATA(v3));
@@ -1906,9 +1911,7 @@
*/
error = nfs_namei(&nd, fhp, len, slp, nam, &md, &dpos,
- &dirp, td, FALSE);
- if (dirp)
- dirfor_ret = VOP_GETATTR(dirp, &dirfor, cred, td);
+ &dirp, v3, &dirfor, &dirfor_ret, td, FALSE);
if (error) {
nfsm_reply(NFSX_WCCDATA(1));
nfsm_srvwcc_data(dirfor_ret, &dirfor, diraft_ret, &diraft);
@@ -2006,10 +2009,10 @@
vp = NULL;
nd.ni_vp = NULL;
}
- diraft_ret = VOP_GETATTR(dirp, &diraft, cred, td);
if (dirp) {
- vrele(dirp);
- dirp = NULL;
+ vn_lock(dirp, LK_EXCLUSIVE | LK_RETRY, td);
+ diraft_ret = VOP_GETATTR(dirp, &diraft, cred, td);
+ VOP_UNLOCK(dirp, 0, td);
}
ereply:
nfsm_reply(NFSX_SRVFH(1) + NFSX_POSTOPATTR(1) + NFSX_WCCDATA(1));
@@ -2085,15 +2088,10 @@
nd.ni_cnd.cn_nameiop = DELETE;
nd.ni_cnd.cn_flags = LOCKPARENT | LOCKLEAF;
error = nfs_namei(&nd, fhp, len, slp, nam, &md, &dpos,
- &dirp, td, FALSE);
- if (dirp) {
- if (v3) {
- dirfor_ret = VOP_GETATTR(dirp, &dirfor, cred,
- td);
- } else {
- vrele(dirp);
- dirp = NULL;
- }
+ &dirp, v3, &dirfor, &dirfor_ret, td, FALSE);
+ if (dirp && !v3) {
+ vrele(dirp);
+ dirp = NULL;
}
if (error == 0) {
if (nd.ni_vp->v_type == VDIR) {
@@ -2114,7 +2112,25 @@
}
}
if (dirp && v3) {
- diraft_ret = VOP_GETATTR(dirp, &diraft, cred, td);
+ if (dirp == nd.ni_dvp)
+ diraft_ret = VOP_GETATTR(dirp, &diraft, cred, td);
+ else {
+ /* Drop the other locks to avoid deadlock. */
+ if (nd.ni_dvp) {
+ if (nd.ni_dvp == nd.ni_vp)
+ vrele(nd.ni_dvp);
+ else
+ vput(nd.ni_dvp);
+ }
+ if (nd.ni_vp)
+ vput(nd.ni_vp);
+ nd.ni_dvp = NULL;
+ nd.ni_vp = NULL;
+
+ vn_lock(dirp, LK_EXCLUSIVE | LK_RETRY, td);
+ diraft_ret = VOP_GETATTR(dirp, &diraft, cred, td);
+ VOP_UNLOCK(dirp, 0, td);
+ }
vrele(dirp);
dirp = NULL;
}
@@ -2200,15 +2216,10 @@
fromnd.ni_cnd.cn_nameiop = DELETE;
fromnd.ni_cnd.cn_flags = WANTPARENT | SAVESTART;
error = nfs_namei(&fromnd, ffhp, len, slp, nam, &md,
- &dpos, &fdirp, td, FALSE);
- if (fdirp) {
- if (v3) {
- fdirfor_ret = VOP_GETATTR(fdirp, &fdirfor, cred,
- td);
- } else {
- vrele(fdirp);
- fdirp = NULL;
- }
+ &dpos, &fdirp, v3, &fdirfor, &fdirfor_ret, td, FALSE);
+ if (fdirp && !v3) {
+ vrele(fdirp);
+ fdirp = NULL;
}
if (error) {
nfsm_reply(2 * NFSX_WCCDATA(v3));
@@ -2227,15 +2238,10 @@
tond.ni_cnd.cn_nameiop = RENAME;
tond.ni_cnd.cn_flags = LOCKPARENT | LOCKLEAF | NOCACHE | SAVESTART;
error = nfs_namei(&tond, tfhp, len2, slp, nam, &md,
- &dpos, &tdirp, td, FALSE);
- if (tdirp) {
- if (v3) {
- tdirfor_ret = VOP_GETATTR(tdirp, &tdirfor, cred,
- td);
- } else {
- vrele(tdirp);
- tdirp = NULL;
- }
+ &dpos, &tdirp, v3, &tdirfor, &tdirfor_ret, td, FALSE);
+ if (tdirp && !v3) {
+ vrele(tdirp);
+ tdirp = NULL;
}
if (error)
goto out1;
@@ -2318,12 +2324,30 @@
/* fall through */
out1:
- if (fdirp)
- fdiraft_ret = VOP_GETATTR(fdirp, &fdiraft, cred, td);
- if (tdirp)
- tdiraft_ret = VOP_GETATTR(tdirp, &tdiraft, cred, td);
nfsm_reply(2 * NFSX_WCCDATA(v3));
if (v3) {
+ /* Release existing locks to prevent deadlock. */
+ if (tond.ni_dvp) {
+ if (tond.ni_dvp == tond.ni_vp)
+ vrele(tond.ni_dvp);
+ else
+ vput(tond.ni_dvp);
+ }
+ if (tond.ni_vp)
+ vput(tond.ni_vp);
+ tond.ni_dvp = NULL;
+ tond.ni_vp = NULL;
+
+ if (fdirp) {
+ vn_lock(fdirp, LK_EXCLUSIVE | LK_RETRY, td);
+ fdiraft_ret = VOP_GETATTR(fdirp, &fdiraft, cred, td);
+ VOP_UNLOCK(fdirp, 0, td);
+ }
+ if (tdirp) {
+ vn_lock(tdirp, LK_EXCLUSIVE | LK_RETRY, td);
+ tdiraft_ret = VOP_GETATTR(tdirp, &tdiraft, cred, td);
+ VOP_UNLOCK(tdirp, 0, td);
+ }
nfsm_srvwcc_data(fdirfor_ret, &fdirfor, fdiraft_ret, &fdiraft);
nfsm_srvwcc_data(tdirfor_ret, &tdirfor, tdiraft_ret, &tdiraft);
}
@@ -2407,7 +2431,7 @@
nfsm_srvmtofh(dfhp);
nfsm_srvnamesiz(len);
- error = nfsrv_fhtovp(fhp, FALSE, &vp, cred, slp, nam, &rdonly, TRUE);
+ error = nfsrv_fhtovp(fhp, TRUE, &vp, cred, slp, nam, &rdonly, TRUE);
if (error) {
nfsm_reply(NFSX_POSTOPATTR(v3) + NFSX_WCCDATA(v3));
if (v3) {
@@ -2418,47 +2442,71 @@
error = 0;
goto nfsmout;
}
+ if (v3)
+ getret = VOP_GETATTR(vp, &at, cred, td);
if (vp->v_type == VDIR) {
error = EPERM; /* POSIX */
goto out1;
}
+ VOP_UNLOCK(vp, 0, td);
nd.ni_cnd.cn_cred = cred;
nd.ni_cnd.cn_nameiop = CREATE;
nd.ni_cnd.cn_flags = LOCKPARENT;
error = nfs_namei(&nd, dfhp, len, slp, nam, &md, &dpos,
- &dirp, td, FALSE);
- if (dirp) {
- if (v3) {
- dirfor_ret = VOP_GETATTR(dirp, &dirfor, cred,
- td);
- } else {
- vrele(dirp);
- dirp = NULL;
- }
+ &dirp, v3, &dirfor, &dirfor_ret, td, FALSE);
+ if (dirp && !v3) {
+ vrele(dirp);
+ dirp = NULL;
+ }
+ if (error) {
+ vrele(vp);
+ vp = NULL;
+ goto out2;
}
- if (error)
- goto out1;
-
xp = nd.ni_vp;
if (xp != NULL) {
error = EEXIST;
- goto out;
+ vrele(vp);
+ vp = NULL;
+ goto out2;
}
xp = nd.ni_dvp;
- if (vp->v_mount != xp->v_mount)
+ if (vp->v_mount != xp->v_mount) {
error = EXDEV;
-out:
- if (!error) {
- error = VOP_LINK(nd.ni_dvp, vp, &nd.ni_cnd);
- NDFREE(&nd, NDF_ONLY_PNBUF);
+ vrele(vp);
+ vp = NULL;
+ goto out2;
}
+ vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
+ error = VOP_LINK(nd.ni_dvp, vp, &nd.ni_cnd);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
/* fall through */
out1:
if (v3)
getret = VOP_GETATTR(vp, &at, cred, td);
- if (dirp)
- diraft_ret = VOP_GETATTR(dirp, &diraft, cred, td);
+out2:
+ if (dirp) {
+ if (dirp == nd.ni_dvp)
+ diraft_ret = VOP_GETATTR(dirp, &diraft, cred, td);
+ else {
+ /* Release existing locks to prevent deadlock. */
+ if (nd.ni_dvp) {
+ if (nd.ni_dvp == nd.ni_vp)
+ vrele(nd.ni_dvp);
+ else
+ vput(nd.ni_dvp);
+ }
+ if (nd.ni_vp)
+ vrele(nd.ni_vp);
+ nd.ni_dvp = NULL;
+ nd.ni_vp = NULL;
+
+ vn_lock(dirp, LK_EXCLUSIVE | LK_RETRY, td);
+ diraft_ret = VOP_GETATTR(dirp, &diraft, cred, td);
+ VOP_UNLOCK(dirp, 0, td);
+ }
+ }
ereply:
nfsm_reply(NFSX_POSTOPATTR(v3) + NFSX_WCCDATA(v3));
if (v3) {
@@ -2473,7 +2521,7 @@
if (dirp)
vrele(dirp);
if (vp)
- vrele(vp);
+ vput(vp);
if (nd.ni_dvp) {
if (nd.ni_dvp == nd.ni_vp)
vrele(nd.ni_dvp);
@@ -2534,15 +2582,10 @@
nd.ni_cnd.cn_nameiop = CREATE;
nd.ni_cnd.cn_flags = LOCKPARENT | SAVESTART;
error = nfs_namei(&nd, fhp, len, slp, nam, &md, &dpos,
- &dirp, td, FALSE);
- if (dirp) {
- if (v3) {
- dirfor_ret = VOP_GETATTR(dirp, &dirfor, cred,
- td);
- } else {
- vrele(dirp);
- dirp = NULL;
- }
+ &dirp, v3, &dirfor, &dirfor_ret, td, FALSE);
+ if (dirp && !v3) {
+ vrele(dirp);
+ dirp = NULL;
}
if (error)
goto out;
@@ -2630,9 +2673,9 @@
pathcp = NULL;
}
if (dirp) {
+ vn_lock(dirp, LK_EXCLUSIVE | LK_RETRY, td);
diraft_ret = VOP_GETATTR(dirp, &diraft, cred, td);
- vrele(dirp);
- dirp = NULL;
+ VOP_UNLOCK(dirp, 0, td);
}
if (nd.ni_startdir) {
vrele(nd.ni_startdir);
@@ -2719,15 +2762,10 @@
nd.ni_cnd.cn_flags = LOCKPARENT;
error = nfs_namei(&nd, fhp, len, slp, nam, &md, &dpos,
- &dirp, td, FALSE);
- if (dirp) {
- if (v3) {
- dirfor_ret = VOP_GETATTR(dirp, &dirfor, cred,
- td);
- } else {
- vrele(dirp);
- dirp = NULL;
- }
+ &dirp, v3, &dirfor, &dirfor_ret, td, FALSE);
+ if (dirp && !v3) {
+ vrele(dirp);
+ dirp = NULL;
}
if (error) {
nfsm_reply(NFSX_WCCDATA(v3));
@@ -2778,8 +2816,31 @@
error = VOP_GETATTR(nd.ni_vp, vap, cred, td);
}
out:
- if (dirp)
- diraft_ret = VOP_GETATTR(dirp, &diraft, cred, td);
+ if (dirp) {
+ if (dirp == nd.ni_dvp) {
+ diraft_ret = VOP_GETATTR(dirp, &diraft, cred, td);
+ } else {
+ /* Release existing locks to prevent deadlock. */
+ if (nd.ni_dvp) {
+ NDFREE(&nd, NDF_ONLY_PNBUF);
+ if (nd.ni_dvp == nd.ni_vp && vpexcl)
+ vrele(nd.ni_dvp);
+ else
+ vput(nd.ni_dvp);
+ }
+ if (nd.ni_vp) {
+ if (vpexcl)
+ vput(nd.ni_vp);
+ else
+ vrele(nd.ni_vp);
+ }
+ nd.ni_dvp = NULL;
+ nd.ni_vp = NULL;
+ vn_lock(dirp, LK_EXCLUSIVE | LK_RETRY, td);
+ diraft_ret = VOP_GETATTR(dirp, &diraft, cred, td);
+ VOP_UNLOCK(dirp, 0, td);
+ }
+ }
nfsm_reply(NFSX_SRVFH(v3) + NFSX_POSTOPATTR(v3) + NFSX_WCCDATA(v3));
if (v3) {
if (!error) {
@@ -2859,15 +2920,10 @@
nd.ni_cnd.cn_nameiop = DELETE;
nd.ni_cnd.cn_flags = LOCKPARENT | LOCKLEAF;
error = nfs_namei(&nd, fhp, len, slp, nam, &md, &dpos,
- &dirp, td, FALSE);
- if (dirp) {
- if (v3) {
- dirfor_ret = VOP_GETATTR(dirp, &dirfor, cred,
- td);
- } else {
- vrele(dirp);
- dirp = NULL;
- }
+ &dirp, v3, &dirfor, &dirfor_ret, td, FALSE);
+ if (dirp && !v3) {
+ vrele(dirp);
+ dirp = NULL;
}
if (error) {
nfsm_reply(NFSX_WCCDATA(v3));
@@ -2902,8 +2958,26 @@
error = VOP_RMDIR(nd.ni_dvp, nd.ni_vp, &nd.ni_cnd);
NDFREE(&nd, NDF_ONLY_PNBUF);
- if (dirp)
- diraft_ret = VOP_GETATTR(dirp, &diraft, cred, td);
+ if (dirp) {
+ if (dirp == nd.ni_dvp)
+ diraft_ret = VOP_GETATTR(dirp, &diraft, cred, td);
+ else {
+ /* Release existing locks to prevent deadlock. */
+ if (nd.ni_dvp) {
+ if (nd.ni_dvp == nd.ni_vp)
+ vrele(nd.ni_dvp);
+ else
+ vput(nd.ni_dvp);
+ }
+ if (nd.ni_vp)
+ vput(nd.ni_vp);
+ nd.ni_dvp = NULL;
+ nd.ni_vp = NULL;
+ vn_lock(dirp, LK_EXCLUSIVE | LK_RETRY, td);
+ diraft_ret = VOP_GETATTR(dirp, &diraft, cred, td);
+ VOP_UNLOCK(dirp, 0, td);
+ }
+ }
nfsm_reply(NFSX_WCCDATA(v3));
error = 0;
if (v3)
==== //depot/projects/hammer/sys/nfsserver/nfs_srvsubs.c#6 (text+ko) ====
@@ -34,11 +34,11 @@
* SUCH DAMAGE.
*
* @(#)nfs_subs.c 8.8 (Berkeley) 5/22/95
- * $FreeBSD: src/sys/nfsserver/nfs_srvsubs.c,v 1.120 2003/02/19 05:47:39 imp Exp $
+ * $FreeBSD: src/sys/nfsserver/nfs_srvsubs.c,v 1.121 2003/05/25 06:17:33 truckman Exp $
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/nfsserver/nfs_srvsubs.c,v 1.120 2003/02/19 05:47:39 imp Exp $");
+__FBSDID("$FreeBSD: src/sys/nfsserver/nfs_srvsubs.c,v 1.121 2003/05/25 06:17:33 truckman Exp $");
/*
* These functions support the macros and help fiddle mbuf chains for
@@ -592,7 +592,8 @@
int
nfs_namei(struct nameidata *ndp, fhandle_t *fhp, int len,
struct nfssvc_sock *slp, struct sockaddr *nam, struct mbuf **mdp,
- caddr_t *dposp, struct vnode **retdirp, struct thread *td, int pubflag)
+ caddr_t *dposp, struct vnode **retdirp, int v3, struct vattr *retdirattrp,
+ int *retdirattr_retp, struct thread *td, int pubflag)
{
int i, rem;
struct mbuf *md;
@@ -602,6 +603,7 @@
struct vnode *dp;
int error, rdonly, linklen;
struct componentname *cnp = &ndp->ni_cnd;
+ int lockleaf = (cnp->cn_flags & LOCKLEAF) != 0;
*retdirp = NULL;
cnp->cn_flags |= NOMACCHECK;
@@ -664,6 +666,12 @@
* to the returned pointer
*/
*retdirp = dp;
+ if (v3) {
+ vn_lock(dp, LK_EXCLUSIVE | LK_RETRY, td);
+ *retdirattr_retp = VOP_GETATTR(dp, retdirattrp,
+ ndp->ni_cnd.cn_cred, td);
+ VOP_UNLOCK(dp, 0, td);
+ }
if (pubflag) {
/*
@@ -736,6 +744,8 @@
VREF(dp);
ndp->ni_startdir = dp;
+ if (!lockleaf)
+ cnp->cn_flags |= LOCKLEAF;
for (;;) {
cnp->cn_nameptr = cnp->cn_pnbuf;
/*
@@ -761,6 +771,8 @@
cnp->cn_flags |= HASBUF;
else
uma_zfree(namei_zone, cnp->cn_pnbuf);
+ if (ndp->ni_vp && !lockleaf)
+ VOP_UNLOCK(ndp->ni_vp, 0, td);
break;
}
@@ -840,6 +852,8 @@
ndp->ni_startdir = ndp->ni_dvp;
ndp->ni_dvp = NULL;
}
+ if (!lockleaf)
+ cnp->cn_flags &= ~LOCKLEAF;
/*
* nfs_namei() guarentees that fields will not contain garbage
==== //depot/projects/hammer/usr.sbin/Makefile#16 (text+ko) ====
@@ -1,5 +1,5 @@
# From: @(#)Makefile 5.20 (Berkeley) 6/12/93
-# $FreeBSD: src/usr.sbin/Makefile,v 1.253 2003/05/24 19:23:05 peter Exp $
+# $FreeBSD: src/usr.sbin/Makefile,v 1.254 2003/05/25 07:39:06 peter Exp $
.if ${MACHINE_ARCH} != "powerpc"
_sysinstall=sysinstall
==== //depot/projects/hammer/usr.sbin/ppp/ncpaddr.c#6 (text+ko) ====
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/usr.sbin/ppp/ncpaddr.c,v 1.12 2003/04/05 10:10:33 ume Exp $
+ * $FreeBSD: src/usr.sbin/ppp/ncpaddr.c,v 1.13 2003/05/25 07:39:06 peter Exp $
*/
#include <sys/types.h>
More information about the p4-projects
mailing list