Thomas Quinot [Tue, 7 Oct 2003 14:46:59 +0000 (14:46 +0000)]
(cdcleanup): Defend against calling sysctl_ctx_free before the sysctl_ctx
has been initialized.
(cdsysctlinit): Set flag CD_FLAG_SCTX_INIT after sysctl_ctx has been
initialized.
This resolves a panic encountered when a cd drive is sucessfully probed
but fails to attach.
Warner Losh [Tue, 7 Oct 2003 03:35:48 +0000 (03:35 +0000)]
Add new file for definitions of CIS. We can share this with cardbus.
the filename isn't that bad, because all of these are defined in the
PC Card standard :-)
Warner Losh [Tue, 7 Oct 2003 03:33:54 +0000 (03:33 +0000)]
o move the cis tuple definitions into a common file.
o minor optimization of cardbus_cis processing. Remove a bunch of generic
entries that are handled by generic.
o no longer need the card_get_type stuff.
Allow our bio tools to be used for local bio-chopping by not mandating
a bio_from value. bio_to is still mandated (mostly for debuggign) and
shall be copied from the parent bio.
- Introduce hw.firewire.hold_count sysctl MIB by popular demand.
This MIB specifies how many bus resets should be observed before the
lost device entry is removed. The default value is 3.
You can set this value to 0 if you want a SBP device to be detached from CAM
layer as soon as the device is physically detached like USB.
Warner Losh [Mon, 6 Oct 2003 07:17:20 +0000 (07:17 +0000)]
refactor how we do the quirk matching. this puts an ugly if into a
routine of its own, and allows us to move the indentation back two
layers making the code more readable.
delete a prototype that should have been killed years ago in pccardvar.h.
# adding quirks here is way harder than it needs to be. :-(
In unodered excution case, we cannot detect link-chain end only
by prev == NULL if lastest ORB is executed earlyer than the former
ORBs. Use ORB_LINK_DEAD flag for this case.
Jeff Roberson [Sun, 5 Oct 2003 22:56:33 +0000 (22:56 +0000)]
- The VCHR case in ffs_sync() is an unneccsary optimization especially
considering how infrequently we access devices via ffs now that we have
devfs. Collapse this case with the other case.
Alan Cox [Sun, 5 Oct 2003 22:23:44 +0000 (22:23 +0000)]
The addition of a locking assertion to vm_page_zero_invalid() has revealed
a long-time bug: vm_pager_get_pages() assumes that m[reqpage] contains a
valid page upon return from pgo_getpages(). In the case of the device
pager this page has been freed and replaced by a fake page. The fake page
is properly inserted into the vm object but m[reqpage] is left pointing
to a freed page. For now, update m[reqpage] to point to the fake page.
Jeff Roberson [Sun, 5 Oct 2003 22:16:08 +0000 (22:16 +0000)]
- Add a missing vn_start_write() to flushbufqueues(). This could have
caused snapshot related problems.
- The vp can not be NULL here or we would panic in vfs_bio_awrite(). Stop
confusing the logic by checking for it in several places.
Submitted by: kirk and then rototilled by me to remove vp == NULL checks.
Ian Dowse [Sun, 5 Oct 2003 19:40:02 +0000 (19:40 +0000)]
Remove the hardcoded default block/frag/cpg values from bsdlabel
and the logic for setting them according to the partition size.
Instead, unspecified filesystem values are left at 0 so that newfs
will use its own defaults. It just caused confusion to have the
defaults duplicated in two different places.
Ian Dowse [Sun, 5 Oct 2003 12:41:35 +0000 (12:41 +0000)]
Since the addition of the VI_DOINGINACT flag some time ago,
VOP_INACTIVE routines need not worry about their vnode getting
recycled if they block. Remove the code from nfs_inactive() that
used vget() to get an extra vnode reference that was held during
the nfs_vinvalbuf() call.
Jeff Roberson [Sun, 5 Oct 2003 09:42:24 +0000 (09:42 +0000)]
- Further simplify ffs_sync(). The vnode lock is required for UFS_UPDATE()
so make the code slightly more uniform. The vnode lock is acquired in
all cases and now the only difference between VCHR and other is we
call UFS_UPDATE instead of VOP_FSYNC().
Bruce M Simpson [Sun, 5 Oct 2003 09:35:08 +0000 (09:35 +0000)]
Add a pre-emption counter, td_generation, so that threads can notice
when they have been pre-empted by other threads. This is bumped from
within mi_switch() every time a context switch takes place.
Bruce M Simpson [Sun, 5 Oct 2003 08:38:22 +0000 (08:38 +0000)]
Fold the vslock() and vsunlock() calls in this file with #if 0's; they will
go away in due course. Involuntary pre-emption means that we can't count
on wiring of pages alone for consistency when performing a SYSCTL_OUT()
bigger than PAGE_SIZE.
Jeff Roberson [Sun, 5 Oct 2003 07:16:45 +0000 (07:16 +0000)]
- Check the XLOCK before inspecting v_data.
- Slightly rewrite the fsync loop to be more lock friendly. We must
acquire the vnode interlock before dropping the mnt lock. We must
also check XLOCK to prevent vclean() races.
- Use LK_INTERLOCK in the vget() in ffs_sync to further prevent vclean()
races.
- Use a local variable to store the results of the nvp == TAILQ_NEXT
test so that we do not access the vp after we've vrele()d it.
- Add an XXX comment about UFS_UPDATE() not being protected by any lock
here. I suspect that it should need the VOP lock.
Jeff Roberson [Sun, 5 Oct 2003 07:12:38 +0000 (07:12 +0000)]
- Fix an XXX. Check the error of vn_lock() in vflush(). Don't specify
LK_RETRY either, we don't want this vnode if it turns into another.
- Remove the code that checks the mount point after acquiring the lock
we are guaranteed to either fail or get the vnode that we wanted.
Jeff Roberson [Sun, 5 Oct 2003 06:43:03 +0000 (06:43 +0000)]
- File systems that wish to inspect the vnode contents or their private
v_data field before calling vget/vn_lock must check VI_XLOCK manually to
be sure that v_data is still valid. Implement this check in two places
here.
Jeff Roberson [Sun, 5 Oct 2003 05:35:41 +0000 (05:35 +0000)]
- Rename vcanrecycle() to vtryrecycle() to reflect its new role.
- In vtryrecycle() try to vgonel the vnode if all of the previous checks
passed. We won't vgonel if someone has either acquired a hold or usecount
or started the vgone process elsewhere. This is because we may have been
removed from the free list while we were inspecting the vnode for
recycling.
- The VI_TRYLOCK stops two threads from entering getnewvnode() and recycling
the same vnode. To further reduce the likelyhood of this event, requeue
the vnode on the tail of the list prior to calling vtryrecycle(). We can
not actually remove the vnode from the list until we know that it's
going to be recycled because other interlock holders may see the VI_FREE
flag and try to remove it from the free list.
- Kill a bogus XXX comment. If XLOCK is set we shouldn't wait for it
regardless of MNT_WAIT because the vnode does not actually belong to
this filesystem.
Jeff Roberson [Sun, 5 Oct 2003 02:48:04 +0000 (02:48 +0000)]
- Don't cache_purge() in getnewvnode. It's done in vclean(). With this
purge, the purge in vclean, and the filesystems purge, we had 3 purges
per vnode.
- Move the insmntque(vp, 0) to vclean() so that we may remove it from the
two vgone() functions and reduce the number of lock operations required.