r339008 broke repquota for UFS. This rectifies that.
Refactor the function calls and tests so that, on UFS, the proper fields are filled out. PR: 233849 Reported by: Andre Albsmeier Reviewed by: mav, delphij MFC after: 1 month Sponsored by: iXsystems Inc Differential Revision: https://reviews.freebsd.org/D18785
This commit is contained in:
parent
10e3bebf9e
commit
148d31b83d
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=343881
@ -119,6 +119,7 @@ quota_open(struct fstab *fs, int quotatype, int openflags)
|
|||||||
struct group *grp;
|
struct group *grp;
|
||||||
struct stat st;
|
struct stat st;
|
||||||
int qcmd, serrno;
|
int qcmd, serrno;
|
||||||
|
int ufs;
|
||||||
|
|
||||||
if ((qf = calloc(1, sizeof(*qf))) == NULL)
|
if ((qf = calloc(1, sizeof(*qf))) == NULL)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
@ -129,15 +130,21 @@ quota_open(struct fstab *fs, int quotatype, int openflags)
|
|||||||
goto error;
|
goto error;
|
||||||
qf->dev = st.st_dev;
|
qf->dev = st.st_dev;
|
||||||
qcmd = QCMD(Q_GETQUOTASIZE, quotatype);
|
qcmd = QCMD(Q_GETQUOTASIZE, quotatype);
|
||||||
|
ufs = strcmp(fs->fs_vfstype, "ufs") == 0;
|
||||||
|
/*
|
||||||
|
* On UFS, hasquota() fills in qf->qfname. But we only care about
|
||||||
|
* this for UFS. So we need to call hasquota() for UFS, first.
|
||||||
|
*/
|
||||||
|
if (ufs) {
|
||||||
|
serrno = hasquota(fs, quotatype, qf->qfname,
|
||||||
|
sizeof(qf->qfname));
|
||||||
|
}
|
||||||
if (quotactl(qf->fsname, qcmd, 0, &qf->wordsize) == 0)
|
if (quotactl(qf->fsname, qcmd, 0, &qf->wordsize) == 0)
|
||||||
return (qf);
|
return (qf);
|
||||||
/* We only check the quota file for ufs */
|
if (!ufs) {
|
||||||
if (strcmp(fs->fs_vfstype, "ufs")) {
|
|
||||||
errno = 0;
|
errno = 0;
|
||||||
goto error;
|
goto error;
|
||||||
}
|
} else if (serrno == 0) {
|
||||||
serrno = hasquota(fs, quotatype, qf->qfname, sizeof(qf->qfname));
|
|
||||||
if (serrno == 0) {
|
|
||||||
errno = EOPNOTSUPP;
|
errno = EOPNOTSUPP;
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user