summaryrefslogtreecommitdiffstats
path: root/sys/kern/vfs_extattr.c
Commit message (Collapse)AuthorAgeFilesLines
* Turn #ifdef LOOKUP_SHARED into #ifndef LOOKUP_EXCLUSIVE to enable thisjeff2002-04-091-1/+1
| | | | | | | | | behavior by default. Also, change the options line to reflect this. If there are no problems reported this will become the only behavior and the knob will be removed in a month or so. Demanded by: obrien
* The fourth parameter to copystr() is a size_t, not an int.mux2002-04-081-1/+2
| | | | Approved by: peter
* o Change kernel_vmount() interface to be more convenient : pass twomux2002-04-071-30/+34
| | | | | | | | separate strings instead of passing "foo=bar". o Don't forget to clear the VMOUNT flag on the vnode when vfs_nmount() fails because the fs doesn't implement VFS_NMOUNT (and in vfs_mount() when the fs doesn't implement VFS_MOUNT) ; also decrement the vfs refcount in the !MNT_UPDATE case.
* Add two forgotten vfs_unbusy() calls, in vfs_mount() and vfs_nmount().mux2002-04-031-0/+2
| | | | Reviewed by: phk
* Change the suser() API to take advantage of td_ucred as well as do ajhb2002-04-011-25/+25
| | | | | | | | | | | | general cleanup of the API. The entire API now consists of two functions similar to the pre-KSE API. The suser() function takes a thread pointer as its only argument. The td_ucred member of this thread must be valid so the only valid thread pointers are curthread and a few kernel threads such as thread0. The suser_cred() function takes a pointer to a struct ucred as its first argument and an integer flag as its second argument. The flag is currently only used for the PRISON_ROOT flag. Discussed on: smp@
* - Properly sync vfs_nmount() with changes that have be already donemux2002-03-281-57/+39
| | | | | | | | | | | | | | in vfs_mount(), in particular revisions 1.215, 1.227 and 1.240. - flag2 is a low quality variable name, change it to kern_flag. - strncpy NUL-terminates f_fstypename and f_mntonname since the strings have length <= <buffer length> - 1, so the explicit NUL-termination is bogus. - M_ZERO'ing space for fstype and fspath is stupid since we never use the space beyond the end of the string. - Do various style(9) cleanups in both functions. Submitted by: bde Reviewed by: phk
* - Fixup a few style nits:arr2002-03-261-6/+5
| | | | | | | | - return error -> return (error); - move a declaration to the top of the function. - become bug for bug compatible with if (error) lines. Submitted by: bde
* As discussed in -arch, add the new nmount(2) system call and themux2002-03-261-3/+553
| | | | | | | | | | new vfs_getopt()/vfs_copyopt() API. This is intended to be used later, when there will be filesystems implementing the VFS_NMOUNT operation. The mount(2) system call will disappear when all filesystems will be converted to the new API. Documentation will be committed in a while. Reviewed by: phk
* - Recommit the securelevel_gt() calls removed by commits rev. 1.84 ofarr2002-03-251-0/+5
| | | | | | | | kern_linker.c and rev. 1.237 of vfs_syscalls.c since these are not the source of the recent panics occuring around kldloading file system support modules. Requested by: rwatson
* - Back out the commit to make the linker_load_file() securelevel checkarr2002-03-221-5/+0
| | | | | | made aware in jail environments. Supposedly something is broken, so this should be backed out until further investigation proves otherwise, or a proper fix can be provided.
* - Fix a logic error in checking the securelevel that was introduced in thearr2002-03-211-1/+1
| | | | | | previous commit. Pointy hats to: arr, rwatson
* - Change a check of securelevel to securelevel_gt() call in order to helparr2002-03-201-0/+5
| | | | | | | | | against users within a jail attempting to load kernel modules. - Add a check of securelevel_gt() to vfs_mount() in order to chop some low hanging fruit for the repair of securelevel checking of linking and unlinking files from within jails. There is more to be done here. Reviewed by: rwatson
* Remove references to vm_zone.h and switch over to the new uma API.jeff2002-03-201-3/+3
| | | | | Also, remove maxsockets. If you look carefully you'll notice that the old zone allocator never honored this anyway.
* Remove __P.alfred2002-03-191-12/+12
|
* Close a race when vfs_syscalls.c:checkdirs() runs.alfred2002-03-191-7/+12
| | | | | To do this protect the filedesc pointer in the proc with PROC_LOCK in both checkdirs() and kern_descrip.c:fdfree().
* This patch adds the "LOCKSHARED" option to namei which causes it to only ↵jeff2002-03-121-0/+5
| | | | | | | | | | | | | | | | acquire shared locks on leafs. The stat() and open() calls have been changed to make use of this new functionality. Using shared locks in these cases is sufficient and can significantly reduce their latency if IO is pending to these vnodes. Also, this reduces the number of exclusive locks that are floating around in the system, which helps reduce the number of deadlocks that occur. A new kernel option "LOOKUP_SHARED" has been added. It defaults to off so this patch can be turned on for testing, and should eventually go away once it is proven to be stable. I have personally been running this patch for over a year now, so it is believed to be fully stable. Reviewed by: jake, obrien Approved by: jake
* Three p_ucred -> td_ucred's missed in jhb's earlier pass; all appear torwatson2002-03-051-2/+2
| | | | be safe.
* The change from td->td_proc->p_ucred to td->td_ucred has shortened somerwatson2002-03-051-4/+3
| | | | lines: more agressively line wrap under those circumstances.
* - Change namei() to use td_ucred instead of p_ucred.jhb2002-02-271-3/+3
| | | | | - Change the hack in access() that uses a temporary credential to set td_ucred to the temp cred instead of p_ucred.
* Simple p_ucred -> td_ucred changes to start using the per-thread ucredjhb2002-02-271-60/+60
| | | | reference.
* Make sure to hold vnode lock when calling into VOP_GETATTR().rwatson2002-02-101-0/+2
| | | | Discussed with: mckusick, phk
* Make sure to grab vnode lock on a vnode before calling VOP_GETATTR()rwatson2002-02-101-5/+9
| | | | | | | | to perform an ownership test in revoke(). This is also required for MAC hooks so that the vnode lock is held during a call to the MAC framework. Release the lock before calling VOP_REVOKE(). Discussed with: phk, mckusick
* Remove a stray 'const' that slept into extattr_set_vp(), and couldrwatson2002-02-101-1/+1
| | | | result in compiler warnings.
* Part I: Update extended attribute API and ABI:rwatson2002-02-101-81/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | o Modify the system call syntax for extattr_{get,set}_{fd,file}() so as not to use the scatter gather API (which appeared not to be used by any consumers, and be less portable), rather, accepts 'data' and 'nbytes' in the style of other simple read/write interfaces. This changes the API and ABI. o Modify system call semantics so that extattr_get_{fd,file}() return a size_t. When performing a read, the number of bytes read will be returned, unless the data pointer is NULL, in which case the number of bytes of data are returned. This changes the API only. o Modify the VOP_GETEXTATTR() vnode operation to accept a *size_t argument so as to return the size, if desirable. If set to NULL, the size will not be returned. o Update various filesystems (pseodofs, ufs) to DTRT. These changes should make extended attributes more useful and more portable. More commits to rebuild the system call files, as well as update userland utilities to follow. Obtained from: TrustedBSD Project Sponsored by: DARPA, NAI Labs
* o Merge various recent fixes from the MAC branch relating to extattrctl():rwatson2002-02-081-6/+10
| | | | | | | | | | | | | | | - Fix null-pointer dereference introduced when snapshotting was introduced. This occured because unlike the previous code, vn_start_write() doesn't always return a non-NULL mp, as filesystems may not support the VOP_GETWRITEMOUNT() call. For now, rely on two pointers, so that vn_finished_write() works properly. - Fix locking problems on exit, introduced at some past time, some when snapshots came in, where a vnode might not be unlocked before being vrele'd in various error situations. Obtained from: TrustedBSD Project Sponsored by: DARPA, NAI Labs
* Pre-KSE/M3 commit.julian2002-02-071-2/+0
| | | | | | | | | | this is a low-functionality change that changes the kernel to access the main thread of a process via the linked list of threads rather than assuming that it is embedded in the process. It IS still embeded there but remove all teh code that assumes that in preparation for the next commit which will actually move it out. Reviewed by: peter@freebsd.org, gallatin@cs.duke.edu, benno rice,
* Don't recurse on filedesc lock in chroot_refuse_vdir_fds().alfred2002-02-011-8/+9
| | | | Noticed by: Michael Nottebrock <michaelnottebrock@gmx.net>
* Replace ffind_* with fget calls.alfred2002-01-141-4/+3
| | | | | | | | Make fget MPsafe. Make fgetvp and fgetsock use the fget subsystem to reduce code bloat. Push giant down in fpathconf().
* SMP Lock struct file, filedesc and the global file list.alfred2002-01-131-38/+151
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Seigo Tanimura (tanimura) posted the initial delta. I've polished it quite a bit reducing the need for locking and adapting it for KSE. Locks: 1 mutex in each filedesc protects all the fields. protects "struct file" initialization, while a struct file is being changed from &badfileops -> &pipeops or something the filedesc should be locked. 1 mutex in each struct file protects the refcount fields. doesn't protect anything else. the flags used for garbage collection have been moved to f_gcflag which was the FILLER short, this doesn't need locking because the garbage collection is a single threaded container. could likely be made to use a pool mutex. 1 sx lock for the global filelist. struct file * fhold(struct file *fp); /* increments reference count on a file */ struct file * fhold_locked(struct file *fp); /* like fhold but expects file to locked */ struct file * ffind_hold(struct thread *, int fd); /* finds the struct file in thread, adds one reference and returns it unlocked */ struct file * ffind_lock(struct thread *, int fd); /* ffind_hold, but returns file locked */ I still have to smp-safe the fget cruft, I'll get to that asap.
* Change dounmount() to return EBUSY in the non-MNT_FORCE case if weiedowse2002-01-101-1/+8
| | | | | | | can't acquire the mnt_lock without blocking. Normally non-forced unmount attempts return EBUSY quickly if any vnodes are active, so this just extends that behaviour to cover the per-mount mnt_lock too.
* Return EBADF in case some vnode field has been reset to a NULL pointer.se2002-01-031-0/+2
| | | | | | | | | | | | (There has been some discussion, whether ENOENT or EBADF is more appropriate. I choose the latter, since the operation is not supported on the file descriptor at that time, even if it was, immediately before.) PR: 32681 Reviewed by: dillon, iedowse, ... Approved by: nectar MFC after: 3 days (pending RE approval)
* Define a new mount flag "MNT_JAILDEVFS"phk2001-11-051-8/+2
| | | | | | Collect the magic combination of flags which can be updated into a macro in sys/mount.h rather than inlining them (twice!) in vfs_syscalls.c
* Add mnt_reservedvnlist so we can MFC to 4.x, in order to make all mountdillon2001-11-041-0/+1
| | | | | | | | structure changes now rather then piecemeal later on. mnt_nvnodelist currently holds all the vnodes under the mount point. This will eventually be split into a 'dirty' and 'clean' list. This way we only break kld's once rather then twice. nvnodelist will eventually turn into the dirty list and should remain compatible with the klds.
* o Remove the local temporary variable "struct proc *p" from vfs_mount()rwatson2001-11-021-7/+7
| | | | | | | | | in vfs_syscalls.c. Although it did save some indirection, many of those savings will be obscured with the impending commit of suser() changes, and the result is increased code complexity. Also, once p->p_ucred and td->td_ucred are distinguished, this will make vfs_mount() use the correct thread credential, rather than the process credential.
* Argh!phk2001-11-021-21/+0
| | | | | | patch added the nmount at the bottom first time around. Take 3!
* Add empty shell for nmount syscall (take 2!)phk2001-11-021-0/+21
|
* Add nmount() stub function and regenerate the syscall-glue which shouldphk2001-11-021-0/+21
| | | | not need to check in generated files.
* unwind v_writecount in fhopen() if we are unable to allocate thedillon2001-10-241-1/+4
| | | | | | descriptor. MFC after: 3 days
* Change the vnode list under the mount point from a LIST to a TAILQdillon2001-10-231-1/+2
| | | | | | in preparation for an implementation of limiting code for kern.maxvnodes. MFC after: 3 days
* o Complete the migration from suser error checking in the following formrwatson2001-10-011-22/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | in vfs_syscalls.c: if (mp->mnt_stat.f_owner != p->p_ucred->cr_uid && (error = suser_td(td)) != 0) { unwrap_lots_of_stuff(); return (error); } to: if (mp->mnt_stat.f_owner != p->p_ucred->cr_uid) { error = suser_td(td); if (error) { unwrap_lots_of_stuff(); return (error); } } This makes the code more readable when complex clauses are in use, and minimizes conflicts for large outstanding patchsets modifying the kernel authorization code (of which I have several), especially where existing authorization and context code are combined in the same if() conditional. Obtained from: TrustedBSD Project
* o vpaccess() -> vn_access() -- Peter reminds me that there is alreadyrwatson2001-09-221-4/+4
| | | | | | a convention for vnop helper routines of this sort. Submitted by: Mr Wemm <peter>
* o Introduce eaccess(2), a version of access(2) that uses the effectiverwatson2001-09-211-14/+67
| | | | | | | | | | | | | | | | | | credentials rather than the real credentials. This is useful for implementing GUI's which need to modify icons based on access rights, but where use of open(2) is too expensive, use of stat(2) doesn't reflect the file system's real protection model, and use of access() suffers from real/effective credential confusion. This implementation provides the same semantics as the call of the same name on SCO OpenServer. Note: using this call improperly can leave you subject to some of the same races present in the access(2) call. o To implement this, break out the basic logic of access(2) into vpaccess(), which accepts a passed credential to perform the invocation of VOP_ACCESS(). Add eaccess(2) to invoke vpaccess(), and modify access(2) to use vpaccess(). Obtained from: TrustedBSD Project
* KSE Milestone 2julian2001-09-121-429/+443
| | | | | | | | | | | | | | Note ALL MODULES MUST BE RECOMPILED make the kernel aware that there are smaller units of scheduling than the process. (but only allow one thread per process at this time). This is functionally equivalent to teh previousl -current except that there is a thread associated with each process. Sorry john! (your next MFC will be a doosie!) Reviewed by: peter@freebsd.org, dillon@freebsd.org X-MFC after: ha ha ha ha
* lseek: simplify overflow checksache2001-08-291-4/+4
|
* Cosmetique & style fixes from bdeache2001-08-261-1/+0
|
* lseek: fix check for vattr.va_size overflow. Check suggested by bde simple notache2001-08-231-1/+2
| | | | works with unsigned types.
* Cosmetique: more <sys/*> into one group, separate include families byache2001-08-231-1/+2
| | | | blank line
* Make lseek() POSIXed: for non character special filesache2001-08-211-5/+20
| | | | | | | 1) handle off_t overflow with EOVERFLOW 2) handle negative offsets with EINVAL Reviewed by: arch discussion
* Avoid sleeping while holding a mutex in dounmount(). This problemiedowse2001-08-201-6/+7
| | | | | | | | | | | has existed for a long time, but I made it worse a few months ago by by adding calls to VFS_ROOT() and checkdirs() in revision 1.179. Also, remove the LK_REENABLE flag in the lockmgr() call; this flag has been ignored by the lockmgr code for 4 years. This was the only remaining mention of it apart from its definition. Reviewed by: jhb
* Arbitrarily limit to 64k the number of bytes that can be read atiedowse2001-08-101-0/+3
| | | | | | | a time using the ogetdirentries() compatibility syscall. This is a hack to ensure that rediculous values don't get passed to MALLOC(). Reviewed by: kris
OpenPOWER on IntegriCloud