diff options
author | tegge <tegge@FreeBSD.org> | 2006-05-05 20:10:04 +0000 |
---|---|---|
committer | tegge <tegge@FreeBSD.org> | 2006-05-05 20:10:04 +0000 |
commit | b40c756c61dc2e35b9c86fbaab79c618cbe1288f (patch) | |
tree | 0f21b3b1482691a8dde7f3417059aeed7b24b3fc /sys | |
parent | 70578f430db0cf7d896e18a5c717a092b861b326 (diff) | |
download | FreeBSD-src-b40c756c61dc2e35b9c86fbaab79c618cbe1288f.zip FreeBSD-src-b40c756c61dc2e35b9c86fbaab79c618cbe1288f.tar.gz |
Turn off disk quotas for snapshot files.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/ufs/ffs/ffs_snapshot.c | 21 | ||||
-rw-r--r-- | sys/ufs/ufs/ufs_quota.c | 17 |
2 files changed, 38 insertions, 0 deletions
diff --git a/sys/ufs/ffs/ffs_snapshot.c b/sys/ufs/ffs/ffs_snapshot.c index 66df8d6..78862b5 100644 --- a/sys/ufs/ffs/ffs_snapshot.c +++ b/sys/ufs/ffs/ffs_snapshot.c @@ -36,6 +36,8 @@ #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); +#include "opt_quota.h" + #include <sys/param.h> #include <sys/kernel.h> #include <sys/systm.h> @@ -364,6 +366,18 @@ 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. */ @@ -1634,6 +1648,13 @@ ffs_snapremove(vp) ip->i_flags &= ~SF_SNAPSHOT; DIP_SET(ip, i_flags, ip->i_flags); ip->i_flag |= IN_CHANGE | IN_UPDATE; +#ifdef QUOTA + /* + * Reenable disk quotas for ex-snapshot file. + */ + if (!getinoquota(ip)) + (void) chkdq(ip, DIP(ip, i_blocks), KERNCRED, FORCE); +#endif } /* diff --git a/sys/ufs/ufs/ufs_quota.c b/sys/ufs/ufs/ufs_quota.c index f856e02..dcb94d1 100644 --- a/sys/ufs/ufs/ufs_quota.c +++ b/sys/ufs/ufs/ufs_quota.c @@ -35,6 +35,8 @@ #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); +#include "opt_ffs.h" + #include <sys/param.h> #include <sys/systm.h> #include <sys/fcntl.h> @@ -46,6 +48,7 @@ __FBSDID("$FreeBSD$"); #include <sys/namei.h> #include <sys/proc.h> #include <sys/socket.h> +#include <sys/stat.h> #include <sys/sysctl.h> #include <sys/vnode.h> @@ -97,6 +100,13 @@ getinoquota(ip) struct vnode *vp = ITOV(ip); int error; +#ifndef NO_FFS_SNAPSHOT + /* + * Disk quotas must be turned off for snapshot files. + */ + if ((ip->i_flags & SF_SNAPSHOT) != 0) + return (0); +#endif ump = VFSTOUFS(vp->v_mount); /* * Set up the user quota based on file uid. @@ -375,6 +385,13 @@ chkdquot(ip) struct ufsmount *ump = VFSTOUFS(ITOV(ip)->v_mount); int i; +#ifndef NO_FFS_SNAPSHOT + /* + * Disk quotas must be turned off for snapshot files. + */ + if ((ip->i_flags & SF_SNAPSHOT) != 0) + return; +#endif for (i = 0; i < MAXQUOTAS; i++) { if (ump->um_quotas[i] == NULLVP || (ump->um_qflags[i] & (QTF_OPENING|QTF_CLOSING))) |