Module Name: src
Committed By: martin
Date: Wed Apr 27 16:55:18 UTC 2022
Modified Files:
src/lib/libquota [netbsd-8]: quota_oldfiles.c
src/sys/ufs/ufs [netbsd-8]: ufs_quota1.c
src/usr.sbin/quotaon [netbsd-8]: quotaon.c
Log Message:
Pull up following revision(s) (requested by hannken in ticket #1739):
usr.sbin/quotaon/quotaon.c: revision 1.31
lib/libquota/quota_oldfiles.c: revision 1.10
sys/ufs/ufs/ufs_quota1.c: revision 1.25
Fix default quota file names, both user and group quota used the
same default name "QUOTAFILENAME, names[USRQUOTA])" resulting in
diagnostic assertion and possibly corrupted quota data.
Keep flag "UFS_QUOTA" set until the last quota is closed.
Prevents a live lock when dqrele() finds a struct with "dq_cnt == 1"
and flag "DQ_MOD" and cannot sync as flag UFS_QUOTA is unset.
As the quota type comes from the kernel and is only valid when
quota is on get the type before quota_off and after quota_on.
To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.9.26.1 src/lib/libquota/quota_oldfiles.c
cvs rdiff -u -r1.22.10.1 -r1.22.10.2 src/sys/ufs/ufs/ufs_quota1.c
cvs rdiff -u -r1.30 -r1.30.24.1 src/usr.sbin/quotaon/quotaon.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/lib/libquota/quota_oldfiles.c
diff -u src/lib/libquota/quota_oldfiles.c:1.9 src/lib/libquota/quota_oldfiles.c:1.9.26.1
--- src/lib/libquota/quota_oldfiles.c:1.9 Fri Feb 24 18:00:09 2012
+++ src/lib/libquota/quota_oldfiles.c Wed Apr 27 16:55:18 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: quota_oldfiles.c,v 1.9 2012/02/24 18:00:09 njoly Exp $ */
+/* $NetBSD: quota_oldfiles.c,v 1.9.26.1 2022/04/27 16:55:18 martin Exp $ */
/*
* Copyright (c) 1980, 1990, 1993
@@ -33,7 +33,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: quota_oldfiles.c,v 1.9 2012/02/24 18:00:09 njoly Exp $");
+__RCSID("$NetBSD: quota_oldfiles.c,v 1.9.26.1 2022/04/27 16:55:18 martin Exp $");
#include <sys/types.h>
#include <sys/stat.h>
@@ -255,7 +255,7 @@ __quota_oldfiles_defquotafile(struct quo
(void)snprintf(buf, maxlen, "%s/%s.%s",
qh->qh_mountpoint,
- QUOTAFILENAME, names[USRQUOTA]);
+ QUOTAFILENAME, names[idtype]);
}
const char *
Index: src/sys/ufs/ufs/ufs_quota1.c
diff -u src/sys/ufs/ufs/ufs_quota1.c:1.22.10.1 src/sys/ufs/ufs/ufs_quota1.c:1.22.10.2
--- src/sys/ufs/ufs/ufs_quota1.c:1.22.10.1 Fri Jan 1 13:19:57 2021
+++ src/sys/ufs/ufs/ufs_quota1.c Wed Apr 27 16:55:18 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: ufs_quota1.c,v 1.22.10.1 2021/01/01 13:19:57 martin Exp $ */
+/* $NetBSD: ufs_quota1.c,v 1.22.10.2 2022/04/27 16:55:18 martin Exp $ */
/*
* Copyright (c) 1982, 1986, 1990, 1993, 1995
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ufs_quota1.c,v 1.22.10.1 2021/01/01 13:19:57 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ufs_quota1.c,v 1.22.10.2 2022/04/27 16:55:18 martin Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@@ -435,7 +435,6 @@ quota1_handle_cmd_quotaoff(struct lwp *l
return (0);
}
ump->umq1_qflags[type] |= QTF_CLOSING;
- ump->um_flags &= ~UFS_QUOTA;
mutex_exit(&dqlock);
/*
* Search vnodes associated with this mount point,
@@ -472,6 +471,8 @@ quota1_handle_cmd_quotaoff(struct lwp *l
if (ump->um_quotas[i] != NULLVP)
break;
ump->umq1_qflags[type] &= ~QTF_CLOSING;
+ if (i == MAXQUOTAS)
+ ump->um_flags &= ~UFS_QUOTA;
cv_broadcast(&dqcv);
mutex_exit(&dqlock);
kauth_cred_free(cred);
Index: src/usr.sbin/quotaon/quotaon.c
diff -u src/usr.sbin/quotaon/quotaon.c:1.30 src/usr.sbin/quotaon/quotaon.c:1.30.24.1
--- src/usr.sbin/quotaon/quotaon.c:1.30 Sat Apr 7 05:07:33 2012
+++ src/usr.sbin/quotaon/quotaon.c Wed Apr 27 16:55:18 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: quotaon.c,v 1.30 2012/04/07 05:07:33 christos Exp $ */
+/* $NetBSD: quotaon.c,v 1.30.24.1 2022/04/27 16:55:18 martin Exp $ */
/*
* Copyright (c) 1980, 1990, 1993
@@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19
#if 0
static char sccsid[] = "@(#)quotaon.c 8.1 (Berkeley) 6/6/93";
#else
-__RCSID("$NetBSD: quotaon.c,v 1.30 2012/04/07 05:07:33 christos Exp $");
+__RCSID("$NetBSD: quotaon.c,v 1.30.24.1 2022/04/27 16:55:18 martin Exp $");
#endif
#endif /* not lint */
@@ -217,12 +217,14 @@ quotaonoff(struct fstab *fs, struct quot
int warn_on_enxio, const char *fsspec)
{
const char *mode = (offmode == 1) ? "off" : "on";
+ const char *type;
if (strcmp(fs->fs_file, "/") && readonly(fs, fsspec)) {
return 1;
}
if (offmode) {
+ type = quota_idtype_getname(qh, idtype);
if (quota_quotaoff(qh, idtype)) {
if (warn_on_enxio || errno != ENXIO) {
warn("quota%s for %s", mode, fs->fs_file);
@@ -236,11 +238,12 @@ quotaonoff(struct fstab *fs, struct quot
}
return 1;
}
+ type = quota_idtype_getname(qh, idtype);
}
if (vflag) {
printf("%s: %s quotas turned %s\n",
- fs->fs_file, quota_idtype_getname(qh, idtype), mode);
+ fs->fs_file, type, mode);
}
return 0;
}