Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-8]: src Pull up following revision(s) (requested by hannken in ti...



details:   https://anonhg.NetBSD.org/src/rev/218992ca3346
branches:  netbsd-8
changeset: 365836:218992ca3346
user:      martin <martin%NetBSD.org@localhost>
date:      Wed Apr 27 16:55:18 2022 +0000

description:
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.

diffstat:

 lib/libquota/quota_oldfiles.c |  6 +++---
 sys/ufs/ufs/ufs_quota1.c      |  7 ++++---
 usr.sbin/quotaon/quotaon.c    |  9 ++++++---
 3 files changed, 13 insertions(+), 9 deletions(-)

diffs (109 lines):

diff -r 7e6c54476b1e -r 218992ca3346 lib/libquota/quota_oldfiles.c
--- a/lib/libquota/quota_oldfiles.c     Fri Mar 18 13:27:22 2022 +0000
+++ b/lib/libquota/quota_oldfiles.c     Wed Apr 27 16:55:18 2022 +0000
@@ -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 @@
 
        (void)snprintf(buf, maxlen, "%s/%s.%s",
                       qh->qh_mountpoint,
-                      QUOTAFILENAME, names[USRQUOTA]);
+                      QUOTAFILENAME, names[idtype]);
 }
 
 const char *
diff -r 7e6c54476b1e -r 218992ca3346 sys/ufs/ufs/ufs_quota1.c
--- a/sys/ufs/ufs/ufs_quota1.c  Fri Mar 18 13:27:22 2022 +0000
+++ b/sys/ufs/ufs/ufs_quota1.c  Wed Apr 27 16:55:18 2022 +0000
@@ -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 @@
                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 @@
                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);
diff -r 7e6c54476b1e -r 218992ca3346 usr.sbin/quotaon/quotaon.c
--- a/usr.sbin/quotaon/quotaon.c        Fri Mar 18 13:27:22 2022 +0000
+++ b/usr.sbin/quotaon/quotaon.c        Wed Apr 27 16:55:18 2022 +0000
@@ -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 @@
 #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 @@
     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 @@
                        }
                        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;
 }



Home | Main Index | Thread Index | Old Index