summaryrefslogtreecommitdiffstats
path: root/sys/ufs
Commit message (Collapse)AuthorAgeFilesLines
* o Introduce new VOP_ACCESS() flag VADMIN, allowing file systems to performrwatson2000-10-192-26/+48
| | | | | | | | | | | | | | | | | | | | "administrative" authorization checks. In most cases, the VADMIN test checks to make sure the credential effective uid is the same as the file owner. o Modify vaccess() to set VADMIN as an available right if the uid is appropriate. o Modify references to uid-based access control operations such that they now always invoke VOP_ACCESS() instead of using hard-coded policy checks. o This allows alternative UFS policies to be implemented by replacing only ufs_access() (such as mandatory system policies). o VOP_ACCESS() requires the caller to hold an exclusive vnode lock on the vnode: I believe that new invocations of VOP_ACCESS() are always called with the lock held. o Some direct checks of the uid remain, largely associated with the QUOTA and SUIDDIR code. Reviewed by: eivind Obtained from: TrustedBSD Project
* Initial commit of IFS - a inode-namespaced FFS. Here is a shortadrian2000-10-149-7/+1326
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | description: How it works: -- Basically ifs is a copy of ffs, overriding some vfs/vnops. (Yes, hack.) I didn't see the need in duplicating all of sys/ufs/ffs to get this off the ground. File creation is done through a special file - 'newfile' . When newfile is called, the system allocates and returns an inode. Note that newfile is done in a cloning fashion: fd = open("newfile", O_CREAT|O_RDWR, 0644); fstat(fd, &st); printf("new file is %d\n", (int)st.st_ino); Once you have created a file, you can open() and unlink() it by its returned inode number retrieved from the stat call, ie: fd = open("5", O_RDWR); The creation permissions depend entirely if you have write access to the root directory of the filesystem. To get the list of currently allocated inodes, VOP_READDIR has been added which returns a directory listing of those currently allocated. -- What this entails: * patching conf/files and conf/options to include IFS as a new compile option (and since ifs depends upon FFS, include the FFS routines) * An entry in i386/conf/NOTES indicating IFS exists and where to go for an explanation * Unstaticize a couple of routines in src/sys/ufs/ffs/ which the IFS routines require (ffs_mount() and ffs_reload()) * a new bunch of routines in src/sys/ufs/ifs/ which implement the IFS routines. IFS replaces some of the vfsops, and a handful of vnops - most notably are VFS_VGET(), VOP_LOOKUP(), VOP_UNLINK() and VOP_READDIR(). Any other directory operation is marked as invalid. What this results in: * an IFS partition's create permissions are controlled by the perm/ownership of the root mount point, just like a normal directory * Each inode has perm and ownership too * IFS does *NOT* mean an FFS partition can be opened per inode. This is a completely seperate filesystem here * Softupdates doesn't work with IFS, and really I don't think it needs it. Besides, fsck's are FAST. (Try it :-) * Inodes 0 and 1 aren't allocatable because they are special (dump/swap IIRC). Inode 2 isn't allocatable since UFS/FFS locks all inodes in the system against this particular inode, and unravelling THAT code isn't trivial. Therefore, useful inodes start at 3. Enjoy, and feedback is definitely appreciated!
* o Sanity check was inverted, resulting in a possible spurious panicrwatson2000-10-091-1/+1
| | | | | during unmount if extended attributes were in use. Correct by removing an unneeded (and undesirable) '!'.
* Blow away the v_specmountpoint define, replacing it with what it waseivind2000-10-093-9/+9
| | | | defined as (rdev->si_mountpoint)
* o Move initialization of ump from mp to the top of the function so thatrwatson2000-10-061-2/+1
| | | | | | | it is defined whenm used in ufs_extattr_uepm_destroy(), fixing a panic due to a NULL pointer dereference. Submitted by: Wesley Morgan <morganw@chemicals.tacorp.com>
* o Add call to ufs_extattr_uepm_destroy() in ffs_unmount() so as to cleanrwatson2000-10-041-0/+15
| | | | | | | up lock on extattrs. o Get for free a comment indicating where auto-starting of extended attributes will eventually occur, as it was in my commit tree also. No implementation change here, only a comment.
* o Correct use of lockdestroy() by adding a new ufs_extattr_uepm_destroy()rwatson2000-10-042-2/+25
| | | | | | | | call, which should be the last thing down to a per-mount extattr management structure, after ufs_extattr_stop() on the file system. This currently has the effect only of destroying the per-mount lock on extended attributes, and clearing appropriate flags. o Remove inappropriate invocation in ufs_extattr_vnode_inactive().
* Convert lockmgr locks from using simple locks to using mutexes.jasone2000-10-046-15/+23
| | | | | | Add lockdestroy() and appropriate invocations, which corresponds to lockinit() and must be called to clean up after a lockmgr lock is no longer needed.
* Add a lock structure to vnode structure. Previously it was either allocatedbp2000-09-254-4/+7
| | | | | | | | | | | | | | | | | | | separately (nfs, cd9660 etc) or keept as a first element of structure referenced by v_data pointer(ffs). Such organization leads to known problems with stacked filesystems. From this point vop_no*lock*() functions maintain only interlock lock. vop_std*lock*() functions maintain built-in v_lock structure using lockmgr(). vop_sharedlock() is compatible with vop_stdunlock(), but maintains a shared lock on vnode. If filesystem wishes to export lockmgr compatible lock, it can put an address of this lock to v_vnlock field. This indicates that the upper filesystem can take advantage of it and use single lock structure for entire (or part) of stack of vnodes. This field shouldn't be examined or modified by VFS code except for initialization purposes. Reviewed in general by: mckusick
* o Permit UFS Extended Attributes to be associated with special devicesrwatson2000-09-211-0/+8
| | | | | | and FIFOs. Obtained from: TrustedBSD Project
* o Disallow privileged processes in jail() from directly accessingrwatson2000-09-181-1/+9
| | | | | | | | system namespace extended attributes. o Document privilege/jail() interaction relating to extended attributes. Obtained from: TrustedBSD Project
* o Allow privileged processes in jail() to override sticky bit behaviorrwatson2000-09-181-2/+2
| | | | | | | | | | | on directories. o Allow privileged processes in jail() to create inodes with the setgid bit set even if they are not a member of the group denoted by the file creation gid. This occurs due to inherited gid's from parent directories on file creation, allowing a user to create a file with a gid that is not in the creating process's credentials. Obtained from: TrustedBSD Project
* o Add a comment clarifying interaction between jail(), privileged processes,rwatson2000-09-181-0/+5
| | | | | | | | | | | | | | and UFS file flags. Here's what the comment says, for reference: Privileged processes in jail() are permitted to modify arbitrary user flags on files, but are not permitted to modify system flags. In other words, privilege does allow a process in jail to modify user flags for objects that the process does not own, but privilege will not permit the setting of system flags on the file. Obtained from: TrustedBSD Project
* o Add missing PRISON_ROOT allowing a privileged process in a jail() to notrwatson2000-09-181-1/+1
| | | | | | | | remove the setuid/setgid bits by virtue of a change to a file with those bits set, even if the process doesn't own the file, or isn't a group member of the file's gid. Obtained from: TrustedBSD Project
* o Substitute suser() calls for direct credential checks, which is nowrwatson2000-09-184-8/+10
| | | | | | | | | | | | | | safe as suser() no longer sets ASU. o Note that in some cases, the PRISON_ROOT flag is used even though no process structure is passed, to indicate that if a process structure (and hence jail) was available, it would be ok. In the long run, the jail identifier should probably be moved to ucred, as the uidinfo information was. o Some uid 0 checks remain relating to the quota code, which I'll leave for another day. Reviewed by: phk, eivind Obtained from: TrustedBSD Project
* Silence a warning.des2000-09-171-1/+1
|
* Add new flag PDIRUNLOCK to the component.cn_flags which should be set bybp2000-09-171-13/+30
| | | | | | | | | | | | | | | | | | filesystem lookup() routine if it unlocks parent directory. This flag should be carefully tracked by filesystems if they want to work properly with nullfs and other stacked filesystems. VFS takes advantage of this flag to perform symantically correct usage of vrele() instead of vput() if parent directory already unlocked. If filesystem fails to track this flag then previous codepath in VFS left unchanged. Convert UFS code to set PDIRUNLOCK flag if necessary. Other filesystmes will be changed after some period of testing. Reviewed in general by: mckusick, dillon, adrian Obtained from: NetBSD
* Remove a pointless casting of a gid_t to a gid_t.phk2000-09-161-1/+1
|
* Add VOP_*VOBJECT vops, because MFS requires explicit vop specification.bp2000-09-121-0/+3
| | | | Noted by: knu
* o Variety of extended attribute fixesrwatson2000-09-121-26/+39
| | | | | | | | | | | | | | | | | | | | | | | - In ufs_extattr_enable(), return EEXIST instead of EOPNOTSUPP if the caller tries to configure an attribute name that is already configured - Throughout, add IO_NODELOCKED to VOP_{READ,WRITE} calls to indicate lock status of passed vnode. Apparently not a problem, but worth fixing. - For all writes, make use of IO_SYNC consistent. Really, IO_UNIT and combining of VOP_WRITE's should happen, but I don't have that tested. At least with this, it's consistent usage. (pointed out by: bde) - In ufs_extattr_get(), fixed nested locking of backing vnode (fine due to recursive lock support, but make it more consistent with other code) - In ufs_extattr_get(), clean up return code to set uio_resid more consistently with other pieces of code (worked fine, this is just a cleanup) - Fix ufs_extattr_rm(), which was broken--effectively a nop. - Minor comment and whitespace fixes. Obtained from: TrustedBSD Project
* Fix a 64-bitism. Use size_t instead of int for 4th argument to copyinstr.jhb2000-09-111-1/+2
| | | | Approved by: rwatson
* Cannot do MALLOC with M_WAITOK while holding ACQUIRE_LOCKmckusick2000-09-071-2/+2
| | | | Obtained from: Ethan Solomita <ethan@geocast.com>
* Major update to the way synchronization is done in the kernel. Highlightsjasone2000-09-073-3/+1
| | | | | | | | | | | | | | | include: * Mutual exclusion is used instead of spl*(). See mutex(9). (Note: The alpha port is still in transition and currently uses both.) * Per-CPU idle processes. * Interrupts are run in their own separate kernel threads and can be preempted (i386 only). Partially contributed by: BSDi (BSD/OS) Submissions by (at least): cp, dfr, dillon, grog, jake, jhb, sheldonh
* Modify extended attribute protection model to authorize based onrwatson2000-09-022-43/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | attribute namespace and DAC protection on file: - Attribute names beginning with '$' are in the system namespace - The attribute name "$" is reserved - System namespace attributes may only be read/set by suser() or by kernel (cred == NULL) - Other attribute names are in the application namespace - The attribute name "" is reserved - Application namespace attributes are protected in the manner of the target file permission o Kernel changes - Add ufs_extattr_valid_attrname() to check whether the requested attribute "set" or "enable" is appropriate (i.e., non-reserved) - Modify ufs_extattr_credcheck() to accept target file vnode, not to take inode uid - Modify ufs_extattr_credcheck() to check namespace, then enforce either kernel/suser for system namespace, or vaccess() for application namespace o EA backing file format changes - Remove permission fields from extended attribute backing file header - Bump extended attribute backing file header version to 3 o Update extattrctl.c and extattrctl.8 - Remove now deprecated -r and -w arguments to initattr, as permissions are now implicit - (unrelated) fix error reporting and unlinking during failed initattr to remove duplicate/inaccurate error messages, and to only unlink if the failure wasn't in the backing file open() Obtained from: TrustedBSD Project
* o Restructure vaccess() so as to check for DAC permission to modify therwatson2000-08-291-1/+1
| | | | | | | | | | | | | | | | object before falling back on privilege. Make vaccess() accept an additional optional argument, privused, to determine whether privilege was required for vaccess() to return 0. Add commented out capability checks for reference. Rename some variables to make it more clear which modes/uids/etc are associated with the object, and which with the access mode. o Update file system use of vaccess() to pass NULL as the optional privused argument. Once additional patches are applied, suser() will no longer set ASU, so privused will permit passing of privilege information up the stack to the caller. Reviewed by: bde, green, phk, -security, others Obtained from: TrustedBSD Project
* o Correct spelling of ufs_exttatr_find_attr -> ufs_extattr_find_attrrwatson2000-08-262-22/+22
| | | | | | | o Add "const" qualifier to attrname argument of various calls to remove warnings Obtained from: TrustedBSD Project
* Remove all traces of Julians DEVFS (incl from kern/subr_diskslice.c)phk2000-08-201-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | Remove old DEVFS support fields from dev_t. Make uid, gid & mode members of dev_t and set them in make_dev(). Use correct uid, gid & mode in make_dev in disk minilayer. Add support for registering alias names for a dev_t using the new function make_dev_alias(). These will show up as symlinks in DEVFS. Use makedev() rather than make_dev() for MFSs magic devices to prevent DEVFS from noticing this abuse. Add a field for DEVFS inode number in dev_t. Add new DEVFS in fs/devfs. Add devfs cloning to: disk minilayer (ie: ad(4), sd(4), cd(4) etc etc) md(4), tun(4), bpf(4), fd(4) If DEVFS add -d flag to /sbin/inits args to make it mount devfs. Add commented out DEVFS to GENERIC
* Centralize the canonical vop_access user/group/other check in vaccess().phk2000-08-201-41/+3
| | | | Discussed with: bde
* Initialize *countp to 0 in stub for softdep_flushworklist().tegge2000-08-091-0/+1
| | | | | | This allows ffs_fsync() to break out of a loop that might otherwise be infinite on kernels compiled without the SOFTUPDATES option. The observed symptom was a system hang at the first unmount attempt.
* Fix the lockmgr panic everyone is seeing at shutdown time.roberto2000-08-011-1/+2
| | | | | | | | | vput assumes curproc is the lock holder, but it's not true in this case. Thanks a lot Luoqi ! Submitted by: luoqi Tested by: phk
* Minor tweak - removed unused variable 'struct mount *mp';peter2000-07-281-1/+0
|
* Minor change: fix warning - move a 'struct vnode *vp' declaration inside apeter2000-07-281-0/+2
| | | | #ifdef DIAGNOSTIC to match its corresponding usage.
* Clean up the snapshot code so that it no longer depends on the use ofmckusick2000-07-264-12/+37
| | | | | | | | | | | | | | the SF_IMMUTABLE flag to prevent writing. Instead put in explicit checking for the SF_SNAPSHOT flag in the appropriate places. With this change, it is now possible to rename and link to snapshot files. It is also possible to set or clear any of the owner, group, or other read bits on the file, though none of the write or execute bits can be set. There is also an explicit test to prevent the setting or clearing of the SF_SNAPSHOT flag via chflags() or fchflags(). Note also that the modify time cannot be changed as it needs to accurately reflect the time that the snapshot was taken. Submitted by: Robert Watson <rwatson@FreeBSD.org>
* Fix the "mfs_badop[vop_getwritemount] = 45" messages.phk2000-07-261-0/+1
|
* Add stub for softdep_flushworklist() so that kernels compiledmckusick2000-07-251-0/+10
| | | | | | without the SOFTUPDATES option will load correctly. Obtained from: John Baldwin <jhb@bsdi.com>
* Eliminate periodic 'mfs_badop[vop_getwritemount] = 45' messages.mckusick2000-07-251-0/+1
| | | | Submitted by: Sheldon Hearn <sheldonh@uunet.co.za>
* This patch corrects the first round of panics and hangs reportedmckusick2000-07-249-75/+152
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | with the new snapshot code. Update addaliasu to correctly implement the semantics of the old checkalias function. When a device vnode first comes into existence, check to see if an anonymous vnode for the same device was created at boot time by bdevvp(). If so, adopt the bdevvp vnode rather than creating a new vnode for the device. This corrects a problem which caused the kernel to panic when taking a snapshot of the root filesystem. Change the calling convention of vn_write_suspend_wait() to be the same as vn_start_write(). Split out softdep_flushworklist() from softdep_flushfiles() so that it can be used to clear the work queue when suspending filesystem operations. Access to buffers becomes recursive so that snapshots can recursively traverse their indirect blocks using ffs_copyonwrite() when checking for the need for copy on write when flushing one of their own indirect blocks. This eliminates a deadlock between the syncer daemon and a process taking a snapshot. Ensure that softdep_process_worklist() can never block because of a snapshot being taken. This eliminates a problem with buffer starvation. Cleanup change in ffs_sync() which did not synchronously wait when MNT_WAIT was specified. The result was an unclean filesystem panic when doing forcible unmount with heavy filesystem I/O in progress. Return a zero'ed block when reading a block that was not in use at the time that a snapshot was taken. Normally, these blocks should never be read. However, the readahead code will occationally read them which can cause unexpected behavior. Clean up the debugging code that ensures that no blocks be written on a filesystem while it is suspended. Snapshots must explicitly label the blocks that they are writing during the suspension so that they do not cause a `write on suspended filesystem' panic. Reorganize ffs_copyonwrite() to eliminate a deadlock and also to prevent a race condition that would permit the same block to be copied twice. This change eliminates an unexpected soft updates inconsistency in fsck caused by the double allocation. Use bqrelse rather than brelse for buffers that will be needed soon again by the snapshot code. This improves snapshot performance.
* o Marius pointed out an unusually inconvenient upper bound on extendedrwatson2000-07-141-1/+0
| | | | | | | | | attribute data size. o Fortunately it turned out to be an unused constant left over from an earlier implementation, and is therefore being removed so as not to confuse casual observers. Submitted by: mbendiks@eunet.no
* Prevent possible dereference of NULL pointer.bp2000-07-131-1/+1
| | | | Submitted by: Marius Bendiksen <mbendiks@eunet.no>
* Brain fault, forgot to update ffs_snapshot.c with the new calling conventionmckusick2000-07-121-4/+5
| | | | for vn_start_write.
* Add snapshots to the fast filesystem. Most of the changes supportmckusick2000-07-1115-184/+1365
| | | | | | | | | | | | | | | | | | | | the gating of system calls that cause modifications to the underlying filesystem. The gating can be enabled by any filesystem that needs to consistently suspend operations by adding the vop_stdgetwritemount to their set of vnops. Once gating is enabled, the function vfs_write_suspend stops all new write operations to a filesystem, allows any filesystem modifying system calls already in progress to complete, then sync's the filesystem to disk and returns. The function vfs_write_resume allows the suspended write operations to begin again. Gating is not added by default for all filesystems as for SMP systems it adds two extra locks to such critical kernel paths as the write system call. Thus, gating should only be added as needed. Details on the use and current status of snapshots in FFS can be found in /sys/ufs/ffs/README.snapshot so for brevity and timelyness is not included here. Unless and until you create a snapshot file, these changes should have no effect on your system (famous last words).
* Clean up warning about undeclared function by declaring softdep_fsyncmckusick2000-07-111-0/+3
| | | | | | in mount.h instead of ffs_extern.h. The correct solution is to use an indirect function pointer so that the kernel does not have to be built with options FFS, but that will be left for another day.
* Finish repo-copy:phk2000-07-101-409/+0
| | | | | | Move ufs/ufs/ufs_disksubr.c to kern/subr_disklabel.c. These functions are not UFS specific and are in fact used all over the place.
* Delete README as it is now obsolete. Relevant information is inmckusick2000-07-081-322/+0
| | | | README.softupdates.
* Update to reflect current status.mckusick2000-07-081-4/+42
|
* Get userland visible flags added for snapshots to give a few daysmckusick2000-07-041-1/+26
| | | | | | advance preparation for them to get migrated into place so that subsequent changes in utilities will not fail to compile for lack of up-to-date header files in /usr/include.
* Move the truncation code out of vn_open and into the open system callmckusick2000-07-042-4/+6
| | | | | | | | | | after the acquisition of any advisory locks. This fix corrects a case in which a process tries to open a file with a non-blocking exclusive lock. Even if it fails to get the lock it would still truncate the file even though its open failed. With this change, the truncation is done only after the lock is successfully acquired. Obtained from: BSD/OS
* Make the two calls from kern/* into softupdates #ifdef SOFTUPDATES,phk2000-07-031-15/+0
| | | | | | | that is way cleaner than using the softupdates_stub stunt, which should be killed when convenient. Discussed with: mckusick
* Move prtactive to vfs from ufs. It is used all over the place.phk2000-06-271-2/+0
|
* Remove obsoleted info about linking from contribache2000-06-241-16/+2
|
OpenPOWER on IntegriCloud