diff options
author | Mike Pritchard <mpp@FreeBSD.org> | 2008-01-15 06:33:20 +0000 |
---|---|---|
committer | Mike Pritchard <mpp@FreeBSD.org> | 2008-01-15 06:33:20 +0000 |
commit | eee55ebda90d696603fce9671d2aaca981ad4c76 (patch) | |
tree | f562a02129c788ce89893a7733cd7679441ded5f /sbin | |
parent | a8f2d755d0937a759f65ae935486f32a7f15ea46 (diff) | |
download | src-eee55ebda90d696603fce9671d2aaca981ad4c76.tar.gz src-eee55ebda90d696603fce9671d2aaca981ad4c76.zip |
Quotacheck may possibly skip quota accounting for up to 2 files
on a filesystem if the quota data files reside on a different
filesystem (e.g. the userquota=/somepath,groupquota=/somepath2
options are specified in /etc/fstab to place the quota files
somewhere other than the default location).
Fix quotacheck to only skip accounting if the quota data file
actually resides on the filesystem being checked.
Notes
Notes:
svn path=/head/; revision=175344
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/quotacheck/quotacheck.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/sbin/quotacheck/quotacheck.c b/sbin/quotacheck/quotacheck.c index 1956184f91cf..7e4c026fbf8a 100644 --- a/sbin/quotacheck/quotacheck.c +++ b/sbin/quotacheck/quotacheck.c @@ -275,6 +275,7 @@ chkquota(fsname, mntpt, qnp) union dinode *dp; int cg, i, mode, errs = 0; ino_t ino, inosused, userino = 0, groupino = 0; + dev_t dev, userdev = 0, groupdev = 0; char *cp; struct stat sb; @@ -282,6 +283,11 @@ chkquota(fsname, mntpt, qnp) warn("%s", fsname); return (1); } + if ((stat(mntpt, &sb)) < 0) { + warn("%s", mntpt); + return (1); + } + dev = sb.st_dev; if (vflag) { (void)printf("*** Checking "); if (qnp->flags & HASUSR) @@ -292,12 +298,16 @@ chkquota(fsname, mntpt, qnp) (void)printf(" quotas for %s (%s)\n", fsname, mntpt); } if (qnp->flags & HASUSR) { - if (stat(qnp->usrqfname, &sb) == 0) + if (stat(qnp->usrqfname, &sb) == 0) { userino = sb.st_ino; + userdev = sb.st_dev; + } } if (qnp->flags & HASGRP) { - if (stat(qnp->grpqfname, &sb) == 0) + if (stat(qnp->grpqfname, &sb) == 0) { groupino = sb.st_ino; + groupdev = sb.st_dev; + } } sync(); dev_bsize = 1; @@ -379,7 +389,8 @@ chkquota(fsname, mntpt, qnp) if (DIP(dp, di_flags) & SF_SNAPSHOT) continue; #endif - if (ino == userino || ino == groupino) + if ((ino == userino && dev == userdev) || + (ino == groupino && dev == groupdev)) continue; if (qnp->flags & HASGRP) { fup = addid((u_long)DIP(dp, di_gid), GRPQUOTA, |