summaryrefslogtreecommitdiffstats
path: root/sys/ufs
Commit message (Collapse)AuthorAgeFilesLines
* Fix the NAMEI zone leak when snapshot was successfully created.kib2007-04-101-0/+1
| | | | | Reported and tested by: Peter Holm MFC after: 2 weeks
* Recalculate the NEWBLOCK flag for pagedep structure after the softdepkib2007-04-101-5/+26
| | | | | | | lock is dropped, since pagedep may be already processed and deallocated. Found and tested by: kris MFC after: 2 weeks
* When LK_NOWAIT is passed as argument to process_worklist_item(), thiskib2007-04-101-1/+4
| | | | | | | | | | does not prevent handle_workitem_remove() from recursing into a blocking version. Add the dirrem to worklist instead of processing it now if this is the case. Reported and tested by: kris Submitted by: tegge MFC after: 2 weeks
* Use *_EMPTY macros when appropriate.delphij2007-04-044-47/+47
|
* Revert rev. 1.205. Replace unconditional acquision of Giant when QUOTAS arekib2007-03-291-0/+5
| | | | | | | | | defined with VFS_LOCK_GIANT(NULL) call. This shall fix softdep operation when mpsafe_vfs = 0. Reported and tested by: kris Submitted by: tegge MFC after: 1 week
* Mark UFS as being MP-Safe in "options QUOTA" case too. Remove no morekib2007-03-202-19/+0
| | | | | | | | neccessary Giant acquisions in softdepend processing code. Tested by: Peter Holm Reviewed by: tegge Approved by: re (kensmith)
* When we write extended attributes, assert that the inode hasn'tbrian2007-03-191-0/+3
| | | | | | | | | | already been deleted. The assertion is important to show that we won't end up accounting for extended attribute blocks (using fs_pendingblocks) in our subsequent call to fs_alloc(). Agreed verbally by: mckusick MFC after: 3 weeks
* Implement fine-grained locking for UFS quotas.kib2007-03-143-142/+493
| | | | | | | | | | | | | | | | | | | Each struct dquot gets dq_lock mutex to protect dq_flags and to interlock with DQ_LOCK. qhash, dqfreelist and dq.dq_cnt are protected by global dqhlock mutex. i_dquot array for inode is protected by lockmgr' vnode lock, corresponding assert added to the dqget(). Access to struct ufsmount quota-related fields (um_quotas and um_qflags) is protected by um_lock. Tested by: Peter Holm Reviewed by: tegge Approved by: re (kensmith) This work were not possible without enormous amount of help given by Tor Egge and Peter Holm. Tor reviewed each version of patch, pointed out numerous errors and provided invaluable suggestions. Peter did tireless testing of the patch as it was developed.
* Call getinoquota() before allocating new block for the directory to properlykib2007-03-141-0/+8
| | | | | | | | account for block allocation. Tested by: Peter Holm Reviewed by: tegge Approved by: re (kensmith)
* Remove unneeded getinoquota() call in the ufs_access().kib2007-03-141-4/+0
| | | | | | Tested by: Peter Holm Reviewed by: tegge Approved by: re (kensmith)
* Make insmntque() externally visibile and allow it to fail (e.g. duringtegge2007-03-131-1/+10
| | | | | | | | | | | | | | | | | | | | | | | late stages of unmount). On failure, the vnode is recycled. Add insmntque1(), to allow for file system specific cleanup when recycling vnode on failure. Change getnewvnode() to no longer call insmntque(). Previously, embryonic vnodes were put onto the list of vnode belonging to a file system, which is unsafe for a file system marked MPSAFE. Change vfs_hash_insert() to no longer lock the vnode. The caller now has that responsibility. Change most file systems to lock the vnode and call insmntque() or insmntque1() after a new vnode has been sufficiently setup. Handle failed insmntque*() calls by propagating errors to callers, possibly after some file system specific cleanup. Approved by: re (kensmith) Reviewed by: kib In collaboration with: kib
* Move macros describing extended attributes in UFS frommckusick2007-03-061-0/+49
| | | | | | | | | | | <sys/extattr.h> to <ufs/ufs/extattr.h>. Move description of extended attributes in UFS from man9/extattr.9 to man5/fs.5. Note that restore will not compile until <sys/extattr.h> and <ufs/ufs/extattr.h> have been updated. Suggested by: Robert Watson
* Fix build breakage.pjd2007-03-011-1/+1
|
* Change:pjd2007-03-011-1/+1
| | | | | | "... try to use VADMIN in preference to VADMIN ..." To: "... try to use VADMIN in preference to VWRITE ..."
* Rename PRIV_VFS_CLEARSUGID to PRIV_VFS_RETAINSUGID, which seems to betterpjd2007-03-012-3/+4
| | | | | | describe the privilege. OK'ed by: rwatson
* Avoid checking for privileges if there is no need to.pjd2007-03-012-13/+18
| | | | Discussed with: rwatson
* Account for di_blocks allocations when IN_SPACECOUNTED is set in anbrian2007-02-232-7/+32
| | | | | | | | | | | | | | | | | | | | | | | inode's i_flag. It's possible that after ufs_infactive() calls softdep_releasefile(), i_nlink stays >0 for a considerable amount of time (> 60 seconds here). During this period, any ffs allocation routines that alter di_blocks must also account for the blocks in the filesystem's fs_pendingblocks value. This change fixes an eventual df/du discrepency that will happen as the result of fs_pendingblocks being reduced to <0. The only manifestation of this that people may recognise is the following message on boot: /somefs: update error: blocks -N files M at which point the negative pending block count is adjusted to zero. Reviewed by: tegge MFC after: 3 weeks
* The functions that set and delete external attributes must checkmckusick2007-02-211-0/+9
| | | | | | | that the filesystem is not mounted read-only before proceeding. Reported by: Ryan Beasley <ryanb@FreeBSD.org> MFC after: 1 week
* Rename three quota privileges from the UFS privilege namespace to therwatson2007-02-191-5/+5
| | | | | | | | | | VFS privilege namespace: exceedquota, getquota, and setquota. Leave UFS-specific quota configuration privileges in the UFS name space. This renumbers VFS and UFS privileges, so requires rebuilding modules if you are using security policies aware of privilege identifiers. This is likely no one at this point since none of the committed MAC policies use the privilege checks.
* Limit quota privileges in jail to PRIV_UFS_GETQUOTA andrwatson2007-02-191-12/+3
| | | | PRIV_UFS_SETQUOTA.
* This README file is obsolete. The cited problems were fixed long agomckusick2007-02-171-58/+0
| | | | | and the code is installed by default so no longer requires action by the administrator to be included.
* Move vnode-to-file-handle translation from vfs_vptofh to vop_vptofh method.pjd2007-02-152-22/+28
| | | | | | | | | | | | | | | | This way we may support multiple structures in v_data vnode field within one file system without using black magic. Vnode-to-file-handle should be VOP in the first place, but was made VFS operation to keep interface as compatible as possible with SUN's VFS. BTW. Now Solaris also implements vnode-to-file-handle as VOP operation. VFS_VPTOFH() was left for API backward compatibility, but is marked for removal before 8.0-RELEASE. Approved by: mckusick Discussed with: many (on IRC) Tested with: ufs, msdosfs, cd9660, nullfs and zfs
* Style(9).kib2007-02-151-5/+11
|
* Remove not needed acquision of the mount interlock aroung reading ofkib2007-02-081-12/+5
| | | | | | | | mnt_kern_flags in ufs_itimes(). Suggested by: ssouhlal Confirmed by: tegge MFC after: 2 weeks
* Call pbgetvp() and pbrelvp() instead of setting b_vp directly.tegge2007-02-041-3/+9
| | | | PR: kern/108151
* If quotacheck or edquota reset the block or inode grace time formpp2007-02-041-2/+10
| | | | | | | | | | | a user or group, when the kernel first sees this, it will update the grace time value. However, it never flags the quota as modified and the updated value never makes it to the quota data file unless the user actually makes some other change that would write the data out. Fixed to flag the quota as modified if the soft limit has actually been reached and should be now enforced.
* Prevent quotactl calls that pass in an id of -1 from incorrectlympp2007-02-011-7/+20
| | | | | | | | | | | | using the callers UID instead of the GID when performing group operations. This could allow users to determine group quota information for groups they are not a member of in some cases. Rename the "uid" parameter in ufs_quotactl to "id" to better show that it is used for more than just the uid, and to be more in line with the naming conventions in the other quota routines. PR: kern/33940
* Disallow negative UIDs when processing quotactl options.mpp2007-02-011-0/+5
|
* Cylinder group bitmaps and blocks containing inode for a snapshotkib2007-01-233-0/+120
| | | | | | | | | | | | | | | | | | | | | file are after snaplock, while other ffs device buffers are before snaplock in global lock order. By itself, this could cause deadlock when bdwrite() tries to flush dirty buffers on snapshotted ffs. If, during the flush, COW activity for snapshot needs to allocate block and ffs_alloccg() selects the cylinder group that is being written by bdwrite(), then kernel would panic due to recursive buffer lock acquision. Avoid dealing with buffers in bdwrite() that are from other side of snaplock divisor in the lock order then the buffer being written. Add new BOP, bop_bdwrite(), to do dirty buffer flushing for same vnode in the bdwrite(). Default implementation, bufbdflush(), refactors the code from bdwrite(). For ffs device buffers, specialized implementation is used. Reviewed by: tegge, jeff, Russell Cattelan (cattelan xfs org, xfs changes) Tested by: Peter Holm X-MFC after: 3 weeks (if ever: it changes ABI)
* Fix build. chkdquot() should not return anything.delphij2007-01-201-1/+1
|
* Quota system cleanup.mpp2007-01-204-30/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1) Do not do quota accounting for the actual quota data files or for file system snapshot files ("system" files). This prevents a deadlock descibed in PR kern/30958 if the kernel ever has to grow the quota file. Snapshot files were already exempt from the quota checks, but this change generalized the check. 2) Fix a cast that caused extremely large uids/gids to incorrectly write the quota information to the data file at a truncated value for a uint_t32 id value. The incorrect cast caused quota files in this case to be around 4GB in size, with the correct cast they can now be 131GB in size. Also related to PR kern/30958. 3) Check for what appear to be negative UIDs/GIDs and not account for them. This prevents the quota files from becoming 131GB in size and causing quotacheck to run forever at bootup. This could also cause the kernel to try and expand the quota file, which might deadlock due to the issue in #1. kern/30958 and kern/38156 (and some much older closed PR's). 4) With the deadlock problems gone, the kernel can now expand the size of the quota database files if it needs to. 5) Pass in the i-node count change value to chkiq and chkiqchg as an int, like it used to be before the common routine was split up into 2 different routines to increase / decrease the i-node in-use count. Prevents an underflow on the i-node count. Related to PR kern/89247. 6) Prevent the block usage from growing slowly if a file system is full and the write was denied due to that fact. PR kern/89247. Some of these changes require an updated quotacheck to prevent the creation of huge (131GB) quota data files (item #3). #1/#4 probably fixes a lot of the random hangs when quotas are enabled, possibly some of the jail hangs.
* Fix a spelling error. heirarchy -> hierarchy.mpp2007-01-161-1/+1
| | | | Obtained from: OpenBSD
* Fix a spelling error in some comments. heirarchy -> hierarchy.mpp2007-01-161-2/+2
| | | | Obtained from: OpenBSD
* Canonicalize copyright: use a date range rather than comma-delimitedrwatson2007-01-081-1/+1
| | | | | | list. MFC after: 3 days
* change vop_lock handling to allowing tracking of callers' file and line forkmacy2006-11-131-9/+11
| | | | | | acquisition of lockmgr locks Approved by: scottl (standing in for mentor rwatson)
* Sweep kernel replacing suser(9) calls with priv(9) calls, assigningrwatson2006-11-066-43/+84
| | | | | | | | | | | | | specific privilege names to a broad range of privileges. These may require some future tweaking. Sponsored by: nCircle Network Security, Inc. Obtained from: TrustedBSD Project Discussed on: arch@ Reviewed (at least in part) by: mlaier, jmg, pjd, bde, ceri, Alex Lyashkov <umka at sevcity dot net>, Skip Ford <skip dot ford at verizon dot net>, Antoine Brodin <antoine dot brodin at laposte dot net>
* Aquire Giant in the softdep_flush for clear_remove() and clear_inodedeps()kib2006-11-011-0/+7
| | | | | | | | processing when QUOTA is set. Reported and tested by: Peter Holm Reviewed by: tegge MFC after: 3 days
* Add gjournal specific code to the UFS file system:pjd2006-10-317-4/+247
| | | | | | | | | | | | | | | | - Add FS_GJOURNAL flag which enables gjournal support on a file system. - Add cg_unrefs field to the cylinder group structure which holds number of unreferenced (orphaned) inodes in the given cylinder group. - Add fs_unrefs field to the super block structure which holds total number of unreferenced (orphaned) inodes. - When file or a directory is orphaned (last reference is removed, but object is still open), increase fs_unrefs and cg_unrefs fields, which is a hint for fsck in which cylinder groups looks for such (orphaned) objects. - When file is last closed, decrease {fs,cg}_unrefs fields. - Add VV_DELETED vnode flag which points at orphaned objects. Sponsored by: home.pl
* Complete break-out of sys/sys/mac.h into sys/security/mac/mac_framework.hrwatson2006-10-222-2/+4
| | | | | | | | | | | | | begun with a repo-copy of mac.h to mac_framework.h. sys/mac.h now contains the userspace and user<->kernel API and definitions, with all in-kernel interfaces moved to mac_framework.h, which is now included across most of the kernel instead. This change is the first step in a larger cleanup and sweep of MAC Framework interfaces in the kernel, and will not be MFC'd. Obtained from: TrustedBSD Project Sponsored by: SPARTA
* Do not translate the IN_ACCESS inode flag into the IN_MODIFIED while filesystemkib2006-10-105-34/+89
| | | | | | | | | | | | | | | is suspending/suspended. Doing so may result in deadlock. Instead, set the (new) IN_LAZYACCESS flag, that becomes IN_MODIFIED when suspend is lifted. Change the locking protocol in order to set the IN_ACCESS and timestamps without upgrading shared vnode lock to exclusive (see comments in the inode.h). Before that, inode was modified while holding only shared lock. Tested by: Peter Holm Reviewed by: tegge, bde Approved by: pjd (mentor) MFC after: 3 weeks
* Correct check for when IO_SYNC should be set for filesystemtegge2006-10-021-2/+2
| | | | | | not using softupdates when truncating a directory to zero length. Discussed with: bde
* Protect change to bo_flag by holding the bufobj mutex.tegge2006-09-261-0/+2
|
* Reduce fluctuations of mnt_flag to allow unlocked readers to get ategge2006-09-261-2/+1
| | | | slightly more consistent view.
* Don't restore MNT_QUOTA bit in mnt_flag after snapshot creation,tegge2006-09-261-1/+1
| | | | closing a race between nmount() and quotactl().
* Increase mnt_noasync once in softdep_mount() to disallow async io,tegge2006-09-261-0/+5
| | | | | | | closing a window where a file system using softupdates could be async for a short while if both MNT_UPDATE and MNT_ASYNC were passed as flags to nmount(). Add MNTK_SOFTDEP flag to ensure that softdep_mount() doesn't increase mnt_noasync multiple times.
* Add mnt_noasync counter to better handle interleaved calls to nmount(),tegge2006-09-261-1/+1
| | | | | | sync() and sync_fsync() without losing MNT_ASYNC. Add MNTK_ASYNC flag which is set only when MNT_ASYNC is set and mnt_noasync is zero, and check that flag instead of MNT_ASYNC before initiating async io.
* Use mount interlock to protect all changes to mnt_flag and mnt_kern_flag.tegge2006-09-264-15/+57
| | | | | This eliminates a race where MNT_UPDATE flag could be lost when nmount() raced against sync(), sync_fsync() or quotactl().
* Fix the glitch introduced in rev. 1.93. In softdep_sync_metadata(),kib2006-09-201-2/+3
| | | | | | | | | | | | switch by worklist type contains two for() loops, for D_INDIRDEP and D_PAGEDEP. On error, these loops are exited by break, where the switch actually shall be leaved. Use goto instead of break to reach the error handling code. Reported by: Peter Holm Reviewed by: tegge Approved by: pjd (mentor) MFC after: 2 weeks
* Declare security and security.bsd sysctl hierarchies in sysctl.h alongrwatson2006-09-171-2/+0
| | | | | | | | with other commonly used sysctl name spaces, rather than declaring them all over the place. MFC after: 1 month Sponsored by: nCircle Network Security, Inc.
* While checking for update of snapshot file in the ffs_copyonwrite,kib2006-08-211-1/+1
| | | | | | | | | | | first filter out metadata update. Otherwise, devfs vnode could be erronously interpreted as ufs one, causing further check of i_flags to use random memory. PR: kern/100365 Debugged and fix described by: tegge Approved by: pjd (mentor) MFC after: 2 weeks
OpenPOWER on IntegriCloud