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;
|
union dinode *dp;
|
||||||
int cg, i, mode, errs = 0;
|
int cg, i, mode, errs = 0;
|
||||||
ino_t ino, inosused, userino = 0, groupino = 0;
|
ino_t ino, inosused, userino = 0, groupino = 0;
|
||||||
|
dev_t dev, userdev = 0, groupdev = 0;
|
||||||
char *cp;
|
char *cp;
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
|
|
||||||
@ -282,6 +283,11 @@ chkquota(fsname, mntpt, qnp)
|
|||||||
warn("%s", fsname);
|
warn("%s", fsname);
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
if ((stat(mntpt, &sb)) < 0) {
|
||||||
|
warn("%s", mntpt);
|
||||||
|
return (1);
|
||||||
|
}
|
||||||
|
dev = sb.st_dev;
|
||||||
if (vflag) {
|
if (vflag) {
|
||||||
(void)printf("*** Checking ");
|
(void)printf("*** Checking ");
|
||||||
if (qnp->flags & HASUSR)
|
if (qnp->flags & HASUSR)
|
||||||
@ -292,12 +298,16 @@ chkquota(fsname, mntpt, qnp)
|
|||||||
(void)printf(" quotas for %s (%s)\n", fsname, mntpt);
|
(void)printf(" quotas for %s (%s)\n", fsname, mntpt);
|
||||||
}
|
}
|
||||||
if (qnp->flags & HASUSR) {
|
if (qnp->flags & HASUSR) {
|
||||||
if (stat(qnp->usrqfname, &sb) == 0)
|
if (stat(qnp->usrqfname, &sb) == 0) {
|
||||||
userino = sb.st_ino;
|
userino = sb.st_ino;
|
||||||
|
userdev = sb.st_dev;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (qnp->flags & HASGRP) {
|
if (qnp->flags & HASGRP) {
|
||||||
if (stat(qnp->grpqfname, &sb) == 0)
|
if (stat(qnp->grpqfname, &sb) == 0) {
|
||||||
groupino = sb.st_ino;
|
groupino = sb.st_ino;
|
||||||
|
groupdev = sb.st_dev;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
sync();
|
sync();
|
||||||
dev_bsize = 1;
|
dev_bsize = 1;
|
||||||
@ -379,7 +389,8 @@ chkquota(fsname, mntpt, qnp)
|
|||||||
if (DIP(dp, di_flags) & SF_SNAPSHOT)
|
if (DIP(dp, di_flags) & SF_SNAPSHOT)
|
||||||
continue;
|
continue;
|
||||||
#endif
|
#endif
|
||||||
if (ino == userino || ino == groupino)
|
if ((ino == userino && dev == userdev) ||
|
||||||
|
(ino == groupino && dev == groupdev))
|
||||||
continue;
|
continue;
|
||||||
if (qnp->flags & HASGRP) {
|
if (qnp->flags & HASGRP) {
|
||||||
fup = addid((u_long)DIP(dp, di_gid), GRPQUOTA,
|
fup = addid((u_long)DIP(dp, di_gid), GRPQUOTA,
|
||||||
|
Loading…
Reference in New Issue
Block a user