summaryrefslogtreecommitdiffstats
path: root/sys/fs
Commit message (Collapse)AuthorAgeFilesLines
* Fix and speedup timestamp calculations which is roughly based on the patch inmarkus2008-05-161-22/+34
| | | | | | | | | | | | | | | | | | | | the mentioned PR: - bounds check time->month as it is used as an array index - fix usage of time->month as array index (month is 1-12) - fix calculation based on time->day (day is 1-31) - fix the speedup code as it doesn't calculate correct timestamps before the year 2000 and reduce the number of calculation in the year-by-year code - speedup month calculations by replacing the array content with cumulative values - add microseconds calculation - fix an endian problem PR: kern/97786 Submitted by: Andriy Gapon <avg@topspin.kiev.ua> Reviewed by: scottl (earlier version) Approved by: emax (mentor) MFC after: 1 week
* lockinit() can't accept LK_EXCLUSIVE as an initializaiton flag, so justattilio2008-05-151-1/+1
| | | | | | | drop it. Reported by: Josh Carroll <josh dot carroll at gmail dot com> Submitted by: jhb
* Don't explicitly drop Giant around d_open/d_fdopen/d_close for MPSAFEjhb2008-05-071-20/+5
| | | | | | | | drivers. Since devfs is already marked MPSAFE it shouldn't be held anyway. MFC after: 2 weeks Discussed with: phk
* - change function name from *_vdir to *_vnode becausedaichi2008-05-071-21/+33
| | | | | | | | | | VSOCK has been added as cache target. Now they process not only VDIR but also VSOCK. - fixed panic issue caused by cache incorrect free process by "umount -f" Submitted by: Masanori OZAWA <ozawa@ongs.co.jp> MFC after: 1 week
* o Fixed multi thread access issue reported by Alexander V. Chernikovdaichi2008-04-253-12/+13
| | | | | | | | | | (admin@su29.net) fixed: kern/109950 PR: kern/109950 Submitted by: Alexander V. Chernikov (admin@su29.net) Reviewed by: Masanori OZAWA (ozawa@ongs.co.jp) MFC after: 1 week
* o Improved unix socket connection issuedaichi2008-04-251-13/+28
| | | | | | | | fixed: kern/118346 PR: kern/118346 Submitted by: Masanori OZAWA (ozawa@ongs.co.jp) MFC after: 1 week
* o Fixed rename panic issuedaichi2008-04-251-11/+14
| | | | | Submitted by: Masanori OZAWA (ozawa@ongs.co.jp) MFC after: 1 week
* o Fixed inaccessible issue especially including devfs on unionfs case.daichi2008-04-252-8/+187
| | | | | | | | fixed also: kern/117829 PR: kern/117829 Submitted by: Masanori OZAWA (ozawa@ongs.co.jp) MFC after: 1 week
* o Added system hang-up process when VOP_READDIR of unionfs_nodeget()daichi2008-04-251-1/+7
| | | | | | | | returns not end of the file status on debug mode (DIAGNOSTIC defined) kernel. Submitted by: Masanori OZAWA (ozawa@ongs.co.jp) MFC after: 1 week
* Move the head of byte-level advisory lock list from thekib2008-04-167-77/+4
| | | | | | | | | | | | | | | | | | | | | | filesystem-specific vnode data to the struct vnode. Provide the default implementation for the vop_advlock and vop_advlockasync. Purge the locks on the vnode reclaim by using the lf_purgelocks(). The default implementation is augmented for the nfs and smbfs. In the nfs_advlock, push the Giant inside the nfs_dolock. Before the change, the vop_advlock and vop_advlockasync have taken the unlocked vnode and dereferenced the fs-private inode data, racing with with the vnode reclamation due to forced unmount. Now, the vop_getattr under the shared vnode lock is used to obtain the inode size, and later, in the lf_advlockasync, after locking the vnode interlock, the VI_DOOMED flag is checked to prevent an operation on the doomed vnode. The implementation of the lf_purgelocks() is submitted by dfr. Reported by: kris Tested by: kris, pho Discussed with: jeff, dfr MFC after: 2 weeks
* When calling lf_advlock to unlock a record, make sure that ap->a_fl->l_typedfr2008-04-141-0/+3
| | | | | | is F_UNLCK otherwise we trigger a LOCKF_DEBUG panic. MFC after: 3 days
* Optimize lockmgr in order to get rid of the pool mutex interlock, of theattilio2008-04-061-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | state transitioning flags and of msleep(9) callings. Use, instead, an algorithm very similar to what sx(9) and rwlock(9) alredy do and direct accesses to the sleepqueue(9) primitive. In order to avoid writer starvation a mechanism very similar to what rwlock(9) uses now is implemented, with the correspective per-thread shared lockmgrs counter. This patch also adds 2 new functions to lockmgr KPI: lockmgr_rw() and lockmgr_args_rw(). These two are like the 2 "normal" versions, but they both accept a rwlock as interlock. In order to realize this, the general lockmgr manager function "__lockmgr_args()" has been implemented through the generic lock layer. It supports all the blocking primitives, but currently only these 2 mappers live. The patch drops the support for WITNESS atm, but it will be probabilly added soon. Also, there is a little race in the draining code which is also present in the current CVS stock implementation: if some sharers, once they wakeup, are in the runqueue they can contend the lock with the exclusive drainer. This is hard to be fixed but the now committed code mitigate this issue a lot better than the (past) CVS version. In addition assertive KA_HELD and KA_UNHELD have been made mute assertions because they are dangerous and they will be nomore supported soon. In order to avoid namespace pollution, stack.h is splitted into two parts: one which includes only the "struct stack" definition (_stack.h) and one defining the KPI. In this way, newly added _lockmgr.h can just include _stack.h. Kernel ABI results heavilly changed by this commit (the now committed version of "struct lock" is a lot smaller than the previous one) and KPI results broken by lockmgr_rw() / lockmgr_args_rw() introduction, so manpages and __FreeBSD_version will be updated accordingly. Tested by: kris, pho, jeff, danger Reviewed by: jeff Sponsored by: Google, Summer of Code program 2007
* The temporary workaround for the call to the vget() without lock type inkib2008-04-041-1/+3
| | | | | | | | | the fdesc_allocvp(). The caller of the fdesc_allocvp() expects that the returned vnode is not reclaimed. Do lock the vnode exclusive and drop the lock after. Reported by: pho Reviewed by: jeff
* Add the support for the AT_FDCWD and fd-relative name lookups to thekib2008-03-314-0/+4
| | | | | | | | | namei(9). Based on the submission by rdivacky, sponsored by Google Summer of Code 2007 Reviewed by: rwatson, rdivacky Tested by: pho
* - Simplify null_hashget() and null_hashins() by using vref() ratherjeff2008-03-291-21/+4
| | | | | than a complex series of steps involving vget() without a lock type to emulate the same thing.
* Add the new kernel-mode NFS Lock Manager. To use it instead of thedfr2008-03-262-0/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | user-mode lock manager, build a kernel with the NFSLOCKD option and add '-k' to 'rpc_lockd_flags' in rc.conf. Highlights include: * Thread-safe kernel RPC client - many threads can use the same RPC client handle safely with replies being de-multiplexed at the socket upcall (typically driven directly by the NIC interrupt) and handed off to whichever thread matches the reply. For UDP sockets, many RPC clients can share the same socket. This allows the use of a single privileged UDP port number to talk to an arbitrary number of remote hosts. * Single-threaded kernel RPC server. Adding support for multi-threaded server would be relatively straightforward and would follow approximately the Solaris KPI. A single thread should be sufficient for the NLM since it should rarely block in normal operation. * Kernel mode NLM server supporting cancel requests and granted callbacks. I've tested the NLM server reasonably extensively - it passes both my own tests and the NFS Connectathon locking tests running on Solaris, Mac OS X and Ubuntu Linux. * Userland NLM client supported. While the NLM server doesn't have support for the local NFS client's locking needs, it does have to field async replies and granted callbacks from remote NLMs that the local client has contacted. We relay these replies to the userland rpc.lockd over a local domain RPC socket. * Robust deadlock detection for the local lock manager. In particular it will detect deadlocks caused by a lock request that covers more than one blocking request. As required by the NLM protocol, all deadlock detection happens synchronously - a user is guaranteed that if a lock request isn't rejected immediately, the lock will eventually be granted. The old system allowed for a 'deferred deadlock' condition where a blocked lock request could wake up and find that some other deadlock-causing lock owner had beaten them to the lock. * Since both local and remote locks are managed by the same kernel locking code, local and remote processes can safely use file locks for mutual exclusion. Local processes have no fairness advantage compared to remote processes when contending to lock a region that has just been unlocked - the local lock manager enforces a strict first-come first-served model for both local and remote lockers. Sponsored by: Isilon Systems PR: 95247 107555 115524 116679 MFC after: 2 weeks
* - Complete part of the unfinished bufobj work by consistently usingjeff2008-03-221-0/+4
| | | | | | | | | | | | | | | | | BO_LOCK/UNLOCK/MTX when manipulating the bufobj. - Create a new lock in the bufobj to lock bufobj fields independently. This leaves the vnode interlock as an 'identity' lock while the bufobj is an io lock. The bufobj lock is ordered before the vnode interlock and also before the mnt ilock. - Exploit this new lock order to simplify softdep_check_suspend(). - A few sync related functions are marked with a new XXX to note that we may not properly interlock against a non-zero bv_cnt when attempting to sync all vnodes on a mountlist. I do not believe this race is important. If I'm wrong this will make these locations easier to find. Reviewed by: kib (earlier diff) Tested by: kris, pho (earlier diff)
* Do not dereference cdev->si_cdevsw, use the dev_refthread() to properlykib2008-03-201-5/+12
| | | | | | | | obtain the reference. In particular, this fixes the panic reported in the PR. Remove the comments stating that this needs to be done. PR: kern/119422 MFC after: 1 week
* Remove kernel support for M:N threading.jeff2008-03-124-21/+10
| | | | | | | | While the KSE project was quite successful in bringing threading to FreeBSD, the M:N approach taken by the kse library was never developed to its full potential. Backwards compatibility will be provided via libmap.conf for dynamically linked binaries and static binaries will be broken.
* Replace lockmgr lock protecting nwfs vnode hash table with an sx lock.rwatson2008-03-021-12/+15
| | | | MFC after: 1 month
* Replace lockmgr lock protecting smbfs node hash table with sx lock.rwatson2008-03-023-9/+10
| | | | MFC after: 1 month
* - Handle buffer lock waiters count directly in the buffer cache insteadattilio2008-03-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | than rely on the lockmgr support [1]: * bump the waiters only if the interlock is held * let brelvp() return the waiters count * rely on brelvp() instead than BUF_LOCKWAITERS() in order to check for the waiters number - Remove a namespace pollution introduced recently with lockmgr.h including lock.h by including lock.h directly in the consumers and making it mandatory for using lockmgr. - Modify flags accepted by lockinit(): * introduce LK_NOPROFILE which disables lock profiling for the specified lockmgr * introduce LK_QUIET which disables ktr tracing for the specified lockmgr [2] * disallow LK_SLEEPFAIL and LK_NOWAIT to be passed there so that it can only be used on a per-instance basis - Remove BUF_LOCKWAITERS() and lockwaiters() as they are no longer used This patch breaks KPI so __FreBSD_version will be bumped and manpages updated by further commits. Additively, 'struct buf' changes results in a disturbed ABI also. [2] Really, currently there is no ktr tracing in the lockmgr, but it will be added soon. [1] Submitted by: kib Tested by: pho, Andrea Barberio <insomniac at slackware dot it>
* Rename fdescfs vnode from "fdesc" to "fdescfs" to avoid name collisionkib2008-02-261-1/+1
| | | | | of the vnode lock with the fdesc_mtx mutex. Having different kinds of locks with the same name confuses witness.
* Add "Make MPSAFE" to the Coda todo list.rwatson2008-02-261-0/+1
| | | | MFC after: 3 days
* Axe the 'thread' argument from VOP_ISLOCKED() and lockstatus() as it isattilio2008-02-258-41/+40
| | | | | | | | | always curthread. As KPI gets broken by this patch, manpages and __FreeBSD_version will be updated by further commits. Tested by: Andrea Barberio <insomniac at slackware dot it>
* Introduce some functions in the vnode locks namespace and in the ffsattilio2008-02-243-3/+3
| | | | | | | | | | | | | | | namespace in order to handle lockmgr fields in a controlled way instead than spreading all around bogus stubs: - VN_LOCK_AREC() allows lock recursion for a specified vnode - VN_LOCK_ASHARE() allows lock sharing for a specified vnode In FFS land: - BUF_AREC() allows lock recursion for a specified buffer lock - BUF_NOREC() disallows recursion for a specified buffer lock Side note: union_subr.c::unionfs_node_update() is the only other function directly handling lockmgr fields. As this is not simple to fix, it has been left behind as "sole" exception.
* Don't check the bpbSecPerTrack and bpbHeads fields of the BPB.marcel2008-02-211-8/+7
| | | | | They are typically 0 on new ia64 systems. Since we don't use either field, there's no harm in not checking.
* Remove custom queue macros in Coda, replacing them with queue(9) tailqrwatson2008-02-174-105/+30
| | | | | | | | macros. The only semantic change was the need to add a vc_opened field to struct vcomm since we can no longer use the request queue returning to an uninitialized state to hold whether or not the device is open. MFC after: 1 month
* Remove namecache performance-tuning todo for Coda: we now use the FreeBSDrwatson2008-02-171-1/+0
| | | | | | name cache. MFC after: 1 month
* The possibly interruptible msleep in coda_call() means well, but isrwatson2008-02-151-1/+1
| | | | | | | | | | | | fundamentally fairly confused about how signals work and when it is appropriate for upcalls to be interrupted. In particular, we should be exempting certain upcalls from interruption, we should not always eventually time out sleeping on a upcall, and we should not be interrupting the sleep for certain signals that we currently are (including SIGINFO). This code needs to be reworked in the style of NFS interruptible mounts. MFC after: 1 month
* Spell replys as replies.rwatson2008-02-152-8/+8
| | | | MFC after: 1 month
* Reorder and clean up make_coda_node(), annotate weaknesses in therwatson2008-02-151-20/+25
| | | | | | implementation. MFC after: 1 month
* Remove debugging code under OLD_DIAGNOSTIC; this is all >10 years old andrwatson2008-02-142-32/+3
| | | | | | hasn't been used in that time. MFC after: 1 month
* In Coda, flush the attribute cache for a cnode when its fid isrwatson2008-02-141-1/+4
| | | | | | | changed, as its synthesized inode number may have changed and we want stat(2) to pick up the new inode number. MFC after: 1 month
* Update cache flushing behavior in light of recent namecache andrwatson2008-02-131-7/+0
| | | | | | | | | | | | | access cache improvements: - Flush just access control state on CODA_PURGEUSER, not the full namecache for /coda. - When replacing a fid on a cnode as a result of, e.g., reintegration after offline operation, we no longer need to purge the namecache entries associated with its vnode. MFC after: 1 month
* Implement a rudimentary access cache for the Coda kernel module,rwatson2008-02-133-28/+117
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | modeled on the access cache found in NFS, smbfs, and the Linux coda module. This is a positive access cache of a single entry per file, tracking recently granted rights, but unlike NFS and smbfs, supporting explicit invalidation by the distributed file system. For each cnode, maintain a C_ACCCACHE flag indicating the validity of the cache, and a cached uid and mode tracking recently granted positive access control decisions. Prefer the cache to venus_access() in VOP_ACCESS() if it is valid, and when we must fall back to venus_access(), update the cache. Allow Venus to clear the access cache, either the whole cache on CODA_FLUSH, or just entries for a specific uid on CODA_PURGEUSER. Unlike the Coda module on Linux, we don't flush all entries on a user purge using a generation number, we instead walk present cnodes and clear only entries for the specific user, meaning it is somewhat more expensive but won't hit all users. Since the Coda module is agressive about not keeping around unopened cnodes, the utility of the cache is somewhat limited for files, but works will for directories. We should make Coda less agressive about GCing cnodes in VOP_INACTIVE() in order to improve the effectiveness of in-kernel caching of attributes and access rights. MFC after: 1 month
* Remove now-unused Coda namecache.rwatson2008-02-132-905/+0
| | | | MFC after: 1 month
* Rather than having the Coda module use its own namecache, use the globalrwatson2008-02-136-165/+112
| | | | | | | | | | | | | | | | | VFS namecache, as is done by the Coda module on Linux. Unlike the Coda namecache, the global VFS namecache isn't tagged by credential, so use ore conservative flushing behavior (for now) when CODA_PURGEUSER is issued by Venus. This improves overall integration with the FreeBSD VFS, including allowing __getcwd() to work better, procfs/procstat monitoring, and so on. This improves shell behavior in many cases, and improves ".." handling. It may lead to some slowdown until we've implemented a specific access cache, which should net improve performance, but in the mean time, lookup access control now always goes to Venus, whereas previously it didn't. MFC after: 1 month
* Fix a lock leak in the ntfs locking scheme:attilio2008-02-131-1/+1
| | | | | | | | | When ntfs_ntput() reaches 0 in the refcount the inode lockmgr is not released and directly destroyed. Fix this by unlocking the lockmgr() even in the case of zero-refcount. Reported by: dougb, yar, Scot Hetzel <swhetzel at gmail dot com> Submitted by: yar
* Clean up coda_pathconf() slightly while debugging a problem there.rwatson2008-02-111-11/+7
| | | | MFC after: 1 month
* Since we're now actively maintaining the Coda module in the FreeBSD sourcerwatson2008-02-1018-3954/+4002
| | | | | | | | | | | tree, restyle everything but coda.h (which is more explicitly shared across systems) into a closer approximation to style(9). Remove a few more unused function prototypes. Add or clarify some comments. MFC after: 1 month
* Various further non-functional cleanups to coda:rwatson2008-02-0910-104/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | - Rename print_vattr to coda_print_vattr and make static, rename print_cred to coda_print_cred. - Remove unused coda_vop_nop. - Add XXX comment because coda_readdir forwards to the cache vnode's readdir rather than venus_readdir, and annotate venus_readdir as unused. - Rename vc_nb_* to vc_*. - Use d_open_t, d_close_t, d_read_t, d_write_t, d_ioctl_t and d_poll_t for prototyping vc_* as that is the intent, don't use our own definitions. - Rename coda_nb_statfs to coda_statfs, rename NB_SFS_SIZ to CODA_SFS_SIZ. - Replace one more OBE reference to NetBSD with a reference to FreeBSD. - Tidy up a little vertical whitespace here and there. - Annotate coda_nc_zapvnode as unused. - Remove unused vcodattach. - Annotate VM_INTR as unused. - Annotate that coda_fhtovp is unused and doesn't match the FreeBSD prototype, so isn't hooked up to vfs_fhtovp. If we want NFS export of Coda to work someday, this needs to be fixed. - Remove unused getNewVnode. - Remove unused coda_vget, coda_init, coda_quotactl prototypes. MFC after: 1 month
* No reason not to maintain stats on statfs in Coda, as it's done forrwatson2008-02-091-3/+3
| | | | | | other VFS operations, so uncomment the existing statistics gathering. MFC after: 1 month
* Remove unused devtomp(), which exploited UFS-specific knowledge to findrwatson2008-02-092-24/+0
| | | | | | | | the mountpoint for a specific device. This was implemented incorrectly, a bad idea in a fundamental sense, and also never used, so presumably a long-idle debugging function. MFC after: 1 month
* Since Coda is effectively a stacked file system, use VOP_EOPNOTSUPPrwatson2008-02-092-38/+1
| | | | | | | | for vop_bmap; delete the existing stub that returned either EINVAL or EOPNOTSUPP, and had unreachable calls to VOP_BMAP on the cache vnode. MFC after: 1 month
* Lock cache vnode when VOP_FSYNC() is called on a Coda vnode.rwatson2008-02-091-2/+5
| | | | MFC after: 1 month
* Make all calls to vn_lock() in Coda, including recently added ones,rwatson2008-02-092-7/+7
| | | | | | | use LK_RETRY, since failure is undesirable (and not handled). MFC after: 1 month Pointed out by: kib
* The Coda module was originally ported to NetBSD from Mach by rvb, andrwatson2008-02-086-13/+16
| | | | | | | | | | then later to FreeBSD. Update various NetBSD-related comments: in some cases delete them because they don't appply, in others update to say FreeBSD as they still apply but in FreeBSD (and might for that matter no longer apply on NetBSD), and flag one case where I'm not sure whether it applies. MFC after: 1 month
* Before invoking vnode operations on cache vnodes, acquire the vnoderwatson2008-02-081-1/+9
| | | | | | | | | | | | | | | | | | locks of those vnodes. Probably, Coda should do the same lock sharing/ pass-through that is done for nullfs, but in the mean time this ensures that locks are adequately held to prevent corruption of data structures in the cache file system. Assuming most operations came from the top layer of Coda and weren't performed directly on the cache vnodes, in practice this corruption was relatively unlikely as the Coda vnode locks were ensuring exclusive access for most consumers. This causes WITNESS to squeal like a pig immediately when Coda is used, rather than waiting until file close; I noticed these problems because of the lack of said squealing. MFC after: 1 month
* Remove undefined coda excluded by #if 1 #else, which previously protectedrwatson2008-02-081-12/+0
| | | | | | | vget() calls using inode numbers to query the root of /coda, which is not needed since we now cache the root vnode with the mountpoint. MFC after: 1 month
OpenPOWER on IntegriCloud