summaryrefslogtreecommitdiffstats
path: root/sys/ufs
Commit message (Collapse)AuthorAgeFilesLines
* We just cached the inode pointer, no need to call VTOI() again.phk2003-07-041-2/+2
|
* Lock the vm object when freeing pages.alc2003-06-151-0/+8
|
* Add the same KASSERT to all VOP_STRATEGY and VOP_SPECSTRATEGY implementationsphk2003-06-152-0/+4
| | | | to check that the buffer points to the correct vnode.
* Re-implement kernel access control for quotactl() as found in therwatson2003-06-153-23/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | UFS quota implementation. Push some quite broken access control logic out of ufs_quotactl() into the individual command implementations in ufs_quota.c; fix that logic. Pass in the thread argument to any quotactl command that will need to perform access control. o quotaon() requires privilege (PRISON_ROOT). o quotaoff() requires privilege (PRISON_ROOT). o getquota() requires that: If the type is USRQUOTA, either the effective uid match the requested quota ID, that the unprivileged_get_quota flag be set, or that the thread be privileged (PRISON_ROOT). If the type is GRPQUOTA, require that either the thread be a member of the group represented by the requested quota ID, that the unprivileged_get_quota flag be set, or that the thread be privileged (PRISON_ROOT). o setquota() requires privilege (PRISON_ROOT). o setuse() requires privilege (PRISON_ROOT). o qsync() requires no special privilege (consistent with what was present before, but probably not very useful). Add a new sysctl, security.bsd.unprivileged_get_quota, which when set to a non-zero value, will permit unprivileged users to query user quotas with non-matching uids and gids. Set this to 0 by default to be mostly consistent with the previous behavior (the same for USRQUOTA, but not for GRPQUOTA). Obtained from: TrustedBSD Project Sponsored by: DARPA, Network Associates Laboratories
* Initialize struct vfsops C99-sparsely.phk2003-06-121-14/+13
| | | | | Submitted by: hmp Reviewed by: phk
* Use __FBSDID().obrien2003-06-1120-26/+63
|
* Implement ffs_listextattr() by breaking out that logic and special-casedrwatson2003-06-051-32/+88
| | | | | | | | | | | attribute name of "" from ffs_getextattr(). Invoking VOP_GETETATTR() with an empty name is now no longer supported; user application compatibility is provided by a system call level compatibility wrapper. We make sure to explicitly reject attempts to set an EA with the name "". Obtained from: TrustedBSD Project Sponsored by: DARPA, Network Associates Laboratories
* Don't special-case handling of the empty string in the UFS1rwatson2003-06-051-4/+1
| | | | | | | | | extended attribute retrieval code: it's no longer special-cased, and is caught by the normal UFS1 EA validity checks (and, in fact, returns the same error, EINVAL). Obtained from: TrustedBSD Project Sponsored by: DARPA, Network Associates Laboratories
* Return EOPNOTSUPP for attempted EA operations on VCHR vnodes in UFS2;rwatson2003-06-011-0/+14
| | | | | | | | | | | | | | if we permit them to occur, the kernel panics due to our performing EA operations using VOP_STRATEGY on the vnode. This went unnoticed previously because there are very for users of device nodes on UFS2 due to the introduction of devfs. However, this can come up with the Linux compat directories and its hard-coded dev nodes (which will need to go away as we move away from hard-coded device numbers). This can come up if you use EA-intensive features such as ACLs and MAC. The proper fix is pretty complicated, but this band-aid would be an excellent MFC candidate for the release.
* Remove unused variable.phk2003-05-311-2/+0
| | | | Found by: FlexeLint
* Remove unused local variables.phk2003-05-313-33/+7
| | | | Found by: FlexeLint
* The IO_NOWDRAIN and B_NOWDRAIN hacks are no longer needed to preventphk2003-05-311-4/+0
| | | | | | deadlocks with vnode backed md(4) devices because md now uses a kthread to run the bio requests instead of doing it directly from the bio down path.
* Lock the vm object when performing vm_object_page_clean().alc2003-05-181-1/+4
| | | | Approved by: re (rwatson)
* Jeff added locking assertions that the VV_ flags on vnodes were modifiedrwatson2003-05-151-5/+11
| | | | | | | | | | | | | only while holding appropriate vnode locks. This patch slides the lock release for ufs_extattr_enable() to continue to hold the active vnode lock on a backing file until after the flag change; it also acquires a vnode lock when disabling an attribute and hence clearing a flag on the backing vnode. This permits VFS_DEBUG_LOCKS to run UFS1 extended attributes without panicking, as well as preventing a potential race and vnode flag problem. Approved by: re (jhb) Pointed out by: DEBUG_VFS_LOCKS
* Lock the vm_object on entry to vm_object_vndeallocate().alc2003-05-031-0/+5
|
* Do not attempt to free NULL dinodes (i_din1 or i_din2) in ffs_ifree().tjr2003-05-011-2/+2
| | | | | | | | | | | | | | These fields can be left as NULL if ffs_vget() allocates an inode but fails before the dinode memory has been allocated. There are two cases when this can occur: when we lose a race and another process has added the inode to the hash, and when reading the inode off disk fails. The bug was observed by Kris on one of the package-building machines. See http://marc.theaimsgroup.com/?l=freebsd-current&m=105172731013411&w=2 In Kris's case, it was the bread() that failed because of a disk error. The alternative to this patch is to ensure that ffs_vget() does not call vput() when the inode that hasn't been properly initialised.
* Free i_din2 instead of i_din1 in ffs_ifree() on UFS2 filesystems.tjr2003-05-011-1/+1
| | | | | This is purely a cosmetic change because these members are in a union together.
* Fix some easy, global, lint warnings. In most cases, this meansmarkm2003-04-302-3/+3
| | | | | making some local variables static. In a couple of cases, this means removing an unused variable.
* Deprecate machine/limits.h in favor of new sys/limits.h.kan2003-04-292-3/+2
| | | | | | | Change all in-tree consumers to include <sys/limits.h> Discussed on: standards@ Partially submitted by: Craig Rodrigues <rodrigc@attbi.com>
* Lock both the proc lock and sched_lock when calling sched_nice sincejhb2003-04-221-1/+10
| | | | | | kg_nice is now protected by both. Being protected by both means that other places in the kernel that want to read kg_nice only need one of the two locks.
* - Use the sched_nice() api instead of setting the nice value directly.jeff2003-04-121-2/+3
| | | | Tested by: Steve Kargl <sgk@troutmask.apl.washington.edu>
* Sufficient access checks are performed by vmapbuf() that calling useracc()alc2003-04-061-5/+0
| | | | | | | | is pointless. Remove the call to useracc(). Don't reinitialize fields that are already initialized by getpbuf(). Reviewed by: tegge
* Check return value from vmapbuf instead of the function address.tegge2003-03-271-2/+1
|
* Eliminate a buffer sleep/wakeup race.tegge2003-03-271-7/+3
|
* Add support for reading directly from file to userland buffer when thetegge2003-03-262-0/+511
| | | | | O_DIRECT descriptor status flag is set and both offset and length is a multiple of the physical media sector size.
* Use td->td_ucred instead of td->td_proc->p_ucred.jhb2003-03-202-2/+2
|
* Minor fixes to ffs_fserr():jhb2003-03-201-3/+3
| | | | | - Assume that curthread is not NULL. It never is in -current. - Use td_ucred instead of p_ucred.
* Including <sys/stdint.h> is (almost?) universally only to be able to usephk2003-03-186-6/+0
| | | | | %j in printfs, so put a newsted include in <sys/systm.h> where the printf prototype lives and save everybody else the trouble.
* - Remove a race between fsync like functions and flushbufqueues() byjeff2003-03-131-4/+2
| | | | | | | | | | | requiring locked bufs in vfs_bio_awrite(). Previously the buf could have been written out by fsync before we acquired the buf lock if it weren't for giant. The cluster_wbuild() handles this race properly but the single write at the end of vfs_bio_awrite() would not. - Modify flushbufqueues() so there is only one copy of the loop. Pass a parameter in that says whether or not we should sync bufs with deps. - Call flushbufqueues() a second time and then break if we couldn't find any bufs without deps.
* Use the appropriate size when zeroing out the unused portionmckusick2003-03-071-3/+3
| | | | | | | | of a snapshot's copy of a superblock. This patch fixes a panic when taking a snapshot of a 4096/512 filesystem. Reported by: Ian Freislich <ianf@za.uu.net> Sponsored by: DARPA & NAI Labs.
* Remove ENABLE_VFS_IOOPT. It is a long unfinished work-in-progress.alc2003-03-061-108/+0
| | | | Discussed on: arch@
* - Add a new 'flags' parameter to getblk().jeff2003-03-047-19/+19
| | | | | | | | | | - Define one flag GB_LOCK_NOWAIT that tells getblk() to pass the LK_NOWAIT flag to the initial BUF_LOCK(). This will eventually be used in cases were we want to use a buffer only if it is not currently in use. - Convert all consumers of the getblk() api to use this extra parameter. Reviwed by: arch Not objected to by: mckusick
* Finish cleanup of vprint() which was begun with changing v_tag to a string.njl2003-03-031-1/+1
| | | | | | Remove extraneous uses of vop_null, instead defering to the default op. Rename vnode type "vfs" to the more descriptive "syncer". Fix formatting for various filesystems that use vop_print.
* More low-hanging fruit: kill caddr_t in calls to wakeup(9) / [mt]sleep(9).des2003-03-022-10/+10
|
* Change the field used to test whether the superblock has been updatedmckusick2003-02-251-1/+5
| | | | | | | | | | | | | | | from the filesystem size field to the filesystem maximum blocksize field. The problem is that older versions of growfs updated only the new size field and not the old size field. This resulted in the old (smaller) size field being copied up to the new size field which caused the filesystem to appear to fsck to be badly trashed. This also adds a sanity check to ensure that the superblock is not being updated when the filesystem is mounted read-only. Obviously such an update should never happen. Reported by: Nate Lawson <nate@root.org> Sponsored by: DARPA & NAI Labs.
* - Add an interlock argument to BUF_LOCK and BUF_TIMELOCK.jeff2003-02-252-5/+6
| | | | | | | | | | - Remove the buftimelock mutex and acquire the buf's interlock to protect these fields instead. - Hold the vnode interlock while locking bufs on the clean/dirty queues. This reduces some cases from one BUF_LOCK with a LK_NOWAIT and another BUF_LOCK with a LK_TIMEFAIL to a single lock. Reviewed by: arch, mckusick
* Expand the reference count on struct dquot to 32 bits.das2003-02-241-2/+1
| | | | | | | | This fixes a panic on large systems where a single user may have more than 64K active or inactive vnodes. PR: 48234 Reviewed by: mike (mentor)
* When removing the last item from a non-empty worklist, the worklistmckusick2003-02-241-2/+15
| | | | | | | tail pointer must be updated. Reported by: Kris Kennaway <kris@obsecurity.org> Sponsored by: DARPA & NAI Labs.
* This patch fixes a deadlock between the bufdaemon and a process takingmckusick2003-02-221-7/+43
| | | | | | | | | | | | | | | | | | a snapshot. As part of taking a snapshot of a filesystem, the kernel builds up a list of the filesystem metadata (such as the cylinder group bitmaps) that are contained in the snapshot. When doing a copy-on-write check, the list is first consulted. If the block being written is found on the list, then the full snapshot lookup can be avoided. Besides providing an important performance speedup this check also avoids a potential deadlock between the code creating the snapshot and the bufdaemon trying to cleanup snapshot related buffers. This fix creates a temporary list containing the key metadata blocks that can cause the deadlock. This temporary list is used between the time that the snapshot is first enabled and the time that the fully complete list is built. Reported by: Attila Nagy <bra@fsn.hu> Sponsored by: DARPA & NAI Labs.
* This patch fixes a bug on an active filesystem on which a snapshotmckusick2003-02-223-1/+47
| | | | | | | | | | | | | | is being taken from panicing with either "freeing free block" or "freeing free inode". The problem arises when the snapshot code is scanning the filesystem looking for inodes with a reference count of zero (e.g., unlinked but still open) so that it can expunge them from its view. If it encounters a reclaimed vnode and has to restart its scan, then it will panic if it encounters and tries to free an inode that it has already processed. The fix is to check each candidate inode to see if it has already been processed before trying to delete it from the snapshot image. Sponsored by: DARPA & NAI Labs.
* This patch fixes a bug in the logical block calculation macros somckusick2003-02-222-7/+7
| | | | | | | that they convert to 64-bit values before shifting rather than afterwards. Once fixed, they can be used rather than inline expanded. Sponsored by: DARPA & NAI Labs.
* Back out M_* changes, per decision of the TRB.imp2003-02-199-29/+29
| | | | Approved by: trb
* Replace use of random() with arc4random() to provide less guessablemckusick2003-02-142-3/+3
| | | | | | | | values for the initial inode generation numbers in newfs and for newly allocated inode generation numbers in the kernel. Submitted by: Theo de Raadt <deraadt@cvs.openbsd.org> Sponsored by: DARPA & NAI Labs.
* Correct lines incorrectly added to the copyright message.mckusick2003-02-142-6/+0
| | | | | Submitted by: Frank van der Linden <fvdl@wasabisystems.com> Sponsored by: DARPA & NAI Labs.
* - Cleanup unlocked accesses to buf flags by introducing a new b_vflag memberjeff2003-02-091-7/+6
| | | | | | | | | | that is protected by the vnode lock. - Move B_SCANNED into b_vflags and call it BV_SCANNED. - Create a vop_stdfsync() modeled after spec's sync. - Replace spec_fsync, msdos_fsync, and hpfs_fsync with the stdfsync and some fs specific processing. This gives all of these filesystems proper behavior wrt MNT_WAIT/NOWAIT and the use of the B_SCANNED flag. - Annotate the locking in buf.h
* Catch more uses of MIN().alfred2003-02-021-2/+0
|
* Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.alfred2003-01-219-29/+29
| | | | Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.
* Bow to the whining masses and change a union back into void *. Retaindillon2003-01-131-1/+1
| | | | | removal of unnecessary casts and throw in some minor cleanups to see if anyone complains, just for the hell of it.
* Change struct file f_data to un_data, a union of the correct structdillon2003-01-121-1/+1
| | | | | | | | | | pointer types, and remove a huge number of casts from code using it. Change struct xfile xf_data to xun_data (ABI is still compatible). If we need to add a #define for f_data and xf_data we can, but I don't think it will be necessary. There are no operational changes in this commit.
* o Improve wording of the comment that accompanies fs_pad. Themarcel2003-01-101-1/+6
| | | | | | | | | | | padding is not specific to non-i386 architectures. It is caused by non-i386 specific alignment requirements of fs_swuid, o Add a CTASSERT to catch a change in the size of struct fs at compile-time rather than run-time. Ok'd: gordon Tested on: i386 ia64
OpenPOWER on IntegriCloud