PERFORCE change 119160 for review
John Baldwin
jhb at FreeBSD.org
Wed May 2 15:06:30 UTC 2007
http://perforce.freebsd.org/chv.cgi?CH=119160
Change 119160 by jhb at jhb_mutex on 2007/05/02 15:06:19
IFC @119149.
Affected files ...
.. //depot/projects/smpng/sys/cam/cam_xpt.c#44 integrate
.. //depot/projects/smpng/sys/compat/freebsd32/freebsd32_misc.c#45 integrate
.. //depot/projects/smpng/sys/compat/linprocfs/linprocfs.c#59 integrate
.. //depot/projects/smpng/sys/compat/opensolaris/kern/opensolaris_kobj.c#2 integrate
.. //depot/projects/smpng/sys/compat/opensolaris/kern/opensolaris_vfs.c#3 integrate
.. //depot/projects/smpng/sys/contrib/opensolaris/uts/common/fs/gfs.c#2 integrate
.. //depot/projects/smpng/sys/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c#2 integrate
.. //depot/projects/smpng/sys/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c#2 integrate
.. //depot/projects/smpng/sys/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c#3 integrate
.. //depot/projects/smpng/sys/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c#3 integrate
.. //depot/projects/smpng/sys/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c#3 integrate
.. //depot/projects/smpng/sys/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c#3 integrate
.. //depot/projects/smpng/sys/dev/ata/atapi-cam.c#33 integrate
.. //depot/projects/smpng/sys/dev/bge/if_bge.c#93 integrate
.. //depot/projects/smpng/sys/dev/bge/if_bgereg.h#54 integrate
.. //depot/projects/smpng/sys/dev/ciss/ciss.c#52 integrate
.. //depot/projects/smpng/sys/dev/ciss/cissvar.h#10 integrate
.. //depot/projects/smpng/sys/dev/firewire/firewire.c#41 integrate
.. //depot/projects/smpng/sys/dev/firewire/firewirereg.h#21 integrate
.. //depot/projects/smpng/sys/dev/firewire/fwdev.c#25 integrate
.. //depot/projects/smpng/sys/dev/firewire/fwohci.c#38 integrate
.. //depot/projects/smpng/sys/dev/firewire/fwohcireg.h#19 integrate
.. //depot/projects/smpng/sys/dev/firewire/if_fwip.c#11 integrate
.. //depot/projects/smpng/sys/dev/firewire/sbp.c#43 integrate
.. //depot/projects/smpng/sys/dev/firewire/sbp_targ.c#10 integrate
.. //depot/projects/smpng/sys/dev/hme/if_hme.c#34 integrate
.. //depot/projects/smpng/sys/dev/mii/brgphy.c#42 integrate
.. //depot/projects/smpng/sys/dev/mii/mii.c#17 integrate
.. //depot/projects/smpng/sys/dev/mxge/if_mxge.c#16 integrate
.. //depot/projects/smpng/sys/dev/stge/if_stge.c#7 integrate
.. //depot/projects/smpng/sys/dev/stge/if_stgereg.h#2 integrate
.. //depot/projects/smpng/sys/dev/uart/uart_kbd_sun.c#12 integrate
.. //depot/projects/smpng/sys/dev/usb/if_axe.c#30 integrate
.. //depot/projects/smpng/sys/dev/usb/if_axereg.h#9 integrate
.. //depot/projects/smpng/sys/dev/usb/uftdi.c#19 integrate
.. //depot/projects/smpng/sys/dev/usb/usbdevs#104 integrate
.. //depot/projects/smpng/sys/fs/procfs/procfs_ioctl.c#17 integrate
.. //depot/projects/smpng/sys/geom/part/g_part.c#2 integrate
.. //depot/projects/smpng/sys/kern/subr_rman.c#35 integrate
.. //depot/projects/smpng/sys/kern/sys_generic.c#50 integrate
.. //depot/projects/smpng/sys/net/ieee8023ad_lacp.c#3 integrate
.. //depot/projects/smpng/sys/net/if.h#33 integrate
.. //depot/projects/smpng/sys/net/if_lagg.c#2 integrate
.. //depot/projects/smpng/sys/netinet/in_pcb.c#74 integrate
.. //depot/projects/smpng/sys/netinet/in_pcb.h#46 integrate
.. //depot/projects/smpng/sys/netinet/ip_divert.c#53 integrate
.. //depot/projects/smpng/sys/netinet/libalias/alias_proxy.c#6 integrate
.. //depot/projects/smpng/sys/netinet/raw_ip.c#65 integrate
.. //depot/projects/smpng/sys/netinet/sctp.h#4 integrate
.. //depot/projects/smpng/sys/netinet/sctp_auth.c#7 integrate
.. //depot/projects/smpng/sys/netinet/sctp_bsd_addr.c#5 integrate
.. //depot/projects/smpng/sys/netinet/sctp_constants.h#10 integrate
.. //depot/projects/smpng/sys/netinet/sctp_header.h#3 integrate
.. //depot/projects/smpng/sys/netinet/sctp_indata.c#11 integrate
.. //depot/projects/smpng/sys/netinet/sctp_indata.h#4 integrate
.. //depot/projects/smpng/sys/netinet/sctp_input.c#11 integrate
.. //depot/projects/smpng/sys/netinet/sctp_os_bsd.h#9 integrate
.. //depot/projects/smpng/sys/netinet/sctp_output.c#11 integrate
.. //depot/projects/smpng/sys/netinet/sctp_output.h#5 integrate
.. //depot/projects/smpng/sys/netinet/sctp_pcb.c#10 integrate
.. //depot/projects/smpng/sys/netinet/sctp_pcb.h#9 integrate
.. //depot/projects/smpng/sys/netinet/sctp_peeloff.c#7 integrate
.. //depot/projects/smpng/sys/netinet/sctp_usrreq.c#11 integrate
.. //depot/projects/smpng/sys/netinet/sctputil.c#12 integrate
.. //depot/projects/smpng/sys/netinet/sctputil.h#8 integrate
.. //depot/projects/smpng/sys/netinet/tcp_subr.c#92 integrate
.. //depot/projects/smpng/sys/netinet/tcp_usrreq.c#61 integrate
.. //depot/projects/smpng/sys/netinet/udp_usrreq.c#76 integrate
.. //depot/projects/smpng/sys/netinet6/in6_pcb.c#48 integrate
.. //depot/projects/smpng/sys/netinet6/in6_src.c#30 integrate
.. //depot/projects/smpng/sys/netinet6/sctp6_usrreq.c#10 integrate
.. //depot/projects/smpng/sys/security/audit/audit_ioctl.h#4 integrate
.. //depot/projects/smpng/sys/sparc64/sparc64/machdep.c#85 integrate
.. //depot/projects/smpng/sys/sparc64/sparc64/upa.c#7 integrate
.. //depot/projects/smpng/sys/sys/ioctl_compat.h#6 integrate
.. //depot/projects/smpng/sys/sys/param.h#116 integrate
Differences ...
==== //depot/projects/smpng/sys/cam/cam_xpt.c#44 (text+ko) ====
@@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/cam/cam_xpt.c,v 1.182 2007/04/19 23:34:51 scottl Exp $");
+__FBSDID("$FreeBSD: src/sys/cam/cam_xpt.c,v 1.183 2007/04/27 14:23:05 scottl Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -7017,10 +7017,12 @@
}
}
- task = malloc(sizeof(struct xpt_task), M_CAMXPT, M_NOWAIT);
- if (task != NULL) {
- TASK_INIT(&task->task, 0, xpt_finishconfig_task, task);
- taskqueue_enqueue(taskqueue_thread, &task->task);
+ if (busses_to_config == 0) {
+ task = malloc(sizeof(struct xpt_task), M_CAMXPT, M_NOWAIT);
+ if (task != NULL) {
+ TASK_INIT(&task->task, 0, xpt_finishconfig_task, task);
+ taskqueue_enqueue(taskqueue_thread, &task->task);
+ }
}
if (done_ccb != NULL)
==== //depot/projects/smpng/sys/compat/freebsd32/freebsd32_misc.c#45 (text+ko) ====
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/compat/freebsd32/freebsd32_misc.c,v 1.62 2006/12/20 19:36:03 jkim Exp $");
+__FBSDID("$FreeBSD: src/sys/compat/freebsd32/freebsd32_misc.c,v 1.63 2007/05/01 17:10:01 alc Exp $");
#include "opt_compat.h"
@@ -407,7 +407,6 @@
start = addr;
end = addr + len;
- mtx_lock(&Giant);
if (start != trunc_page(start)) {
error = freebsd32_mmap_partial(td, start,
round_page(start), prot,
@@ -438,14 +437,11 @@
prot |= VM_PROT_WRITE;
map = &td->td_proc->p_vmspace->vm_map;
rv = vm_map_remove(map, start, end);
- if (rv != KERN_SUCCESS) {
- mtx_unlock(&Giant);
+ if (rv != KERN_SUCCESS)
return (EINVAL);
- }
rv = vm_map_find(map, 0, 0,
&start, end - start, FALSE,
prot, VM_PROT_ALL, 0);
- mtx_unlock(&Giant);
if (rv != KERN_SUCCESS)
return (EINVAL);
r.fd = fd;
@@ -459,7 +455,6 @@
td->td_retval[0] = addr;
return (0);
}
- mtx_unlock(&Giant);
if (end == start) {
/*
* After dealing with the ragged ends, there
==== //depot/projects/smpng/sys/compat/linprocfs/linprocfs.c#59 (text+ko) ====
@@ -40,7 +40,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/compat/linprocfs/linprocfs.c,v 1.111 2007/04/22 08:41:52 des Exp $");
+__FBSDID("$FreeBSD: src/sys/compat/linprocfs/linprocfs.c,v 1.112 2007/05/01 03:09:57 alc Exp $");
#include <sys/param.h>
#include <sys/queue.h>
@@ -860,12 +860,14 @@
{
char mebuffer[512];
vm_map_t map = &p->p_vmspace->vm_map;
- vm_map_entry_t entry;
+ vm_map_entry_t entry, tmp_entry;
vm_object_t obj, tobj, lobj;
+ vm_offset_t saved_end;
vm_ooffset_t off = 0;
char *name = "", *freename = NULL;
size_t len;
ino_t ino;
+ unsigned int last_timestamp;
int ref_count, shadow_count, flags;
int error;
struct vnode *vp;
@@ -885,8 +887,7 @@
return (0);
error = 0;
- if (map != &curthread->td_proc->p_vmspace->vm_map)
- vm_map_lock_read(map);
+ vm_map_lock_read(map);
for (entry = map->header.next;
((uio->uio_resid > 0) && (entry != &map->header));
entry = entry->next) {
@@ -894,12 +895,16 @@
freename = NULL;
if (entry->eflags & MAP_ENTRY_IS_SUB_MAP)
continue;
+ saved_end = entry->end;
obj = entry->object.vm_object;
- for (lobj = tobj = obj; tobj; tobj = tobj->backing_object)
+ for (lobj = tobj = obj; tobj; tobj = tobj->backing_object) {
+ VM_OBJECT_LOCK(tobj);
+ if (lobj != obj)
+ VM_OBJECT_UNLOCK(lobj);
lobj = tobj;
+ }
ino = 0;
if (lobj) {
- VM_OBJECT_LOCK(lobj);
off = IDX_TO_OFF(lobj->size);
if (lobj->type == OBJT_VNODE) {
vp = lobj->handle;
@@ -908,10 +913,12 @@
}
else
vp = NULL;
+ if (lobj != obj)
+ VM_OBJECT_UNLOCK(lobj);
flags = obj->flags;
ref_count = obj->ref_count;
shadow_count = obj->shadow_count;
- VM_OBJECT_UNLOCK(lobj);
+ VM_OBJECT_UNLOCK(obj);
if (vp) {
vn_fullpath(td, vp, &name, &freename);
locked = VFS_LOCK_GIANT(vp->v_mount);
@@ -953,12 +960,23 @@
* XXX We should probably return
* EFBIG here, as in procfs.
*/
+ last_timestamp = map->timestamp;
+ vm_map_unlock_read(map);
error = uiomove(mebuffer, len, uio);
+ vm_map_lock_read(map);
if (error)
break;
+ if (last_timestamp + 1 != map->timestamp) {
+ /*
+ * Look again for the entry because the map was
+ * modified while it was unlocked. Specifically,
+ * the entry may have been clipped, merged, or deleted.
+ */
+ vm_map_lookup_entry(map, saved_end - 1, &tmp_entry);
+ entry = tmp_entry;
+ }
}
- if (map != &curthread->td_proc->p_vmspace->vm_map)
- vm_map_unlock_read(map);
+ vm_map_unlock_read(map);
return (error);
}
==== //depot/projects/smpng/sys/compat/opensolaris/kern/opensolaris_kobj.c#2 (text+ko) ====
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/compat/opensolaris/kern/opensolaris_kobj.c,v 1.2 2007/04/08 23:57:08 pjd Exp $");
+__FBSDID("$FreeBSD: src/sys/compat/opensolaris/kern/opensolaris_kobj.c,v 1.3 2007/05/02 01:03:10 pjd Exp $");
#include <sys/types.h>
#include <sys/systm.h>
@@ -123,7 +123,7 @@
struct vattr va;
int error;
- vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
+ vn_lock(vp, LK_SHARED | LK_RETRY, td);
error = VOP_GETATTR(vp, &va, td->td_ucred, td);
VOP_UNLOCK(vp, 0, td);
if (error == 0)
@@ -176,7 +176,7 @@
auio.uio_resid = size;
auio.uio_td = td;
- vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
+ vn_lock(vp, LK_SHARED | LK_RETRY, td);
error = VOP_READ(vp, &auio, IO_UNIT | IO_SYNC, td->td_ucred);
VOP_UNLOCK(vp, 0, td);
return (error != 0 ? -1 : size - auio.uio_resid);
==== //depot/projects/smpng/sys/compat/opensolaris/kern/opensolaris_vfs.c#3 (text+ko) ====
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/compat/opensolaris/kern/opensolaris_vfs.c,v 1.4 2007/04/21 12:02:57 pjd Exp $");
+__FBSDID("$FreeBSD: src/sys/compat/opensolaris/kern/opensolaris_vfs.c,v 1.5 2007/05/02 01:03:10 pjd Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@@ -187,7 +187,7 @@
/*
* Allocate and initialize the filesystem.
*/
- vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
+ vn_lock(vp, LK_SHARED | LK_RETRY, td);
mp = vfs_mount_alloc(vp, vfsp, fspath, td);
VOP_UNLOCK(vp, 0, td);
==== //depot/projects/smpng/sys/contrib/opensolaris/uts/common/fs/gfs.c#2 (text+ko) ====
@@ -197,6 +197,7 @@
st->grd_dirent->d_reclen = (ushort_t)reclen;
st->grd_dirent->d_namlen = namlen;
+ /* TODO: d_type */
if (uiomove((caddr_t)st->grd_dirent, reclen, UIO_READ, uiop))
return (EFAULT);
@@ -231,6 +232,7 @@
st->grd_dirent->d_ino = ino;
(void) strncpy(st->grd_dirent->d_name, name, st->grd_namlen);
+ /* TODO: d_type */
/*
* Inter-entry offsets are invalid, so we assume a record size of
==== //depot/projects/smpng/sys/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c#2 (text+ko) ====
@@ -65,7 +65,7 @@
auio.uio_iov = &aiov;
auio.uio_iovcnt = 1;
auio.uio_resid = len;
- auio.uio_segflg = UIO_SYSSPACE;
+ auio.uio_segflg = UIO_SYSSPACE;
auio.uio_rw = UIO_WRITE;
auio.uio_offset = (off_t)-1;
auio.uio_td = ba->td;
@@ -473,7 +473,7 @@
auio.uio_iov = &aiov;
auio.uio_iovcnt = 1;
auio.uio_resid = len;
- auio.uio_segflg = UIO_SYSSPACE;
+ auio.uio_segflg = UIO_SYSSPACE;
auio.uio_rw = UIO_READ;
auio.uio_offset = off;
auio.uio_td = ra->td;
==== //depot/projects/smpng/sys/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c#2 (text+ko) ====
@@ -84,13 +84,13 @@
ZFS_LOG(1, "Closing access to %s.", cp->provider->name);
g_access(cp, -cp->acr, -cp->acw, -cp->ace);
+ ZFS_LOG(1, "Destroyed consumer to %s.", cp->provider->name);
g_detach(cp);
- ZFS_LOG(1, "Destroyed consumer to %s.", cp->provider->name);
g_destroy_consumer(cp);
/* Destroy geom if there are no consumers left. */
if (LIST_EMPTY(&gp->consumer)) {
ZFS_LOG(1, "Destroyed geom %s.", gp->name);
- g_wither_geom(cp->geom, error);
+ g_wither_geom(gp, error);
}
vdev_geom_release(vd);
/* Both methods below work, but in a bit different way. */
==== //depot/projects/smpng/sys/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c#3 (text+ko) ====
@@ -605,30 +605,30 @@
static int
zfsctl_snapdir_remove(vnode_t *dvp, char *name, vnode_t *cwd, cred_t *cr)
{
- zfsctl_snapdir_t *sdp = dvp->v_data;
- char snapname[MAXNAMELEN];
- int err;
+ zfsctl_snapdir_t *sdp = dvp->v_data;
+ char snapname[MAXNAMELEN];
+ int err;
- err = zfsctl_snapshot_zname(dvp, name, MAXNAMELEN, snapname);
- if (err)
- return (err);
- err = zfs_secpolicy_write(snapname, cr);
- if (err)
- return (err);
+ err = zfsctl_snapshot_zname(dvp, name, MAXNAMELEN, snapname);
+ if (err)
+ return (err);
+ err = zfs_secpolicy_write(snapname, cr);
+ if (err)
+ return (err);
- mutex_enter(&sdp->sd_lock);
+ mutex_enter(&sdp->sd_lock);
- err = zfsctl_unmount_snap(dvp, name, 0, cr);
- if (err) {
- mutex_exit(&sdp->sd_lock);
- return (err);
- }
+ err = zfsctl_unmount_snap(dvp, name, 0, cr);
+ if (err) {
+ mutex_exit(&sdp->sd_lock);
+ return (err);
+ }
- err = dmu_objset_destroy(snapname);
+ err = dmu_objset_destroy(snapname);
- mutex_exit(&sdp->sd_lock);
+ mutex_exit(&sdp->sd_lock);
- return (err);
+ return (err);
}
#endif
@@ -934,7 +934,7 @@
return (ENOENT);
err = traverse(vpp);
if (err == 0)
- vn_lock(*vpp, LK_EXCLUSIVE | LK_RETRY, td);
+ vn_lock(*vpp, LK_SHARED | LK_RETRY, td);
return (err);
}
==== //depot/projects/smpng/sys/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c#3 (text+ko) ====
@@ -598,7 +598,7 @@
static int
zfs_statfs(vfs_t *vfsp, struct statfs *statp, kthread_t *td)
-{
+{
zfsvfs_t *zfsvfs = vfsp->vfs_data;
uint64_t refdbytes, availbytes, usedobjs, availobjs;
@@ -666,7 +666,7 @@
error = zfs_zget(zfsvfs, zfsvfs->z_root, &rootzp);
if (error == 0) {
*vpp = ZTOV(rootzp);
- error = vn_lock(*vpp, LK_EXCLUSIVE | LK_RETRY, td);
+ error = vn_lock(*vpp, flags, td);
(*vpp)->v_vflag |= VV_ROOT;
}
@@ -691,7 +691,7 @@
* Unmount any snapshots mounted under .zfs before unmounting the
* dataset itself.
*/
- if (zfsvfs->z_ctldir != NULL) {
+ if (zfsvfs->z_ctldir != NULL) {
if ((ret = zfsctl_umount_snapshots(vfsp, fflag, cr)) != 0)
return (ret);
ret = vflush(vfsp, 0, 0, td);
@@ -766,7 +766,7 @@
*vpp = NULL;
else {
*vpp = ZTOV(zp);
- vn_lock(*vpp, LK_EXCLUSIVE | LK_RETRY, curthread);
+ vn_lock(*vpp, flags, curthread);
}
ZFS_EXIT(zfsvfs);
return (0);
@@ -832,6 +832,7 @@
VN_HOLD(*vpp);
}
ZFS_EXIT(zfsvfs);
+ /* XXX: LK_RETRY? */
vn_lock(*vpp, LK_EXCLUSIVE | LK_RETRY, td);
return (0);
}
@@ -854,6 +855,7 @@
}
*vpp = ZTOV(zp);
+ /* XXX: LK_RETRY? */
vn_lock(*vpp, LK_EXCLUSIVE | LK_RETRY, td);
vnode_create_vobject(*vpp, zp->z_phys->zp_size, td);
ZFS_EXIT(zfsvfs);
==== //depot/projects/smpng/sys/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c#3 (text+ko) ====
@@ -23,6 +23,8 @@
* Use is subject to license terms.
*/
+/* Portions Copyright 2007 Jeremy Teo */
+
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/types.h>
@@ -327,6 +329,15 @@
va = (caddr_t)sf_buf_kva(sf);
woff = uio->uio_loffset - off;
error = uiomove(va + off, bytes, UIO_WRITE, uio);
+ /*
+ * The uiomove() above could have been partially
+ * successful, that's why we call dmu_write()
+ * below unconditionally. The page was marked
+ * non-dirty above and we would lose the changes
+ * without doing so. If the uiomove() failed
+ * entirely, well, we just write what we got
+ * before one more time.
+ */
dmu_write(os, zp->z_id, woff,
MIN(PAGESIZE, fsize - woff), va, tx);
sf_buf_free(sf);
@@ -999,7 +1010,7 @@
/* ARGSUSED */
static int
zfs_lookup(vnode_t *dvp, char *nm, vnode_t **vpp, struct componentname *cnp,
- int nameiop, cred_t *cr, kthread_t *td)
+ int nameiop, cred_t *cr, kthread_t *td)
{
znode_t *zdp = VTOZ(dvp);
@@ -1098,11 +1109,20 @@
}
}
if (error == 0 && (nm[0] != '.' || nm[1] != '\0')) {
- if (cnp->cn_flags & ISDOTDOT)
+ int ltype = 0;
+
+ if (cnp->cn_flags & ISDOTDOT) {
+ ltype = VOP_ISLOCKED(dvp, td);
VOP_UNLOCK(dvp, 0, td);
- vn_lock(*vpp, LK_EXCLUSIVE | LK_RETRY, td);
+ }
+ error = vn_lock(*vpp, cnp->cn_lkflags, td);
if (cnp->cn_flags & ISDOTDOT)
- vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY, td);
+ vn_lock(dvp, ltype | LK_RETRY, td);
+ if (error != 0) {
+ VN_RELE(*vpp);
+ *vpp = NULL;
+ return (error);
+ }
}
#ifdef FREEBSD_NAMECACHE
@@ -1111,9 +1131,9 @@
*/
if (error == ENOENT && (cnp->cn_flags & MAKEENTRY) && nameiop != CREATE)
cache_enter(dvp, *vpp, cnp);
- /*
- * Insert name into cache if appropriate.
- */
+ /*
+ * Insert name into cache if appropriate.
+ */
if (error == 0 && (cnp->cn_flags & MAKEENTRY)) {
if (!(cnp->cn_flags & ISLASTCN) ||
(nameiop != DELETE && nameiop != RENAME)) {
@@ -1266,7 +1286,6 @@
* Truncate regular files if requested.
*/
if ((ZTOV(zp)->v_type == VREG) &&
- (zp->z_phys->zp_size != 0) &&
(vap->va_mask & AT_SIZE) && (vap->va_size == 0)) {
error = zfs_freesp(zp, 0, 0, mode, TRUE);
if (error == ERESTART &&
@@ -1794,13 +1813,13 @@
odp = (struct dirent64 *)iovp->iov_base;
}
- if (ncookies != NULL) {
+ if (ncookies != NULL) {
/*
* Minimum entry size is dirent size and 1 byte for a file name.
*/
ncooks = uio->uio_resid / (sizeof(struct dirent) - sizeof(((struct dirent *)NULL)->d_name) + 1);
cooks = malloc(ncooks * sizeof(u_long), M_TEMP, M_WAITOK);
- *cookies = cooks;
+ *cookies = cooks;
*ncookies = ncooks;
}
@@ -1818,12 +1837,15 @@
if (offset == 0) {
(void) strcpy(zap.za_name, ".");
objnum = zp->z_id;
+ type = DT_DIR;
} else if (offset == 1) {
(void) strcpy(zap.za_name, "..");
objnum = zp->z_phys->zp_parent;
+ type = DT_DIR;
} else if (offset == 2 && zfs_show_ctldir(zp)) {
(void) strcpy(zap.za_name, ZFS_CTLDIR_NAME);
objnum = ZFSCTL_INO_ROOT;
+ type = DT_DIR;
} else {
/*
* Grab next entry.
@@ -1929,7 +1951,7 @@
uio->uio_loffset = offset;
ZFS_EXIT(zfsvfs);
- if (error != 0) {
+ if (error != 0 && cookies != NULL) {
free(*cookies, M_TEMP);
*cookies = NULL;
*ncookies = 0;
@@ -3422,10 +3444,10 @@
static int
zfs_freebsd_inactive(ap)
- struct vop_inactive_args /* {
- struct vnode *a_vp;
- struct thread *a_td;
- } */ *ap;
+ struct vop_inactive_args /* {
+ struct vnode *a_vp;
+ struct thread *a_td;
+ } */ *ap;
{
vnode_t *vp = ap->a_vp;
@@ -3440,7 +3462,7 @@
struct thread *a_td;
} */ *ap;
{
- vnode_t *vp = ap->a_vp;
+ vnode_t *vp = ap->a_vp;
znode_t *zp = VTOZ(vp);
zfsvfs_t *zfsvfs;
int rele = 1;
@@ -3561,7 +3583,7 @@
.vop_fid = zfs_freebsd_fid,
};
-struct vop_vector zfs_fifoops = {
+struct vop_vector zfs_fifoops = {
.vop_default = &fifo_specops,
.vop_fsync = VOP_PANIC,
.vop_access = zfs_freebsd_access,
==== //depot/projects/smpng/sys/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c#3 (text+ko) ====
@@ -23,6 +23,8 @@
* Use is subject to license terms.
*/
+/* Portions Copyright 2007 Jeremy Teo */
+
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef _KERNEL
@@ -104,14 +106,18 @@
zfs_znode_cache_constructor(void *buf, void *cdrarg, int kmflags)
{
znode_t *zp = buf;
+ vnode_t *vp;
vfs_t *vfsp = cdrarg;
int error;
if (cdrarg != NULL) {
- error = getnewvnode("zfs", vfsp, &zfs_vnodeops, &zp->z_vnode);
+ error = getnewvnode("zfs", vfsp, &zfs_vnodeops, &vp);
ASSERT(error == 0);
- zp->z_vnode->v_data = (caddr_t)zp;
- vhold(zp->z_vnode);
+ zp->z_vnode = vp;
+ vp->v_data = (caddr_t)zp;
+ vhold(vp);
+ vp->v_vnlock->lk_flags |= LK_CANRECURSE;
+ vp->v_vnlock->lk_flags &= ~LK_NOSHARE;
} else {
zp->z_vnode = NULL;
}
@@ -596,6 +602,8 @@
vp = ZTOV(zp);
vp->v_data = (caddr_t)zp;
vhold(vp);
+ vp->v_vnlock->lk_flags |= LK_CANRECURSE;
+ vp->v_vnlock->lk_flags &= ~LK_NOSHARE;
vp->v_type = IFTOVT((mode_t)zp->z_phys->zp_mode);
if (vp->v_type == VDIR)
zp->z_zn_prefetch = B_TRUE; /* z_prefetch default is enabled */
@@ -830,7 +838,7 @@
* Nothing to do if file already at desired length.
*/
size = zp->z_phys->zp_size;
- if (len == 0 && size == off) {
+ if (len == 0 && size == off && off != 0) {
zfs_range_unlock(rl);
return (0);
}
==== //depot/projects/smpng/sys/dev/ata/atapi-cam.c#33 (text+ko) ====
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/ata/atapi-cam.c,v 1.51 2007/04/15 08:49:14 scottl Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/ata/atapi-cam.c,v 1.53 2007/04/30 09:33:57 thomas Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -516,10 +516,10 @@
switch (ccb_h->flags & CAM_DIR_MASK) {
case CAM_DIR_IN:
- request_flags |= ATA_R_READ|ATA_R_DMA;
+ request_flags |= ATA_R_READ;
break;
case CAM_DIR_OUT:
- request_flags |= ATA_R_WRITE|ATA_R_DMA;
+ request_flags |= ATA_R_WRITE;
break;
case CAM_DIR_NONE:
/* No flags need to be set */
@@ -528,8 +528,6 @@
device_printf(softc->dev, "unknown IO operation\n");
goto action_invalid;
}
- if (softc->atadev[tid]->mode < ATA_DMA)
- request_flags &= ~ATA_R_DMA;
if ((hcb = allocate_hcb(softc, unit, bus, ccb)) == NULL) {
printf("cannot allocate ATAPI/CAM hcb\n");
@@ -594,7 +592,24 @@
request->u.atapi.ccb[3] = request->u.atapi.ccb[1] & 0x1f;
request->u.atapi.ccb[2] = 0;
request->u.atapi.ccb[1] = 0;
+ /* FALLTHROUGH */
+
+ case READ_10:
+ /* FALLTHROUGH */
+ case WRITE_10:
+ /* FALLTHROUGH */
+ case READ_12:
+ /* FALLTHROUGH */
+ case WRITE_12:
+ /*
+ * Enable DMA (if target supports it) for READ and WRITE commands
+ * only, as some combinations of drive, controller and chipset do
+ * not behave correctly when DMA is enabled for other commands.
+ */
+ if (softc->atadev[tid]->mode >= ATA_DMA)
+ request_flags |= ATA_R_DMA;
break;
+
}
if ((ccb_h->flags & CAM_DIR_MASK) == CAM_DIR_IN && (len & 1)) {
@@ -616,7 +631,7 @@
/*
* no retries are to be performed at the ATA level; any retries
- * will be done by CAM .
+ * will be done by CAM.
*/
request->retries = 0;
@@ -729,7 +744,7 @@
* issued a REQUEST SENSE automatically and that operation
* returned without error.
*/
- if (request->u.atapi.saved_cmd != 0 && request->error == 0) {
+ if (request->u.atapi.sense.key != 0 && request->error == 0) {
bcopy (&request->u.atapi.sense, &csio->sense_data, sizeof(struct atapi_sense));
csio->ccb_h.status |= CAM_AUTOSNS_VALID;
}
==== //depot/projects/smpng/sys/dev/bge/if_bge.c#93 (text+ko) ====
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/bge/if_bge.c,v 1.187 2007/04/02 19:09:06 jkim Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/bge/if_bge.c,v 1.189 2007/05/01 19:18:12 jkim Exp $");
/*
* Broadcom BCM570x family gigabit ethernet driver for FreeBSD.
@@ -106,6 +106,13 @@
#include "miidevs.h"
#include <dev/mii/brgphyreg.h>
+#ifdef __sparc64__
+#include <dev/ofw/ofw_bus.h>
+#include <dev/ofw/openfirm.h>
+#include <machine/ofw_machdep.h>
+#include <machine/ver.h>
+#endif
+
#include <dev/pci/pcireg.h>
#include <dev/pci/pcivar.h>
@@ -348,6 +355,7 @@
static int bge_chipinit(struct bge_softc *);
static int bge_blockinit(struct bge_softc *);
+static int bge_has_eeprom(struct bge_softc *);
static uint32_t bge_readmem_ind(struct bge_softc *, int);
static void bge_writemem_ind(struct bge_softc *, int, int);
#ifdef notdef
@@ -428,6 +436,50 @@
SYSCTL_INT(_hw_bge, OID_AUTO, allow_asf, CTLFLAG_RD, &bge_allow_asf, 0,
"Allow ASF mode if available");
+#define SPARC64_BLADE_1500_MODEL "SUNW,Sun-Blade-1500"
+#define SPARC64_BLADE_1500_PATH_BGE "/pci at 1f,700000/network at 2"
+#define SPARC64_BLADE_2500_MODEL "SUNW,Sun-Blade-2500"
+#define SPARC64_BLADE_2500_PATH_BGE "/pci at 1c,600000/network at 3"
+#define SPARC64_OFW_SUBVENDOR "subsystem-vendor-id"
+
+static int
+bge_has_eeprom(struct bge_softc *sc)
+{
+#ifdef __sparc64__
+ char buf[sizeof(SPARC64_BLADE_1500_PATH_BGE)];
+ device_t dev;
+ uint32_t subvendor;
+
+ dev = sc->bge_dev;
+
+ /*
+ * The on-board BGEs found in sun4u machines aren't fitted with
+ * an EEPROM which means that we have to obtain the MAC address
+ * via OFW and that some tests will always fail. We distinguish
+ * such BGEs by the subvendor ID, which also has to be obtained
+ * from OFW instead of the PCI configuration space as the latter
+ * indicates Broadcom as the subvendor of the netboot interface.
+ * For early Blade 1500 and 2500 we even have to check the OFW
+ * device path as the subvendor ID always defaults to Broadcom
+ * there.
+ */
+ if (OF_getprop(ofw_bus_get_node(dev), SPARC64_OFW_SUBVENDOR,
+ &subvendor, sizeof(subvendor)) == sizeof(subvendor) &&
+ subvendor == SUN_VENDORID)
+ return (0);
+ memset(buf, 0, sizeof(buf));
+ if (OF_package_to_path(ofw_bus_get_node(dev), buf, sizeof(buf)) > 0) {
+ if (strcmp(sparc64_model, SPARC64_BLADE_1500_MODEL) == 0 &&
+ strcmp(buf, SPARC64_BLADE_1500_PATH_BGE) == 0)
+ return (0);
+ if (strcmp(sparc64_model, SPARC64_BLADE_2500_MODEL) == 0 &&
+ strcmp(buf, SPARC64_BLADE_2500_PATH_BGE) == 0)
+ return (0);
+ }
+#endif
+ return (1);
+}
+
static uint32_t
bge_readmem_ind(struct bge_softc *sc, int off)
{
@@ -1100,9 +1152,12 @@
/*
* Check the 'ROM failed' bit on the RX CPU to see if
- * self-tests passed.
+ * self-tests passed. Skip this check when there's no
+ * EEPROM fitted, since in that case it will always
+ * fail.
*/
- if (CSR_READ_4(sc, BGE_RXCPU_MODE) & BGE_RXCPUMODE_ROMFAIL) {
+ if ((sc->bge_flags & BGE_FLAG_EEPROM) &&
+ CSR_READ_4(sc, BGE_RXCPU_MODE) & BGE_RXCPUMODE_ROMFAIL) {
device_printf(sc->bge_dev, "RX CPU self-diagnostics failed!\n");
return (ENODEV);
}
@@ -2171,8 +2226,8 @@
struct bge_softc *sc;
uint32_t hwcfg = 0;
uint32_t mac_tmp = 0;
- u_char eaddr[6];
- int error = 0, rid, trys, reg;
+ u_char eaddr[ETHER_ADDR_LEN];
+ int error, reg, rid, trys;
sc = device_get_softc(dev);
sc->bge_dev = dev;
@@ -2203,6 +2258,9 @@
sc->bge_asicrev = BGE_ASICREV(sc->bge_chipid);
sc->bge_chiprev = BGE_CHIPREV(sc->bge_chipid);
+ if (bge_has_eeprom(sc))
+ sc->bge_flags |= BGE_FLAG_EEPROM;
+
/* Save chipset family. */
switch (sc->bge_asicrev) {
case BGE_ASICREV_BCM5700:
@@ -2248,7 +2306,7 @@
/*
* Check if this is a PCI-X or PCI Express device.
*/
-#if __FreeBSD_version > 700010
+#if __FreeBSD_version > 602101
if (pci_find_extcap(dev, PCIY_EXPRESS, ®) == 0) {
/*
* Found a PCI Express capabilities register, this
@@ -2316,7 +2374,6 @@
/* Try to reset the chip. */
if (bge_reset(sc)) {
device_printf(sc->bge_dev, "chip reset failed\n");
- bge_release_resources(sc);
error = ENXIO;
goto fail;
}
@@ -2339,7 +2396,6 @@
bge_sig_pre_reset(sc, BGE_RESET_STOP);
if (bge_reset(sc)) {
device_printf(sc->bge_dev, "chip reset failed\n");
- bge_release_resources(sc);
error = ENXIO;
goto fail;
}
@@ -2349,29 +2405,32 @@
if (bge_chipinit(sc)) {
device_printf(sc->bge_dev, "chip initialization failed\n");
- bge_release_resources(sc);
error = ENXIO;
goto fail;
}
- /*
- * Get station address from the EEPROM.
- */
- mac_tmp = bge_readmem_ind(sc, 0x0C14);
- if ((mac_tmp >> 16) == 0x484B) {
- eaddr[0] = (u_char)(mac_tmp >> 8);
- eaddr[1] = (u_char)mac_tmp;
- mac_tmp = bge_readmem_ind(sc, 0x0C18);
- eaddr[2] = (u_char)(mac_tmp >> 24);
- eaddr[3] = (u_char)(mac_tmp >> 16);
- eaddr[4] = (u_char)(mac_tmp >> 8);
- eaddr[5] = (u_char)mac_tmp;
- } else if (bge_read_eeprom(sc, eaddr,
- BGE_EE_MAC_OFFSET + 2, ETHER_ADDR_LEN)) {
- device_printf(sc->bge_dev, "failed to read station address\n");
- bge_release_resources(sc);
- error = ENXIO;
- goto fail;
+#ifdef __sparc64__
+ if ((sc->bge_flags & BGE_FLAG_EEPROM) == 0)
+ OF_getetheraddr(dev, eaddr);
+ else
+#endif
+ {
+ mac_tmp = bge_readmem_ind(sc, 0x0C14);
+ if ((mac_tmp >> 16) == 0x484B) {
+ eaddr[0] = (u_char)(mac_tmp >> 8);
+ eaddr[1] = (u_char)mac_tmp;
+ mac_tmp = bge_readmem_ind(sc, 0x0C18);
+ eaddr[2] = (u_char)(mac_tmp >> 24);
+ eaddr[3] = (u_char)(mac_tmp >> 16);
+ eaddr[4] = (u_char)(mac_tmp >> 8);
+ eaddr[5] = (u_char)mac_tmp;
+ } else if (bge_read_eeprom(sc, eaddr,
+ BGE_EE_MAC_OFFSET + 2, ETHER_ADDR_LEN)) {
+ device_printf(sc->bge_dev,
+ "failed to read station address\n");
+ error = ENXIO;
+ goto fail;
+ }
}
/* 5705 limits RX return ring to 512 entries. */
@@ -2383,7 +2442,6 @@
if (bge_dma_alloc(dev)) {
device_printf(sc->bge_dev,
"failed to allocate DMA resources\n");
- bge_release_resources(sc);
error = ENXIO;
goto fail;
}
@@ -2399,7 +2457,6 @@
ifp = sc->bge_ifp = if_alloc(IFT_ETHER);
if (ifp == NULL) {
device_printf(sc->bge_dev, "failed to if_alloc()\n");
- bge_release_resources(sc);
error = ENXIO;
goto fail;
}
@@ -2445,11 +2502,10 @@
*/
if (bge_readmem_ind(sc, BGE_SOFTWARE_GENCOMM_SIG) == BGE_MAGIC_NUMBER)
hwcfg = bge_readmem_ind(sc, BGE_SOFTWARE_GENCOMM_NICCFG);
- else {
+ else if (sc->bge_flags & BGE_FLAG_EEPROM) {
if (bge_read_eeprom(sc, (caddr_t)&hwcfg, BGE_EE_HWCFG_OFFSET,
sizeof(hwcfg))) {
device_printf(sc->bge_dev, "failed to read EEPROM\n");
- bge_release_resources(sc);
error = ENXIO;
goto fail;
}
@@ -2495,7 +2551,6 @@
}
device_printf(sc->bge_dev, "MII without any PHY!\n");
- bge_release_resources(sc);
error = ENXIO;
goto fail;
}
>>> TRUNCATED FOR MAIL (1000 lines) <<<
More information about the p4-projects
mailing list