summaryrefslogtreecommitdiffstats
path: root/sys/ufs/ffs
diff options
context:
space:
mode:
authormpp <mpp@FreeBSD.org>2007-01-20 11:58:32 +0000
committermpp <mpp@FreeBSD.org>2007-01-20 11:58:32 +0000
commit0f6ed07b8918bfe5659030dbe819eec3e761dcfb (patch)
tree6a47b77ab38ba0b99bba086730b7d5d814291037 /sys/ufs/ffs
parentd1c3c94c604d27fe2d26ffdfc1d7fb534261fe92 (diff)
downloadFreeBSD-src-0f6ed07b8918bfe5659030dbe819eec3e761dcfb.zip
FreeBSD-src-0f6ed07b8918bfe5659030dbe819eec3e761dcfb.tar.gz
Quota system cleanup.
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.
Diffstat (limited to 'sys/ufs/ffs')
-rw-r--r--sys/ufs/ffs/ffs_alloc.c2
-rw-r--r--sys/ufs/ffs/ffs_snapshot.c14
2 files changed, 2 insertions, 14 deletions
diff --git a/sys/ufs/ffs/ffs_alloc.c b/sys/ufs/ffs/ffs_alloc.c
index 827af17..a746a69 100644
--- a/sys/ufs/ffs/ffs_alloc.c
+++ b/sys/ufs/ffs/ffs_alloc.c
@@ -188,6 +188,7 @@ retry:
*bnp = bno;
return (0);
}
+nospace:
#ifdef QUOTA
UFS_UNLOCK(ump);
/*
@@ -196,7 +197,6 @@ retry:
(void) chkdq(ip, -btodb(size), cred, FORCE);
UFS_LOCK(ump);
#endif
-nospace:
if (fs->fs_pendingblocks > 0 && reclaimed == 0) {
reclaimed = 1;
softdep_request_cleanup(fs, ITOV(ip));
diff --git a/sys/ufs/ffs/ffs_snapshot.c b/sys/ufs/ffs/ffs_snapshot.c
index 6ab9af2..14b231c 100644
--- a/sys/ufs/ffs/ffs_snapshot.c
+++ b/sys/ufs/ffs/ffs_snapshot.c
@@ -281,6 +281,7 @@ restart:
return (error);
}
vp = nd.ni_vp;
+ vp->v_vflag |= VV_SYSTEM;
ip = VTOI(vp);
devvp = ip->i_devvp;
/*
@@ -367,18 +368,6 @@ restart:
if (error)
goto out;
}
-#ifdef QUOTA
- /*
- * Turn off disk quotas for snapshot file.
- */
- (void) chkdq(ip, -DIP(ip, i_blocks), KERNCRED, FORCE);
- for (i = 0; i < MAXQUOTAS; i++) {
- if (ip->i_dquot[i] != NODQUOT) {
- dqrele(vp, ip->i_dquot[i]);
- ip->i_dquot[i] = NODQUOT;
- }
- }
-#endif
/*
* Change inode to snapshot type file.
*/
@@ -682,7 +671,6 @@ loop:
devvp->v_vflag |= VV_COPYONWRITE;
VI_UNLOCK(devvp);
ASSERT_VOP_LOCKED(vp, "ffs_snapshot vp");
- vp->v_vflag |= VV_SYSTEM;
out1:
KASSERT((sn != NULL && sbp != NULL && error == 0) ||
(sn == NULL && sbp == NULL && error != 0),
OpenPOWER on IntegriCloud