summaryrefslogtreecommitdiffstats
path: root/sys/ufs
Commit message (Collapse)AuthorAgeFilesLines
* New option: NO_FFS_SNAPSHOT. I did this in p4 about the same timeimp2006-01-061-0/+58
| | | | | | | that NetBSD implemented it independently of them (don't know which one was actually first). This saves about 24k for those times you don't need snapshot support (like when running off a ram disk, or in an embedded environment where size matters).
* Typo.delphij2005-12-231-1/+1
|
* Eradicate caddr_t from the VFS API.des2005-12-143-15/+15
|
* Fix parsing of atime, clusterr, clusterw, exec, suid, symfollowrodrigc2005-11-241-4/+4
| | | | | | mount options. Noticed by: Amir Shalem < amir at boom dot org dot il>
* If export mount flag is not passed in, set default parametersrodrigc2005-11-201-1/+13
| | | | | | | for export structure and pass that to vfs_export(). Currently in userland mount(8), an export structure is unconditionally passed in, only for UFS. This is an attempt to move that UFS-specific behavior out of mount(8) and into the UFS filesystem code.
* Add more options to ffs_opts, so that vfs_filteropts() will notrodrigc2005-11-191-2/+3
| | | | | complain when we pass these options to a UFS filesystem as strings via nmount(): noexec, nosuid, nosymfollow, sync, suiddir
* - Add parsing for the following existing UFS/FFS mount options in the nmount()rodrigc2005-11-181-1/+33
| | | | | | | | | | callpath via vfs_getopt(), and set the appropriate MNT_* flag: -> acls, async, force, multilabel, noasync, noatime, -> noclusterr, noclusterw, snapshot, update - Allow errmsg as a valid mount option via vfs_getopt(), so we can later add a hook to propagate mount errors back to userspace via vfs_mount_error().
* Slightly reorganize to reduce duplicated code.delphij2005-11-071-2/+1
| | | | Reviewed by: rwatson
* Rate limit filesystem full and out of inodes messages to once aps2005-10-311-6/+21
| | | | second.
* Normalize a significant number of kernel malloc type names:rwatson2005-10-313-3/+3
| | | | | | | | | | | | | | | | | | | - Prefer '_' to ' ', as it results in more easily parsed results in memory monitoring tools such as vmstat. - Remove punctuation that is incompatible with using memory type names as file names, such as '/' characters. - Disambiguate some collisions by adding subsystem prefixes to some memory types. - Generally prefer lower case to upper case. - If the same type is defined in multiple architecture directories, attempt to use the same name in additional cases. Not all instances were caught in this change, so more work is required to finish this conversion. Similar changes are required for UMA zone names.
* Remove an unneeded "a" from comment.delphij2005-10-251-1/+1
|
* Adjust maxfilesize for UFS1 and old 4.4 FFS. For UFS1, increase the limitnjl2005-10-211-2/+2
| | | | | | | | | to (max block - 1) * bsize. For DEV_BSIZE, this doubles the limit from 0.5 TB to 1 TB. For the old 4.4 FFS case, decrease the limit from 0.5 TB to 2 GB - 1. Older systems had a 32 bit off_t so they couldn't access the larger files anyway. Collaboration with: bde
* Correct the type of the temporary variable used by ufs_lookup.c:1.78truckman2005-10-161-1/+1
| | | | | | | to fix the race condition in the ufs_lookup() ISDOTDOT code. Noticed by: bde MFC after: 12 days
* Close a race in the ufs_lookup() code that handles the ISDOTDOTtruckman2005-10-141-1/+3
| | | | | | | | | | | | | | | | | | | | | | case by saving the value of dp->i_ino before unlocking the vnode for the current directory and passing the saved value to VFS_VGET(). Without this change, another thread can overwrite dp->i_ino after the current directory is unlocked, causing ufs_lookup() to lock and return the wrong vnode in place of the vnode for its parent directory. A deadlock can occur if dp->i_ino was changed to a subdirectory of the current directory because the root to leaf vnode lock ordering will be violated. A vnode lock can be leaked if dp->i_ino was changed to point to the current directory, which causes the current vnode lock for the current directory to be recursed, which confuses lookup() into calling vrele() when it should be calling vput(). The probability of this bug being triggered seems to be quite low unless the sysctl variable debug.vfscache is set to 0. Reviewed by: jhb MFC after: 2 weeks
* When performing a VOP_LOOKUP() as part of UFS1 extended attributerwatson2005-10-121-0/+1
| | | | | | | | | | | | | auto-start, set cnp.cn_lkflags to LK_EXCLUSIVE. This flag must now be set so that lockmgr knows what kind of lock to acquire, and it will panic if not specified. This resulted in a panic when using extended attributes on UFS1 as of locking work present in the 6.x branch. This is a RELENG_6_0 merge candidate. Reported by: lofi MFC after: 3 days
* Move execve's access time update functionality into a newdds2005-10-121-3/+3
| | | | | | | | vfs_mark_atime() function, and use the new function for performing efficient atime updates in mmap(). Reviewed by: bde MFC after: 2 weeks
* Avoid unintended VMIO on directories and symlinks due to leftover objecttegge2005-10-101-0/+1
| | | | not having been destroyed.
* Adjust totread argument passed to cluster_read() to account for offset nottegge2005-10-091-1/+1
| | | | being block aligned.
* Don't pretend that a failed sync write was succesful.tegge2005-10-091-3/+1
|
* Reduce probability for a deadlock that can occur when a snapshot inode istegge2005-10-091-0/+11
| | | | | | | | | | | | | | updated by a process holding the snapshot lock. Another process updating a different inode in the same inodeblock will do copy on write checks and lock in the opposite direction. The snapshot code force a copy on write of these blocks manually (cf. start of expunge_ufs[12]) and these inode blocks are later put on snapblklist. This partial fix is to 'drain' the relevant ffs_copyonwrite() operation after installing new snapblklist. This is not a 100% solution since a failed block allocation can cause implicit fsync() which might deadlock before the new snapblklist has been installed.
* Eliminate a deadlock that can occur when a dirty block belonging to a snapshottegge2005-10-091-0/+2
| | | | | | file is flushed by a process not holding snaplk (e.g. bufdaemon). Another process might hold snaplk and try to access the block due to ffs_copyonwrite processing.
* Eliminate a deadlock that can occur during the cgaccount() processing due totegge2005-10-091-3/+2
| | | | | | | | | | | | the cg map buffer being held when writing indirect blocks. The process ends up in ffs_copyonwrite(), attempting to get snaplk while holding the cg map buffer lock. Another process might be in ffs_copyonwrite(), trying to allocate a new block for a copy. It would hold snaplk while trying to get the cg map buffer lock. Release the cg map buffer early and use the copy for most of the cgaccount processing to avoid this deadlock.
* Reduce the probability of low block numbers passed to ffs_snapblkfree() bytegge2005-10-091-55/+35
| | | | | | | | | | | skipping the call from ffs_snapremove() if the block number is zero. Simplify snapshot locking in ffs_copyonwrite() and ffs_snapblkfree() by using the same locking protocol for low block numbers as for larger block numbers. This removes a lock leak that could happen if vn_lock() succeeded after lockmgr() failed in ffs_snapblkfree(). Check if snapshot is gone before retrying a lock in ffs_copyonwrite().
* Reinitialize v_type and v_op fields in case vnode has been reused withouttegge2005-10-091-0/+5
| | | | | | reclamation. If the vnode previously was a fifo then v_op would point to ffs_fifoops[12] instead of the expected ffs_vnodeops[12], causing a panic at the end of ffsext_strategy.
* Initialize the inode i_flag field in ffs_valloc() to clean up anytruckman2005-10-031-0/+1
| | | | | | | | | | | | | | | | | stale flag bits left over from before the inode was recycled. Without this change, a leftover IN_SPACECOUNTED flag could prevent softdep_freefile() and softdep_releasefile() from incrementing fs_pendinginodes. Because handle_workitem_freefile() unconditionally decrements fs_pendinginodes, a negative value could be reported at file system unmount time with a message like: unmount pending error: blocks 0 files -3 The pending block count in fs_pendingblocks could also be negative for similar reasons. These errors can cause the data returned by statfs() to be slightly incorrect. Some other cleanup code in softdep_releasefile() could also be incorrectly bypassed. MFC after: 3 days
* Correct previous commit to fix the sense of the TDP_NORUNNINGBUFtruckman2005-10-011-1/+1
| | | | | | | | | check in ffs_copyonwrite() that is a precondition for calling waitrunningbufspace(). Pointed out by: tegge Pointy hat to: truckman MFC after: 3 days
* Un-staticize waitrunningbufspace() and call it before returning fromtruckman2005-09-301-1/+13
| | | | | | | ffs_copyonwrite() if any async writes were launched. Restore the threads previous TDP_NORUNNINGBUF state before returning from ffs_copyonwrite().
* Un-staticize runningbufwakeup() and staticize updateproc.truckman2005-09-301-4/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a new private thread flag to indicate that the thread should not sleep if runningbufspace is too large. Set this flag on the bufdaemon and syncer threads so that they skip the waitrunningbufspace() call in bufwrite() rather than than checking the proc pointer vs. the known proc pointers for these two threads. A way of preventing these threads from being starved for I/O but still placing limits on their outstanding I/O would be desirable. Set this flag in ffs_copyonwrite() to prevent bufwrite() calls from blocking on the runningbufspace check while holding snaplk. This prevents snaplk from being held for an arbitrarily long period of time if runningbufspace is high and greatly reduces the contention for snaplk. The disadvantage is that ffs_copyonwrite() can start a large amount of I/O if there are a large number of snapshots, which could cause a deadlock in other parts of the code. Call runningbufwakeup() in ffs_copyonwrite() to decrement runningbufspace before attempting to grab snaplk so that I/O requests waiting on snaplk are not counted in runningbufspace as being in-progress. Increment runningbufspace again before actually launching the original I/O request. Prior to the above two changes, the system could deadlock if enough I/O requests were blocked by snaplk to prevent runningbufspace from falling below lorunningspace and one of the bawrite() calls in ffs_copyonwrite() blocked in waitrunningbufspace() while holding snaplk. See <http://www.holm.cc/stress/log/cons143.html>
* After a rmdir()ed directory has been truncated, force an update oftruckman2005-09-291-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | the directory's inode after queuing the dirrem that will decrement the parent directory's link count. This will force the update of the parent directory's actual link to actually be scheduled. Without this change the parent directory's actual link count would not be updated until ufs_inactive() cleared the inode of the newly removed directory, which might be deferred indefinitely. ufs_inactive() will not be called as long as any process holds a reference to the removed directory, and ufs_inactive() will not clear the inode if the link count is non-zero, which could be the result of an earlier system crash. If a background fsck is run before the update of the parent directory's actual link count has been performed, or at least scheduled by putting the dirrem on the leaf directory's inodedep id_bufwait list, fsck will corrupt the file system by decrementing the parent directory's effective link count, which was previously correct because it already took the removal of the leaf directory into account, and setting the actual link count to the same value as the effective link count after the dangling, removed, leaf directory has been removed. This happens because fsck acts based on the actual link count, which will be too high when fsck creates the file system snapshot that it references. This change has the fortunate side effect of more quickly cleaning up the large number dirrem structures that linger for an extended time after the removal of a large directory tree. It also fixes a potential problem with the shutdown of the syncer thread timing out if the system is rebooted immediately after removing a large directory tree. Submitted by: tegge MFC after: 3 days
* Back out alpha/alpha/trap.c:1.124, osf1_ioctl.c:1.14, osf1_misc.c:1.57,rwatson2005-09-281-6/+0
| | | | | | | | | | | | | | | | | | | | osf1_signal.c:1.41, amd64/amd64/trap.c:1.291, linux_socket.c:1.60, svr4_fcntl.c:1.36, svr4_ioctl.c:1.23, svr4_ipc.c:1.18, svr4_misc.c:1.81, svr4_signal.c:1.34, svr4_stat.c:1.21, svr4_stream.c:1.55, svr4_termios.c:1.13, svr4_ttold.c:1.15, svr4_util.h:1.10, ext2_alloc.c:1.43, i386/i386/trap.c:1.279, vm86.c:1.58, unaligned.c:1.12, imgact_elf.c:1.164, ffs_alloc.c:1.133: Now that Giant is acquired in uprintf() and tprintf(), the caller no longer leads to acquire Giant unless it also holds another mutex that would generate a lock order reversal when calling into these functions. Specifically not backed out is the acquisition of Giant in nfs_socket.c and rpcclnt.c, where local mutexes are held and would otherwise violate the lock order with Giant. This aligns this code more with the eventual locking of ttys. Suggested by: bde
* Use the refcount API to manage the reference count for user credentialsjhb2005-09-271-2/+3
| | | | | | rather than using pool mutexes. Tested on: i386, alpha, sparc64
* Restore a historical ufs_inactive behavior that has been changeddelphij2005-09-231-1/+1
| | | | | | | | | | | | | | | | | | | in rev. 1.40 of ufs_inode.c, which allows an inode being truncated even when the filesystem itself is marked RDONLY. A subsequent call of UFS_TRUNCATE (ffs_truncate) would panic the system as it asserts that it can only be called when the filesystem is mounted read-write (same changeset, rev. 1.74 of sys/ufs/ffs/ffs_inode.c). Because ffs_mount() already takes care of sync'ing the filesystem to disk before being downgraded to readonly, it appears to be more desirable that we should not permit this sort of writes to disk. This change would fix a panic that occours when read-only mounted a corrupted filesystem and doing some file operations. MT6/5/4 candidate Reviewed by: mckusick
* Add GIANT_REQUIRED and WITNESS sleep warnings to uprintf() and tprintf(),rwatson2005-09-191-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | as they both interact with the tty code (!MPSAFE) and may sleep if the tty buffer is full (per comment). Modify all consumers of uprintf() and tprintf() to hold Giant around calls into these functions. In most cases, this means adding an acquisition of Giant immediately around the function. In some cases (nfs_timer()), it means acquiring Giant higher up in the callout. With these changes, UFS no longer panics on SMP when either blocks are exhausted or inodes are exhausted under load due to races in the tty code when running without Giant. NB: Some reduction in calls to uprintf() in the svr4 code is probably desirable. NB: In the case of nfs_timer(), calling uprintf() while holding a mutex, or even in a callout at all, is a bad idea, and will generate warnings and potential upset. This needs to be fixed, but was a problem before this change. NB: uprintf()/tprintf() sleeping is generally a bad ideas, as is having non-MPSAFE tty code. MFC after: 1 week
* Giant is no longer needed here.tegge2005-09-121-3/+0
|
* Convert the primary ACL allocator from malloc(9) to using a UMA zone instead.csjp2005-09-061-19/+19
| | | | | | | | Also introduce an aclinit function which will be used to create the UMA zone for use by file systems at system start up. MFC after: 1 month Discussed with: rwatson
* Retain generation count when writing zeroes instead of an inode to disk.tegge2005-09-051-4/+42
| | | | | | | | | Don't free a struct inodedep if another process is allocating saved inode memory for the same struct inodedep in initiate_write_inodeblock_ufs[12](). Handle disappearing dependencies in softdep_disk_io_initiation(). Reviewed by: mckusick
* ffs_mountfs() needs devvp to be locked, so lock it.ssouhlal2005-09-021-5/+3
| | | | | | Glanced at by: phk Tested by: pjd MFC after: 3 days
* Set the mountpoint path in the superblock (fs_fsmnt) at mount-timessouhlal2005-08-211-1/+2
| | | | | so that it appears in the various messages (not cleanly unmounted, filesystem full, etc). This has been broken since rev 1.261.
* Don't set the COMPLETE flag in an inodedep structure before the relatedtegge2005-08-211-1/+1
| | | | inode has been written.
* In the ufsdirhash_build() failure case for corrupted directoriesiedowse2005-08-171-2/+3
| | | | | | | | | or unreadable blocks, make sure to destroy the mutex we created. Also fix an unrelated typo in a comment. Found by: Peter Holm's stress tests Reviewed by: dwmalone MFC after: 3 days
* Delay freeing disk space for file system blocks until all dirty buffersups2005-07-312-0/+20
| | | | | | | | | are safely released. This fixes softdep problems on truncation (deletion) of files with dirty buffers. Reviewed by: jeff@, mckusick@, ps@, tegge@ Tested by: glebius@, ps@ MFC after: 3 weeks
* Eliminate inconsistency in the setting of the B_DONE flag. Specifically,alc2005-07-201-1/+1
| | | | | | | | | | | | | | | | make the b_iodone callback responsible for setting it if it is needed. Previously, it was set unconditionally by bufdone() without holding whichever lock is shared by the b_iodone callback and the corresponding top-half function. Consequently, in a race, the top-half function could conclude that operation was done before the b_iodone callback finished. See, for example, aio_physwakeup() and aio_fphysio(). Note: I don't believe that the other, more widely-used b_iodone callbacks are affected. Discussed with: jeff Reviewed by: phk MFC after: 2 weeks
* Allow EVFILT_VNODE events to work on every filesystem type, not justssouhlal2005-06-092-129/+2
| | | | | | | | | | | | | | | UFS by: - Making the pre and post hooks for the VOP functions work even when DEBUG_VFS_LOCKS is not defined. - Moving the KNOTE activations into the corresponding VOP hooks. - Creating a MNTK_NOKNOTE flag for the mnt_kern_flag field of struct mount that permits filesystems to disable the new behavior. - Creating a default VOP_KQFILTER function: vfs_kqfilter() My benchmarks have not revealed any performance degradation. Reviewed by: jeff, bde Approved by: rwatson, jmg (kqueue changes), grehan (mentor)
* This patch addresses a standards violation issue. The standards say akensmith2005-05-311-0/+11
| | | | | | | | | | | | | | | | | | | | | | file's access time should be updated when it gets executed. A while ago the mechanism used to exec was changed to use a more mmap based mechanism and this behavior was broken as a side-effect of that. A new vnode flag is added that gets set when the file gets executed, and the VOP_SETATTR() vnode operation gets called. The underlying filesystem is expected to handle it based on its own semantics, some filesystems don't support access time at all. Those that do should handle it in a way that does not block, does not generate I/O if possible, etc. In particular vn_start_write() has not been called. The UFS code handles it the same way as it would normally handle the access time if a file was read - the IN_ACCESS flag gets set in the inode but no other action happens at this point. The actual time update will happen later during a sync (which handles all the necessary locking). Got me into this: cperciva Discussed with: a lot with bde, a little with kan Showed patches to: phk, jeffr, standards@, arch@ Minor discussion on: arch@
* - Don't set our bio op to be a READ when we've just completed a write. Therejeff2005-05-301-10/+10
| | | | | | | | | are subtle differences in the read and write completion path. Instead, grab an extra write ref so the write path can drop it when we recursively call bufdone(). I believe this may be the source of the wrong bufobj panics. Reported by: pho, kkenn
* Allow removal of empty directories with high link counts. These canmckusick2005-05-181-3/+2
| | | | | | | | | occur on a filesystem running with soft updates after a crash and before a background fsck has been run. To prevent discrepancies from arising in a background fsck that may already be running, the directory is removed but its inode is not freed and is left with the residual reference count. When encountered by the background fsck it will be reclaimed.
* - Don't restrict the softdep stats to DEBUG kernels, they cost nothing tojeff2005-05-031-11/+7
| | | | | | | | | export. This was happening anyway since this file manually sets DEBUG. - Add a sysctl for the number of items on the worklist. - Use a more canonical loop restart in softdep_fsync_mountdev, it saves some code at the expense of a goto and makes me worry less about modifying a variable that should be private to the TAILQ_FOREACH_SAFE macro.
* - Use bdone() directly instead of calling it indirectly throughjeff2005-04-301-11/+1
| | | | | | ffs_rawreaddone(). Sponsored by: Isilon Systems, Inc.
* - Plug memory leak.pjd2005-04-161-3/+10
| | | | | | | | - Fix two style nits. Found by: Coverity Prevent analysis tool Reviewed by: rwatson MFC after: 1 week
* - Change all filesystems and vfs_cache to relock the dvp once the child isjeff2005-04-131-3/+2
| | | | | | locked in the ISDOTDOT case. Se vfs_lookup.c r1.79 for details. Sponsored by: Isilon Systems, Inc.
OpenPOWER on IntegriCloud