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.
This commit is contained in:
parent
a8f2d755d0
commit
eee55ebda9
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=175344
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user