summaryrefslogtreecommitdiffstats
path: root/sys/fs
Commit message (Collapse)AuthorAgeFilesLines
* style nit in r188815avg2009-02-191-1/+1
| | | | | Pointed out by: jhb, rpaulo Approved by: jhb (mentor)
* fs/udf: fix incorrect error return (-1) when reading a large diravg2009-02-191-4/+3
| | | | | | | | | | | | Not enough space in user-land buffer is not an error, userland will read further until eof is reached. So instead of propagating -1 to caller we convert it to zero/success. cd9660 code works exactly the same way. PR: kern/78987 Reviewed by: jhb (mentor) Approved by: jhb (mentor)
* Fix a logic bug that caused the pfs_attr method to be called only fordes2009-02-162-8/+11
| | | | | | | PFS_PROCDEP nodes. Submitted by: Andrew Brampton <brampton@gmail.com> MFC after: 2 weeks
* Use shared vnode locks when invoking VOP_READDIR().jhb2009-02-131-1/+1
| | | | MFC after: 1 month
* - Consolidate error handling in the cd9660 and udf mount routines.jhb2009-02-112-24/+26
| | | | | | | | | - Always read the character device pointer while the associated devfs vnode is locked. Also, use dev_ref() to obtain a new reference on the vnode for the mountpoint. This reference is released on unmount. This mirrors the earlier fix to FFS. Reviewed by: kib
* Mark udf(4) MPSAFE and add support for shared vnode locks during pathnamejhb2009-02-092-24/+55
| | | | | | | | | | | | | | lookups: - Honor the caller's locking flags in udf_root() and udf_vget(). - Set VV_ROOT for the root vnode in udf_vget() instead of only doing it in udf_root(). - Honor the requested locking flags during pathname lookups in udf_lookup(). - Release the buffer holding the directory data before looking up the vnode for a given file to avoid a LOR between the "udf" vnode locks and "bufwait". - Use vn_vget_ino() to handle ".." lookups. - Special case "." lookups instead of calling udf_vget(). We have to do extra checking for the vnode lock for "." lookups.
* Use the same style as the rest of the file for the optional data stringjhb2009-02-091-1/+1
| | | | after each path component rather than a GCC-ism.
* Lookup up the directory entry for the tmpfs node that are deleted bykib2009-02-083-22/+10
| | | | | | | | | both node pointer and name component. This does the right thing for hardlinks to the same node in the same directory. Submitted by: Yoshihiro Ota <ota j email ne jp> PR: kern/131356 MFC after: 2 weeks
* Add rudimentary support for symbolic links on UDF. Links are stored as ajhb2009-02-062-3/+124
| | | | | | | | sequence of pathname components. We walk the list building a string in the caller's passed in buffer. Currently this only handles path names in CS8 (character set 8) as that is what mkisofs generates for UDF images. MFC after: 1 month
* Add support for fifos to UDF:jhb2009-02-063-0/+64
| | | | | | | | | - Add a separate set of vnode operations that inherits from the fifo ops and use it for fifo nodes. - Add a VOP_SETATTR() method that allows setting the size (by silently ignoring the requests) of fifos. This is to allow O_TRUNC opens of fifo devices (e.g. I/O redirection in shells using ">"). - Add a VOP_PRINT() handler while I'm here.
* Tweak the output of VOP_PRINT/vn_printf() some.jhb2009-02-061-0/+1
| | | | | | | | - Align the fifo output in fifo_print() with other vn_printf() output. - Remove the leading space from lockmgr_printinfo() so its output lines up in vn_printf(). - lockmgr_printinfo() now ends with a newline, so remove an extra newline from vn_printf().
* After r186194 the *fs_strategy() functions always return 0.bz2009-01-312-4/+2
| | | | | | | | So we are no longer interested in the error returned from the *fs_doio() functions. With that we can remove the error variable as its value is unused now. Submitted by: Christoph Mallon christoph.mallon@gmx.de
* Remove unused local variables.bz2009-01-318-20/+2
| | | | | | Submitted by: Christoph Mallon christoph.mallon@gmx.de Reviewed by: kib MFC after: 2 weeks
* Mark most often used sysctl's as MPSAFE.ed2009-01-281-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | After running a `make buildkernel', I noticed most of the Giant locks in sysctl are only caused by a very small amount of sysctl's: - sysctl.name2oid. This one is locked by SYSCTL_LOCK, just like sysctl.oidfmt. - kern.ident, kern.osrelease, kern.version, etc. These are just constant strings. - kern.arandom, used by the stack protector. It is already protected by arc4_mtx. I also saw the following sysctl's show up. Not as often as the ones above, but still quite often: - security.jail.jailed. Also mark security.jail.list as MPSAFE. They don't need locking or already use allprison_lock. - kern.devname, used by devname(3), ttyname(3), etc. This seems to reduce Giant locking inside sysctl by ~75% in my primitive test setup.
* Use the correct field name for the size of the sierra_id. While thisimp2009-01-281-1/+1
| | | | | | is the same size as id, and is unlikely to change, it seems better to use the correct field here. There's no difference in the generated code.
* Mark cd9660 MPSAFE and add support for using shared vnode locks duringjhb2009-01-284-50/+114
| | | | | | | | | | | | | | | | | | | | | | pathname lookups. - Remove 'i_offset' and 'i_ino' from the ISO node structure and replace them with local variables in the lookup routine instead. - Cache a copy of 'i_diroff' for use during a lookup in a local variable. - Save a copy of the found directory entry in a malloc'd buffer after a successfull lookup before getting the vnode. This allows us to release the buffer holding the directory block before calling vget() which otherwise resulted in a LOR between "bufwait" and the vnode lock. - Use an inlined version of vn_vget_ino() to handle races with .. lookups. I had to inline the code here since cd9660 uses an internal vget routine to save a disk I/O that would otherwise re-read the directory block. - Honor the requested locking flags during lookups to allow for shared locking. - Honor the requested locking flags passed to VFS_ROOT() and VFS_VGET() similar to UFS. - Don't make every ISO 9660 vnode hold a reference on the vnode of the underlying device vnode of the mountpoint. The mountpoint already holds a suitable reference.
* Sync with ufs_vnops.c:1.245 and remove support for accessing device nodesjhb2009-01-281-3/+7
| | | | in ISO 9660 filesystems.
* Assert an exclusive vnode lock for fifo_cleanup() and fifo_close() sincejhb2009-01-281-2/+2
| | | | | | they change v_fifoinfo. Discussed with: ups (a while ago)
* Last step of splitting up minor and unit numbers: remove minor().ed2009-01-281-2/+2
| | | | | | | | | | | | | | | | | | | | | | | Inside the kernel, the minor() function was responsible for obtaining the device minor number of a character device. Because we made device numbers dynamically allocated and independent of the unit number passed to make_dev() a long time ago, it was actually a misnomer. If you really want to obtain the device number, you should use dev2udev(). We already converted all the drivers to use dev2unit() to obtain the device unit number, which is still used by a lot of drivers. I've noticed not a single driver passes NULL to dev2unit(). Even if they would, its behaviour would make little sense. This is why I've removed the NULL check. Ths commit removes minor(), minor2unit() and unit2minor() from the kernel. Because there was a naming collision with uminor(), we can rename umajor() and uminor() back to major() and minor(). This means that the makedev(3) manual page also applies to kernel space code now. I suspect umajor() and uminor() isn't used that often in external code, but to make it easier for other parties to port their code, I've increased __FreeBSD_version to 800062.
* The kernel may do unbalanced calls to fifo_close() for fifo vnode,kib2009-01-261-1/+4
| | | | | | | | | | | | | without corresponding number of fifo_open(). This causes assertion failure in fifo_close() due to vp->v_fifoinfo being NULL for kernel with INVARIANTS, or NULL pointer dereference otherwise. In fact, we may ignore excess calls to fifo_close() without bad consequences. Turn KASSERT() into the return, and print warning for now. Tested by: pho Reviewed by: rwatson MFC after: 2 weeks
* Turn a "panic: non-decreasing id" into an error printf. This seemstrasz2009-01-131-2/+5
| | | | | | | | | to be caused by a metadata corruption that occurs quite often after unplugging a pendrive during write activity. Reviewed by: scottl Approved by: rwatson (mentor) Sponsored by: FreeBSD Foundation
* Fix msdosfs_print(), which in turn fixes "show lockedvnods" for msdosfstrasz2009-01-111-0/+1
| | | | | | | | vnodes. Reviewed by: kib Approved by: rwatson (mentor) Sponsored by: FreeBSD Foundation
* Fix a deadlock which can occur due to a pseudofs vnode not getting unlocked.marcus2009-01-091-0/+1
| | | | | | Reported by: Richard Todd <rmtodd@ichotolot.servalan.com> Reviewed by: kib Approved by: kib
* Don't panic with "vinvalbuf: dirty bufs" when the mounted device that wastrasz2009-01-081-2/+18
| | | | | | | | being written to goes away. Reviewed by: kib, scottl Approved by: rwatson (mentor) Sponsored by: FreeBSD Foundation
* Add a VOP_VPTOCNP implementation for pseudofs which covers file systemsmarcus2008-12-301-0/+79
| | | | | | | | | | | | such as procfs and linprocfs. This implementation's locking was enhanced by kib. Reviewed by: kib des Approved by: des kib Tested by: pho
* When the insmntque() in the pfs_vncache_alloc() fails, vop_reclaim callskib2008-12-291-1/+2
| | | | | | | | | | | | pfs_vncache_free() that removes pvd from the list, while it is not yet put on the list. Prevent the invalid removal from the list by clearing pvd_next and pvd_prev for the newly allocated pvd, and only move pfs_vncache list head when the pvd was at the head. Suggested and approved by: des MFC after: 2 weeks
* vm_map_lock_read() does not increment map->timestamp, so we shouldkib2008-12-291-1/+1
| | | | | | | | | | compare map->timestamp with saved timestamp after map read lock is reacquired, not with saved timestamp + 1. The only consequence of the +1 was unconditional lookup of the next map entry, though. Tested by: pho Approved by: des MFC after: 2 weeks
* Use curproc->p_sysent->sv_flags bit SV_ILP32 for detection of the 32 bitkib2008-12-291-11/+5
| | | | | | | | caller, instead of direct comparision with ia32_freebsd_sysvec. Tested by: pho Approved by: des MFC after: 2 weeks
* Drop the pseudofs vnode lock around call to pfs_read handler. The handlerkib2008-12-291-15/+18
| | | | | | | | | may need to lock arbitrary vnodes, causing either lock order reversal or recursive vnode lock acquisition. Tested by: pho Approved by: des MFC after: 2 weeks
* After the pfs_vncache_mutex is dropped, another thread may attempt tokib2008-12-291-13/+26
| | | | | | | | | | | | | | | | | | do pfs_vncache_alloc() for the same pfs_node and pid. In this case, we could end up with two vnodes for the pair. Recheck the cache under the locked pfs_vncache_mutex after all sleeping operations are done [1]. This case mostly cannot happen now because pseudofs uses exclusive vnode locking for lookup. But it does drop the vnode lock for dotdot lookups, and Marcus' pseudofs_vptocnp implementation is vulnerable too. Do not call free() on the struct pfs_vdata after insmntque() failure, because vp->v_data points to the structure, and pseudofs_reclaim() frees it by the call to pfs_vncache_free(). Tested by: pho [1] Approved by: des MFC after: 2 weeks
* According to phk@, VOP_STRATEGY should never, _ever_, returntrasz2008-12-165-5/+5
| | | | | | | | | | | | | anything other than 0. Make it so. This fixes "panic: VOP_STRATEGY failed bp=0xc320dd90 vp=0xc3b9f648", encountered when writing to an orphaned filesystem. Reason for the panic was the following assert: KASSERT(i == 0, ("VOP_STRATEGY failed bp=%p vp=%p", bp, bp->b_vp)); at vfs_bio:bufstrategy(). Reviewed by: scottl, phk Approved by: rwatson (mentor) Sponsored by: FreeBSD Foundation
* Reference the vmspace of the process being inspected by procfs, linprocfskib2008-12-121-1/+8
| | | | | | | | and sysctl kern_proc_vmmap handlers. Reported and tested by: pho Reviewed by: rwatson, des MFC after: 1 week
* Do not leak defs_de_interlock on error.kib2008-12-121-1/+3
| | | | Another pointy hat for my collection.
* Implement VOP_VPTOCNP for devfs. Directory and character device vnodes aremarcus2008-12-121-0/+65
| | | | | | | properly translated to their component names. Reviewed by: arch Approved by: kib
* Add a simple VOP_VPTOCNP implementation for deadfs which returns EBADF.marcus2008-12-121-0/+1
| | | | | Reviewed by: arch Approved by: kib
* Relock user map earlier, to have the lock held when break leaves thekib2008-12-101-2/+1
| | | | | | | loop earlier due to sbuf error. Pointy hat to: me Submitted by: dchagin
* Make two style changes to create new commit and document proper commitkib2008-12-081-1/+1
| | | | | | | | | | | | | | | | | | message for r185765. Noted by: rdivacky Requested by: des Commit message for r185765 should be: In procfs map handler, and in linprocfs maps handler, do not call vn_fullpath() while having vm map locked. This is done in anticipation of the vop_vptocnp commit, that would make vn_fullpath sometime acquire vnode lock. Also, in linprocfs, maps handler already acquires vnode lock. No objections from: des MFC after: 2 week
* Change the linprocfs <pid>/maps and procfs <pid>/map handlers to usekib2008-12-081-9/+28
| | | | | | | | | | | | sbuf instead of doing uiomove. This allows for reads from non-zero offsets to work. Patch is forward-ported des@' one, and was adopted to current code by dchagin@ and me. Reviewed by: des (linprocfs part) PR: kern/101453 MFC after: 1 week
* The timezone byte is a signed value, treat it as such.kientzle2008-11-271-1/+1
| | | | | | | | | Otherwise, time zone information for time zones west of GMT gets discarded. PR: kern/128934 Submitted by: J.R. Oldroyd MFC after: 4 days
* In null_lookup(), do the needed cleanup instead of panicing sayingkib2008-11-261-5/+4
| | | | | | | | the cleanup is needed. Reported by: kris, pho Tested by: pho MFC after: 2 weeks
* - Support IEEE_P1282 and IEEE_1282 tags in the rock ridge extensions record.lulf2008-11-261-2/+6
| | | | | PR: kern/128942 Submitted by: "J.R. Oldroyd" <fbsd - at - opal.com>
* Simplify mode_t check treatment (suggested by trasz).daichi2008-11-251-39/+2
| | | | | | | By semantical view, trasz's code is better than prior one. Submitted by: trasz Reviewed by: Masanori OZAWA <ozawa@ongs.co.jp>
* Fixes Unionfs socket issue reported as kern/118346.daichi2008-11-253-39/+191
| | | | | | | | PR: 118346 Submitted by: Masanori OZAWA <ozawa@ongs.co.jp> Discussed at: devsummit Strassburg, EuroBSDCon2008 Discussed with: rwatson, gnn, hrs MFC after: 2 week
* - Fix a typo in a comment.jhb2008-11-183-9/+5
| | | | | | - Whitespace fix. - Remove #if 0'd BSD 4.x code for flushing busy buffers from a mountpoint during an unmount. FreeBSD uses vflush() for this.
* When looking up the vnode for the device to mount the filesystem on,jhb2008-11-181-12/+8
| | | | | | ask NDINIT to return a locked vnode instead of letting it drop the lock and return a referenced vnode and then relock the vnode a few lines down. This matches the behavior of other filesystem mount routines.
* Remove copy/paste code from UFS to handle sparse blocks. While Rockjhb2008-11-181-6/+0
| | | | | Ridge does support sparse files, the cd9660 code does not currently support them.
* Remove unused i_flags field and IN_ACCESS flag from cd9660 in-memoryjhb2008-11-183-6/+0
| | | | i-nodes. cd9660 doesn't support access times.
* Remove unnecessary locking around vn_fullpath(). The vnode lock for thejhb2008-11-042-11/+6
| | | | | | | | | | | | | | | | vnode in question does not need to be held. All the data structures used during the name lookup are protected by the global name cache lock. Instead, the caller merely needs to ensure a reference is held on the vnode (such as vhold()) to keep it from being freed. In the case of procfs' <pid>/file entry, grab the process lock while we gain a new reference (via vhold()) on p_textvp to fully close races with execve(2). For the kern.proc.vmmap sysctl handler, use a shared vnode lock around the call to VOP_GETATTR() rather than an exclusive lock. MFC after: 1 month
* Don't pass WANTPARENT to the pathname lookup of the mount point for ajhb2008-11-041-4/+1
| | | | | unionfs mount just so we can immediately drop the reference on the parent directory vnode without using it.
* Fix few missed accmode changes in coda.trasz2008-11-033-5/+7
| | | | Approved by: rwatson (mentor)
OpenPOWER on IntegriCloud