CVS commit: [bouyer-quota2] src
Module Name:src Committed By: bouyer Date: Sun Mar 6 15:08:05 UTC 2011 Added Files: src/distrib/emips [bouyer-quota2]: Makefile src/distrib/emips/cdroms [bouyer-quota2]: Makefile src/distrib/emips/cdroms/installcd [bouyer-quota2]: Makefile src/distrib/emips/instkernel [bouyer-quota2]: Makefile list src/distrib/emips/miniroot [bouyer-quota2]: Makefile.inc dot.profile list src/distrib/emips/ramdisk [bouyer-quota2]: Makefile disktab.preinstall dot.hdprofile dot.profile list src/distrib/notes/emips [bouyer-quota2]: Makefile hardware install legal prep upgrade xfer src/distrib/utils/sysinst/arch/emips [bouyer-quota2]: Makefile md.c md.h menus.md.en menus.md.es menus.md.fr menus.md.pl msg.md.de msg.md.en msg.md.es msg.md.fr msg.md.pl src/etc/etc.emips [bouyer-quota2]: MAKEDEV.conf Makefile.inc ttys src/external/bsd/llvm [bouyer-quota2]: Makefile Makefile.inc link.mk tablegen.mk src/external/bsd/llvm/bin [bouyer-quota2]: Makefile Makefile.inc src/external/bsd/llvm/bin/bugpoint [bouyer-quota2]: Makefile src/external/bsd/llvm/bin/clang [bouyer-quota2]: Makefile src/external/bsd/llvm/bin/llc [bouyer-quota2]: Makefile src/external/bsd/llvm/bin/lli [bouyer-quota2]: Makefile src/external/bsd/llvm/bin/llvm-ar [bouyer-quota2]: Makefile src/external/bsd/llvm/bin/llvm-as [bouyer-quota2]: Makefile src/external/bsd/llvm/bin/llvm-bcanalyzer [bouyer-quota2]: Makefile src/external/bsd/llvm/bin/llvm-diff [bouyer-quota2]: Makefile src/external/bsd/llvm/bin/llvm-dis [bouyer-quota2]: Makefile src/external/bsd/llvm/bin/llvm-extract [bouyer-quota2]: Makefile src/external/bsd/llvm/bin/llvm-ld [bouyer-quota2]: Makefile src/external/bsd/llvm/bin/llvm-link [bouyer-quota2]: Makefile src/external/bsd/llvm/bin/llvm-mc [bouyer-quota2]: Makefile src/external/bsd/llvm/bin/llvm-nm [bouyer-quota2]: Makefile src/external/bsd/llvm/bin/llvm-prof [bouyer-quota2]: Makefile src/external/bsd/llvm/bin/llvm-ranlib [bouyer-quota2]: Makefile src/external/bsd/llvm/bin/llvm-stub [bouyer-quota2]: Makefile src/external/bsd/llvm/bin/llvmc [bouyer-quota2]: Makefile src/external/bsd/llvm/bin/macho-dumpx [bouyer-quota2]: Makefile src/external/bsd/llvm/bin/opt [bouyer-quota2]: Makefile src/external/bsd/llvm/bin/tblgen [bouyer-quota2]: Makefile src/external/bsd/llvm/config/clang/Basic [bouyer-quota2]: Version.inc src/external/bsd/llvm/config/llvm/Config [bouyer-quota2]: AsmParsers.def AsmPrinters.def Disassemblers.def Targets.def config.h llvm-config.h src/external/bsd/llvm/config/llvm/Support [bouyer-quota2]: DataTypes.h src/external/bsd/llvm/include [bouyer-quota2]: Makefile src/external/bsd/llvm/lib [bouyer-quota2]: Makefile Makefile.inc src/external/bsd/llvm/lib/libLLVMAnalysis [bouyer-quota2]: Makefile src/external/bsd/llvm/lib/libLLVMArchive [bouyer-quota2]: Makefile src/external/bsd/llvm/lib/libLLVMAsmParser [bouyer-quota2]: Makefile src/external/bsd/llvm/lib/libLLVMAsmPrinter [bouyer-quota2]: Makefile src/external/bsd/llvm/lib/libLLVMBitReader [bouyer-quota2]: Makefile src/external/bsd/llvm/lib/libLLVMBitWriter [bouyer-quota2]: Makefile src/external/bsd/llvm/lib/libLLVMCBackend [bouyer-quota2]: Makefile src/external/bsd/llvm/lib/libLLVMCBackendInfo [bouyer-quota2]: Makefile src/external/bsd/llvm/lib/libLLVMCodeGen [bouyer-quota2]: Makefile src/external/bsd/llvm/lib/libLLVMCompilerDriver [bouyer-quota2]: Makefile src/external/bsd/llvm/lib/libLLVMCore [bouyer-quota2]: Makefile src/external/bsd/llvm/lib/libLLVMCppBackend [bouyer-quota2]: Makefile src/external/bsd/llvm/lib/libLLVMCppBackendInfo [bouyer-quota2]: Makefile src/external/bsd/llvm/lib/libLLVMExecutionEngine [bouyer-quota2]: Makefile src/external/bsd/llvm/lib/libLLVMHello [bouyer-quota2]: Makefile src/external/bsd/llvm/lib/libLLVMInstCombine [bouyer-quota2]: Makefile src/external/bsd/llvm/lib/libLLVMInstrumentation [bouyer-quota2]: Makefile src/external/bsd/llvm/lib/libLLVMInterpreter [bouyer-quota2]: Makefile src/external/bsd/llvm/lib/libLLVMJIT [bouyer-quota2]: Makefile src/external/bsd/llvm/lib/libLLVMLinker [bouyer-quota2]: Makefile src/external/bsd/llvm/lib/libLLVMMC [bouyer-quota2]: Makefile src/external/bsd/llvm/lib/libLLVMMCDisassembler [bouyer-quota2]: Makefile src/external/bsd/llvm/lib/libLLVMMCJIT [bouyer-quota2]: Makefile src/external/bsd/llvm/lib/libLLVMMCParser [bouyer-quota2]: Makefile src/external/bsd/llvm/lib/libLLVMObject
CVS commit: [bouyer-quota2] src
Module Name:src Committed By: bouyer Date: Sat Mar 5 18:10:44 UTC 2011 Modified Files: src/usr.bin/quota [bouyer-quota2]: quota.c src/usr.sbin/edquota [bouyer-quota2]: edquota.c src/usr.sbin/repquota [bouyer-quota2]: repquota.c Log Message: The new quotactl interface should be filesystem-independant, so check only the MNT_QUOTA flag. To generate a diff of this commit: cvs rdiff -u -r1.33.2.9 -r1.33.2.10 src/usr.bin/quota/quota.c cvs rdiff -u -r1.29.16.11 -r1.29.16.12 src/usr.sbin/edquota/edquota.c cvs rdiff -u -r1.25.2.8 -r1.25.2.9 src/usr.sbin/repquota/repquota.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/quota/quota.c diff -u src/usr.bin/quota/quota.c:1.33.2.9 src/usr.bin/quota/quota.c:1.33.2.10 --- src/usr.bin/quota/quota.c:1.33.2.9 Mon Feb 14 20:38:56 2011 +++ src/usr.bin/quota/quota.c Sat Mar 5 18:10:44 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: quota.c,v 1.33.2.9 2011/02/14 20:38:56 bouyer Exp $ */ +/* $NetBSD: quota.c,v 1.33.2.10 2011/03/05 18:10:44 bouyer Exp $ */ /* * Copyright (c) 1980, 1990, 1993 @@ -42,7 +42,7 @@ #if 0 static char sccsid[] = @(#)quota.c 8.4 (Berkeley) 4/28/95; #else -__RCSID($NetBSD: quota.c,v 1.33.2.9 2011/02/14 20:38:56 bouyer Exp $); +__RCSID($NetBSD: quota.c,v 1.33.2.10 2011/03/05 18:10:44 bouyer Exp $); #endif #endif /* not lint */ @@ -507,9 +507,7 @@ version = 0; if (getnfsquota(fst[i], NULL, qup, id, quotatype) == 0) continue; - } else if (strncmp(fst[i].f_fstypename, ffs, - sizeof(fst[i].f_fstypename)) == 0 - (fst[i].f_flag ST_QUOTA) != 0) { + } else if ((fst[i].f_flag ST_QUOTA) != 0) { if (getvfsquota(fst[i].f_mntonname, qup-q2e, version, id, quotatype, dflag, Dflag) == 0) continue; Index: src/usr.sbin/edquota/edquota.c diff -u src/usr.sbin/edquota/edquota.c:1.29.16.11 src/usr.sbin/edquota/edquota.c:1.29.16.12 --- src/usr.sbin/edquota/edquota.c:1.29.16.11 Wed Feb 9 17:48:45 2011 +++ src/usr.sbin/edquota/edquota.c Sat Mar 5 18:10:44 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: edquota.c,v 1.29.16.11 2011/02/09 17:48:45 bouyer Exp $ */ +/* $NetBSD: edquota.c,v 1.29.16.12 2011/03/05 18:10:44 bouyer Exp $ */ /* * Copyright (c) 1980, 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -41,7 +41,7 @@ #if 0 static char sccsid[] = from: @(#)edquota.c 8.3 (Berkeley) 4/27/95; #else -__RCSID($NetBSD: edquota.c,v 1.29.16.11 2011/02/09 17:48:45 bouyer Exp $); +__RCSID($NetBSD: edquota.c,v 1.29.16.12 2011/03/05 18:10:44 bouyer Exp $); #endif #endif /* not lint */ @@ -386,8 +386,7 @@ errx(2, no filesystems mounted!); for (i = 0; i nfst; i++) { - if (strcmp(fst[i].f_fstypename, ffs) != 0 || - (fst[i].f_flag ST_QUOTA) == 0) + if ((fst[i].f_flag ST_QUOTA) == 0) continue; if (filesys strcmp(fst[i].f_mntonname, filesys) != 0 strcmp(fst[i].f_mntfromname, filesys) != 0) @@ -1123,8 +1122,7 @@ errx(2, no filesystems mounted!); for (i = 0; i nfst; i++) { - if (strcmp(fst[i].f_fstypename, ffs) != 0 || - (fst[i].f_flag ST_QUOTA) == 0) + if ((fst[i].f_flag ST_QUOTA) == 0) continue; if (filesys strcmp(fst[i].f_mntonname, filesys) != 0 strcmp(fst[i].f_mntfromname, filesys) != 0) Index: src/usr.sbin/repquota/repquota.c diff -u src/usr.sbin/repquota/repquota.c:1.25.2.8 src/usr.sbin/repquota/repquota.c:1.25.2.9 --- src/usr.sbin/repquota/repquota.c:1.25.2.8 Mon Feb 14 20:55:36 2011 +++ src/usr.sbin/repquota/repquota.c Sat Mar 5 18:10:44 2011 @@ -40,7 +40,7 @@ #if 0 static char sccsid[] = @(#)repquota.c 8.2 (Berkeley) 11/22/94; #else -__RCSID($NetBSD: repquota.c,v 1.25.2.8 2011/02/14 20:55:36 bouyer Exp $); +__RCSID($NetBSD: repquota.c,v 1.25.2.9 2011/03/05 18:10:44 bouyer Exp $); #endif #endif /* not lint */ @@ -173,9 +173,7 @@ if (nfst == 0) errx(2, no filesystems mounted!); for (i = 0; i nfst; i++) { - if (strncmp(fst[i].f_fstypename, ffs, - sizeof(fst[i].f_fstypename)) != 0 || - (fst[i].f_flag ST_QUOTA) == 0) + if ((fst[i].f_flag ST_QUOTA) == 0) continue; if (aflag) { if (gflag)
CVS commit: [bouyer-quota2] src/usr.sbin/repquota
Module Name:src Committed By: bouyer Date: Sat Mar 5 18:53:01 UTC 2011 Modified Files: src/usr.sbin/repquota [bouyer-quota2]: repquota.c Log Message: Make sure users which don't have quota entries are reported with the default quotas (instead of wrong all-0 quota entry, which cause it to be reported as overquota now) To generate a diff of this commit: cvs rdiff -u -r1.25.2.9 -r1.25.2.10 src/usr.sbin/repquota/repquota.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/repquota/repquota.c diff -u src/usr.sbin/repquota/repquota.c:1.25.2.9 src/usr.sbin/repquota/repquota.c:1.25.2.10 --- src/usr.sbin/repquota/repquota.c:1.25.2.9 Sat Mar 5 18:10:44 2011 +++ src/usr.sbin/repquota/repquota.c Sat Mar 5 18:53:00 2011 @@ -40,7 +40,7 @@ #if 0 static char sccsid[] = @(#)repquota.c 8.2 (Berkeley) 11/22/94; #else -__RCSID($NetBSD: repquota.c,v 1.25.2.9 2011/03/05 18:10:44 bouyer Exp $); +__RCSID($NetBSD: repquota.c,v 1.25.2.10 2011/03/05 18:53:00 bouyer Exp $); #endif #endif /* not lint */ @@ -95,6 +95,7 @@ struct fileusage *addid(u_long, int, const char *); int hasquota(struct fstab *, int, char **); struct fileusage *lookup(u_long, int); +struct fileusage *qremove(u_long, int); int main(int, char **); int oneof(const char *, char **, int); int repquota(const struct statvfs *, int); @@ -110,8 +111,6 @@ int argc; char **argv; { - struct passwd *pw; - struct group *gr; int gflag = 0, uflag = 0, errs = 0; long i, argnum, done = 0; int ch; @@ -147,7 +146,7 @@ } argc -= optind; argv += optind; - if (xflag argc != 1) + if (xflag (argc != 1 || aflag)) usage(); if (argc == 0 !aflag) usage(); @@ -156,18 +155,6 @@ gflag++; uflag++; } - if (gflag) { - setgrent(); - while ((gr = getgrent()) != 0) - (void) addid((u_long)gr-gr_gid, GRPQUOTA, gr-gr_name); - endgrent(); - } - if (uflag) { - setpwent(); - while ((pw = getpwent()) != 0) - (void) addid((u_long)pw-pw_uid, USRQUOTA, pw-pw_name); - endpwent(); - } nfst = getmntinfo(fst, MNT_WAIT); if (nfst == 0) @@ -410,6 +397,22 @@ char overchar[N_QL]; static time_t now; + if (type == GRPQUOTA) { + struct group *gr; + setgrent(); + while ((gr = getgrent()) != 0) + (void) addid((u_long)gr-gr_gid, GRPQUOTA, gr-gr_name); + endgrent(); + } else if (type == USRQUOTA) { + struct passwd *pw; + setpwent(); + while ((pw = getpwent()) != 0) + (void) addid((u_long)pw-pw_uid, USRQUOTA, pw-pw_name); + endpwent(); + } else { + errx(1, unknown quota type %d\n, type); + } + if (now == 0) time(now); @@ -424,7 +427,7 @@ printf(type == USRQUOTA ? User : Group); printf(used soft hard grace usedsofthard grace\n); for (id = 0; id = highid[type]; id++) { - fup = lookup(id, type); + fup = qremove(id, type); if (fup == 0) continue; for (i = 0; i N_QL; i++) { @@ -472,7 +475,7 @@ intprt(fup-fu_q2e.q2e_val[QL_FILE].q2v_hardlimit, 0, hflag, 8), timemsg[QL_FILE]); - memset(fup-fu_q2e, 0, sizeof(fup-fu_q2e)); + free(fup); } } @@ -506,7 +509,7 @@ err(1, prop_array_add(data)); for (id = 0; id = highid[type]; id++) { - fup = lookup(id, type); + fup = qremove(id, type); if (fup == 0) continue; fup-fu_q2e.q2e_uid = id; @@ -515,6 +518,7 @@ err(1, q2etoprop(default)); if (!prop_array_add_and_rel(datas, data)) err(1, prop_array_add(data)); + free(fup); } if (!quota2_prop_add_command(cmds, set, @@ -602,6 +606,26 @@ return (fup); return ((struct fileusage *)0); } +/* + * Lookup and remove an id of a specific type. + */ +struct fileusage * +qremove(id, type) + u_long id; + int type; +{ + struct fileusage *fup, **fupp; + + for (fupp = fuhead[type][id (FUHASH-1)]; *fupp != 0;) { + fup = *fupp; + if (fup-fu_id == id) { + *fupp = fup-fu_next; + return (fup); + } + fupp = fup-fu_next; + } + return ((struct fileusage *)0); +} /* * Add a new file usage id if it does not already exist. @@ -636,5 +660,6 @@ } else { sprintf(fup-fu_name, %lu, (u_long)id); } + fup-fu_q2e = defaultq2e[type]; return (fup); }
CVS commit: [bouyer-quota2] src/tests/fs/ffs
Module Name:src Committed By: bouyer Date: Sat Mar 5 18:54:48 UTC 2011 Modified Files: src/tests/fs/ffs [bouyer-quota2]: t_getquota.sh Log Message: Also check that repquota doesn't report any overquota user To generate a diff of this commit: cvs rdiff -u -r1.1.2.8 -r1.1.2.9 src/tests/fs/ffs/t_getquota.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/fs/ffs/t_getquota.sh diff -u src/tests/fs/ffs/t_getquota.sh:1.1.2.8 src/tests/fs/ffs/t_getquota.sh:1.1.2.9 --- src/tests/fs/ffs/t_getquota.sh:1.1.2.8 Fri Feb 11 16:54:03 2011 +++ src/tests/fs/ffs/t_getquota.sh Sat Mar 5 18:54:47 2011 @@ -1,4 +1,4 @@ -# $NetBSD: t_getquota.sh,v 1.1.2.8 2011/02/11 16:54:03 bouyer Exp $ +# $NetBSD: t_getquota.sh,v 1.1.2.9 2011/03/05 18:54:47 bouyer Exp $ # # Copyright (c) 2011 Manuel Bouyer # All rights reserved. @@ -69,6 +69,7 @@ $(atf_get_srcdir)/rump_quota -${q} -v atf_check -s exit:0 \ -o match:--0--1 - - \ +-o not-match:\+\+ \ $(atf_get_srcdir)/rump_repquota -${q} /mnt done
CVS commit: [bouyer-quota2] src/usr.sbin/repquota
Module Name:src Committed By: bouyer Date: Sat Mar 5 19:05:29 UTC 2011 Modified Files: src/usr.sbin/repquota [bouyer-quota2]: repquota.c Log Message: Report user or group name again instead of uid/gid. To generate a diff of this commit: cvs rdiff -u -r1.25.2.10 -r1.25.2.11 src/usr.sbin/repquota/repquota.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/repquota/repquota.c diff -u src/usr.sbin/repquota/repquota.c:1.25.2.10 src/usr.sbin/repquota/repquota.c:1.25.2.11 --- src/usr.sbin/repquota/repquota.c:1.25.2.10 Sat Mar 5 18:53:00 2011 +++ src/usr.sbin/repquota/repquota.c Sat Mar 5 19:05:29 2011 @@ -40,7 +40,7 @@ #if 0 static char sccsid[] = @(#)repquota.c 8.2 (Berkeley) 11/22/94; #else -__RCSID($NetBSD: repquota.c,v 1.25.2.10 2011/03/05 18:53:00 bouyer Exp $); +__RCSID($NetBSD: repquota.c,v 1.25.2.11 2011/03/05 19:05:29 bouyer Exp $); #endif #endif /* not lint */ @@ -397,19 +397,26 @@ char overchar[N_QL]; static time_t now; - if (type == GRPQUOTA) { + switch(type) { + case GRPQUOTA: + { struct group *gr; setgrent(); while ((gr = getgrent()) != 0) (void) addid((u_long)gr-gr_gid, GRPQUOTA, gr-gr_name); endgrent(); - } else if (type == USRQUOTA) { + break; + } + case USRQUOTA: + { struct passwd *pw; setpwent(); while ((pw = getpwent()) != 0) (void) addid((u_long)pw-pw_uid, USRQUOTA, pw-pw_name); endpwent(); - } else { + break; + } + default: errx(1, unknown quota type %d\n, type); } @@ -637,10 +644,31 @@ const char *name; { struct fileusage *fup, **fhp; + struct group *gr = NULL; + struct passwd *pw = NULL; int len; - if ((fup = lookup(id, type)) != NULL) + if ((fup = lookup(id, type)) != NULL) { return (fup); + } + if (name == NULL) { + switch(type) { + case GRPQUOTA: + gr = getgrgid(id); + + if (gr != NULL) +name = gr-gr_name; + break; + case USRQUOTA: + pw = getpwuid(id); + if (pw) +name = pw-pw_name; + break; + default: + errx(1, unknown quota type %d\n, type); + } + } + if (name) len = strlen(name); else
CVS commit: [bouyer-quota2] src
Module Name:src Committed By: bouyer Date: Sat Mar 5 18:10:44 UTC 2011 Modified Files: src/usr.bin/quota [bouyer-quota2]: quota.c src/usr.sbin/edquota [bouyer-quota2]: edquota.c src/usr.sbin/repquota [bouyer-quota2]: repquota.c Log Message: The new quotactl interface should be filesystem-independant, so check only the MNT_QUOTA flag. To generate a diff of this commit: cvs rdiff -u -r1.33.2.9 -r1.33.2.10 src/usr.bin/quota/quota.c cvs rdiff -u -r1.29.16.11 -r1.29.16.12 src/usr.sbin/edquota/edquota.c cvs rdiff -u -r1.25.2.8 -r1.25.2.9 src/usr.sbin/repquota/repquota.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [bouyer-quota2] src/sys/ufs/ffs
Module Name:src Committed By: bouyer Date: Fri Feb 18 09:51:16 UTC 2011 Modified Files: src/sys/ufs/ffs [bouyer-quota2]: ffs_snapshot.c Log Message: Sync with HEAD To generate a diff of this commit: cvs rdiff -u -r1.102.4.5 -r1.102.4.6 src/sys/ufs/ffs/ffs_snapshot.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/ufs/ffs/ffs_snapshot.c diff -u src/sys/ufs/ffs/ffs_snapshot.c:1.102.4.5 src/sys/ufs/ffs/ffs_snapshot.c:1.102.4.6 --- src/sys/ufs/ffs/ffs_snapshot.c:1.102.4.5 Thu Feb 17 13:28:15 2011 +++ src/sys/ufs/ffs/ffs_snapshot.c Fri Feb 18 09:51:16 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: ffs_snapshot.c,v 1.102.4.5 2011/02/17 13:28:15 bouyer Exp $ */ +/* $NetBSD: ffs_snapshot.c,v 1.102.4.6 2011/02/18 09:51:16 bouyer Exp $ */ /* * Copyright 2000 Marshall Kirk McKusick. All Rights Reserved. @@ -38,7 +38,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: ffs_snapshot.c,v 1.102.4.5 2011/02/17 13:28:15 bouyer Exp $); +__KERNEL_RCSID(0, $NetBSD: ffs_snapshot.c,v 1.102.4.6 2011/02/18 09:51:16 bouyer Exp $); #if defined(_KERNEL_OPT) #include opt_ffs.h @@ -288,7 +288,6 @@ fs-fs_snapinum[snaploc] = ip-i_number; mutex_enter(si-si_lock); - vref(vp); if (is_active_snapshot(si, ip)) panic(ffs_snapshot: %PRIu64 already on list, ip-i_number); TAILQ_INSERT_TAIL(si-si_snapshots, ip, i_nextsnap); @@ -402,7 +401,8 @@ (void) ffs_truncate(vp, (off_t)0, 0, NOCRED); UFS_WAPBL_END(mp); } - } + } else + vref(vp); return (error); } @@ -1321,8 +1321,10 @@ if (xp == ip) break; mutex_exit(si-si_lock); + if (xp != NULL) + vrele(ITOV(ip)); #ifdef DEBUG - if (snapdebug xp == NULL) + else if (snapdebug) printf(ffs_snapgone: lost snapshot vnode %llu\n, (unsigned long long)ip-i_number); #endif @@ -1390,7 +1392,6 @@ free(ip-i_snapblklist, M_UFSMNT); ip-i_snapblklist = NULL; } - vrele(vp); } else mutex_exit(si-si_lock); /* @@ -1775,25 +1776,28 @@ ffs_snapshot_unmount(struct mount *mp) { struct vnode *devvp = VFSTOUFS(mp)-um_devvp; - struct inode *ip; + struct inode *xp; + struct vnode *vp = NULL; struct snap_info *si; - bool list_empty = true; si = VFSTOUFS(mp)-um_snapinfo; mutex_enter(si-si_lock); - while ((ip = TAILQ_FIRST(si-si_snapshots)) != 0) { - list_empty = false; - TAILQ_REMOVE(si-si_snapshots, ip, i_nextsnap); - if (ip-i_snapblklist == si-si_snapblklist) + while ((xp = TAILQ_FIRST(si-si_snapshots)) != 0) { + vp = ITOV(xp); + TAILQ_REMOVE(si-si_snapshots, xp, i_nextsnap); + if (xp-i_snapblklist == si-si_snapblklist) si-si_snapblklist = NULL; - free(ip-i_snapblklist, M_UFSMNT); - si-si_gen++; - mutex_exit(si-si_lock); - vrele(ITOV(ip)); - mutex_enter(si-si_lock); + free(xp-i_snapblklist, M_UFSMNT); + if (xp-i_nlink 0) { + si-si_gen++; + mutex_exit(si-si_lock); + vrele(vp); + mutex_enter(si-si_lock); + } } + si-si_gen++; mutex_exit(si-si_lock); - if (! list_empty) + if (vp) fscow_disestablish(mp, ffs_copyonwrite, devvp); }
CVS commit: [bouyer-quota2] src/sys/ufs/ufs
Module Name:src Committed By: bouyer Date: Fri Feb 18 11:46:43 UTC 2011 Modified Files: src/sys/ufs/ufs [bouyer-quota2]: ufs_quota2.c Log Message: Only use B_MODIFY when needed, avoid unecessery copy on write when using snapshots. To generate a diff of this commit: cvs rdiff -u -r1.1.2.15 -r1.1.2.16 src/sys/ufs/ufs/ufs_quota2.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/ufs/ufs/ufs_quota2.c diff -u src/sys/ufs/ufs/ufs_quota2.c:1.1.2.15 src/sys/ufs/ufs/ufs_quota2.c:1.1.2.16 --- src/sys/ufs/ufs/ufs_quota2.c:1.1.2.15 Sat Feb 12 21:48:09 2011 +++ src/sys/ufs/ufs/ufs_quota2.c Fri Feb 18 11:46:43 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: ufs_quota2.c,v 1.1.2.15 2011/02/12 21:48:09 bouyer Exp $ */ +/* $NetBSD: ufs_quota2.c,v 1.1.2.16 2011/02/18 11:46:43 bouyer Exp $ */ /*- * Copyright (c) 2010 Manuel Bouyer * All rights reserved. @@ -28,7 +28,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: ufs_quota2.c,v 1.1.2.15 2011/02/12 21:48:09 bouyer Exp $); +__KERNEL_RCSID(0, $NetBSD: ufs_quota2.c,v 1.1.2.16 2011/02/18 11:46:43 bouyer Exp $); #include sys/buf.h #include sys/param.h @@ -64,7 +64,7 @@ */ static int quota2_bwrite(struct mount *, struct buf *); -static int getinoquota2(struct inode *, int, struct buf **, +static int getinoquota2(struct inode *, bool, bool, struct buf **, struct quota2_entry **); static int getq2h(struct ufsmount *, int, struct buf **, struct quota2_header **, int); @@ -321,7 +321,7 @@ } static int -getinoquota2(struct inode *ip, int alloc, struct buf **bpp, +getinoquota2(struct inode *ip, bool alloc, bool modify, struct buf **bpp, struct quota2_entry **q2ep) { int error; @@ -365,7 +365,7 @@ } if ((dq-dq2_lblkno | dq-dq2_blkoff) == 0) { - if (alloc == 0) { + if (!alloc) { continue; } /* need to alloc a new on-disk quot */ @@ -377,7 +377,8 @@ return error; } else { error = getq2e(ump, i, dq-dq2_lblkno, - dq-dq2_blkoff, bpp[i], q2ep[i], B_MODIFY); + dq-dq2_blkoff, bpp[i], q2ep[i], + modify ? B_MODIFY : 0); if (error) return error; } @@ -400,7 +401,7 @@ const int needswap = UFS_MPNEEDSWAP(ump); int i; - if ((error = getinoquota2(ip, change 0, bp, q2e)) != 0) + if ((error = getinoquota2(ip, change 0, change != 0, bp, q2e)) != 0) return error; if (change == 0) { for (i = 0; i MAXQUOTAS; i++) {
CVS commit: [bouyer-quota2] src/sys
Module Name:src Committed By: bouyer Date: Fri Feb 18 14:45:59 UTC 2011 Modified Files: src/sys/rump/fs/lib/libffs [bouyer-quota2]: Makefile src/sys/rump/librump/rumpvfs [bouyer-quota2]: Makefile.rumpvfs src/sys/ufs [bouyer-quota2]: files.ufs Log Message: quota2_subr.c is not used outside of ufs_quota2.c in kernel, so make it compiled conditionally on QUOTA2 again To generate a diff of this commit: cvs rdiff -u -r1.12.4.2 -r1.12.4.3 src/sys/rump/fs/lib/libffs/Makefile cvs rdiff -u -r1.28.4.1 -r1.28.4.2 \ src/sys/rump/librump/rumpvfs/Makefile.rumpvfs cvs rdiff -u -r1.24.6.4 -r1.24.6.5 src/sys/ufs/files.ufs Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/fs/lib/libffs/Makefile diff -u src/sys/rump/fs/lib/libffs/Makefile:1.12.4.2 src/sys/rump/fs/lib/libffs/Makefile:1.12.4.3 --- src/sys/rump/fs/lib/libffs/Makefile:1.12.4.2 Tue Feb 15 16:45:57 2011 +++ src/sys/rump/fs/lib/libffs/Makefile Fri Feb 18 14:45:59 2011 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.12.4.2 2011/02/15 16:45:57 bouyer Exp $ +# $NetBSD: Makefile,v 1.12.4.3 2011/02/18 14:45:59 bouyer Exp $ # .PATH: ${.CURDIR}/../../../../ufs/ffs ${.CURDIR}/../../../../ufs/ufs @@ -11,7 +11,7 @@ SRCS+= ufs_bmap.c ufs_dirhash.c ufs_extattr.c ufs_ihash.c ufs_inode.c \ ufs_lookup.c ufs_vfsops.c ufs_vnops.c ufs_wapbl.c \ - ufs_quota.c ufs_quota2.c + ufs_quota.c ufs_quota2.c quota2_subr.c CPPFLAGS+= -DFFS_EI -DUFS_DIRHASH -DWAPBL -DAPPLE_UFS -DUFS_EXTATTR \ -DQUOTA2 Index: src/sys/rump/librump/rumpvfs/Makefile.rumpvfs diff -u src/sys/rump/librump/rumpvfs/Makefile.rumpvfs:1.28.4.1 src/sys/rump/librump/rumpvfs/Makefile.rumpvfs:1.28.4.2 --- src/sys/rump/librump/rumpvfs/Makefile.rumpvfs:1.28.4.1 Tue Feb 15 16:45:57 2011 +++ src/sys/rump/librump/rumpvfs/Makefile.rumpvfs Fri Feb 18 14:45:59 2011 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.rumpvfs,v 1.28.4.1 2011/02/15 16:45:57 bouyer Exp $ +# $NetBSD: Makefile.rumpvfs,v 1.28.4.2 2011/02/18 14:45:59 bouyer Exp $ # .include ${RUMPTOP}/Makefile.rump @@ -51,7 +51,7 @@ SRCS+= mfs_miniroot.c #quota2 plists -SRCS+= quota1_subr.c quota2_subr.c quota2_prop.c +SRCS+= quota1_subr.c quota2_prop.c # dev # firmload is technically part of rumpdev, but it's pure vfs in nature. Index: src/sys/ufs/files.ufs diff -u src/sys/ufs/files.ufs:1.24.6.4 src/sys/ufs/files.ufs:1.24.6.5 --- src/sys/ufs/files.ufs:1.24.6.4 Tue Feb 15 16:45:57 2011 +++ src/sys/ufs/files.ufs Fri Feb 18 14:45:59 2011 @@ -1,4 +1,4 @@ -# $NetBSD: files.ufs,v 1.24.6.4 2011/02/15 16:45:57 bouyer Exp $ +# $NetBSD: files.ufs,v 1.24.6.5 2011/02/18 14:45:59 bouyer Exp $ deffs FFS deffs EXT2FS @@ -63,7 +63,7 @@ file ufs/ufs/ufs_quota1.c quota (ffs | lfs | mfs | ext2fs) file ufs/ufs/ufs_quota2.c quota2 (ffs | lfs | mfs | ext2fs) file ufs/ufs/quota1_subr.c -file ufs/ufs/quota2_subr.c +file ufs/ufs/quota2_subr.c quota2 (ffs | lfs | mfs | ext2fs) file ufs/ufs/quota2_prop.c file ufs/ufs/ufs_vfsops.c ffs | lfs | mfs | ext2fs file ufs/ufs/ufs_vnops.c ffs | lfs | mfs | ext2fs
CVS commit: [bouyer-quota2] src/external/bsd/acpica/bin/iasl
Module Name:src Committed By: bouyer Date: Fri Feb 18 19:05:45 UTC 2011 Modified Files: src/external/bsd/acpica/bin/iasl [bouyer-quota2]: Makefile Log Message: Sync with HEAD To generate a diff of this commit: cvs rdiff -u -r1.1.2.2 -r1.1.2.3 src/external/bsd/acpica/bin/iasl/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/acpica/bin/iasl/Makefile diff -u src/external/bsd/acpica/bin/iasl/Makefile:1.1.2.2 src/external/bsd/acpica/bin/iasl/Makefile:1.1.2.3 --- src/external/bsd/acpica/bin/iasl/Makefile:1.1.2.2 Thu Feb 17 11:57:26 2011 +++ src/external/bsd/acpica/bin/iasl/Makefile Fri Feb 18 19:05:45 2011 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.1.2.2 2011/02/17 11:57:26 bouyer Exp $ +# $NetBSD: Makefile,v 1.1.2.3 2011/02/18 19:05:45 bouyer Exp $ .if (${MACHINE_ARCH} == i386 || ${MACHINE_ARCH} == x86_64) PROG= iasl @@ -11,146 +11,66 @@ .include bsd.own.mk CPPFLAGS+= -I${TOPDIR}/../include -I${TOPDIR} -I. -CPPFLAGS+= -D_LINUX -DACPI_ASL_COMPILER -DACPI_USE_ALTERNATE_TIMEOUT +CPPFLAGS+= -D__NetBSD__ -DACPI_ASL_COMPILER -DACPI_USE_ALTERNATE_TIMEOUT CPPFLAGS+= -D_USE_BERKELEY_YACC LDADD+= -ll -ly -lrt -lpthread DPADD+= ${LIBL} ${LIBY} ${LIBRT} ${LIBPTHREAD} -DPSRCS= aslcompilerparse.c +DPSRCS= aslcompilerparse.c DPSRCS+=aslcompilerlex.c .PATH: ${TOPDIR} -SRCS= aslcompilerparse.c -SRCS+= aslcompilerlex.c -SRCS+= aslanalyze.c -SRCS+= aslcodegen.c -SRCS+= aslcompile.c -SRCS+= aslerror.c -SRCS+= aslfiles.c -SRCS+= asllength.c -SRCS+= asllisting.c -SRCS+= aslload.c -SRCS+= asllookup.c -SRCS+= aslmain.c -SRCS+= aslmap.c -SRCS+= aslopcodes.c -SRCS+= asloperands.c -SRCS+= aslpredef.c -SRCS+= aslresource.c -SRCS+= aslrestype1.c -SRCS+= aslrestype1i.c -SRCS+= aslrestype2.c -SRCS+= aslrestype2d.c -SRCS+= aslrestype2e.c -SRCS+= aslrestype2q.c -SRCS+= aslrestype2w.c -SRCS+= aslstartup.c -SRCS+= asltree.c -SRCS+= aslutils.c -SRCS+= asltransform.c -SRCS+= aslfold.c -SRCS+= aslstubs.c -SRCS+= aslopt.c -SRCS+= dtcompile.c -SRCS+= dtfield.c -SRCS+= dtio.c -SRCS+= dtsubtable.c -SRCS+= dttable.c -SRCS+= dtutils.c -.PATH: ${TOPDIR}/../common -SRCS+= getopt.c -.PATH: ${TOPDIR}/../utilities -SRCS+= utalloc.c -SRCS+= utcache.c -SRCS+= utcopy.c -SRCS+= utdebug.c -SRCS+= utdelete.c -SRCS+= utglobal.c -SRCS+= utinit.c -SRCS+= utlock.c -SRCS+= utobject.c -SRCS+= utmisc.c -SRCS+= utmath.c -SRCS+= utmutex.c -SRCS+= utresrc.c -SRCS+= utstate.c -SRCS+= utxface.c -.PATH: ${TOPDIR}/../namespace -SRCS+= nsaccess.c -SRCS+= nsalloc.c -SRCS+= nsdump.c -SRCS+= nsnames.c -SRCS+= nsobject.c -SRCS+= nsparse.c -SRCS+= nssearch.c -SRCS+= nsutils.c -SRCS+= nswalk.c -SRCS+= nsxfobj.c -.PATH: ${TOPDIR}/../parser -SRCS+= psargs.c -SRCS+= psloop.c -SRCS+= psopcode.c -SRCS+= psparse.c -SRCS+= psscope.c -SRCS+= pstree.c -SRCS+= psutils.c -SRCS+= pswalk.c -.PATH: ${TOPDIR}/../dispatcher -SRCS+= dmextern.c -SRCS+= dswscope.c -SRCS+= dswstate.c -SRCS+= dsfield.c -SRCS+= dsobject.c -SRCS+= dsopcode.c -SRCS+= dsutils.c -SRCS+= dswexec.c -SRCS+= dswload.c -.PATH: ${TOPDIR}/../executer -SRCS+= exconvrt.c -SRCS+= excreate.c -SRCS+= exdump.c -SRCS+= exmisc.c -SRCS+= exmutex.c -SRCS+= exnames.c -SRCS+= exoparg1.c -SRCS+= exoparg2.c -SRCS+= exoparg3.c -SRCS+= exoparg6.c -SRCS+= exprep.c -SRCS+= exregion.c -SRCS+= exresnte.c -SRCS+= exresolv.c -SRCS+= exresop.c -SRCS+= exstore.c -SRCS+= exstoren.c -SRCS+= exstorob.c -SRCS+= exsystem.c -SRCS+= exutils.c +SRCS+= aslcompilerparse.c aslcompilerlex.c adfile.c \ + aslanalyze.c aslbtypes.c aslcodegen.c aslcompile.c \ + aslerror.c aslfiles.c aslfold.c asllength.c \ + asllisting.c aslload.c asllookup.c aslmain.c aslmap.c \ + aslopcodes.c asloperands.c aslopt.c aslpredef.c \ + aslresource.c aslrestype1.c aslrestype1i.c \ + aslrestype2.c aslrestype2d.c aslrestype2e.c \ + aslrestype2q.c aslrestype2w.c aslstartup.c aslstubs.c \ + asltransform.c asltree.c aslutils.c asluuid.c \ + aslwalks.c dtcompile.c dtexpress.c dtfield.c dtio.c \ + dtsubtable.c dttable.c dttemplate.c dtutils.c + .PATH: ${TOPDIR}/../common -SRCS+= adfile.c -SRCS+= adisasm.c -SRCS+= adwalk.c -SRCS+= dmrestag.c -SRCS+= dmtable.c -SRCS+= dmtbinfo.c -SRCS+= dmtbdump.c +SRCS+= adisasm.c adwalk.c dmextern.c dmrestag.c dmtable.c \ + dmtbdump.c dmtbinfo.c getopt.c + .PATH: ${TOPDIR}/../debugger -SRCS+= dbfileio.c +SRCS+= dbfileio.c + .PATH: ${TOPDIR}/../disassembler -SRCS+= dmbuffer.c -SRCS+= dmnames.c -SRCS+= dmopcode.c -SRCS+= dmobject.c -SRCS+= dmresrc.c -SRCS+= dmresrcl.c -SRCS+= dmresrcs.c -SRCS+= dmutils.c -SRCS+= dmwalk.c +SRCS+= dmbuffer.c dmnames.c dmobject.c dmopcode.c dmresrc.c\ + dmresrcl.c dmresrcs.c dmutils.c dmwalk.c + +.PATH: ${TOPDIR}/../dispatcher +SRCS+= dsargs.c dscontrol.c dsfield.c dsobject.c dsopcode.c\ + dsutils.c dswexec.c dswload.c dswload2.c dswscope.c \ + dswstate.c + +.PATH: ${TOPDIR}/../executer +SRCS+=
CVS commit: [bouyer-quota2] src/sys
Module Name:src Committed By: bouyer Date: Fri Feb 18 19:54:45 UTC 2011 Modified Files: src/sys/sys [bouyer-quota2]: stat.h src/sys/ufs/ffs [bouyer-quota2]: ffs_snapshot.c src/sys/ufs/ufs [bouyer-quota2]: ufs_bmap.c ufs_readwrite.c ufs_vnops.c Log Message: Add a new inode flag, SF_SNAPINVAL, to be set on SF_SNAPSHOT inodes when the snapshot is invalid. Set SF_SNAPSHOT | SF_SNAPINVAL early when initializing a snapshot indode, so that quota are bypassed for allocations on this inode. Set SF_SNAPSHOT | SF_SNAPINVAL (instead of clearing SF_SNAPSHOT) when expuge()ing a snapshot inode, so that userland tools working on the snapshot (e.g. fsck or dump) can properly handle this inode. The main point at this time is to have fsck_ffs -X properly compute quotas; as a bonus persistent snapshots files won't show up in a dump(8) from a snapshot. This may also help speeding up taking snapshots, by bypassing expuge() for snapshot inodes completely (but this needs more thoughs). Briefly discussed with hannken@ in private mail. To generate a diff of this commit: cvs rdiff -u -r1.59 -r1.59.8.1 src/sys/sys/stat.h cvs rdiff -u -r1.102.4.6 -r1.102.4.7 src/sys/ufs/ffs/ffs_snapshot.c cvs rdiff -u -r1.48 -r1.48.34.1 src/sys/ufs/ufs/ufs_bmap.c cvs rdiff -u -r1.95 -r1.95.4.1 src/sys/ufs/ufs/ufs_readwrite.c cvs rdiff -u -r1.186.4.1 -r1.186.4.2 src/sys/ufs/ufs/ufs_vnops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/sys/stat.h diff -u src/sys/sys/stat.h:1.59 src/sys/sys/stat.h:1.59.8.1 --- src/sys/sys/stat.h:1.59 Thu Aug 27 07:28:42 2009 +++ src/sys/sys/stat.h Fri Feb 18 19:54:44 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: stat.h,v 1.59 2009/08/27 07:28:42 mouse Exp $ */ +/* $NetBSD: stat.h,v 1.59.8.1 2011/02/18 19:54:44 bouyer Exp $ */ /*- * Copyright (c) 1982, 1986, 1989, 1993 @@ -195,6 +195,7 @@ /* SF_NOUNLINK 0x0010 [NOT IMPLEMENTED] */ #define SF_SNAPSHOT 0x0020 /* snapshot inode */ #define SF_LOG 0x0040 /* WAPBL log file inode */ +#define SF_SNAPINVAL 0x0080 /* snapshot is invalid */ #ifdef _KERNEL /* Index: src/sys/ufs/ffs/ffs_snapshot.c diff -u src/sys/ufs/ffs/ffs_snapshot.c:1.102.4.6 src/sys/ufs/ffs/ffs_snapshot.c:1.102.4.7 --- src/sys/ufs/ffs/ffs_snapshot.c:1.102.4.6 Fri Feb 18 09:51:16 2011 +++ src/sys/ufs/ffs/ffs_snapshot.c Fri Feb 18 19:54:44 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: ffs_snapshot.c,v 1.102.4.6 2011/02/18 09:51:16 bouyer Exp $ */ +/* $NetBSD: ffs_snapshot.c,v 1.102.4.7 2011/02/18 19:54:44 bouyer Exp $ */ /* * Copyright 2000 Marshall Kirk McKusick. All Rights Reserved. @@ -38,7 +38,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: ffs_snapshot.c,v 1.102.4.6 2011/02/18 09:51:16 bouyer Exp $); +__KERNEL_RCSID(0, $NetBSD: ffs_snapshot.c,v 1.102.4.7 2011/02/18 19:54:44 bouyer Exp $); #if defined(_KERNEL_OPT) #include opt_ffs.h @@ -194,7 +194,7 @@ /* * If the vnode already is a snapshot, return. */ - if (VTOI(vp)-i_flags SF_SNAPSHOT) { + if ((VTOI(vp)-i_flags (SF_SNAPSHOT | SF_SNAPINVAL)) == SF_SNAPSHOT) { if (ctime) { ctime-tv_sec = DIP(VTOI(vp), mtime); ctime-tv_nsec = DIP(VTOI(vp), mtimensec); @@ -215,18 +215,6 @@ error = snapshot_setup(mp, vp); if (error) goto out; - /* shapshot inodes are not accounted in quotas */ -#if defined(QUOTA) || defined(QUOTA2) - chkdq(ip, -DIP(ip, blocks), l-l_cred, 0); - chkiq(ip, -1, l-l_cred, 0); -#endif - /* - * Change inode to snapshot type file. - */ - ip-i_flags |= SF_SNAPSHOT; - DIP_ASSIGN(ip, flags, ip-i_flags); - ip-i_flag |= IN_CHANGE | IN_UPDATE; - /* * Copy all the cylinder group maps. Although the @@ -239,6 +227,14 @@ error = cgaccount(vp, 1, NULL); if (error) goto out; + + /* + * snapshot is now valid + */ + ip-i_flags = ~SF_SNAPINVAL; + DIP_ASSIGN(ip, flags, ip-i_flags); + ip-i_flag |= IN_CHANGE | IN_UPDATE; + /* * Ensure that the snapshot is completely on disk. * Since we have marked it as a snapshot it is safe to @@ -418,6 +414,7 @@ struct fs *fs = VFSTOUFS(mp)-um_fs; struct lwp *l = curlwp; const int wbreak = blocks_in_journal(fs)/8; + struct inode *ip = VTOI(vp); /* * Check mount, exclusive reference and owner. @@ -436,6 +433,22 @@ if (error) return error; } + + /* Change inode to snapshot type file. */ + error = UFS_WAPBL_BEGIN(mp); + if (error) + return error; +#if defined(QUOTA) || defined(QUOTA2) + /* shapshot inodes are not accounted in quotas */ + chkiq(ip, -1, l-l_cred, 0); +#endif + ip-i_flags |= (SF_SNAPSHOT | SF_SNAPINVAL); + DIP_ASSIGN(ip, flags, ip-i_flags); + ip-i_flag |= IN_CHANGE | IN_UPDATE; + ffs_update(vp, NULL, NULL, UPDATE_WAIT); + UFS_WAPBL_END(mp); + + KASSERT(ip-i_flags SF_SNAPSHOT); /* * Write an empty list of preallocated blocks to the end of * the snapshot to set size to at least that of the filesystem. @@ -571,7 +584,7 @@ snapshot_expunge(struct mount *mp, struct vnode
CVS commit: [bouyer-quota2] src/sys/ufs/ffs
Module Name:src Committed By: bouyer Date: Fri Feb 18 09:51:16 UTC 2011 Modified Files: src/sys/ufs/ffs [bouyer-quota2]: ffs_snapshot.c Log Message: Sync with HEAD To generate a diff of this commit: cvs rdiff -u -r1.102.4.5 -r1.102.4.6 src/sys/ufs/ffs/ffs_snapshot.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [bouyer-quota2] src/sys/ufs/ufs
Module Name:src Committed By: bouyer Date: Fri Feb 18 11:46:43 UTC 2011 Modified Files: src/sys/ufs/ufs [bouyer-quota2]: ufs_quota2.c Log Message: Only use B_MODIFY when needed, avoid unecessery copy on write when using snapshots. To generate a diff of this commit: cvs rdiff -u -r1.1.2.15 -r1.1.2.16 src/sys/ufs/ufs/ufs_quota2.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [bouyer-quota2] src/sys
Module Name:src Committed By: bouyer Date: Fri Feb 18 14:45:59 UTC 2011 Modified Files: src/sys/rump/fs/lib/libffs [bouyer-quota2]: Makefile src/sys/rump/librump/rumpvfs [bouyer-quota2]: Makefile.rumpvfs src/sys/ufs [bouyer-quota2]: files.ufs Log Message: quota2_subr.c is not used outside of ufs_quota2.c in kernel, so make it compiled conditionally on QUOTA2 again To generate a diff of this commit: cvs rdiff -u -r1.12.4.2 -r1.12.4.3 src/sys/rump/fs/lib/libffs/Makefile cvs rdiff -u -r1.28.4.1 -r1.28.4.2 \ src/sys/rump/librump/rumpvfs/Makefile.rumpvfs cvs rdiff -u -r1.24.6.4 -r1.24.6.5 src/sys/ufs/files.ufs Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [bouyer-quota2] src/external/bsd/acpica/bin/iasl
Module Name:src Committed By: bouyer Date: Fri Feb 18 19:05:45 UTC 2011 Modified Files: src/external/bsd/acpica/bin/iasl [bouyer-quota2]: Makefile Log Message: Sync with HEAD To generate a diff of this commit: cvs rdiff -u -r1.1.2.2 -r1.1.2.3 src/external/bsd/acpica/bin/iasl/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [bouyer-quota2] src/sys
Module Name:src Committed By: bouyer Date: Fri Feb 18 19:54:45 UTC 2011 Modified Files: src/sys/sys [bouyer-quota2]: stat.h src/sys/ufs/ffs [bouyer-quota2]: ffs_snapshot.c src/sys/ufs/ufs [bouyer-quota2]: ufs_bmap.c ufs_readwrite.c ufs_vnops.c Log Message: Add a new inode flag, SF_SNAPINVAL, to be set on SF_SNAPSHOT inodes when the snapshot is invalid. Set SF_SNAPSHOT | SF_SNAPINVAL early when initializing a snapshot indode, so that quota are bypassed for allocations on this inode. Set SF_SNAPSHOT | SF_SNAPINVAL (instead of clearing SF_SNAPSHOT) when expuge()ing a snapshot inode, so that userland tools working on the snapshot (e.g. fsck or dump) can properly handle this inode. The main point at this time is to have fsck_ffs -X properly compute quotas; as a bonus persistent snapshots files won't show up in a dump(8) from a snapshot. This may also help speeding up taking snapshots, by bypassing expuge() for snapshot inodes completely (but this needs more thoughs). Briefly discussed with hannken@ in private mail. To generate a diff of this commit: cvs rdiff -u -r1.59 -r1.59.8.1 src/sys/sys/stat.h cvs rdiff -u -r1.102.4.6 -r1.102.4.7 src/sys/ufs/ffs/ffs_snapshot.c cvs rdiff -u -r1.48 -r1.48.34.1 src/sys/ufs/ufs/ufs_bmap.c cvs rdiff -u -r1.95 -r1.95.4.1 src/sys/ufs/ufs/ufs_readwrite.c cvs rdiff -u -r1.186.4.1 -r1.186.4.2 src/sys/ufs/ufs/ufs_vnops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [bouyer-quota2] src/sys/ufs/ffs
Module Name:src Committed By: bouyer Date: Thu Feb 17 10:37:56 UTC 2011 Modified Files: src/sys/ufs/ffs [bouyer-quota2]: ffs_snapshot.c Log Message: Do not adjust quota when a snapshot inode is cleared in a snapshot view. To generate a diff of this commit: cvs rdiff -u -r1.102.4.2 -r1.102.4.3 src/sys/ufs/ffs/ffs_snapshot.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/ufs/ffs/ffs_snapshot.c diff -u src/sys/ufs/ffs/ffs_snapshot.c:1.102.4.2 src/sys/ufs/ffs/ffs_snapshot.c:1.102.4.3 --- src/sys/ufs/ffs/ffs_snapshot.c:1.102.4.2 Sat Feb 12 21:48:09 2011 +++ src/sys/ufs/ffs/ffs_snapshot.c Thu Feb 17 10:37:55 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: ffs_snapshot.c,v 1.102.4.2 2011/02/12 21:48:09 bouyer Exp $ */ +/* $NetBSD: ffs_snapshot.c,v 1.102.4.3 2011/02/17 10:37:55 bouyer Exp $ */ /* * Copyright 2000 Marshall Kirk McKusick. All Rights Reserved. @@ -38,7 +38,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: ffs_snapshot.c,v 1.102.4.2 2011/02/12 21:48:09 bouyer Exp $); +__KERNEL_RCSID(0, $NetBSD: ffs_snapshot.c,v 1.102.4.3 2011/02/17 10:37:55 bouyer Exp $); #if defined(_KERNEL_OPT) #include opt_ffs.h @@ -214,7 +214,7 @@ error = snapshot_setup(mp, vp); if (error) goto out; - /* quota inodes are not accounted in quotas */ + /* shapshot inodes are not accounted in quotas */ #if defined(QUOTA) || defined(QUOTA2) chkdq(ip, -DIP(ip, blocks), l-l_cred, 0); chkiq(ip, -1, l-l_cred, 0); @@ -1036,10 +1036,6 @@ ufs_rw32(ufs_rw32(dip1-di_flags, ns) ~SF_SNAPSHOT, ns); memset(dip1-di_db[0], 0, (NDADDR + NIADDR) * sizeof(int32_t)); /* quota inodes are not accounted in quotas */ -#if defined(QUOTA) || defined(QUOTA2) - if (dip1-di_mode != 0) - chkiq(cancelip, 1, l-l_cred, FORCE); -#endif } else { dip2 = (struct ufs2_dinode *)bp-b_data + ino_to_fsbo(fs, cancelip-i_number); @@ -1050,10 +1046,6 @@ dip2-di_flags = ufs_rw32(ufs_rw32(dip2-di_flags, ns) ~SF_SNAPSHOT, ns); memset(dip2-di_db[0], 0, (NDADDR + NIADDR) * sizeof(int64_t)); -#if defined(QUOTA) || defined(QUOTA2) - if (dip2-di_mode != 0) - chkiq(cancelip, 1, l-l_cred, FORCE); -#endif } bdwrite(bp); /*
CVS commit: [bouyer-quota2] src/sys/ufs/ffs
Module Name:src Committed By: bouyer Date: Thu Feb 17 13:28:15 UTC 2011 Modified Files: src/sys/ufs/ffs [bouyer-quota2]: ffs_snapshot.c Log Message: Remove comment that should not be there To generate a diff of this commit: cvs rdiff -u -r1.102.4.4 -r1.102.4.5 src/sys/ufs/ffs/ffs_snapshot.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/ufs/ffs/ffs_snapshot.c diff -u src/sys/ufs/ffs/ffs_snapshot.c:1.102.4.4 src/sys/ufs/ffs/ffs_snapshot.c:1.102.4.5 --- src/sys/ufs/ffs/ffs_snapshot.c:1.102.4.4 Thu Feb 17 12:00:52 2011 +++ src/sys/ufs/ffs/ffs_snapshot.c Thu Feb 17 13:28:15 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: ffs_snapshot.c,v 1.102.4.4 2011/02/17 12:00:52 bouyer Exp $ */ +/* $NetBSD: ffs_snapshot.c,v 1.102.4.5 2011/02/17 13:28:15 bouyer Exp $ */ /* * Copyright 2000 Marshall Kirk McKusick. All Rights Reserved. @@ -38,7 +38,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: ffs_snapshot.c,v 1.102.4.4 2011/02/17 12:00:52 bouyer Exp $); +__KERNEL_RCSID(0, $NetBSD: ffs_snapshot.c,v 1.102.4.5 2011/02/17 13:28:15 bouyer Exp $); #if defined(_KERNEL_OPT) #include opt_ffs.h @@ -1051,7 +1051,6 @@ dip1-di_flags = ufs_rw32(ufs_rw32(dip1-di_flags, ns) ~SF_SNAPSHOT, ns); memset(dip1-di_db[0], 0, (NDADDR + NIADDR) * sizeof(int32_t)); - /* quota inodes are not accounted in quotas */ } else { dip2 = (struct ufs2_dinode *)bp-b_data + ino_to_fsbo(fs, cancelip-i_number);
CVS commit: [bouyer-quota2] src/sys
Module Name:src Committed By: bouyer Date: Thu Feb 17 13:58:46 UTC 2011 Modified Files: src/sys/dev/acpi [bouyer-quota2]: acpi_ec.c acpi_wakedev.c src/sys/dev/acpi/acpica [bouyer-quota2]: OsdMisc.c src/sys/external/bsd/acpica/conf [bouyer-quota2]: files.acpica src/sys/external/bsd/acpica/dist/debugger [bouyer-quota2]: dbdisply.c src/sys/external/bsd/acpica/dist/dispatcher [bouyer-quota2]: dscontrol.c src/sys/external/bsd/acpica/dist/include [bouyer-quota2]: acutils.h src/sys/external/bsd/acpica/dist/utilities [bouyer-quota2]: utdebug.c utdecode.c utosi.c Log Message: Sync with HEAD To generate a diff of this commit: cvs rdiff -u -r1.68 -r1.68.4.1 src/sys/dev/acpi/acpi_ec.c cvs rdiff -u -r1.20 -r1.20.4.1 src/sys/dev/acpi/acpi_wakedev.c cvs rdiff -u -r1.9.4.1 -r1.9.4.2 src/sys/dev/acpi/acpica/OsdMisc.c cvs rdiff -u -r1.2.2.2 -r1.2.2.3 \ src/sys/external/bsd/acpica/conf/files.acpica cvs rdiff -u -r1.3.2.2 -r1.3.2.3 \ src/sys/external/bsd/acpica/dist/debugger/dbdisply.c cvs rdiff -u -r1.2.2.2 -r1.2.2.3 \ src/sys/external/bsd/acpica/dist/dispatcher/dscontrol.c cvs rdiff -u -r1.4.2.2 -r1.4.2.3 \ src/sys/external/bsd/acpica/dist/include/acutils.h cvs rdiff -u -r1.3.2.2 -r1.3.2.3 \ src/sys/external/bsd/acpica/dist/utilities/utdebug.c cvs rdiff -u -r1.2.2.2 -r1.2.2.3 \ src/sys/external/bsd/acpica/dist/utilities/utdecode.c \ src/sys/external/bsd/acpica/dist/utilities/utosi.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/acpi/acpi_ec.c diff -u src/sys/dev/acpi/acpi_ec.c:1.68 src/sys/dev/acpi/acpi_ec.c:1.68.4.1 --- src/sys/dev/acpi/acpi_ec.c:1.68 Fri Jan 7 14:08:29 2011 +++ src/sys/dev/acpi/acpi_ec.c Thu Feb 17 13:58:44 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: acpi_ec.c,v 1.68 2011/01/07 14:08:29 cegger Exp $ */ +/* $NetBSD: acpi_ec.c,v 1.68.4.1 2011/02/17 13:58:44 bouyer Exp $ */ /*- * Copyright (c) 2007 Joerg Sonnenberger jo...@netbsd.org. @@ -59,7 +59,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: acpi_ec.c,v 1.68 2011/01/07 14:08:29 cegger Exp $); +__KERNEL_RCSID(0, $NetBSD: acpi_ec.c,v 1.68.4.1 2011/02/17 13:58:44 bouyer Exp $); #include sys/param.h #include sys/callout.h @@ -161,7 +161,7 @@ static void acpiec_callout(void *); static void acpiec_gpe_query(void *); -static uint32_t acpiec_gpe_handler(void *); +static uint32_t acpiec_gpe_handler(ACPI_HANDLE, uint32_t, void *); static ACPI_STATUS acpiec_space_setup(ACPI_HANDLE, uint32_t, void *, void **); static ACPI_STATUS acpiec_space_handler(uint32_t, ACPI_PHYSICAL_ADDRESS, uint32_t, ACPI_INTEGER *, void *, void *); @@ -366,7 +366,7 @@ goto post_csr_map; } - rv = AcpiEnableGpe(sc-sc_gpeh, sc-sc_gpebit, ACPI_GPE_TYPE_RUNTIME); + rv = AcpiEnableGpe(sc-sc_gpeh, sc-sc_gpebit); if (rv != AE_OK) { aprint_error_dev(self, unable to enable GPE: %s\n, AcpiFormatException(rv)); @@ -844,7 +844,7 @@ } static uint32_t -acpiec_gpe_handler(void *arg) +acpiec_gpe_handler(ACPI_HANDLE hdl, uint32_t gpebit, void *arg) { device_t dv = arg; struct acpiec_softc *sc = device_private(dv); Index: src/sys/dev/acpi/acpi_wakedev.c diff -u src/sys/dev/acpi/acpi_wakedev.c:1.20 src/sys/dev/acpi/acpi_wakedev.c:1.20.4.1 --- src/sys/dev/acpi/acpi_wakedev.c:1.20 Sun Jan 2 12:06:02 2011 +++ src/sys/dev/acpi/acpi_wakedev.c Thu Feb 17 13:58:44 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: acpi_wakedev.c,v 1.20 2011/01/02 12:06:02 jruoho Exp $ */ +/* $NetBSD: acpi_wakedev.c,v 1.20.4.1 2011/02/17 13:58:44 bouyer Exp $ */ /*- * Copyright (c) 2009, 2010 Jared D. McNeill jmcne...@invisible.ca @@ -27,7 +27,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: acpi_wakedev.c,v 1.20 2011/01/02 12:06:02 jruoho Exp $); +__KERNEL_RCSID(0, $NetBSD: acpi_wakedev.c,v 1.20.4.1 2011/02/17 13:58:44 bouyer Exp $); #include sys/param.h #include sys/device.h @@ -287,12 +287,17 @@ acpi_wakedev_power(ad, obj); /* - * Set both runtime and wake GPEs, but unset only wake GPEs. + * This affects only wake GPEs, provided that _PRW works. */ if (enable != 0) - (void)AcpiEnableGpe(hdl, val, ACPI_GPE_TYPE_WAKE_RUN); + (void)AcpiSetGpe(hdl, val, ACPI_GPE_ENABLE); else - (void)AcpiDisableGpe(hdl, val, ACPI_GPE_TYPE_WAKE); + (void)AcpiSetGpe(hdl, val, ACPI_GPE_DISABLE); + + /* + * XXX: Is this right? + */ + (void)AcpiUpdateAllGpes(); ACPI_DEBUG_PRINT((ACPI_DB_INFO, wake GPE %s for %s\n, (enable != 0) ? enabled : disabled, ad-ad_name)); Index: src/sys/dev/acpi/acpica/OsdMisc.c diff -u src/sys/dev/acpi/acpica/OsdMisc.c:1.9.4.1 src/sys/dev/acpi/acpica/OsdMisc.c:1.9.4.2 --- src/sys/dev/acpi/acpica/OsdMisc.c:1.9.4.1 Thu Feb 17 12:00:10 2011 +++ src/sys/dev/acpi/acpica/OsdMisc.c Thu Feb 17 13:58:45 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: OsdMisc.c,v 1.9.4.1 2011/02/17 12:00:10 bouyer Exp $ */ +/* $NetBSD: OsdMisc.c,v 1.9.4.2
CVS commit: [bouyer-quota2] src/usr.sbin/acpitools/acpidump
Module Name:src Committed By: bouyer Date: Thu Feb 17 15:24:52 UTC 2011 Modified Files: src/usr.sbin/acpitools/acpidump [bouyer-quota2]: acpidump.h Log Message: Sync with HEAD To generate a diff of this commit: cvs rdiff -u -r1.2.2.1 -r1.2.2.2 src/usr.sbin/acpitools/acpidump/acpidump.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/acpitools/acpidump/acpidump.h diff -u src/usr.sbin/acpitools/acpidump/acpidump.h:1.2.2.1 src/usr.sbin/acpitools/acpidump/acpidump.h:1.2.2.2 --- src/usr.sbin/acpitools/acpidump/acpidump.h:1.2.2.1 Thu Feb 17 12:00:57 2011 +++ src/usr.sbin/acpitools/acpidump/acpidump.h Thu Feb 17 15:24:51 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: acpidump.h,v 1.2.2.1 2011/02/17 12:00:57 bouyer Exp $ */ +/* $NetBSD: acpidump.h,v 1.2.2.2 2011/02/17 15:24:51 bouyer Exp $ */ /*- * Copyright (c) 1999 Doug Rabson @@ -54,6 +54,8 @@ #define ACPI_HPET_ID_LEGACY_CAPABLE 0x8000 #define ACPI_HPET_ID_PCI_VENDOR_ID 0x +#define ACPI_RSDP_REV0_SIZE 20 /* Size of original ACPI 1.0 RSDP */ + /* Find and map the RSD PTR structure and return it for parsing */ ACPI_TABLE_HEADER *sdt_load_devmem(void);
CVS commit: [bouyer-quota2] src/sbin/fsck_ffs
Module Name:src Committed By: bouyer Date: Thu Feb 17 17:13:48 UTC 2011 Modified Files: src/sbin/fsck_ffs [bouyer-quota2]: setup.c Log Message: Move quota2_check_doquota() call so that an unclean, wapbl filesystem will still be ckecked if a quota inode needs to be created. To generate a diff of this commit: cvs rdiff -u -r1.90.2.1 -r1.90.2.2 src/sbin/fsck_ffs/setup.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/fsck_ffs/setup.c diff -u src/sbin/fsck_ffs/setup.c:1.90.2.1 src/sbin/fsck_ffs/setup.c:1.90.2.2 --- src/sbin/fsck_ffs/setup.c:1.90.2.1 Thu Jan 20 14:24:54 2011 +++ src/sbin/fsck_ffs/setup.c Thu Feb 17 17:13:48 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: setup.c,v 1.90.2.1 2011/01/20 14:24:54 bouyer Exp $ */ +/* $NetBSD: setup.c,v 1.90.2.2 2011/02/17 17:13:48 bouyer Exp $ */ /* * Copyright (c) 1980, 1986, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = @(#)setup.c 8.10 (Berkeley) 5/9/95; #else -__RCSID($NetBSD: setup.c,v 1.90.2.1 2011/01/20 14:24:54 bouyer Exp $); +__RCSID($NetBSD: setup.c,v 1.90.2.2 2011/02/17 17:13:48 bouyer Exp $); #endif #endif /* not lint */ @@ -174,6 +174,10 @@ doskipclean = 0; pwarn(USING ALTERNATE SUPERBLOCK AT %d\n, bflag); } + + if (!quota2_check_doquota()) + doskipclean = 0; + /* ffs_superblock_layout() == 2 */ if (sblock-fs_magic != FS_UFS1_MAGIC || (sblock-fs_old_flags FS_FLAGS_UPDATED) != 0) { @@ -182,7 +186,7 @@ doskipclean = 0; } if (sblock-fs_flags FS_DOWAPBL) { - if (preen skipclean) { + if (preen doskipclean) { if (!quiet) pwarn(file system is journaled; not checking\n); @@ -210,9 +214,6 @@ if (doswap) doskipclean = 0; - if (!quota2_check_doquota()) - doskipclean = 0; - if (sblock-fs_clean FS_ISCLEAN) { if (doskipclean) { if (!quiet)
CVS commit: [bouyer-quota2] src/sys/ufs/ffs
Module Name:src Committed By: bouyer Date: Thu Feb 17 10:37:56 UTC 2011 Modified Files: src/sys/ufs/ffs [bouyer-quota2]: ffs_snapshot.c Log Message: Do not adjust quota when a snapshot inode is cleared in a snapshot view. To generate a diff of this commit: cvs rdiff -u -r1.102.4.2 -r1.102.4.3 src/sys/ufs/ffs/ffs_snapshot.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [bouyer-quota2] src/sys
Module Name:src Committed By: bouyer Date: Thu Feb 17 13:58:46 UTC 2011 Modified Files: src/sys/dev/acpi [bouyer-quota2]: acpi_ec.c acpi_wakedev.c src/sys/dev/acpi/acpica [bouyer-quota2]: OsdMisc.c src/sys/external/bsd/acpica/conf [bouyer-quota2]: files.acpica src/sys/external/bsd/acpica/dist/debugger [bouyer-quota2]: dbdisply.c src/sys/external/bsd/acpica/dist/dispatcher [bouyer-quota2]: dscontrol.c src/sys/external/bsd/acpica/dist/include [bouyer-quota2]: acutils.h src/sys/external/bsd/acpica/dist/utilities [bouyer-quota2]: utdebug.c utdecode.c utosi.c Log Message: Sync with HEAD To generate a diff of this commit: cvs rdiff -u -r1.68 -r1.68.4.1 src/sys/dev/acpi/acpi_ec.c cvs rdiff -u -r1.20 -r1.20.4.1 src/sys/dev/acpi/acpi_wakedev.c cvs rdiff -u -r1.9.4.1 -r1.9.4.2 src/sys/dev/acpi/acpica/OsdMisc.c cvs rdiff -u -r1.2.2.2 -r1.2.2.3 \ src/sys/external/bsd/acpica/conf/files.acpica cvs rdiff -u -r1.3.2.2 -r1.3.2.3 \ src/sys/external/bsd/acpica/dist/debugger/dbdisply.c cvs rdiff -u -r1.2.2.2 -r1.2.2.3 \ src/sys/external/bsd/acpica/dist/dispatcher/dscontrol.c cvs rdiff -u -r1.4.2.2 -r1.4.2.3 \ src/sys/external/bsd/acpica/dist/include/acutils.h cvs rdiff -u -r1.3.2.2 -r1.3.2.3 \ src/sys/external/bsd/acpica/dist/utilities/utdebug.c cvs rdiff -u -r1.2.2.2 -r1.2.2.3 \ src/sys/external/bsd/acpica/dist/utilities/utdecode.c \ src/sys/external/bsd/acpica/dist/utilities/utosi.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [bouyer-quota2] src/usr.sbin/acpitools/acpidump
Module Name:src Committed By: bouyer Date: Thu Feb 17 15:24:52 UTC 2011 Modified Files: src/usr.sbin/acpitools/acpidump [bouyer-quota2]: acpidump.h Log Message: Sync with HEAD To generate a diff of this commit: cvs rdiff -u -r1.2.2.1 -r1.2.2.2 src/usr.sbin/acpitools/acpidump/acpidump.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [bouyer-quota2] src/sbin/fsck_ffs
Module Name:src Committed By: bouyer Date: Thu Feb 17 17:13:48 UTC 2011 Modified Files: src/sbin/fsck_ffs [bouyer-quota2]: setup.c Log Message: Move quota2_check_doquota() call so that an unclean, wapbl filesystem will still be ckecked if a quota inode needs to be created. To generate a diff of this commit: cvs rdiff -u -r1.90.2.1 -r1.90.2.2 src/sbin/fsck_ffs/setup.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [bouyer-quota2] src/sys
Module Name:src Committed By: bouyer Date: Tue Feb 15 16:45:57 UTC 2011 Modified Files: src/sys/compat/common [bouyer-quota2]: compat_mod.c vfs_syscalls_50.c src/sys/kern [bouyer-quota2]: vfs_syscalls.c src/sys/rump/fs/lib/libffs [bouyer-quota2]: Makefile src/sys/rump/librump/rumpvfs [bouyer-quota2]: Makefile.rumpvfs src/sys/ufs [bouyer-quota2]: files.ufs Log Message: Implement COMPAT_50 quotactl(2) To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.12.2.1 src/sys/compat/common/compat_mod.c cvs rdiff -u -r1.6 -r1.6.4.1 src/sys/compat/common/vfs_syscalls_50.c cvs rdiff -u -r1.414.4.2 -r1.414.4.3 src/sys/kern/vfs_syscalls.c cvs rdiff -u -r1.12.4.1 -r1.12.4.2 src/sys/rump/fs/lib/libffs/Makefile cvs rdiff -u -r1.28 -r1.28.4.1 src/sys/rump/librump/rumpvfs/Makefile.rumpvfs cvs rdiff -u -r1.24.6.3 -r1.24.6.4 src/sys/ufs/files.ufs Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/compat/common/compat_mod.c diff -u src/sys/compat/common/compat_mod.c:1.12 src/sys/compat/common/compat_mod.c:1.12.2.1 --- src/sys/compat/common/compat_mod.c:1.12 Wed Jan 19 10:21:16 2011 +++ src/sys/compat/common/compat_mod.c Tue Feb 15 16:45:56 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: compat_mod.c,v 1.12 2011/01/19 10:21:16 tsutsui Exp $ */ +/* $NetBSD: compat_mod.c,v 1.12.2.1 2011/02/15 16:45:56 bouyer Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: compat_mod.c,v 1.12 2011/01/19 10:21:16 tsutsui Exp $); +__KERNEL_RCSID(0, $NetBSD: compat_mod.c,v 1.12.2.1 2011/02/15 16:45:56 bouyer Exp $); #ifdef _KERNEL_OPT #include opt_compat_netbsd.h @@ -230,6 +230,7 @@ # endif { SYS_compat_50___fhstat40, 0, (sy_call_t *)compat_50_sys___fhstat40 }, { SYS_compat_50_aio_suspend, 0, (sy_call_t *)compat_50_sys_aio_suspend }, + { SYS_compat_50_quotactl, 0, (sy_call_t *)compat_50_sys_quotactl }, #endif { 0, 0, NULL }, }; Index: src/sys/compat/common/vfs_syscalls_50.c diff -u src/sys/compat/common/vfs_syscalls_50.c:1.6 src/sys/compat/common/vfs_syscalls_50.c:1.6.4.1 --- src/sys/compat/common/vfs_syscalls_50.c:1.6 Tue Jul 13 15:38:15 2010 +++ src/sys/compat/common/vfs_syscalls_50.c Tue Feb 15 16:45:56 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_syscalls_50.c,v 1.6 2010/07/13 15:38:15 pooka Exp $ */ +/* $NetBSD: vfs_syscalls_50.c,v 1.6.4.1 2011/02/15 16:45:56 bouyer Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -36,7 +36,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: vfs_syscalls_50.c,v 1.6 2010/07/13 15:38:15 pooka Exp $); +__KERNEL_RCSID(0, $NetBSD: vfs_syscalls_50.c,v 1.6.4.1 2011/02/15 16:45:56 bouyer Exp $); #include sys/param.h #include sys/systm.h @@ -312,3 +312,218 @@ return do_sys_mknod(l, SCARG(uap, path), SCARG(uap, mode), SCARG(uap, dev), retval, UIO_USERSPACE); } + +#include ufs/ufs/quota1.h +#include ufs/ufs/quota2_prop.h + +/* ARGSUSED */ +int +compat_50_sys_quotactl(struct lwp *l, const struct compat_50_sys_quotactl_args *uap, register_t *retval) +{ + /* { + syscallarg(const char *) path; + syscallarg(int) cmd; + syscallarg(int) uid; + syscallarg(void *) arg; + } */ + struct mount *mp; + int error; + uint8_t error8; + struct vnode *vp; + int q1cmd = SCARG(uap, cmd); + prop_dictionary_t dict, data, cmd; + prop_array_t cmds, datas; + char *bufpath; + struct dqblk dqblk; + struct quota2_entry q2e; + static const char *quotatypes[MAXQUOTAS] = INITQFNAMES; + + error = namei_simple_user(SCARG(uap, path), +NSM_FOLLOW_TRYEMULROOT, vp); + if (error != 0) + return (error); + error = ENOMEM; + mp = vp-v_mount; + if ((dict = quota2_prop_create()) == NULL) + goto out; + if ((cmds = prop_array_create()) == NULL) + goto out_dict; + if ((datas = prop_array_create()) == NULL) + goto out_cmds; + + switch((q1cmd ~SUBCMDMASK) SUBCMDSHIFT) { + case Q_QUOTAON: + data = prop_dictionary_create(); + if (data == NULL) + goto out_datas; + bufpath = malloc(PATH_MAX * sizeof(char), M_TEMP, M_WAITOK); + if (bufpath == NULL) + goto out_data; + error = copyinstr(SCARG(uap, arg), bufpath, PATH_MAX, NULL); + if (error != 0) { + free(bufpath, M_TEMP); + goto out_data; + } + if (!prop_dictionary_set_cstring(data, quotafile, bufpath)) + error = ENOMEM; + free(bufpath, M_TEMP); + if (error) + goto out_data; + error = ENOMEM; + if (!prop_array_add_and_rel(datas, data)) + goto out_datas; + if (!quota2_prop_add_command(cmds, quotaon, + quotatypes[q1cmd SUBCMDMASK], datas)) + goto out_cmds; + goto do_quotaonoff; + + case Q_QUOTAOFF: + error = ENOMEM; + if (!quota2_prop_add_command(cmds, quotaoff, + quotatypes[q1cmd SUBCMDMASK], datas)) + goto out_cmds; +do_quotaonoff: + if (!prop_dictionary_set_and_rel(dict, commands, cmds)) + goto out_dict; + error = VFS_QUOTACTL(mp, dict);
CVS commit: [bouyer-quota2] src/sys/compat/netbsd32
Module Name:src Committed By: bouyer Date: Tue Feb 15 17:52:52 UTC 2011 Modified Files: src/sys/compat/netbsd32 [bouyer-quota2]: netbsd32.h netbsd32_compat_50.c netbsd32_conv.h netbsd32_ioctl.h netbsd32_netbsd.c Log Message: implement COMPAT_NETBSD32 quotactl syscalls (both new and COMPAT_50) To generate a diff of this commit: cvs rdiff -u -r1.84.8.1 -r1.84.8.2 src/sys/compat/netbsd32/netbsd32.h cvs rdiff -u -r1.17 -r1.17.4.1 src/sys/compat/netbsd32/netbsd32_compat_50.c cvs rdiff -u -r1.24 -r1.24.4.1 src/sys/compat/netbsd32/netbsd32_conv.h cvs rdiff -u -r1.29.4.1 -r1.29.4.2 src/sys/compat/netbsd32/netbsd32_ioctl.h cvs rdiff -u -r1.168.4.2 -r1.168.4.3 \ src/sys/compat/netbsd32/netbsd32_netbsd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/compat/netbsd32/netbsd32.h diff -u src/sys/compat/netbsd32/netbsd32.h:1.84.8.1 src/sys/compat/netbsd32/netbsd32.h:1.84.8.2 --- src/sys/compat/netbsd32/netbsd32.h:1.84.8.1 Tue Feb 8 16:19:47 2011 +++ src/sys/compat/netbsd32/netbsd32.h Tue Feb 15 17:52:51 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: netbsd32.h,v 1.84.8.1 2011/02/08 16:19:47 bouyer Exp $ */ +/* $NetBSD: netbsd32.h,v 1.84.8.2 2011/02/15 17:52:51 bouyer Exp $ */ /* * Copyright (c) 1998, 2001, 2008 Matthew R. Green @@ -789,6 +789,12 @@ netbsd32_long stbcnt; /* stability limit exceeded (ro) */ }; +/* prop/plistref.h */ +struct netbsd32_plistref { + netbsd32_pointer_t pref_plist; + netbsd32_size_t pref_len; +}; + /* from ufs/lfs/lfs.h */ typedef netbsd32_pointer_t netbsd32_block_infop_t; /* XXX broken */ Index: src/sys/compat/netbsd32/netbsd32_compat_50.c diff -u src/sys/compat/netbsd32/netbsd32_compat_50.c:1.17 src/sys/compat/netbsd32/netbsd32_compat_50.c:1.17.4.1 --- src/sys/compat/netbsd32/netbsd32_compat_50.c:1.17 Sun May 30 19:31:39 2010 +++ src/sys/compat/netbsd32/netbsd32_compat_50.c Tue Feb 15 17:52:51 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: netbsd32_compat_50.c,v 1.17 2010/05/30 19:31:39 drochner Exp $ */ +/* $NetBSD: netbsd32_compat_50.c,v 1.17.4.1 2011/02/15 17:52:51 bouyer Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -36,7 +36,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: netbsd32_compat_50.c,v 1.17 2010/05/30 19:31:39 drochner Exp $); +__KERNEL_RCSID(0, $NetBSD: netbsd32_compat_50.c,v 1.17.4.1 2011/02/15 17:52:51 bouyer Exp $); #if defined(_KERNEL_OPT) #include opt_sysv.h @@ -1069,3 +1069,21 @@ return error; } #endif + +int +compat_50_netbsd32_quotactl(struct lwp *l, const struct compat_50_netbsd32_quotactl_args *uap, register_t *retval) +{ + /* { + syscallarg(const netbsd32_charp) path; + syscallarg(int) cmd; + syscallarg(int) uid; + syscallarg(netbsd32_voidp) arg; + } */ + struct compat_50_sys_quotactl_args ua; + + NETBSD32TOP_UAP(path, const char); + NETBSD32TO64_UAP(cmd); + NETBSD32TO64_UAP(uid); + NETBSD32TOP_UAP(arg, void *); + return (compat_50_sys_quotactl(l, ua, retval)); +} Index: src/sys/compat/netbsd32/netbsd32_conv.h diff -u src/sys/compat/netbsd32/netbsd32_conv.h:1.24 src/sys/compat/netbsd32/netbsd32_conv.h:1.24.4.1 --- src/sys/compat/netbsd32/netbsd32_conv.h:1.24 Sun Jan 16 23:21:16 2011 +++ src/sys/compat/netbsd32/netbsd32_conv.h Tue Feb 15 17:52:51 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: netbsd32_conv.h,v 1.24 2011/01/16 23:21:16 njoly Exp $ */ +/* $NetBSD: netbsd32_conv.h,v 1.24.4.1 2011/02/15 17:52:51 bouyer Exp $ */ /* * Copyright (c) 1998, 2001 Matthew R. Green @@ -52,6 +52,8 @@ #include compat/sys/dirent.h +#include prop/plistref.h + #include compat/netbsd32/netbsd32.h /* converters for structures that we need */ @@ -756,4 +758,30 @@ return ((char *)(void *)odp) - buf; } +static inline int +netbsd32_copyin_plistref(netbsd32_pointer_t n32p, struct plistref *p) +{ + struct netbsd32_plistref n32plist; + int error; + + error = copyin(NETBSD32PTR64(n32p), n32plist, + sizeof(struct netbsd32_plistref)); + if (error) + return error; + p-pref_plist = NETBSD32PTR64(n32plist.pref_plist); + p-pref_len = n32plist.pref_len; + return 0; +} + +static inline int +netbsd32_copyout_plistref(netbsd32_pointer_t n32p, struct plistref *p) +{ + struct netbsd32_plistref n32plist; + + NETBSD32PTR32(n32plist.pref_plist, p-pref_plist); + n32plist.pref_len = p-pref_len; + return copyout(n32plist, NETBSD32PTR64(n32p), + sizeof(struct netbsd32_plistref)); +} + #endif /* _COMPAT_NETBSD32_NETBSD32_CONV_H_ */ Index: src/sys/compat/netbsd32/netbsd32_ioctl.h diff -u src/sys/compat/netbsd32/netbsd32_ioctl.h:1.29.4.1 src/sys/compat/netbsd32/netbsd32_ioctl.h:1.29.4.2 --- src/sys/compat/netbsd32/netbsd32_ioctl.h:1.29.4.1 Tue Feb 8 16:19:47 2011 +++ src/sys/compat/netbsd32/netbsd32_ioctl.h Tue Feb 15 17:52:51 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: netbsd32_ioctl.h,v 1.29.4.1 2011/02/08 16:19:47 bouyer Exp $ */ +/* $NetBSD: netbsd32_ioctl.h,v 1.29.4.2 2011/02/15
CVS commit: [bouyer-quota2] src/sys
Module Name:src Committed By: bouyer Date: Tue Feb 15 16:45:57 UTC 2011 Modified Files: src/sys/compat/common [bouyer-quota2]: compat_mod.c vfs_syscalls_50.c src/sys/kern [bouyer-quota2]: vfs_syscalls.c src/sys/rump/fs/lib/libffs [bouyer-quota2]: Makefile src/sys/rump/librump/rumpvfs [bouyer-quota2]: Makefile.rumpvfs src/sys/ufs [bouyer-quota2]: files.ufs Log Message: Implement COMPAT_50 quotactl(2) To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.12.2.1 src/sys/compat/common/compat_mod.c cvs rdiff -u -r1.6 -r1.6.4.1 src/sys/compat/common/vfs_syscalls_50.c cvs rdiff -u -r1.414.4.2 -r1.414.4.3 src/sys/kern/vfs_syscalls.c cvs rdiff -u -r1.12.4.1 -r1.12.4.2 src/sys/rump/fs/lib/libffs/Makefile cvs rdiff -u -r1.28 -r1.28.4.1 src/sys/rump/librump/rumpvfs/Makefile.rumpvfs cvs rdiff -u -r1.24.6.3 -r1.24.6.4 src/sys/ufs/files.ufs Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [bouyer-quota2] src/sys/compat/netbsd32
Module Name:src Committed By: bouyer Date: Tue Feb 15 17:52:52 UTC 2011 Modified Files: src/sys/compat/netbsd32 [bouyer-quota2]: netbsd32.h netbsd32_compat_50.c netbsd32_conv.h netbsd32_ioctl.h netbsd32_netbsd.c Log Message: implement COMPAT_NETBSD32 quotactl syscalls (both new and COMPAT_50) To generate a diff of this commit: cvs rdiff -u -r1.84.8.1 -r1.84.8.2 src/sys/compat/netbsd32/netbsd32.h cvs rdiff -u -r1.17 -r1.17.4.1 src/sys/compat/netbsd32/netbsd32_compat_50.c cvs rdiff -u -r1.24 -r1.24.4.1 src/sys/compat/netbsd32/netbsd32_conv.h cvs rdiff -u -r1.29.4.1 -r1.29.4.2 src/sys/compat/netbsd32/netbsd32_ioctl.h cvs rdiff -u -r1.168.4.2 -r1.168.4.3 \ src/sys/compat/netbsd32/netbsd32_netbsd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [bouyer-quota2] src/sys/ufs/ufs
Module Name:src Committed By: bouyer Date: Mon Feb 14 15:38:16 UTC 2011 Modified Files: src/sys/ufs/ufs [bouyer-quota2]: ufs_inode.c Log Message: Update quota in the same WAPBL transaction as we write mode=0 back to inode. To generate a diff of this commit: cvs rdiff -u -r1.83.4.1 -r1.83.4.2 src/sys/ufs/ufs/ufs_inode.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/ufs/ufs/ufs_inode.c diff -u src/sys/ufs/ufs/ufs_inode.c:1.83.4.1 src/sys/ufs/ufs/ufs_inode.c:1.83.4.2 --- src/sys/ufs/ufs/ufs_inode.c:1.83.4.1 Thu Jan 20 14:25:03 2011 +++ src/sys/ufs/ufs/ufs_inode.c Mon Feb 14 15:38:16 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: ufs_inode.c,v 1.83.4.1 2011/01/20 14:25:03 bouyer Exp $ */ +/* $NetBSD: ufs_inode.c,v 1.83.4.2 2011/02/14 15:38:16 bouyer Exp $ */ /* * Copyright (c) 1991, 1993 @@ -37,7 +37,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: ufs_inode.c,v 1.83.4.1 2011/01/20 14:25:03 bouyer Exp $); +__KERNEL_RCSID(0, $NetBSD: ufs_inode.c,v 1.83.4.2 2011/02/14 15:38:16 bouyer Exp $); #if defined(_KERNEL_OPT) #include opt_ffs.h @@ -103,9 +103,6 @@ if (error) goto out; logged = 1; -#if defined(QUOTA) || defined(QUOTA2) - (void)chkiq(ip, -1, NOCRED, 0); -#endif #ifdef UFS_EXTATTR ufs_extattr_vnode_inactive(vp, curlwp); #endif @@ -140,6 +137,9 @@ if (!error) error = UFS_TRUNCATE(vp, (off_t)0, 0, NOCRED); } +#if defined(QUOTA) || defined(QUOTA2) + (void)chkiq(ip, -1, NOCRED, 0); +#endif DIP_ASSIGN(ip, rdev, 0); mode = ip-i_mode; ip-i_mode = 0;
CVS commit: [bouyer-quota2] src
Module Name:src Committed By: bouyer Date: Mon Feb 14 20:35:24 UTC 2011 Modified Files: src/libexec/rpc.rquotad [bouyer-quota2]: Makefile rquotad.c src/usr.bin/quota [bouyer-quota2]: Makefile quota.c Log Message: The rpc.rquotad protocol uses the legacy definitions and integer types. Convert from/to dqblk using the quota1_subr.c routines to have the necessery convertions done. To generate a diff of this commit: cvs rdiff -u -r1.6.64.1 -r1.6.64.2 src/libexec/rpc.rquotad/Makefile cvs rdiff -u -r1.24.2.1 -r1.24.2.2 src/libexec/rpc.rquotad/rquotad.c cvs rdiff -u -r1.6.64.4 -r1.6.64.5 src/usr.bin/quota/Makefile cvs rdiff -u -r1.33.2.7 -r1.33.2.8 src/usr.bin/quota/quota.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/libexec/rpc.rquotad/Makefile diff -u src/libexec/rpc.rquotad/Makefile:1.6.64.1 src/libexec/rpc.rquotad/Makefile:1.6.64.2 --- src/libexec/rpc.rquotad/Makefile:1.6.64.1 Tue Feb 8 22:14:22 2011 +++ src/libexec/rpc.rquotad/Makefile Mon Feb 14 20:35:24 2011 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.6.64.1 2011/02/08 22:14:22 bouyer Exp $ +# $NetBSD: Makefile,v 1.6.64.2 2011/02/14 20:35:24 bouyer Exp $ .include bsd.own.mk PROG = rpc.rquotad @@ -13,7 +13,7 @@ .PATH: ${NETBSDSRCDIR}/usr.bin/quota SRCS+= getvfsquota.c .PATH: ${NETBSDSRCDIR}/sys/ufs/ufs -SRCS+= quota2_prop.c +SRCS+= quota2_prop.c quota1_subr.c .include bsd.prog.mk Index: src/libexec/rpc.rquotad/rquotad.c diff -u src/libexec/rpc.rquotad/rquotad.c:1.24.2.1 src/libexec/rpc.rquotad/rquotad.c:1.24.2.2 --- src/libexec/rpc.rquotad/rquotad.c:1.24.2.1 Tue Feb 8 22:14:22 2011 +++ src/libexec/rpc.rquotad/rquotad.c Mon Feb 14 20:35:24 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: rquotad.c,v 1.24.2.1 2011/02/08 22:14:22 bouyer Exp $ */ +/* $NetBSD: rquotad.c,v 1.24.2.2 2011/02/14 20:35:24 bouyer Exp $ */ /* * by Manuel Bouyer (bou...@ensta.fr). Public domain. @@ -6,7 +6,7 @@ #include sys/cdefs.h #ifndef lint -__RCSID($NetBSD: rquotad.c,v 1.24.2.1 2011/02/08 22:14:22 bouyer Exp $); +__RCSID($NetBSD: rquotad.c,v 1.24.2.2 2011/02/14 20:35:24 bouyer Exp $); #endif #include sys/param.h @@ -30,6 +30,7 @@ #include syslog.h #include ufs/ufs/quota2_prop.h +#include ufs/ufs/quota1.h #include rpc/rpc.h #include rpcsvc/rquota.h #include arpa/inet.h @@ -164,6 +165,7 @@ struct ext_getquota_args ext_getq_args; struct getquota_rslt getq_rslt; struct quota2_entry q2e; + struct dqblk dqblk; int type; int8_t version; struct timeval timev; @@ -207,26 +209,27 @@ /* failed, return noquota */ getq_rslt.status = Q_NOQUOTA; } else { + q2e2dqblk(q2e, dqblk); gettimeofday(timev, NULL); getq_rslt.status = Q_OK; getq_rslt.getquota_rslt_u.gqr_rquota.rq_active = TRUE; getq_rslt.getquota_rslt_u.gqr_rquota.rq_bsize = DEV_BSIZE; getq_rslt.getquota_rslt_u.gqr_rquota.rq_bhardlimit = - q2e.q2e_val[QL_BLOCK].q2v_hardlimit; + dqblk.dqb_bhardlimit; getq_rslt.getquota_rslt_u.gqr_rquota.rq_bsoftlimit = - q2e.q2e_val[QL_BLOCK].q2v_softlimit; + dqblk.dqb_bsoftlimit; getq_rslt.getquota_rslt_u.gqr_rquota.rq_curblocks = - q2e.q2e_val[QL_BLOCK].q2v_cur; + dqblk.dqb_curblocks; getq_rslt.getquota_rslt_u.gqr_rquota.rq_fhardlimit = - q2e.q2e_val[QL_FILE].q2v_hardlimit; + dqblk.dqb_ihardlimit; getq_rslt.getquota_rslt_u.gqr_rquota.rq_fsoftlimit = - q2e.q2e_val[QL_FILE].q2v_softlimit; + dqblk.dqb_isoftlimit; getq_rslt.getquota_rslt_u.gqr_rquota.rq_curfiles = - q2e.q2e_val[QL_FILE].q2v_softlimit; + dqblk.dqb_curinodes; getq_rslt.getquota_rslt_u.gqr_rquota.rq_btimeleft = - q2e.q2e_val[QL_BLOCK].q2v_time - timev.tv_sec; + dqblk.dqb_btime; getq_rslt.getquota_rslt_u.gqr_rquota.rq_ftimeleft = - q2e.q2e_val[QL_FILE].q2v_time - timev.tv_sec; + dqblk.dqb_itime; } out: if (!svc_sendreply(transp, xdr_getquota_rslt, (char *)getq_rslt)) Index: src/usr.bin/quota/Makefile diff -u src/usr.bin/quota/Makefile:1.6.64.4 src/usr.bin/quota/Makefile:1.6.64.5 --- src/usr.bin/quota/Makefile:1.6.64.4 Thu Feb 3 15:56:15 2011 +++ src/usr.bin/quota/Makefile Mon Feb 14 20:35:24 2011 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.6.64.4 2011/02/03 15:56:15 bouyer Exp $ +# $NetBSD: Makefile,v 1.6.64.5 2011/02/14 20:35:24 bouyer Exp $ # from: @(#)Makefile 8.1 (Berkeley) 6/6/93 .include bsd.own.mk @@ -10,5 +10,5 @@ LDADD= -lrpcsvc -lprop .PATH: ${NETBSDSRCDIR}/sys/ufs/ufs -SRCS+= quota2_prop.c quota2_subr.c +SRCS+= quota2_prop.c quota2_subr.c quota1_subr.c .include bsd.prog.mk Index: src/usr.bin/quota/quota.c diff -u src/usr.bin/quota/quota.c:1.33.2.7 src/usr.bin/quota/quota.c:1.33.2.8 --- src/usr.bin/quota/quota.c:1.33.2.7 Thu Feb 3 15:56:15 2011 +++ src/usr.bin/quota/quota.c Mon Feb 14 20:35:24 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: quota.c,v 1.33.2.7 2011/02/03 15:56:15 bouyer Exp $ */ +/* $NetBSD: quota.c,v 1.33.2.8 2011/02/14 20:35:24
CVS commit: [bouyer-quota2] src/usr.sbin/repquota
Module Name:src Committed By: bouyer Date: Mon Feb 14 20:55:36 UTC 2011 Modified Files: src/usr.sbin/repquota [bouyer-quota2]: repquota.8 repquota.c Log Message: When reading quota1 entries, initialize default quota to unlimited, for POLA when using -x. When displaying quotas, do not skip users which have a 0 usage but are overquota. When -v is used display all existing quota entries, including those with a 0 usage. To generate a diff of this commit: cvs rdiff -u -r1.9.50.2 -r1.9.50.3 src/usr.sbin/repquota/repquota.8 cvs rdiff -u -r1.25.2.7 -r1.25.2.8 src/usr.sbin/repquota/repquota.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/repquota/repquota.8 diff -u src/usr.sbin/repquota/repquota.8:1.9.50.2 src/usr.sbin/repquota/repquota.8:1.9.50.3 --- src/usr.sbin/repquota/repquota.8:1.9.50.2 Thu Feb 10 17:11:35 2011 +++ src/usr.sbin/repquota/repquota.8 Mon Feb 14 20:55:36 2011 @@ -29,7 +29,7 @@ .\ SUCH DAMAGE. .\ .\ from: @(#)repquota.8 8.1 (Berkeley) 6/6/93 -.\ $NetBSD: repquota.8,v 1.9.50.2 2011/02/10 17:11:35 bouyer Exp $ +.\ $NetBSD: repquota.8,v 1.9.50.3 2011/02/14 20:55:36 bouyer Exp $ .\ .Dd February 10, 2011 .Dt REPQUOTA 8 @@ -75,6 +75,7 @@ group and user quotas if they exist). .It Fl v Print a header line before printing each filesystem quotas. +Print all exiting quotas, including those whose current usage is 0. .It Fl D Debug: print plist sent to and received from kernel. .It Fl h Index: src/usr.sbin/repquota/repquota.c diff -u src/usr.sbin/repquota/repquota.c:1.25.2.7 src/usr.sbin/repquota/repquota.c:1.25.2.8 --- src/usr.sbin/repquota/repquota.c:1.25.2.7 Thu Feb 10 17:11:35 2011 +++ src/usr.sbin/repquota/repquota.c Mon Feb 14 20:55:36 2011 @@ -40,7 +40,7 @@ #if 0 static char sccsid[] = @(#)repquota.c 8.2 (Berkeley) 11/22/94; #else -__RCSID($NetBSD: repquota.c,v 1.25.2.7 2011/02/10 17:11:35 bouyer Exp $); +__RCSID($NetBSD: repquota.c,v 1.25.2.8 2011/02/14 20:55:36 bouyer Exp $); #endif #endif /* not lint */ @@ -378,7 +378,9 @@ if (dqbuf.dqb_itime 0) igrace = dqbuf.dqb_itime; } - if (dqbuf.dqb_curinodes == 0 dqbuf.dqb_curblocks == 0) + if (dqbuf.dqb_curinodes == 0 dqbuf.dqb_curblocks == 0 + dqbuf.dqb_bsoftlimit == 0 dqbuf.dqb_bhardlimit == 0 + dqbuf.dqb_isoftlimit == 0 dqbuf.dqb_ihardlimit == 0) continue; if ((fup = lookup(id, type)) == 0) fup = addid(id, type, (char *)0); @@ -388,6 +390,10 @@ } defaultq2e[type].q2e_val[QL_BLOCK].q2v_grace = bgrace; defaultq2e[type].q2e_val[QL_FILE].q2v_grace = igrace; + defaultq2e[type].q2e_val[QL_BLOCK].q2v_softlimit = + defaultq2e[type].q2e_val[QL_BLOCK].q2v_hardlimit = + defaultq2e[type].q2e_val[QL_FILE].q2v_softlimit = + defaultq2e[type].q2e_val[QL_FILE].q2v_hardlimit = UQUAD_MAX; fclose(qf); valid[type] = 1; if (xflag == 0) @@ -423,13 +429,6 @@ fup = lookup(id, type); if (fup == 0) continue; - if (fup-fu_q2e.q2e_val[QL_BLOCK].q2v_cur == 0 - fup-fu_q2e.q2e_val[QL_FILE].q2v_cur == 0) - continue; - if (strlen(fup-fu_name) 9) - printf(%s , fup-fu_name); - else - printf(%-10s, fup-fu_name); for (i = 0; i N_QL; i++) { switch (QL_STATUS(quota2_check_limit( fup-fu_q2e.q2e_val[i], 1, now))) { @@ -450,6 +449,14 @@ } } + if (fup-fu_q2e.q2e_val[QL_BLOCK].q2v_cur == 0 + fup-fu_q2e.q2e_val[QL_FILE].q2v_cur == 0 vflag == 0 + overchar[QL_BLOCK] == '-' overchar[QL_FILE] == '-') + continue; + if (strlen(fup-fu_name) 9) + printf(%s , fup-fu_name); + else + printf(%-10s, fup-fu_name); printf(%c%c%9s%9s%9s%7s, overchar[QL_BLOCK], overchar[QL_FILE], intprt(fup-fu_q2e.q2e_val[QL_BLOCK].q2v_cur,
CVS commit: [bouyer-quota2] src/sys/ufs/ufs
Module Name:src Committed By: bouyer Date: Mon Feb 14 15:38:16 UTC 2011 Modified Files: src/sys/ufs/ufs [bouyer-quota2]: ufs_inode.c Log Message: Update quota in the same WAPBL transaction as we write mode=0 back to inode. To generate a diff of this commit: cvs rdiff -u -r1.83.4.1 -r1.83.4.2 src/sys/ufs/ufs/ufs_inode.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [bouyer-quota2] src
Module Name:src Committed By: bouyer Date: Mon Feb 14 20:35:24 UTC 2011 Modified Files: src/libexec/rpc.rquotad [bouyer-quota2]: Makefile rquotad.c src/usr.bin/quota [bouyer-quota2]: Makefile quota.c Log Message: The rpc.rquotad protocol uses the legacy definitions and integer types. Convert from/to dqblk using the quota1_subr.c routines to have the necessery convertions done. To generate a diff of this commit: cvs rdiff -u -r1.6.64.1 -r1.6.64.2 src/libexec/rpc.rquotad/Makefile cvs rdiff -u -r1.24.2.1 -r1.24.2.2 src/libexec/rpc.rquotad/rquotad.c cvs rdiff -u -r1.6.64.4 -r1.6.64.5 src/usr.bin/quota/Makefile cvs rdiff -u -r1.33.2.7 -r1.33.2.8 src/usr.bin/quota/quota.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [bouyer-quota2] src/usr.sbin/repquota
Module Name:src Committed By: bouyer Date: Mon Feb 14 20:55:36 UTC 2011 Modified Files: src/usr.sbin/repquota [bouyer-quota2]: repquota.8 repquota.c Log Message: When reading quota1 entries, initialize default quota to unlimited, for POLA when using -x. When displaying quotas, do not skip users which have a 0 usage but are overquota. When -v is used display all existing quota entries, including those with a 0 usage. To generate a diff of this commit: cvs rdiff -u -r1.9.50.2 -r1.9.50.3 src/usr.sbin/repquota/repquota.8 cvs rdiff -u -r1.25.2.7 -r1.25.2.8 src/usr.sbin/repquota/repquota.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [bouyer-quota2] src/tests/fs/ffs
Module Name:src Committed By: bouyer Date: Sun Feb 13 20:58:28 UTC 2011 Modified Files: src/tests/fs/ffs [bouyer-quota2]: h_quota2_tests.c t_miscquota.sh Log Message: Add a test checking that an unlinked file cleaned by the log replay keeps quotas up to date. To generate a diff of this commit: cvs rdiff -u -r1.1.2.4 -r1.1.2.5 src/tests/fs/ffs/h_quota2_tests.c cvs rdiff -u -r1.1.2.3 -r1.1.2.4 src/tests/fs/ffs/t_miscquota.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/fs/ffs/h_quota2_tests.c diff -u src/tests/fs/ffs/h_quota2_tests.c:1.1.2.4 src/tests/fs/ffs/h_quota2_tests.c:1.1.2.5 --- src/tests/fs/ffs/h_quota2_tests.c:1.1.2.4 Sat Feb 12 21:49:08 2011 +++ src/tests/fs/ffs/h_quota2_tests.c Sun Feb 13 20:58:28 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: h_quota2_tests.c,v 1.1.2.4 2011/02/12 21:49:08 bouyer Exp $ */ +/* $NetBSD: h_quota2_tests.c,v 1.1.2.5 2011/02/13 20:58:28 bouyer Exp $ */ /* * rump server for advanced quota tests @@ -35,6 +35,7 @@ int fd; int error; rump_sys_chown(., TEST_NONROOT_ID, TEST_NONROOT_ID); + rump_sys_chmod(., 0777); if (rump_sys_setegid(TEST_NONROOT_ID) != 0) { error = errno; perror(rump_sys_setegid); @@ -67,6 +68,7 @@ int fd; int error; rump_sys_chown(., TEST_NONROOT_ID, TEST_NONROOT_ID); + rump_sys_chmod(., 0777); if (rump_sys_setegid(TEST_NONROOT_ID) != 0) { error = errno; perror(rump_sys_setegid); @@ -115,6 +117,7 @@ int error; int i; rump_sys_chown(., TEST_NONROOT_ID, TEST_NONROOT_ID); + rump_sys_chmod(., 0777); if (rump_sys_setegid(TEST_NONROOT_ID) != 0) { error = errno; perror(rump_sys_setegid); @@ -151,6 +154,7 @@ int error; int i; rump_sys_chown(., TEST_NONROOT_ID, TEST_NONROOT_ID); + rump_sys_chmod(., 0777); if (rump_sys_setegid(TEST_NONROOT_ID) != 0) { error = errno; perror(rump_sys_setegid); @@ -204,6 +208,8 @@ * take an internal snapshot of the filesystem, and create a new * file with some data */ + rump_sys_chown(., 0, 0); + rump_sys_chmod(., 0777); for (i =0; testopts i strlen(testopts); i++) { switch(testopts[i]) { @@ -233,8 +239,10 @@ fss.fss_csize = 0; if (rump_sys_ioctl(fssfd, FSSIOCSET, fss) == -1) err(1, create snapshot); - if (unl) - rump_sys_unlink(FSTEST_MNTNAME /le_snap); + if (unl) { + if (rump_sys_unlink(FSTEST_MNTNAME /le_snap) == -1) + err(1, unlink snapshot); + } /* now create some extra files */ @@ -253,6 +261,63 @@ return 0; } +static int +quota_test5(const char *testopts) +{ + static char buf[512]; + int fd; + int remount = 0; + int unlnk = 0; + int log = 0; + unsigned int i; + + for (i =0; testopts i strlen(testopts); i++) { + switch(testopts[i]) { + case 'L': + log++; + break; + case 'R': + remount++; + break; + case 'U': + unlnk++; + break; + default: + errx(1, test4: unknown option %c, testopts[i]); + } + } + if (remount) { + struct ufs_args uargs; + uargs.fspec = __UNCONST(/diskdev); + /* remount the fs read/write */ + if (rump_sys_mount(MOUNT_FFS, FSTEST_MNTNAME, + MNT_UPDATE | (log ? MNT_LOG : 0), + uargs, sizeof(uargs)) == -1) + err(1, mount ffs rw %s, FSTEST_MNTNAME); + } + + if (unlnk) { + /* + * open and unlink a file + */ + + fd = rump_sys_open(unlinked_file, + O_EXCL| O_CREAT | O_RDWR, 0644); + if (fd 0) + err(1, create %s, unlinked_file); + sprintf(buf, test unlinked_file); + rump_sys_write(fd, buf, strlen(buf)); + if (rump_sys_unlink(unlinked_file) == -1) + err(1, unlink unlinked_file); + if (rump_sys_fsync(fd) == -1) + err(1, fsync unlinked_file); + rump_sys_reboot(RUMP_RB_NOSYNC, NULL); + errx(1, reboot failed); + return 1; + } + return 0; +} + struct quota_test { int (*func)(const char *); const char *desc; @@ -264,6 +329,7 @@ { quota_test2, create file up to hard limit}, { quota_test3, create file beyond the soft limit after grace time}, { quota_test4, take a snapshot and add some data}, + { quota_test5, open and unlink a file}, }; static void @@ -307,16 +373,19 @@ const char *filename; const char *serverurl; const char *topts = NULL; - int log = 0; + int mntopts = 0; int ch; - while ((ch = getopt(argc, argv, blo:)) != -1) { + while ((ch = getopt(argc, argv, blo:r)) != -1) { switch(ch) { case 'b': background = 1; break; case 'l': - log = 1; + mntopts |= MNT_LOG; + break; + case 'r': + mntopts |= MNT_RDONLY; break; case 'o': topts = optarg; @@ -356,14 +425,12 @@ err(1, mount point create); rump_pub_etfs_register(/diskdev, filename, RUMP_ETFS_BLK); uargs.fspec = __UNCONST(/diskdev); - if (rump_sys_mount(MOUNT_FFS, FSTEST_MNTNAME, (log) ? MNT_LOG : 0, + if (rump_sys_mount(MOUNT_FFS, FSTEST_MNTNAME, mntopts, uargs, sizeof(uargs)) == -1) die(mount ffs, errno); if (rump_sys_chdir(FSTEST_MNTNAME) == -1) err(1, cd %s, FSTEST_MNTNAME); - rump_sys_chown(., 0, 0); -
CVS commit: [bouyer-quota2] src/tests/fs/ffs
Module Name:src Committed By: bouyer Date: Sun Feb 13 20:58:28 UTC 2011 Modified Files: src/tests/fs/ffs [bouyer-quota2]: h_quota2_tests.c t_miscquota.sh Log Message: Add a test checking that an unlinked file cleaned by the log replay keeps quotas up to date. To generate a diff of this commit: cvs rdiff -u -r1.1.2.4 -r1.1.2.5 src/tests/fs/ffs/h_quota2_tests.c cvs rdiff -u -r1.1.2.3 -r1.1.2.4 src/tests/fs/ffs/t_miscquota.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [bouyer-quota2] src/sys/ufs
Module Name:src Committed By: bouyer Date: Sat Feb 12 19:52:40 UTC 2011 Modified Files: src/sys/ufs/ffs [bouyer-quota2]: ffs_snapshot.c src/sys/ufs/ufs [bouyer-quota2]: ufs_quota.c Log Message: Do not update disk quotas for snapshot inodes, as this may require a write to the same filesystem, which will trigger a copy on write, which will trigger another update to the same block. Set SF_SNAPSHOT just after truncating the snapshot inode, so that this inode always account for 0 blocks in quotas. To generate a diff of this commit: cvs rdiff -u -r1.102 -r1.102.4.1 src/sys/ufs/ffs/ffs_snapshot.c cvs rdiff -u -r1.68.4.11 -r1.68.4.12 src/sys/ufs/ufs/ufs_quota.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/ufs/ffs/ffs_snapshot.c diff -u src/sys/ufs/ffs/ffs_snapshot.c:1.102 src/sys/ufs/ffs/ffs_snapshot.c:1.102.4.1 --- src/sys/ufs/ffs/ffs_snapshot.c:1.102 Mon Dec 20 00:25:47 2010 +++ src/sys/ufs/ffs/ffs_snapshot.c Sat Feb 12 19:52:39 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: ffs_snapshot.c,v 1.102 2010/12/20 00:25:47 matt Exp $ */ +/* $NetBSD: ffs_snapshot.c,v 1.102.4.1 2011/02/12 19:52:39 bouyer Exp $ */ /* * Copyright 2000 Marshall Kirk McKusick. All Rights Reserved. @@ -38,7 +38,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: ffs_snapshot.c,v 1.102 2010/12/20 00:25:47 matt Exp $); +__KERNEL_RCSID(0, $NetBSD: ffs_snapshot.c,v 1.102.4.1 2011/02/12 19:52:39 bouyer Exp $); #if defined(_KERNEL_OPT) #include opt_ffs.h @@ -214,12 +214,6 @@ if (error) goto out; /* - * Change inode to snapshot type file. - */ - ip-i_flags |= SF_SNAPSHOT; - DIP_ASSIGN(ip, flags, ip-i_flags); - ip-i_flag |= IN_CHANGE | IN_UPDATE; - /* * Copy all the cylinder group maps. Although the * filesystem is still active, we hope that only a few * cylinder groups will change between now and when we @@ -408,6 +402,7 @@ struct buf *ibp, *nbp; struct fs *fs = VFSTOUFS(mp)-um_fs; struct lwp *l = curlwp; + struct inode *ip = VTOI(vp); /* * Check mount, exclusive reference and owner. @@ -427,6 +422,13 @@ return error; } /* + * Change inode to snapshot type file. + * Do it now so that allocations below are not recorded in quotas + */ + ip-i_flags |= SF_SNAPSHOT; + DIP_ASSIGN(ip, flags, ip-i_flags); + ip-i_flag |= IN_CHANGE | IN_UPDATE; + /* * Write an empty list of preallocated blocks to the end of * the snapshot to set size to at least that of the filesystem. */ Index: src/sys/ufs/ufs/ufs_quota.c diff -u src/sys/ufs/ufs/ufs_quota.c:1.68.4.11 src/sys/ufs/ufs/ufs_quota.c:1.68.4.12 --- src/sys/ufs/ufs/ufs_quota.c:1.68.4.11 Wed Feb 9 16:15:01 2011 +++ src/sys/ufs/ufs/ufs_quota.c Sat Feb 12 19:52:40 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: ufs_quota.c,v 1.68.4.11 2011/02/09 16:15:01 bouyer Exp $ */ +/* $NetBSD: ufs_quota.c,v 1.68.4.12 2011/02/12 19:52:40 bouyer Exp $ */ /* * Copyright (c) 1982, 1986, 1990, 1993, 1995 @@ -35,7 +35,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: ufs_quota.c,v 1.68.4.11 2011/02/09 16:15:01 bouyer Exp $); +__KERNEL_RCSID(0, $NetBSD: ufs_quota.c,v 1.68.4.12 2011/02/12 19:52:40 bouyer Exp $); #if defined(_KERNEL_OPT) #include opt_quota.h @@ -118,6 +118,10 @@ int chkdq(struct inode *ip, int64_t change, kauth_cred_t cred, int flags) { + /* do not track snapshot usage, or we will deadlock */ + if ((ip-i_flags SF_SNAPSHOT) != 0) + return 0; + #ifdef QUOTA if (ip-i_ump-um_flags UFS_QUOTA) return chkdq1(ip, change, cred, flags);
CVS commit: [bouyer-quota2] src/sbin/fsck_ffs
Module Name:src Committed By: bouyer Date: Sat Feb 12 19:53:32 UTC 2011 Modified Files: src/sbin/fsck_ffs [bouyer-quota2]: inode.c pass1.c pass4.c Log Message: Snapshot inode doesn't count for block quotas. To generate a diff of this commit: cvs rdiff -u -r1.63.2.1 -r1.63.2.2 src/sbin/fsck_ffs/inode.c cvs rdiff -u -r1.46.14.1 -r1.46.14.2 src/sbin/fsck_ffs/pass1.c cvs rdiff -u -r1.25.14.1 -r1.25.14.2 src/sbin/fsck_ffs/pass4.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/fsck_ffs/inode.c diff -u src/sbin/fsck_ffs/inode.c:1.63.2.1 src/sbin/fsck_ffs/inode.c:1.63.2.2 --- src/sbin/fsck_ffs/inode.c:1.63.2.1 Thu Jan 20 14:24:53 2011 +++ src/sbin/fsck_ffs/inode.c Sat Feb 12 19:53:32 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: inode.c,v 1.63.2.1 2011/01/20 14:24:53 bouyer Exp $ */ +/* $NetBSD: inode.c,v 1.63.2.2 2011/02/12 19:53:32 bouyer Exp $ */ /* * Copyright (c) 1980, 1986, 1993 @@ -34,12 +34,13 @@ #if 0 static char sccsid[] = @(#)inode.c 8.8 (Berkeley) 4/28/95; #else -__RCSID($NetBSD: inode.c,v 1.63.2.1 2011/01/20 14:24:53 bouyer Exp $); +__RCSID($NetBSD: inode.c,v 1.63.2.2 2011/02/12 19:53:32 bouyer Exp $); #endif #endif /* not lint */ #include sys/param.h #include sys/time.h +#include sys/stat.h #include ufs/ufs/dinode.h #include ufs/ufs/dir.h @@ -830,12 +831,15 @@ } memset(idesc, 0, sizeof(struct inodesc)); - idesc.id_type = ADDR; idesc.id_func = pass4check; idesc.id_number = ino; dp = ginode(ino); idesc.id_uid = iswap32(DIP(dp, uid)); idesc.id_gid = iswap32(DIP(dp, gid)); + if (iswap32(DIP(dp, flags)) SF_SNAPSHOT) + idesc.id_type = SNAP; + else + idesc.id_type = ADDR; (void)ckinode(dp, idesc); clearinode(dp); inodirty(); Index: src/sbin/fsck_ffs/pass1.c diff -u src/sbin/fsck_ffs/pass1.c:1.46.14.1 src/sbin/fsck_ffs/pass1.c:1.46.14.2 --- src/sbin/fsck_ffs/pass1.c:1.46.14.1 Thu Jan 20 14:24:53 2011 +++ src/sbin/fsck_ffs/pass1.c Sat Feb 12 19:53:32 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: pass1.c,v 1.46.14.1 2011/01/20 14:24:53 bouyer Exp $ */ +/* $NetBSD: pass1.c,v 1.46.14.2 2011/02/12 19:53:32 bouyer Exp $ */ /* * Copyright (c) 1980, 1986, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = @(#)pass1.c 8.6 (Berkeley) 4/28/95; #else -__RCSID($NetBSD: pass1.c,v 1.46.14.1 2011/01/20 14:24:53 bouyer Exp $); +__RCSID($NetBSD: pass1.c,v 1.46.14.2 2011/02/12 19:53:32 bouyer Exp $); #endif #endif /* not lint */ @@ -467,7 +467,7 @@ inodirty(); } update_uquot(inumber, idesc-id_uid, idesc-id_gid, - idesc-id_entryno, 1); + (idesc-id_type == SNAP) ? 0 : idesc-id_entryno, 1); return; unknown: pfatal(UNKNOWN FILE TYPE I=%llu, (unsigned long long)inumber); Index: src/sbin/fsck_ffs/pass4.c diff -u src/sbin/fsck_ffs/pass4.c:1.25.14.1 src/sbin/fsck_ffs/pass4.c:1.25.14.2 --- src/sbin/fsck_ffs/pass4.c:1.25.14.1 Thu Jan 20 14:24:54 2011 +++ src/sbin/fsck_ffs/pass4.c Sat Feb 12 19:53:32 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: pass4.c,v 1.25.14.1 2011/01/20 14:24:54 bouyer Exp $ */ +/* $NetBSD: pass4.c,v 1.25.14.2 2011/02/12 19:53:32 bouyer Exp $ */ /* * Copyright (c) 1980, 1986, 1993 @@ -34,12 +34,13 @@ #if 0 static char sccsid[] = @(#)pass4.c 8.4 (Berkeley) 4/28/95; #else -__RCSID($NetBSD: pass4.c,v 1.25.14.1 2011/01/20 14:24:54 bouyer Exp $); +__RCSID($NetBSD: pass4.c,v 1.25.14.2 2011/02/12 19:53:32 bouyer Exp $); #endif #endif /* not lint */ #include sys/param.h #include sys/time.h +#include sys/stat.h #include ufs/ufs/ufs_bswap.h #include ufs/ufs/dinode.h @@ -65,7 +66,6 @@ struct inostat *info; memset(idesc, 0, sizeof(struct inodesc)); - idesc.id_type = ADDR; idesc.id_func = pass4check; for (cg = 0; cg sblock-fs_ncg; cg++) { @@ -89,6 +89,10 @@ idesc.id_number = inumber; idesc.id_uid = iswap32(DIP(dp, uid)); idesc.id_gid = iswap32(DIP(dp, gid)); + if (iswap32(DIP(dp, flags)) SF_SNAPSHOT) +idesc.id_type = SNAP; + else +idesc.id_type = ADDR; switch (info-ino_state) { case FSTATE: case DFOUND: @@ -189,7 +193,8 @@ n_blks--; update_uquot(idesc-id_number, idesc-id_uid, -idesc-id_gid, -btodb(sblock-fs_fsize), 0); +idesc-id_gid, (idesc-id_type == SNAP) ? +0 : -btodb(sblock-fs_fsize), 0); if (idesc-id_numfrags != sblock-fs_frag cgp) { cgp-cg_cs.cs_nffree ++;
CVS commit: [bouyer-quota2] src/sys/ufs
Module Name:src Committed By: bouyer Date: Sat Feb 12 21:48:10 UTC 2011 Modified Files: src/sys/ufs/ffs [bouyer-quota2]: ffs_snapshot.c src/sys/ufs/ufs [bouyer-quota2]: ufs_quota.c ufs_quota2.c Log Message: Don't count snapshot files in inode quota too. At umount time, chk?q may be called after quota have been shutdown, as there is a final vflush pass after quota?_umount(); so skip quota checks if the quota vnode is not there any more. To generate a diff of this commit: cvs rdiff -u -r1.102.4.1 -r1.102.4.2 src/sys/ufs/ffs/ffs_snapshot.c cvs rdiff -u -r1.68.4.12 -r1.68.4.13 src/sys/ufs/ufs/ufs_quota.c cvs rdiff -u -r1.1.2.14 -r1.1.2.15 src/sys/ufs/ufs/ufs_quota2.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/ufs/ffs/ffs_snapshot.c diff -u src/sys/ufs/ffs/ffs_snapshot.c:1.102.4.1 src/sys/ufs/ffs/ffs_snapshot.c:1.102.4.2 --- src/sys/ufs/ffs/ffs_snapshot.c:1.102.4.1 Sat Feb 12 19:52:39 2011 +++ src/sys/ufs/ffs/ffs_snapshot.c Sat Feb 12 21:48:09 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: ffs_snapshot.c,v 1.102.4.1 2011/02/12 19:52:39 bouyer Exp $ */ +/* $NetBSD: ffs_snapshot.c,v 1.102.4.2 2011/02/12 21:48:09 bouyer Exp $ */ /* * Copyright 2000 Marshall Kirk McKusick. All Rights Reserved. @@ -38,10 +38,11 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: ffs_snapshot.c,v 1.102.4.1 2011/02/12 19:52:39 bouyer Exp $); +__KERNEL_RCSID(0, $NetBSD: ffs_snapshot.c,v 1.102.4.2 2011/02/12 21:48:09 bouyer Exp $); #if defined(_KERNEL_OPT) #include opt_ffs.h +#include opt_quota.h #endif #include sys/param.h @@ -213,6 +214,19 @@ error = snapshot_setup(mp, vp); if (error) goto out; + /* quota inodes are not accounted in quotas */ +#if defined(QUOTA) || defined(QUOTA2) + chkdq(ip, -DIP(ip, blocks), l-l_cred, 0); + chkiq(ip, -1, l-l_cred, 0); +#endif + /* + * Change inode to snapshot type file. + */ + ip-i_flags |= SF_SNAPSHOT; + DIP_ASSIGN(ip, flags, ip-i_flags); + ip-i_flag |= IN_CHANGE | IN_UPDATE; + + /* * Copy all the cylinder group maps. Although the * filesystem is still active, we hope that only a few @@ -402,7 +416,6 @@ struct buf *ibp, *nbp; struct fs *fs = VFSTOUFS(mp)-um_fs; struct lwp *l = curlwp; - struct inode *ip = VTOI(vp); /* * Check mount, exclusive reference and owner. @@ -422,13 +435,6 @@ return error; } /* - * Change inode to snapshot type file. - * Do it now so that allocations below are not recorded in quotas - */ - ip-i_flags |= SF_SNAPSHOT; - DIP_ASSIGN(ip, flags, ip-i_flags); - ip-i_flag |= IN_CHANGE | IN_UPDATE; - /* * Write an empty list of preallocated blocks to the end of * the snapshot to set size to at least that of the filesystem. */ @@ -1029,6 +1035,11 @@ dip1-di_flags = ufs_rw32(ufs_rw32(dip1-di_flags, ns) ~SF_SNAPSHOT, ns); memset(dip1-di_db[0], 0, (NDADDR + NIADDR) * sizeof(int32_t)); + /* quota inodes are not accounted in quotas */ +#if defined(QUOTA) || defined(QUOTA2) + if (dip1-di_mode != 0) + chkiq(cancelip, 1, l-l_cred, FORCE); +#endif } else { dip2 = (struct ufs2_dinode *)bp-b_data + ino_to_fsbo(fs, cancelip-i_number); @@ -1039,6 +1050,10 @@ dip2-di_flags = ufs_rw32(ufs_rw32(dip2-di_flags, ns) ~SF_SNAPSHOT, ns); memset(dip2-di_db[0], 0, (NDADDR + NIADDR) * sizeof(int64_t)); +#if defined(QUOTA) || defined(QUOTA2) + if (dip2-di_mode != 0) + chkiq(cancelip, 1, l-l_cred, FORCE); +#endif } bdwrite(bp); /* @@ -1387,6 +1402,10 @@ ip-i_flags = ~SF_SNAPSHOT; DIP_ASSIGN(ip, flags, ip-i_flags); ip-i_flag |= IN_CHANGE | IN_UPDATE; +#if defined(QUOTA) || defined(QUOTA2) + chkdq(ip, DIP(ip, blocks), l-l_cred, FORCE); + chkiq(ip, 1, l-l_cred, FORCE); +#endif } /* Index: src/sys/ufs/ufs/ufs_quota.c diff -u src/sys/ufs/ufs/ufs_quota.c:1.68.4.12 src/sys/ufs/ufs/ufs_quota.c:1.68.4.13 --- src/sys/ufs/ufs/ufs_quota.c:1.68.4.12 Sat Feb 12 19:52:40 2011 +++ src/sys/ufs/ufs/ufs_quota.c Sat Feb 12 21:48:09 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: ufs_quota.c,v 1.68.4.12 2011/02/12 19:52:40 bouyer Exp $ */ +/* $NetBSD: ufs_quota.c,v 1.68.4.13 2011/02/12 21:48:09 bouyer Exp $ */ /* * Copyright (c) 1982, 1986, 1990, 1993, 1995 @@ -35,7 +35,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: ufs_quota.c,v 1.68.4.12 2011/02/12 19:52:40 bouyer Exp $); +__KERNEL_RCSID(0, $NetBSD: ufs_quota.c,v 1.68.4.13 2011/02/12 21:48:09 bouyer Exp $); #if defined(_KERNEL_OPT) #include opt_quota.h @@ -139,6 +139,9 @@ int chkiq(struct inode *ip, int32_t change, kauth_cred_t cred, int flags) { + /* do not track snapshot usage, or we will deadlock */ + if ((ip-i_flags SF_SNAPSHOT) != 0) + return 0; #ifdef QUOTA if (ip-i_ump-um_flags UFS_QUOTA) return chkiq1(ip, change, cred, flags); Index: src/sys/ufs/ufs/ufs_quota2.c diff -u src/sys/ufs/ufs/ufs_quota2.c:1.1.2.14 src/sys/ufs/ufs/ufs_quota2.c:1.1.2.15 --- src/sys/ufs/ufs/ufs_quota2.c:1.1.2.14 Fri
CVS commit: [bouyer-quota2] src/sbin/fsck_ffs
Module Name:src Committed By: bouyer Date: Sat Feb 12 21:48:41 UTC 2011 Modified Files: src/sbin/fsck_ffs [bouyer-quota2]: inode.c pass1.c pass4.c Log Message: Skip snapshot inodes for both block and inode quotas. To generate a diff of this commit: cvs rdiff -u -r1.63.2.2 -r1.63.2.3 src/sbin/fsck_ffs/inode.c cvs rdiff -u -r1.46.14.2 -r1.46.14.3 src/sbin/fsck_ffs/pass1.c cvs rdiff -u -r1.25.14.2 -r1.25.14.3 src/sbin/fsck_ffs/pass4.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/fsck_ffs/inode.c diff -u src/sbin/fsck_ffs/inode.c:1.63.2.2 src/sbin/fsck_ffs/inode.c:1.63.2.3 --- src/sbin/fsck_ffs/inode.c:1.63.2.2 Sat Feb 12 19:53:32 2011 +++ src/sbin/fsck_ffs/inode.c Sat Feb 12 21:48:41 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: inode.c,v 1.63.2.2 2011/02/12 19:53:32 bouyer Exp $ */ +/* $NetBSD: inode.c,v 1.63.2.3 2011/02/12 21:48:41 bouyer Exp $ */ /* * Copyright (c) 1980, 1986, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = @(#)inode.c 8.8 (Berkeley) 4/28/95; #else -__RCSID($NetBSD: inode.c,v 1.63.2.2 2011/02/12 19:53:32 bouyer Exp $); +__RCSID($NetBSD: inode.c,v 1.63.2.3 2011/02/12 21:48:41 bouyer Exp $); #endif #endif /* not lint */ @@ -580,8 +580,9 @@ * ckinode will call id_func (actually always pass4check) * which will update the block count */ - update_uquot(idesc-id_number, idesc-id_uid, idesc-id_gid, - 0, -1); + if (idesc-id_type != SNAP) + update_uquot(idesc-id_number, + idesc-id_uid, idesc-id_gid, 0, -1); (void)ckinode(dp, idesc); clearinode(dp); inoinfo(idesc-id_number)-ino_state = USTATE; @@ -844,7 +845,9 @@ clearinode(dp); inodirty(); inoinfo(ino)-ino_state = USTATE; - update_uquot(idesc.id_number, idesc.id_uid, idesc.id_gid, 0, -1); + if (idesc.id_type != SNAP) + update_uquot(idesc.id_number, + idesc.id_uid, idesc.id_gid, 0, -1); n_files--; if (cgp) { clrbit(cg_inosused(cgp, 0), ino % sblock-fs_ipg); Index: src/sbin/fsck_ffs/pass1.c diff -u src/sbin/fsck_ffs/pass1.c:1.46.14.2 src/sbin/fsck_ffs/pass1.c:1.46.14.3 --- src/sbin/fsck_ffs/pass1.c:1.46.14.2 Sat Feb 12 19:53:32 2011 +++ src/sbin/fsck_ffs/pass1.c Sat Feb 12 21:48:41 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: pass1.c,v 1.46.14.2 2011/02/12 19:53:32 bouyer Exp $ */ +/* $NetBSD: pass1.c,v 1.46.14.3 2011/02/12 21:48:41 bouyer Exp $ */ /* * Copyright (c) 1980, 1986, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = @(#)pass1.c 8.6 (Berkeley) 4/28/95; #else -__RCSID($NetBSD: pass1.c,v 1.46.14.2 2011/02/12 19:53:32 bouyer Exp $); +__RCSID($NetBSD: pass1.c,v 1.46.14.3 2011/02/12 21:48:41 bouyer Exp $); #endif #endif /* not lint */ @@ -466,8 +466,9 @@ dp-dp1.di_blocks = iswap32((int32_t)idesc-id_entryno); inodirty(); } - update_uquot(inumber, idesc-id_uid, idesc-id_gid, - (idesc-id_type == SNAP) ? 0 : idesc-id_entryno, 1); + if (idesc-id_type != SNAP) + update_uquot(inumber, idesc-id_uid, idesc-id_gid, + idesc-id_entryno, 1); return; unknown: pfatal(UNKNOWN FILE TYPE I=%llu, (unsigned long long)inumber); Index: src/sbin/fsck_ffs/pass4.c diff -u src/sbin/fsck_ffs/pass4.c:1.25.14.2 src/sbin/fsck_ffs/pass4.c:1.25.14.3 --- src/sbin/fsck_ffs/pass4.c:1.25.14.2 Sat Feb 12 19:53:32 2011 +++ src/sbin/fsck_ffs/pass4.c Sat Feb 12 21:48:41 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: pass4.c,v 1.25.14.2 2011/02/12 19:53:32 bouyer Exp $ */ +/* $NetBSD: pass4.c,v 1.25.14.3 2011/02/12 21:48:41 bouyer Exp $ */ /* * Copyright (c) 1980, 1986, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = @(#)pass4.c 8.4 (Berkeley) 4/28/95; #else -__RCSID($NetBSD: pass4.c,v 1.25.14.2 2011/02/12 19:53:32 bouyer Exp $); +__RCSID($NetBSD: pass4.c,v 1.25.14.3 2011/02/12 21:48:41 bouyer Exp $); #endif #endif /* not lint */ @@ -192,9 +192,11 @@ dtogd(sblock, blkno)); n_blks--; -update_uquot(idesc-id_number, idesc-id_uid, -idesc-id_gid, (idesc-id_type == SNAP) ? -0 : -btodb(sblock-fs_fsize), 0); +if (idesc-id_type != SNAP) { + update_uquot(idesc-id_number, + idesc-id_uid, idesc-id_gid, + -btodb(sblock-fs_fsize), 0); +} if (idesc-id_numfrags != sblock-fs_frag cgp) { cgp-cg_cs.cs_nffree ++;
CVS commit: [bouyer-quota2] src/tests/fs/ffs
Module Name:src Committed By: bouyer Date: Sat Feb 12 21:49:08 UTC 2011 Modified Files: src/tests/fs/ffs [bouyer-quota2]: h_quota2_tests.c t_miscquota.sh Log Message: Add some quota+snapshot tests. To generate a diff of this commit: cvs rdiff -u -r1.1.2.3 -r1.1.2.4 src/tests/fs/ffs/h_quota2_tests.c cvs rdiff -u -r1.1.2.2 -r1.1.2.3 src/tests/fs/ffs/t_miscquota.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/fs/ffs/h_quota2_tests.c diff -u src/tests/fs/ffs/h_quota2_tests.c:1.1.2.3 src/tests/fs/ffs/h_quota2_tests.c:1.1.2.4 --- src/tests/fs/ffs/h_quota2_tests.c:1.1.2.3 Mon Feb 7 16:22:50 2011 +++ src/tests/fs/ffs/h_quota2_tests.c Sat Feb 12 21:49:08 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: h_quota2_tests.c,v 1.1.2.3 2011/02/07 16:22:50 bouyer Exp $ */ +/* $NetBSD: h_quota2_tests.c,v 1.1.2.4 2011/02/12 21:49:08 bouyer Exp $ */ /* * rump server for advanced quota tests @@ -17,6 +17,7 @@ #include unistd.h #include ufs/ufs/ufsmount.h +#include dev/fssvar.h #include rump/rump.h #include rump/rump_syscalls.h @@ -28,7 +29,7 @@ #define TEST_NONROOT_ID 1 static int -quota_test0(void) +quota_test0(const char *testopts) { static char buf[512]; int fd; @@ -60,7 +61,7 @@ } static int -quota_test1(void) +quota_test1(const char *testopts) { static char buf[512]; int fd; @@ -107,7 +108,7 @@ } static int -quota_test2(void) +quota_test2(const char *testopts) { static char buf[512]; int fd; @@ -143,7 +144,7 @@ } static int -quota_test3(void) +quota_test3(const char *testopts) { static char buf[512]; int fd; @@ -189,8 +190,71 @@ return error; } +static int +quota_test4(const char *testopts) +{ + static char buf[512]; + int fd, fssfd; + struct fss_set fss; + unsigned int i; + int unl=0; + int unconf=0; + + /* + * take an internal snapshot of the filesystem, and create a new + * file with some data + */ + + for (i =0; testopts i strlen(testopts); i++) { + switch(testopts[i]) { + case 'L': + unl++; + break; + case 'C': + unconf++; + break; + default: + errx(1, test4: unknown option %c, testopts[i]); + } + } + + /* first create the snapshot */ + + fd = rump_sys_open(FSTEST_MNTNAME /le_snap, O_CREAT | O_RDWR, 0777); + if (fd == -1) + err(1, create FSTEST_MNTNAME /le_snap); + rump_sys_close(fd); + fssfd = rump_sys_open(/dev/rfss0, O_RDWR); + if (fssfd == -1) + err(1, cannot open fss); + memset(fss, 0, sizeof(fss)); + fss.fss_mount = __UNCONST(/mnt); + fss.fss_bstore = __UNCONST(FSTEST_MNTNAME /le_snap); + fss.fss_csize = 0; + if (rump_sys_ioctl(fssfd, FSSIOCSET, fss) == -1) + err(1, create snapshot); + if (unl) + rump_sys_unlink(FSTEST_MNTNAME /le_snap); + + /* now create some extra files */ + + for (i = 0; i 4; i++) { + sprintf(buf, file%d, i); + fd = rump_sys_open(buf, O_EXCL| O_CREAT | O_RDWR, 0644); + if (fd 0) + err(1, create %s, buf); + sprintf(buf, test file no %d, i); + rump_sys_write(fd, buf, strlen(buf)); + rump_sys_close(fd); + } + if (unconf) + if (rump_sys_ioctl(fssfd, FSSIOCCLR, NULL) == -1) + err(1, unconfigure snapshot); + return 0; +} + struct quota_test { - int (*func)(void); + int (*func)(const char *); const char *desc; }; @@ -199,13 +263,19 @@ { quota_test1, write beyond the soft limit after grace time}, { quota_test2, create file up to hard limit}, { quota_test3, create file beyond the soft limit after grace time}, + { quota_test4, take a snapshot and add some data}, }; static void usage(void) { + unsigned int test; fprintf(stderr, usage: %s [-b] [-l] test# diskimage bindurl\n, getprogname()); + fprintf(stderr, available tests:\n); + for (test = 0; test sizeof(quota_tests) / sizeof(quota_tests[0]); + test++) + fprintf(stderr, \t%d: %s\n, test, quota_tests[test].desc); exit(1); } @@ -236,10 +306,11 @@ struct ufs_args uargs; const char *filename; const char *serverurl; + const char *topts = NULL; int log = 0; int ch; - while ((ch = getopt(argc, argv, bl)) != -1) { + while ((ch = getopt(argc, argv, blo:)) != -1) { switch(ch) { case 'b': background = 1; @@ -247,6 +318,9 @@ case 'l': log = 1; break; + case 'o': + topts = optarg; + break; default: usage(); } @@ -265,8 +339,7 @@ usage(); } if (test sizeof(quota_tests) / sizeof(quota_tests[0])) { - fprintf(stderr, test number %lu too big\n, test); - exit(1); + usage(); } if (background) { @@ -291,7 +364,7 @@ err(1, cd %s, FSTEST_MNTNAME); rump_sys_chown(., 0, 0); rump_sys_chmod(., 0777); - error = quota_tests[test].func(); + error = quota_tests[test].func(topts); if (error) { fprintf(stderr, test %lu: %s returned %d: %s\n, test, quota_tests[test].desc, error, strerror(error)); Index: src/tests/fs/ffs/t_miscquota.sh diff -u src/tests/fs/ffs/t_miscquota.sh:1.1.2.2 src/tests/fs/ffs/t_miscquota.sh:1.1.2.3 ---
CVS commit: [bouyer-quota2] src/sys/ufs/ufs
Module Name:src Committed By: bouyer Date: Sun Feb 13 00:11:09 UTC 2011 Modified Files: src/sys/ufs/ufs [bouyer-quota2]: ufs_quota.c Log Message: Fix memory leak To generate a diff of this commit: cvs rdiff -u -r1.68.4.13 -r1.68.4.14 src/sys/ufs/ufs/ufs_quota.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/ufs/ufs/ufs_quota.c diff -u src/sys/ufs/ufs/ufs_quota.c:1.68.4.13 src/sys/ufs/ufs/ufs_quota.c:1.68.4.14 --- src/sys/ufs/ufs/ufs_quota.c:1.68.4.13 Sat Feb 12 21:48:09 2011 +++ src/sys/ufs/ufs/ufs_quota.c Sun Feb 13 00:11:09 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: ufs_quota.c,v 1.68.4.13 2011/02/12 21:48:09 bouyer Exp $ */ +/* $NetBSD: ufs_quota.c,v 1.68.4.14 2011/02/13 00:11:09 bouyer Exp $ */ /* * Copyright (c) 1982, 1986, 1990, 1993, 1995 @@ -35,7 +35,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: ufs_quota.c,v 1.68.4.13 2011/02/12 21:48:09 bouyer Exp $); +__KERNEL_RCSID(0, $NetBSD: ufs_quota.c,v 1.68.4.14 2011/02/13 00:11:09 bouyer Exp $); #if defined(_KERNEL_OPT) #include opt_quota.h @@ -301,8 +301,10 @@ if (!prop_dictionary_get_cstring_nocopy(data, id, idstr)) continue; - if (strcmp(idstr, default)) -continue; + if (strcmp(idstr, default)) { +error = EINVAL; +goto err; + } id = 0; defaultq = 1; } else { @@ -311,10 +313,8 @@ error = quota_get_auth(mp, l, id); if (error == EPERM) continue; - if (error != 0) { - prop_object_release(replies); - return error; - } + if (error != 0) + goto err; #ifdef QUOTA if (ump-um_flags UFS_QUOTA) error = quota1_handle_cmd_get(ump, type, id, defaultq, @@ -329,17 +329,22 @@ #endif panic(quota_handle_cmd_get: no support ?); - if (error error != ENOENT) { - prop_object_release(replies); - return error; - } + if (error == ENOENT) + continue; + if (error != 0) + goto err; } + prop_object_iterator_release(iter); if (!prop_dictionary_set_and_rel(cmddict, data, replies)) { error = ENOMEM; } else { error = 0; } return error; +err: + prop_object_iterator_release(iter); + prop_object_release(replies); + return error; } static int @@ -380,10 +385,8 @@ } error = kauth_authorize_system(l-l_cred, KAUTH_SYSTEM_FS_QUOTA, KAUTH_REQ_SYSTEM_FS_QUOTA_MANAGE, mp, KAUTH_ARG(id), NULL); - if (error != 0) { - prop_object_release(replies); - return error; - } + if (error != 0) + goto err; #ifdef QUOTA if (ump-um_flags UFS_QUOTA) error = quota1_handle_cmd_set(ump, type, id, defaultq, @@ -398,17 +401,20 @@ #endif panic(quota_handle_cmd_get: no support ?); - if (error error != ENOENT) { - prop_object_release(replies); - return error; - } + if (error error != ENOENT) + goto err; } + prop_object_iterator_release(iter); if (!prop_dictionary_set_and_rel(cmddict, data, replies)) { error = ENOMEM; } else { error = 0; } return error; +err: + prop_object_iterator_release(iter); + prop_object_release(replies); + return error; } static int @@ -449,10 +455,8 @@ } error = kauth_authorize_system(l-l_cred, KAUTH_SYSTEM_FS_QUOTA, KAUTH_REQ_SYSTEM_FS_QUOTA_MANAGE, mp, KAUTH_ARG(id), NULL); - if (error != 0) { - prop_object_release(replies); - return error; - } + if (error != 0) + goto err; #ifdef QUOTA2 if (ump-um_flags UFS_QUOTA2) { error = quota2_handle_cmd_clear(ump, type, id, defaultq, @@ -461,17 +465,20 @@ #endif panic(quota_handle_cmd_get: no support ?); - if (error error != ENOENT) { - prop_object_release(replies); - return error; - } + if (error error != ENOENT) + goto err; } + prop_object_iterator_release(iter); if (!prop_dictionary_set_and_rel(cmddict, data, replies)) { error = ENOMEM; } else { error = 0; } return error; +err: + prop_object_iterator_release(iter); + prop_object_release(replies); + return error; } static int
CVS commit: [bouyer-quota2] src/sys/ufs
Module Name:src Committed By: bouyer Date: Sat Feb 12 19:52:40 UTC 2011 Modified Files: src/sys/ufs/ffs [bouyer-quota2]: ffs_snapshot.c src/sys/ufs/ufs [bouyer-quota2]: ufs_quota.c Log Message: Do not update disk quotas for snapshot inodes, as this may require a write to the same filesystem, which will trigger a copy on write, which will trigger another update to the same block. Set SF_SNAPSHOT just after truncating the snapshot inode, so that this inode always account for 0 blocks in quotas. To generate a diff of this commit: cvs rdiff -u -r1.102 -r1.102.4.1 src/sys/ufs/ffs/ffs_snapshot.c cvs rdiff -u -r1.68.4.11 -r1.68.4.12 src/sys/ufs/ufs/ufs_quota.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [bouyer-quota2] src/sbin/fsck_ffs
Module Name:src Committed By: bouyer Date: Sat Feb 12 19:53:32 UTC 2011 Modified Files: src/sbin/fsck_ffs [bouyer-quota2]: inode.c pass1.c pass4.c Log Message: Snapshot inode doesn't count for block quotas. To generate a diff of this commit: cvs rdiff -u -r1.63.2.1 -r1.63.2.2 src/sbin/fsck_ffs/inode.c cvs rdiff -u -r1.46.14.1 -r1.46.14.2 src/sbin/fsck_ffs/pass1.c cvs rdiff -u -r1.25.14.1 -r1.25.14.2 src/sbin/fsck_ffs/pass4.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [bouyer-quota2] src/sys/ufs
Module Name:src Committed By: bouyer Date: Sat Feb 12 21:48:10 UTC 2011 Modified Files: src/sys/ufs/ffs [bouyer-quota2]: ffs_snapshot.c src/sys/ufs/ufs [bouyer-quota2]: ufs_quota.c ufs_quota2.c Log Message: Don't count snapshot files in inode quota too. At umount time, chk?q may be called after quota have been shutdown, as there is a final vflush pass after quota?_umount(); so skip quota checks if the quota vnode is not there any more. To generate a diff of this commit: cvs rdiff -u -r1.102.4.1 -r1.102.4.2 src/sys/ufs/ffs/ffs_snapshot.c cvs rdiff -u -r1.68.4.12 -r1.68.4.13 src/sys/ufs/ufs/ufs_quota.c cvs rdiff -u -r1.1.2.14 -r1.1.2.15 src/sys/ufs/ufs/ufs_quota2.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [bouyer-quota2] src/sbin/fsck_ffs
Module Name:src Committed By: bouyer Date: Sat Feb 12 21:48:41 UTC 2011 Modified Files: src/sbin/fsck_ffs [bouyer-quota2]: inode.c pass1.c pass4.c Log Message: Skip snapshot inodes for both block and inode quotas. To generate a diff of this commit: cvs rdiff -u -r1.63.2.2 -r1.63.2.3 src/sbin/fsck_ffs/inode.c cvs rdiff -u -r1.46.14.2 -r1.46.14.3 src/sbin/fsck_ffs/pass1.c cvs rdiff -u -r1.25.14.2 -r1.25.14.3 src/sbin/fsck_ffs/pass4.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [bouyer-quota2] src/tests/fs/ffs
Module Name:src Committed By: bouyer Date: Sat Feb 12 21:49:08 UTC 2011 Modified Files: src/tests/fs/ffs [bouyer-quota2]: h_quota2_tests.c t_miscquota.sh Log Message: Add some quota+snapshot tests. To generate a diff of this commit: cvs rdiff -u -r1.1.2.3 -r1.1.2.4 src/tests/fs/ffs/h_quota2_tests.c cvs rdiff -u -r1.1.2.2 -r1.1.2.3 src/tests/fs/ffs/t_miscquota.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [bouyer-quota2] src/sys/kern
Module Name:src Committed By: bouyer Date: Fri Feb 11 11:27:30 UTC 2011 Modified Files: src/sys/kern [bouyer-quota2]: vfs_syscalls.c Log Message: Remove debug printf To generate a diff of this commit: cvs rdiff -u -r1.414.4.1 -r1.414.4.2 src/sys/kern/vfs_syscalls.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/vfs_syscalls.c diff -u src/sys/kern/vfs_syscalls.c:1.414.4.1 src/sys/kern/vfs_syscalls.c:1.414.4.2 --- src/sys/kern/vfs_syscalls.c:1.414.4.1 Thu Jan 20 14:24:58 2011 +++ src/sys/kern/vfs_syscalls.c Fri Feb 11 11:27:29 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_syscalls.c,v 1.414.4.1 2011/01/20 14:24:58 bouyer Exp $ */ +/* $NetBSD: vfs_syscalls.c,v 1.414.4.2 2011/02/11 11:27:29 bouyer Exp $ */ /*- * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc. @@ -66,7 +66,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: vfs_syscalls.c,v 1.414.4.1 2011/01/20 14:24:58 bouyer Exp $); +__KERNEL_RCSID(0, $NetBSD: vfs_syscalls.c,v 1.414.4.2 2011/02/11 11:27:29 bouyer Exp $); #ifdef _KERNEL_OPT #include opt_fileassoc.h @@ -899,27 +899,21 @@ error = namei_simple_user(SCARG(uap, path), NSM_FOLLOW_TRYEMULROOT, vp); - printf(namei error %d\n, error); if (error != 0) return (error); mp = vp-v_mount; error = copyin(SCARG(uap, pref), pref, sizeof(pref)); - printf(copyin error %d\n, error); if (error) return error; error = prop_dictionary_copyin(pref, dict); - printf(prop_dictionary_copyin error %d\n, error); if (error) return error; error = VFS_QUOTACTL(mp, dict); - printf(VFS_QUOTACTL error %d\n, error); vrele(vp); if (!error) error = prop_dictionary_copyout(pref, dict); - printf(prop_dictionary_copyout error %d\n, error); if (!error) error = copyout(pref, SCARG(uap, pref), sizeof(pref)); - printf(copyout error %d\n, error); prop_object_release(dict); return (error); }
CVS commit: [bouyer-quota2] src/sys/ufs/ufs
Module Name:src Committed By: bouyer Date: Fri Feb 11 11:38:44 UTC 2011 Modified Files: src/sys/ufs/ufs [bouyer-quota2]: quota2_prop.c Log Message: Remove key quota version, it doesn't serve any purpose To generate a diff of this commit: cvs rdiff -u -r1.1.2.4 -r1.1.2.5 src/sys/ufs/ufs/quota2_prop.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/ufs/ufs/quota2_prop.c diff -u src/sys/ufs/ufs/quota2_prop.c:1.1.2.4 src/sys/ufs/ufs/quota2_prop.c:1.1.2.5 --- src/sys/ufs/ufs/quota2_prop.c:1.1.2.4 Mon Jan 31 15:24:10 2011 +++ src/sys/ufs/ufs/quota2_prop.c Fri Feb 11 11:38:44 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: quota2_prop.c,v 1.1.2.4 2011/01/31 15:24:10 bouyer Exp $ */ +/* $NetBSD: quota2_prop.c,v 1.1.2.5 2011/02/11 11:38:44 bouyer Exp $ */ /*- * Copyright (c) 2010 Manuel Bouyer * All rights reserved. @@ -134,12 +134,6 @@ if (prop_number_integer_value(pn) != 1) return EINVAL; - pn = prop_dictionary_get(qdict, quota version); - if (pn == NULL) - return EINVAL; - if (prop_number_integer_value(pn) != 2) - return EINVAL; - o = prop_dictionary_get(qdict, commands); if (o == NULL) return ENOMEM; @@ -183,9 +177,6 @@ if (!prop_dictionary_set_uint8(dict, interface version, 1)) { goto err; } - if (!prop_dictionary_set_uint8(dict, quota version, 2)) { - goto err; - } return dict; err: prop_object_release(dict); @@ -247,7 +238,6 @@ err: prop_object_release(dict1); return NULL; - } prop_dictionary_t
CVS commit: [bouyer-quota2] src/usr.sbin/quotactl
Module Name:src Committed By: bouyer Date: Fri Feb 11 12:44:40 UTC 2011 Modified Files: src/usr.sbin/quotactl [bouyer-quota2]: quotactl.8 Log Message: Add an example plist To generate a diff of this commit: cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/usr.sbin/quotactl/quotactl.8 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/quotactl/quotactl.8 diff -u src/usr.sbin/quotactl/quotactl.8:1.1.2.1 src/usr.sbin/quotactl/quotactl.8:1.1.2.2 --- src/usr.sbin/quotactl/quotactl.8:1.1.2.1 Mon Jan 31 21:14:06 2011 +++ src/usr.sbin/quotactl/quotactl.8 Fri Feb 11 12:44:39 2011 @@ -1,4 +1,4 @@ -.\ $NetBSD: quotactl.8,v 1.1.2.1 2011/01/31 21:14:06 bouyer Exp $ +.\ $NetBSD: quotactl.8,v 1.1.2.2 2011/02/11 12:44:39 bouyer Exp $ .\ .\ Copyright (c) 2011 Manuel Bouyer .\ All rights reserved. @@ -67,6 +67,62 @@ .Fl x is present, a message is printed to stderr for each failed command, and the exit status will be 2 if any comand failed. +.Sh EXAMPLES +This will set the quota limits for user id 100 on the filesystem /home: +.Bd -literal +quotactl /home EOF +?xml version=1.0 encoding=UTF-8? +!DOCTYPE plist PUBLIC -//Apple Computer//DTD PLIST 1.0//EN http://www.apple.com/DTDs/PropertyList-1.0.dtd; +plist version=1.0 +dict +keycommands/key +array +dict +keycommand/key +stringset/string +keydata/key +array +dict +keyblock/key +dict +keyexpire time/key +integer0/integer +keygrace time/key +integer2419200/integer +keyhard/key +integer0x2000/integer +keysoft/key +integer0x1000/integer +keyusage/key +integer0x0/integer +/dict +keyfile/key +dict +keyexpire time/key +integer0/integer +keygrace time/key +integer172800/integer +keyhard/key +integer0x800/integer +keysoft/key +integer0x400/integer +keyusage/key +integer0x0/integer +/dict +keyid/key +integer100/integer +/dict +/array +keytype/key +stringuser/string +/dict +/array +keyinterface version/key +integer0x1/integer +/dict +/plist +EOF + .Sh SEE ALSO .Xr quota 1 , .Xr quotactl 2 ,
CVS commit: [bouyer-quota2] src/lib/libc/sys
Module Name:src Committed By: bouyer Date: Fri Feb 11 12:50:11 UTC 2011 Modified Files: src/lib/libc/sys [bouyer-quota2]: quotactl.2 Log Message: Add pointers to source files using the quotactl interface To generate a diff of this commit: cvs rdiff -u -r1.26.2.1 -r1.26.2.2 src/lib/libc/sys/quotactl.2 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libc/sys/quotactl.2 diff -u src/lib/libc/sys/quotactl.2:1.26.2.1 src/lib/libc/sys/quotactl.2:1.26.2.2 --- src/lib/libc/sys/quotactl.2:1.26.2.1 Fri Feb 11 12:35:27 2011 +++ src/lib/libc/sys/quotactl.2 Fri Feb 11 12:50:11 2011 @@ -1,4 +1,4 @@ -.\ $NetBSD: quotactl.2,v 1.26.2.1 2011/02/11 12:35:27 bouyer Exp $ +.\ $NetBSD: quotactl.2,v 1.26.2.2 2011/02/11 12:50:11 bouyer Exp $ .\ .\ Copyright (c) 1983, 1990, 1991, 1993 .\ The Regents of the University of California. All rights reserved. @@ -181,6 +181,20 @@ was supplied; the associated structure could not be copied in or out of the kernel. .El +.Sh FILES +Example of usage of the +.Nm +syscall, with construction of the pref argument an interpretation of +the reply, can be found in the following +.Nx +source files: +.Bl -tag +.It src/usr.bin/quota/getvfsquota.c +.It src/usr.sbin/repquota/repquota.c +.It src/usr.sbin/edquota/edquota.c +.It src/usr.sbin/quotaon/quotaon.c +.It src/sys/ufs/ufs/quota2_prop.c +.El .Sh SEE ALSO .Xr quota 1 , .Xr proplib 3 ,
CVS commit: [bouyer-quota2] src/share/man/man5
Module Name:src Committed By: bouyer Date: Fri Feb 11 12:58:50 UTC 2011 Modified Files: src/share/man/man5 [bouyer-quota2]: fstab.5 Log Message: Mention the new in-filesystem quota system, and a possible migration path using repquota -x and quotactl. To generate a diff of this commit: cvs rdiff -u -r1.36 -r1.36.4.1 src/share/man/man5/fstab.5 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/man/man5/fstab.5 diff -u src/share/man/man5/fstab.5:1.36 src/share/man/man5/fstab.5:1.36.4.1 --- src/share/man/man5/fstab.5:1.36 Sun Jan 11 22:03:56 2009 +++ src/share/man/man5/fstab.5 Fri Feb 11 12:58:50 2011 @@ -1,4 +1,4 @@ -.\ $NetBSD: fstab.5,v 1.36 2009/01/11 22:03:56 wiz Exp $ +.\ $NetBSD: fstab.5,v 1.36.4.1 2011/02/11 12:58:50 bouyer Exp $ .\ .\ Copyright (c) 1980, 1989, 1991, 1993 .\ The Regents of the University of California. All rights reserved. @@ -183,7 +183,7 @@ are specified, the filesystem is automatically processed by the .Xr quotacheck 8 -command, and user and/or group disk quotas are enabled with +command, and legacy user and/or group disk quotas are enabled with .Xr quotaon 8 . By default, filesystem quotas are maintained in files named @@ -202,6 +202,23 @@ userquota=/var/quotas/tmp.user .Ed .Pp +It is recommended to turn on the new, in-filesystem quota with +.Xr tunefs 8 +or at +.Xr newfs 8 +time, and to not use the +.Dq userquota +or +.Dq groupquota +options. +Migration of limits to the new in-filesystem quota can be handled +by +.Xr repquota 8 +with option +.Fl x +and +.Xr quotactl 8 . +.Pp The option .Dq rump is used to mount the file system using a
CVS commit: [bouyer-quota2] src/usr.sbin/quotactl
Module Name:src Committed By: bouyer Date: Fri Feb 11 15:05:35 UTC 2011 Modified Files: src/usr.sbin/quotactl [bouyer-quota2]: quotactl.c Log Message: Fix pointers if realloc return a different memory area. To generate a diff of this commit: cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/usr.sbin/quotactl/quotactl.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/quotactl/quotactl.c diff -u src/usr.sbin/quotactl/quotactl.c:1.1.2.1 src/usr.sbin/quotactl/quotactl.c:1.1.2.2 --- src/usr.sbin/quotactl/quotactl.c:1.1.2.1 Mon Jan 31 21:14:06 2011 +++ src/usr.sbin/quotactl/quotactl.c Fri Feb 11 15:05:35 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: quotactl.c,v 1.1.2.1 2011/01/31 21:14:06 bouyer Exp $ */ +/* $NetBSD: quotactl.c,v 1.1.2.2 2011/02/11 15:05:35 bouyer Exp $ */ /*- * Copyright (c) 2011 Manuel Bouyer * All rights reserved. @@ -29,7 +29,7 @@ #include sys/cdefs.h #ifndef lint -__RCSID($NetBSD: quotactl.c,v 1.1.2.1 2011/01/31 21:14:06 bouyer Exp $); +__RCSID($NetBSD: quotactl.c,v 1.1.2.2 2011/02/11 15:05:35 bouyer Exp $); #endif /* not lint */ /* @@ -107,10 +107,10 @@ plist = realloc(plist, plistsize + READ_SIZE); if (plist == NULL) err(1, realloc buffer); - p += READ_SIZE; + p = plist + plistsize; plistsize += READ_SIZE; } - if (ferror(f)) + if (!feof(f)) err(1, error reading %s, xmlfile); qdict = prop_dictionary_internalize(plist);
CVS commit: [bouyer-quota2] src/tests/fs/ffs
Module Name:src Committed By: bouyer Date: Fri Feb 11 16:54:03 UTC 2011 Modified Files: src/tests/fs/ffs [bouyer-quota2]: Makefile t_getquota.sh Added Files: src/tests/fs/ffs [bouyer-quota2]: t_miscquota.sh Log Message: Add a test which cause the kernel to walk a quota list where all entries are not in the header disk block, and at last 2 of them are in the same non-header disk block. To generate a diff of this commit: cvs rdiff -u -r1.14.2.6 -r1.14.2.7 src/tests/fs/ffs/Makefile cvs rdiff -u -r1.1.2.7 -r1.1.2.8 src/tests/fs/ffs/t_getquota.sh cvs rdiff -u -r0 -r1.1.2.1 src/tests/fs/ffs/t_miscquota.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/fs/ffs/Makefile diff -u src/tests/fs/ffs/Makefile:1.14.2.6 src/tests/fs/ffs/Makefile:1.14.2.7 --- src/tests/fs/ffs/Makefile:1.14.2.6 Wed Feb 9 20:53:10 2011 +++ src/tests/fs/ffs/Makefile Fri Feb 11 16:54:03 2011 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.14.2.6 2011/02/09 20:53:10 bouyer Exp $ +# $NetBSD: Makefile,v 1.14.2.7 2011/02/11 16:54:03 bouyer Exp $ # .include bsd.own.mk @@ -17,7 +17,7 @@ MAN.h_quota2_tests= # empty BINDIR.h_quota2_tests= ${TESTSDIR} -.for name in t_getquota t_setquota t_quotalimit t_clearquota +.for name in t_getquota t_setquota t_quotalimit t_clearquota t_miscquota TESTS_SH+= ${name} TESTS_SH_SRC_${name}= quotas_common.sh ${name}.sh .endfor Index: src/tests/fs/ffs/t_getquota.sh diff -u src/tests/fs/ffs/t_getquota.sh:1.1.2.7 src/tests/fs/ffs/t_getquota.sh:1.1.2.8 --- src/tests/fs/ffs/t_getquota.sh:1.1.2.7 Mon Feb 7 16:22:50 2011 +++ src/tests/fs/ffs/t_getquota.sh Fri Feb 11 16:54:03 2011 @@ -1,4 +1,4 @@ -# $NetBSD: t_getquota.sh,v 1.1.2.7 2011/02/07 16:22:50 bouyer Exp $ +# $NetBSD: t_getquota.sh,v 1.1.2.8 2011/02/11 16:54:03 bouyer Exp $ # # Copyright (c) 2011 Manuel Bouyer # All rights reserved. @@ -84,3 +84,28 @@ done rump_shutdown } + +quota_walk_list() +{ + create_with_quotas_server $* + local q=$4 + local expect + + case ${q} in + user) + expect=u + fail=g + ;; + group) + expect=g + fail=u + ;; + both) + expect=u g + fail= + ;; + *) + atf_fail wrong quota type + ;; + esac +} Added files: Index: src/tests/fs/ffs/t_miscquota.sh diff -u /dev/null src/tests/fs/ffs/t_miscquota.sh:1.1.2.1 --- /dev/null Fri Feb 11 16:54:03 2011 +++ src/tests/fs/ffs/t_miscquota.sh Fri Feb 11 16:54:03 2011 @@ -0,0 +1,63 @@ +# $NetBSD: t_miscquota.sh,v 1.1.2.1 2011/02/11 16:54:03 bouyer Exp $ +# +# Copyright (c) 2011 Manuel Bouyer +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# + +test_case walk_list_user quota_walk_list \ +walk user quota list over several disk blocks -b le 1 user + +quota_walk_list() +{ + create_with_quotas_server $* + local q=$4 + local expect + + case ${q} in + user) + expect=u + fail=g + ;; + group) + expect=g + fail=u + ;; + *) + atf_fail wrong quota type + ;; + esac + + # create 100 users, all in the same hash list + local i=1; + while [ $i -lt 101 ]; do + atf_check -s exit:0 \ + $(atf_get_srcdir)/rump_edquota -${expect} \ + -s10k/20 -h40M/50k -t 2W/3D $((i * 4096)) + i=$((i + 1)) + done + # do a repquota + atf_check -s exit:0 -o 'match:integer0x64000' \ + $(atf_get_srcdir)/rump_repquota -x -${expect} /mnt + rump_shutdown +}
CVS commit: [bouyer-quota2] src/distrib/sets/lists/tests
Module Name:src Committed By: bouyer Date: Fri Feb 11 16:54:35 UTC 2011 Modified Files: src/distrib/sets/lists/tests [bouyer-quota2]: mi Log Message: +t_miscquota To generate a diff of this commit: cvs rdiff -u -r1.240.2.3 -r1.240.2.4 src/distrib/sets/lists/tests/mi Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/sets/lists/tests/mi diff -u src/distrib/sets/lists/tests/mi:1.240.2.3 src/distrib/sets/lists/tests/mi:1.240.2.4 --- src/distrib/sets/lists/tests/mi:1.240.2.3 Wed Feb 9 20:53:10 2011 +++ src/distrib/sets/lists/tests/mi Fri Feb 11 16:54:35 2011 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.240.2.3 2011/02/09 20:53:10 bouyer Exp $ +# $NetBSD: mi,v 1.240.2.4 2011/02/11 16:54:35 bouyer Exp $ # # Note: don't delete entries from here - mark them as obsolete instead. # @@ -1189,6 +1189,7 @@ ./usr/tests/fs/ffs/t_quota2_remount tests-fs-tests atf ./usr/tests/fs/ffs/t_quotalimit tests-fs-tests atf ./usr/tests/fs/ffs/t_setquota tests-fs-tests atf +./usr/tests/fs/ffs/t_miscquota tests-fs-tests atf ./usr/tests/fs/kernfstests-fs-tests ./usr/tests/fs/kernfs/Atffile tests-fs-tests atf ./usr/tests/fs/kernfs/t_basic tests-fs-tests atf
CVS commit: [bouyer-quota2] src/sys/ufs/ufs
Module Name:src Committed By: bouyer Date: Fri Feb 11 16:55:35 UTC 2011 Modified Files: src/sys/ufs/ufs [bouyer-quota2]: ufs_quota2.c Log Message: walk_list: make sure we don't try to read the same quota disk block again without releasing it first To generate a diff of this commit: cvs rdiff -u -r1.1.2.13 -r1.1.2.14 src/sys/ufs/ufs/ufs_quota2.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/ufs/ufs/ufs_quota2.c diff -u src/sys/ufs/ufs/ufs_quota2.c:1.1.2.13 src/sys/ufs/ufs/ufs_quota2.c:1.1.2.14 --- src/sys/ufs/ufs/ufs_quota2.c:1.1.2.13 Thu Feb 10 16:16:05 2011 +++ src/sys/ufs/ufs/ufs_quota2.c Fri Feb 11 16:55:35 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: ufs_quota2.c,v 1.1.2.13 2011/02/10 16:16:05 bouyer Exp $ */ +/* $NetBSD: ufs_quota2.c,v 1.1.2.14 2011/02/11 16:55:35 bouyer Exp $ */ /*- * Copyright (c) 2010 Manuel Bouyer * All rights reserved. @@ -28,7 +28,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: ufs_quota2.c,v 1.1.2.13 2011/02/10 16:16:05 bouyer Exp $); +__KERNEL_RCSID(0, $NetBSD: ufs_quota2.c,v 1.1.2.14 2011/02/11 16:55:35 bouyer Exp $); #include sys/buf.h #include sys/param.h @@ -155,7 +155,7 @@ struct buf *bp, *obp = hbp; int ret = 0, ret2 = 0; struct quota2_entry *q2e; - daddr_t lblkno, blkoff; + daddr_t lblkno, blkoff, olblkno = 0; KASSERT(mutex_owner(dqlock)); @@ -165,6 +165,9 @@ if (lblkno == 0) { /* in the header block */ bp = hbp; + } else if (lblkno == olblkno) { + /* still in the same buf */ + bp = obp; } else { ret = bread(ump-um_quotas[type], lblkno, ump-umq2_bsize, @@ -192,6 +195,7 @@ brelse(obp, 0); } obp = bp; + olblkno = lblkno; offp = (q2e-q2e_next); off = ufs_rw64(*offp, needswap); }
CVS commit: [bouyer-quota2] src/tests/fs/ffs
Module Name:src Committed By: bouyer Date: Fri Feb 11 17:28:30 UTC 2011 Modified Files: src/tests/fs/ffs [bouyer-quota2]: t_miscquota.sh Log Message: This test requires root To generate a diff of this commit: cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/tests/fs/ffs/t_miscquota.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/fs/ffs/t_miscquota.sh diff -u src/tests/fs/ffs/t_miscquota.sh:1.1.2.1 src/tests/fs/ffs/t_miscquota.sh:1.1.2.2 --- src/tests/fs/ffs/t_miscquota.sh:1.1.2.1 Fri Feb 11 16:54:03 2011 +++ src/tests/fs/ffs/t_miscquota.sh Fri Feb 11 17:28:29 2011 @@ -1,4 +1,4 @@ -# $NetBSD: t_miscquota.sh,v 1.1.2.1 2011/02/11 16:54:03 bouyer Exp $ +# $NetBSD: t_miscquota.sh,v 1.1.2.2 2011/02/11 17:28:29 bouyer Exp $ # # Copyright (c) 2011 Manuel Bouyer # All rights reserved. @@ -25,7 +25,7 @@ # POSSIBILITY OF SUCH DAMAGE. # -test_case walk_list_user quota_walk_list \ +test_case_root walk_list_user quota_walk_list \ walk user quota list over several disk blocks -b le 1 user quota_walk_list()
CVS commit: [bouyer-quota2] src/sys/kern
Module Name:src Committed By: bouyer Date: Fri Feb 11 11:27:30 UTC 2011 Modified Files: src/sys/kern [bouyer-quota2]: vfs_syscalls.c Log Message: Remove debug printf To generate a diff of this commit: cvs rdiff -u -r1.414.4.1 -r1.414.4.2 src/sys/kern/vfs_syscalls.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [bouyer-quota2] src/sys/ufs/ufs
Module Name:src Committed By: bouyer Date: Fri Feb 11 11:38:44 UTC 2011 Modified Files: src/sys/ufs/ufs [bouyer-quota2]: quota2_prop.c Log Message: Remove key quota version, it doesn't serve any purpose To generate a diff of this commit: cvs rdiff -u -r1.1.2.4 -r1.1.2.5 src/sys/ufs/ufs/quota2_prop.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [bouyer-quota2] src/lib/libc/sys
Module Name:src Committed By: bouyer Date: Fri Feb 11 12:35:27 UTC 2011 Modified Files: src/lib/libc/sys [bouyer-quota2]: quotactl.2 Log Message: Describe the new quotactl interface To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.26.2.1 src/lib/libc/sys/quotactl.2 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [bouyer-quota2] src/usr.sbin/quotactl
Module Name:src Committed By: bouyer Date: Fri Feb 11 12:44:40 UTC 2011 Modified Files: src/usr.sbin/quotactl [bouyer-quota2]: quotactl.8 Log Message: Add an example plist To generate a diff of this commit: cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/usr.sbin/quotactl/quotactl.8 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [bouyer-quota2] src/lib/libc/sys
Module Name:src Committed By: bouyer Date: Fri Feb 11 12:50:11 UTC 2011 Modified Files: src/lib/libc/sys [bouyer-quota2]: quotactl.2 Log Message: Add pointers to source files using the quotactl interface To generate a diff of this commit: cvs rdiff -u -r1.26.2.1 -r1.26.2.2 src/lib/libc/sys/quotactl.2 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [bouyer-quota2] src/share/man/man5
Module Name:src Committed By: bouyer Date: Fri Feb 11 12:58:50 UTC 2011 Modified Files: src/share/man/man5 [bouyer-quota2]: fstab.5 Log Message: Mention the new in-filesystem quota system, and a possible migration path using repquota -x and quotactl. To generate a diff of this commit: cvs rdiff -u -r1.36 -r1.36.4.1 src/share/man/man5/fstab.5 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [bouyer-quota2] src/usr.sbin/quotactl
Module Name:src Committed By: bouyer Date: Fri Feb 11 15:05:35 UTC 2011 Modified Files: src/usr.sbin/quotactl [bouyer-quota2]: quotactl.c Log Message: Fix pointers if realloc return a different memory area. To generate a diff of this commit: cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/usr.sbin/quotactl/quotactl.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [bouyer-quota2] src/tests/fs/ffs
Module Name:src Committed By: bouyer Date: Fri Feb 11 16:54:03 UTC 2011 Modified Files: src/tests/fs/ffs [bouyer-quota2]: Makefile t_getquota.sh Added Files: src/tests/fs/ffs [bouyer-quota2]: t_miscquota.sh Log Message: Add a test which cause the kernel to walk a quota list where all entries are not in the header disk block, and at last 2 of them are in the same non-header disk block. To generate a diff of this commit: cvs rdiff -u -r1.14.2.6 -r1.14.2.7 src/tests/fs/ffs/Makefile cvs rdiff -u -r1.1.2.7 -r1.1.2.8 src/tests/fs/ffs/t_getquota.sh cvs rdiff -u -r0 -r1.1.2.1 src/tests/fs/ffs/t_miscquota.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [bouyer-quota2] src/distrib/sets/lists/tests
Module Name:src Committed By: bouyer Date: Fri Feb 11 16:54:35 UTC 2011 Modified Files: src/distrib/sets/lists/tests [bouyer-quota2]: mi Log Message: +t_miscquota To generate a diff of this commit: cvs rdiff -u -r1.240.2.3 -r1.240.2.4 src/distrib/sets/lists/tests/mi Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [bouyer-quota2] src/sys/ufs/ufs
Module Name:src Committed By: bouyer Date: Fri Feb 11 16:55:35 UTC 2011 Modified Files: src/sys/ufs/ufs [bouyer-quota2]: ufs_quota2.c Log Message: walk_list: make sure we don't try to read the same quota disk block again without releasing it first To generate a diff of this commit: cvs rdiff -u -r1.1.2.13 -r1.1.2.14 src/sys/ufs/ufs/ufs_quota2.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [bouyer-quota2] src/tests/fs/ffs
Module Name:src Committed By: bouyer Date: Fri Feb 11 17:28:30 UTC 2011 Modified Files: src/tests/fs/ffs [bouyer-quota2]: t_miscquota.sh Log Message: This test requires root To generate a diff of this commit: cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/tests/fs/ffs/t_miscquota.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [bouyer-quota2] src/sys/ufs/ufs
Module Name:src Committed By: bouyer Date: Thu Feb 10 16:16:05 UTC 2011 Modified Files: src/sys/ufs/ufs [bouyer-quota2]: ufs_quota2.c Log Message: Unless the filestystem is mounted MNT_SYNCHRONOUS, use bdwrite() to write back updated quota entries. To generate a diff of this commit: cvs rdiff -u -r1.1.2.12 -r1.1.2.13 src/sys/ufs/ufs/ufs_quota2.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/ufs/ufs/ufs_quota2.c diff -u src/sys/ufs/ufs/ufs_quota2.c:1.1.2.12 src/sys/ufs/ufs/ufs_quota2.c:1.1.2.13 --- src/sys/ufs/ufs/ufs_quota2.c:1.1.2.12 Wed Feb 9 21:17:17 2011 +++ src/sys/ufs/ufs/ufs_quota2.c Thu Feb 10 16:16:05 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: ufs_quota2.c,v 1.1.2.12 2011/02/09 21:17:17 bouyer Exp $ */ +/* $NetBSD: ufs_quota2.c,v 1.1.2.13 2011/02/10 16:16:05 bouyer Exp $ */ /*- * Copyright (c) 2010 Manuel Bouyer * All rights reserved. @@ -28,7 +28,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: ufs_quota2.c,v 1.1.2.12 2011/02/09 21:17:17 bouyer Exp $); +__KERNEL_RCSID(0, $NetBSD: ufs_quota2.c,v 1.1.2.13 2011/02/10 16:16:05 bouyer Exp $); #include sys/buf.h #include sys/param.h @@ -63,6 +63,7 @@ * the locking order is dq_interlock - dqlock */ +static int quota2_bwrite(struct mount *, struct buf *); static int getinoquota2(struct inode *, int, struct buf **, struct quota2_entry **); static int getq2h(struct ufsmount *, int, struct buf **, @@ -77,6 +78,17 @@ static const char *valtypes[] = INITQLNAMES; static int +quota2_bwrite(struct mount *mp, struct buf *bp) +{ + if (mp-mnt_flag MNT_SYNCHRONOUS) + return bwrite(bp); + else { + bdwrite(bp); + return 0; + } +} + +static int getq2h(struct ufsmount *ump, int type, struct buf **bpp, struct quota2_header **q2hp, int flags) { @@ -170,12 +182,12 @@ /* callback changed parent's pointer, redo */ off = ufs_rw64(*offp, needswap); if (bp != hbp bp != obp) -ret2 = VOP_BWRITE(bp); +ret2 = bwrite(bp); } else { /* parent if now current */ if (obp != bp obp != hbp) { if (flags B_MODIFY) - ret2 = VOP_BWRITE(obp); + ret2 = bwrite(obp); else brelse(obp, 0); } @@ -192,7 +204,7 @@ } if (obp != hbp) { if (flags B_MODIFY) - ret2 = VOP_BWRITE(obp); + ret2 = bwrite(obp); else brelse(obp, 0); } @@ -263,7 +275,7 @@ uvm_vnp_setsize(vp, ip-i_size); quota2_addfreeq2e(q2h, bp-b_data, size, ump-umq2_bsize, needswap); - error = VOP_BWRITE(bp); + error = bwrite(bp); error2 = UFS_UPDATE(vp, NULL, NULL, UPDATE_WAIT); if (error || error2) { brelse(hbp, 0); @@ -297,7 +309,7 @@ q2e-q2e_next = q2h-q2h_entries[uid hash_mask]; q2h-q2h_entries[uid hash_mask] = ufs_rw64(offset, needswap); if (hbp != bp) { - VOP_BWRITE(hbp); + bwrite(hbp); } *q2ep = q2e; *bpp = bp; @@ -404,7 +416,7 @@ else ncurblks += change; q2vp-q2v_cur = ufs_rw64(ncurblks, needswap); - VOP_BWRITE(bp[i]); + quota2_bwrite(mp, bp[i]); mutex_exit(dq-dq_interlock); } return 0; @@ -479,7 +491,7 @@ q2vp = q2e[i]-q2e_val[vtype]; ncurblks = ufs_rw64(q2vp-q2v_cur, needswap); q2vp-q2v_cur = ufs_rw64(ncurblks + change, needswap); - VOP_BWRITE(bp[i]); + quota2_bwrite(mp, bp[i]); } else brelse(bp[i], 0); mutex_exit(dq-dq_interlock); @@ -532,7 +544,7 @@ } quota2_ufs_rwq2e(q2e, q2h-q2h_defentry, needswap); mutex_exit(dqlock); - VOP_BWRITE(bp); + quota2_bwrite(ump-um_mountp, bp); goto out_wapbl; } @@ -560,7 +572,7 @@ goto out_il; } quota2_ufs_rwq2e(q2e, q2ep, needswap); - VOP_BWRITE(bp); + quota2_bwrite(ump-um_mountp, bp); out_il: mutex_exit(dq-dq_interlock); @@ -660,7 +672,7 @@ q2e.q2e_val[i].q2v_grace; q2ep-q2e_val[i].q2v_time = 0; } - VOP_BWRITE(bp); + quota2_bwrite(ump-um_mountp, bp); goto out_wapbl; } /* we can free it. release bp so we can walk the list */ @@ -678,7 +690,7 @@ q2h-q2h_entries[id hash_mask], B_MODIFY, c, dq2clear_callback); - VOP_BWRITE(hbp); + bwrite(hbp); out_dqlock: mutex_exit(dqlock);
CVS commit: [bouyer-quota2] src/usr.sbin/repquota
Module Name:src Committed By: bouyer Date: Thu Feb 10 17:11:35 UTC 2011 Modified Files: src/usr.sbin/repquota [bouyer-quota2]: repquota.8 repquota.c Log Message: Add an option -x to export a filesystem quotas in a plist format, which can be feed to quotactl(8). This is the way to migrate limits from quota1 to quota2. To generate a diff of this commit: cvs rdiff -u -r1.9.50.1 -r1.9.50.2 src/usr.sbin/repquota/repquota.8 cvs rdiff -u -r1.25.2.6 -r1.25.2.7 src/usr.sbin/repquota/repquota.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/repquota/repquota.8 diff -u src/usr.sbin/repquota/repquota.8:1.9.50.1 src/usr.sbin/repquota/repquota.8:1.9.50.2 --- src/usr.sbin/repquota/repquota.8:1.9.50.1 Fri Jan 21 16:58:07 2011 +++ src/usr.sbin/repquota/repquota.8 Thu Feb 10 17:11:35 2011 @@ -29,9 +29,9 @@ .\ SUCH DAMAGE. .\ .\ from: @(#)repquota.8 8.1 (Berkeley) 6/6/93 -.\ $NetBSD: repquota.8,v 1.9.50.1 2011/01/21 16:58:07 bouyer Exp $ +.\ $NetBSD: repquota.8,v 1.9.50.2 2011/02/10 17:11:35 bouyer Exp $ .\ -.Dd January 21, 2011 +.Dd February 10, 2011 .Dt REPQUOTA 8 .Os .Sh NAME @@ -52,6 +52,12 @@ .Op Fl u .Op Fl v .Fl a +.Nm +.Fl x +.Op Fl D +.Op Fl g +.Op Fl u +.Ar filesystem .Sh DESCRIPTION .Nm prints a summary of the disk usage and quotas for the @@ -73,6 +79,10 @@ Debug: print plist sent to and received from kernel. .It Fl h Numbers are displayed in a human readable format. +.It Fl x +export filesystem quota in a plist format suitable for +.Xr quotactl 8 . +A single filesystem should be specified. .El .Pp For each user or group, the current @@ -83,14 +93,13 @@ .Xr edquota 8 . .Pp Only the super-user may use this command. -.Sh DIAGNOSTICS -Various messages about inaccessible files; self-explanatory. .Sh SEE ALSO .Xr quota 1 , .Xr quotactl 2 , .Xr fstab 5 , .Xr edquota 8 , .Xr quotacheck 8 , +.Xr quotactl 8 , .Xr quotaon 8 .Sh HISTORY The Index: src/usr.sbin/repquota/repquota.c diff -u src/usr.sbin/repquota/repquota.c:1.25.2.6 src/usr.sbin/repquota/repquota.c:1.25.2.7 --- src/usr.sbin/repquota/repquota.c:1.25.2.6 Thu Feb 3 15:56:16 2011 +++ src/usr.sbin/repquota/repquota.c Thu Feb 10 17:11:35 2011 @@ -40,7 +40,7 @@ #if 0 static char sccsid[] = @(#)repquota.c 8.2 (Berkeley) 11/22/94; #else -__RCSID($NetBSD: repquota.c,v 1.25.2.6 2011/02/03 15:56:16 bouyer Exp $); +__RCSID($NetBSD: repquota.c,v 1.25.2.7 2011/02/10 17:11:35 bouyer Exp $); #endif #endif /* not lint */ @@ -82,12 +82,15 @@ #define FUHASH 1024 /* must be power of two */ struct fileusage *fuhead[MAXQUOTAS][FUHASH]; u_long highid[MAXQUOTAS]; /* highest addid()'ed identifier per type */ +int valid[MAXQUOTAS]; struct quota2_entry defaultq2e[MAXQUOTAS]; int vflag = 0; /* verbose */ int aflag = 0; /* all file systems */ int Dflag = 0; /* debug */ -int hflag = 0; /* debug */ +int hflag = 0; /* humanize */ +int xflag = 0; /* export */ + struct fileusage *addid(u_long, int, const char *); int hasquota(struct fstab *, int, char **); @@ -99,6 +102,7 @@ int repquota1(const struct statvfs *, int); void usage(void); void printquotas(int, const struct statvfs *, int); +void exportquotas(void); void dqblk2q2e(const struct dqblk *, struct quota2_entry *); int @@ -114,7 +118,7 @@ struct statvfs *fst; int nfst; - while ((ch = getopt(argc, argv, Daguhv)) != -1) { + while ((ch = getopt(argc, argv, Daguhvx)) != -1) { switch(ch) { case 'a': aflag++; @@ -134,12 +138,17 @@ case 'D': Dflag++; break; + case 'x': + xflag++; + break; default: usage(); } } argc -= optind; argv += optind; + if (xflag argc != 1) + usage(); if (argc == 0 !aflag) usage(); if (!gflag !uflag) { @@ -184,6 +193,8 @@ errs += repquota(fst[i], USRQUOTA); } } + if (xflag) + exportquotas(); for (i = 0; i argc; i++) if ((done (1 i)) == 0) fprintf(stderr, %s not mounted\n, argv[i]); @@ -193,9 +204,10 @@ void usage() { - fprintf(stderr, usage:\n\t%s\n\t%s\n, - repquota [-D] [-v] [-g] [-u] -a, - repquota [-D] [-v] [-g] [-u] filesys ...); + fprintf(stderr, usage:\n + \trepquota [-D] [-v] [-g] [-u] -a\n + \trepquota [-D] [-v] [-g] [-u] filesys ...\n + \trepquota -x [-D] [-g] [-u] filesys\n); exit(1); } @@ -293,6 +305,7 @@ if (dataiter == NULL) err(1, prop_array_iterator); + valid[type] = 1; while ((data = prop_object_iterator_next(dataiter)) != NULL) { strid = NULL; if (!prop_dictionary_get_uint32(data, id, id)) { @@ -322,7 +335,8 @@ } prop_object_iterator_release(cmditer); prop_object_release(dict); - printquotas(type, vfs, version); + if (xflag == 0) + printquotas(type, vfs, version); return (0); } @@ -334,16 +348,8 @@ FILE *qf; u_long id; struct dqblk dqbuf; + time_t bgrace = MAX_DQ_TIME, igrace = MAX_DQ_TIME; -#if 0 - static int warned = 0; - if (quotactl(fs-fs_file, QCMD(Q_SYNC, type), 0,
CVS commit: [bouyer-quota2] src/sys/ufs/ufs
Module Name:src Committed By: bouyer Date: Thu Feb 10 16:16:05 UTC 2011 Modified Files: src/sys/ufs/ufs [bouyer-quota2]: ufs_quota2.c Log Message: Unless the filestystem is mounted MNT_SYNCHRONOUS, use bdwrite() to write back updated quota entries. To generate a diff of this commit: cvs rdiff -u -r1.1.2.12 -r1.1.2.13 src/sys/ufs/ufs/ufs_quota2.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [bouyer-quota2] src/usr.sbin/repquota
Module Name:src Committed By: bouyer Date: Thu Feb 10 17:11:35 UTC 2011 Modified Files: src/usr.sbin/repquota [bouyer-quota2]: repquota.8 repquota.c Log Message: Add an option -x to export a filesystem quotas in a plist format, which can be feed to quotactl(8). This is the way to migrate limits from quota1 to quota2. To generate a diff of this commit: cvs rdiff -u -r1.9.50.1 -r1.9.50.2 src/usr.sbin/repquota/repquota.8 cvs rdiff -u -r1.25.2.6 -r1.25.2.7 src/usr.sbin/repquota/repquota.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [bouyer-quota2] src/usr.sbin/quotacheck
Module Name:src Committed By: bouyer Date: Wed Feb 9 09:51:17 UTC 2011 Modified Files: src/usr.sbin/quotacheck [bouyer-quota2]: quotacheck.c Log Message: Make it build in new world. Don't attempt to update in-kernel quota, but instead warn if quotas are already on. The rc.d script runs quotacheck before quotaon so this shouldn't be a problem. To generate a diff of this commit: cvs rdiff -u -r1.40 -r1.40.14.1 src/usr.sbin/quotacheck/quotacheck.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/quotacheck/quotacheck.c diff -u src/usr.sbin/quotacheck/quotacheck.c:1.40 src/usr.sbin/quotacheck/quotacheck.c:1.40.14.1 --- src/usr.sbin/quotacheck/quotacheck.c:1.40 Thu Oct 9 14:56:35 2008 +++ src/usr.sbin/quotacheck/quotacheck.c Wed Feb 9 09:51:17 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: quotacheck.c,v 1.40 2008/10/09 14:56:35 christos Exp $ */ +/* $NetBSD: quotacheck.c,v 1.40.14.1 2011/02/09 09:51:17 bouyer Exp $ */ /* * Copyright (c) 1980, 1990, 1993 @@ -42,7 +42,7 @@ #if 0 static char sccsid[] = @(#)quotacheck.c 8.6 (Berkeley) 4/28/95; #else -__RCSID($NetBSD: quotacheck.c,v 1.40 2008/10/09 14:56:35 christos Exp $); +__RCSID($NetBSD: quotacheck.c,v 1.40.14.1 2011/02/09 09:51:17 bouyer Exp $); #endif #endif /* not lint */ @@ -52,9 +52,10 @@ #include sys/param.h #include sys/stat.h #include sys/queue.h +#include sys/statvfs.h #include ufs/ufs/dinode.h -#include ufs/ufs/quota.h +#include ufs/ufs/quota1.h #include ufs/ufs/ufs_bswap.h #include ufs/ffs/fs.h #include ufs/ffs/ffs_extern.h @@ -482,9 +483,25 @@ u_int32_t id, lastid, nextid; int need_seek; struct dqblk dqbuf; - static int warned = 0; static struct dqblk zerodqbuf; static struct fileusage zerofileusage; + struct statvfs *fst; + int nfst, i; + + nfst = getmntinfo(fst, MNT_WAIT); + if (nfst == 0) + errx(1, no filesystems mounted!); + + for (i = 0; i nfst; i++) { + if (strncmp(fst[i].f_fstypename, ffs, + sizeof(fst[i].f_fstypename)) == 0 + strncmp(fst[i].f_mntonname, fsname, + sizeof(fst[i].f_mntonname)) == 0 + (fst[i].f_flag ST_QUOTA) != 0) { + warnx(filesystem %s has quotas already turned on, + fsname); + } + } if ((qfo = fopen(quotafile, r+)) == NULL) { if (errno == ENOENT) @@ -507,12 +524,6 @@ (void) fclose(qfo); return (1); } - if (quotactl(fsname, QCMD(Q_SYNC, type), 0, (void *) NULL) 0 - errno == EOPNOTSUPP !warned vflag) { - warned++; - (void)printf(*** Warning: %s\n, - Quotas are not compiled into this kernel); - } need_seek = 1; for (lastid = highid[type], id = 0; id = lastid; id = nextid) { if (fread((char *)dqbuf, sizeof(struct dqblk), 1, qfi) == 0) @@ -577,10 +588,6 @@ } (void) fwrite((char *)dqbuf, sizeof(struct dqblk), 1, qfo); - if (!warned) - (void) quotactl(fsname, QCMD(Q_SETUSE, type), id, - (caddr_t)dqbuf); - fup-fu_curinodes = 0; fup-fu_curblocks = 0; if (id == UINT32_MAX || nextid == 0) { /* infinite loop avoidance (OR do as nextid id?) */
CVS commit: [bouyer-quota2] src/usr.sbin/quotaon
Module Name:src Committed By: bouyer Date: Wed Feb 9 10:21:02 UTC 2011 Modified Files: src/usr.sbin/quotaon [bouyer-quota2]: Makefile quotaon.c Log Message: Make it compile with new quotactl To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.5.64.1 src/usr.sbin/quotaon/Makefile cvs rdiff -u -r1.23 -r1.23.2.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/usr.sbin/quotaon/Makefile diff -u src/usr.sbin/quotaon/Makefile:1.5 src/usr.sbin/quotaon/Makefile:1.5.64.1 --- src/usr.sbin/quotaon/Makefile:1.5 Sat Oct 18 04:37:55 1997 +++ src/usr.sbin/quotaon/Makefile Wed Feb 9 10:21:02 2011 @@ -1,9 +1,18 @@ # from: @(#)Makefile 8.1 (Berkeley) 6/6/93 -# $NetBSD: Makefile,v 1.5 1997/10/18 04:37:55 lukem Exp $ +# $NetBSD: Makefile,v 1.5.64.1 2011/02/09 10:21:02 bouyer Exp $ +.include bsd.own.mk PROG= quotaon +SRCS= quotaon.c MAN= quotaon.8 MLINKS= quotaon.8 quotaoff.8 LINKS= ${BINDIR}/quotaon ${BINDIR}/quotaoff +CPPFLAGS+=-I${NETBSDSRCDIR}/sys +DPADD= ${LIBPROP} +LDADD= -lprop + +.PATH: ${NETBSDSRCDIR}/sys/ufs/ufs +SRCS+= quota2_prop.c + .include bsd.prog.mk Index: src/usr.sbin/quotaon/quotaon.c diff -u src/usr.sbin/quotaon/quotaon.c:1.23 src/usr.sbin/quotaon/quotaon.c:1.23.2.1 --- src/usr.sbin/quotaon/quotaon.c:1.23 Sat Apr 18 08:20:41 2009 +++ src/usr.sbin/quotaon/quotaon.c Wed Feb 9 10:21:02 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: quotaon.c,v 1.23 2009/04/18 08:20:41 lukem Exp $ */ +/* $NetBSD: quotaon.c,v 1.23.2.1 2011/02/09 10:21:02 bouyer 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.23 2009/04/18 08:20:41 lukem Exp $); +__RCSID($NetBSD: quotaon.c,v 1.23.2.1 2011/02/09 10:21:02 bouyer Exp $); #endif #endif /* not lint */ @@ -52,7 +52,11 @@ #include sys/param.h #include sys/file.h #include sys/mount.h -#include ufs/ufs/quota.h + +#include ufs/ufs/quota2_prop.h +#include ufs/ufs/quota1.h +#include sys/quota.h + #include err.h #include fstab.h @@ -168,27 +172,78 @@ int offmode, type; char *qfpathname; { + const char *mode = (offmode == 1) ? off : on; + prop_dictionary_t dict, data, cmd; + prop_array_t cmds, datas; + struct plistref pref; + int error; + int8_t error8; + + dict = quota2_prop_create(); + cmds = prop_array_create(); + datas = prop_array_create(); if (strcmp(fs-fs_file, /) readonly(fs)) return (1); + + if (dict == NULL || cmds == NULL || datas == NULL) + errx(1, can't allocate proplist); + if (offmode) { - if (quotactl(fs-fs_file, QCMD(Q_QUOTAOFF, type), 0, 0) 0) { - warn(%s, fs-fs_file); - return (1); - } - if (vflag) - printf(%s: %s quotas turned off\n, - fs-fs_file, qfextension[type]); - return (0); + if (!quota2_prop_add_command(cmds, quotaoff, + qfextension[type], datas)) + err(1, prop_add_command); + } else { + data = prop_dictionary_create(); + if (data == NULL) + errx(1, can't allocate proplist); + if (!prop_dictionary_set_cstring(data, quotafile, + qfpathname)) + err(1, prop_dictionary_set(quotafile)); + if (!prop_array_add_and_rel(datas, data)) + err(1, prop_array_add(data)); + if (!quota2_prop_add_command(cmds, quotaon, + qfextension[type], datas)) + err(1, prop_add_command); } - if (quotactl(fs-fs_file, QCMD(Q_QUOTAON, type), 0, qfpathname) 0) { - warn(%s quotas using %s on %s, - qfextension[type], qfpathname, fs-fs_file); - return (1); + if (!prop_dictionary_set(dict, commands, cmds)) + err(1, prop_dictionary_set(command)); + + if (!prop_dictionary_send_syscall(dict, pref)) + err(1, prop_dictionary_send_syscall); + prop_object_release(dict); + + if (quotactl(fs-fs_file, pref) != 0) { + warn(quotactl(%s), fs-fs_file); + return(1); + } + + if ((error = prop_dictionary_recv_syscall(pref, dict)) != 0) { + errx(1, prop_dictionary_recv_syscall: %s\n, + strerror(error)); + } + + if ((error = quota2_get_cmds(dict, cmds)) != 0) { + errx(1, quota2_get_cmds: %s\n, strerror(error)); + } + /* only one command, no need to iter */ + cmd = prop_array_get(cmds, 0); + if (cmd == NULL) + err(1, prop_array_get(cmd)); + + if (!prop_dictionary_get_int8(cmd, return, error8)) + err(1, prop_get(return)); + + if (error8) { + warnx(quota%s for %s: %s, mode, fs-fs_file, + strerror(error8)); + return 1; + } + + if (vflag) { + printf(%s: %s quotas turned %s\n, + fs-fs_file, qfextension[type], mode); } - if (vflag) - printf(%s: %s quotas turned on\n, fs-fs_file, - qfextension[type]); return (0); }
CVS commit: [bouyer-quota2] src/usr.bin/quota
Module Name:src Committed By: bouyer Date: Wed Feb 9 10:21:36 UTC 2011 Modified Files: src/usr.bin/quota [bouyer-quota2]: getvfsquota.c Log Message: Use prop_array_add_and_rel() To generate a diff of this commit: cvs rdiff -u -r1.1.2.2 -r1.1.2.3 src/usr.bin/quota/getvfsquota.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/quota/getvfsquota.c diff -u src/usr.bin/quota/getvfsquota.c:1.1.2.2 src/usr.bin/quota/getvfsquota.c:1.1.2.3 --- src/usr.bin/quota/getvfsquota.c:1.1.2.2 Sun Jan 30 19:38:45 2011 +++ src/usr.bin/quota/getvfsquota.c Wed Feb 9 10:21:36 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: getvfsquota.c,v 1.1.2.2 2011/01/30 19:38:45 bouyer Exp $ */ +/* $NetBSD: getvfsquota.c,v 1.1.2.3 2011/02/09 10:21:36 bouyer Exp $ */ /*- * Copyright (c) 2011 Manuel Bouyer @@ -29,7 +29,7 @@ */ #include sys/cdefs.h -__RCSID($NetBSD: getvfsquota.c,v 1.1.2.2 2011/01/30 19:38:45 bouyer Exp $); +__RCSID($NetBSD: getvfsquota.c,v 1.1.2.3 2011/02/09 10:21:36 bouyer Exp $); #include stdio.h #include stdlib.h @@ -75,9 +75,8 @@ if (!ret) err(1, prop_dictionary_set(id)); - if (!prop_array_add(datas, data)) + if (!prop_array_add_and_rel(datas, data)) err(1, prop_array_add(data)); - prop_object_release(data); if (!quota2_prop_add_command(cmds, get, qfextension[type], datas)) err(1, prop_add_command); if (!quota2_prop_add_command(cmds, get version, qfextension[type],
CVS commit: [bouyer-quota2] src
Module Name:src Committed By: bouyer Date: Wed Feb 9 10:51:03 UTC 2011 Modified Files: src/distrib/sets/lists/tests [bouyer-quota2]: mi src/etc/mtree [bouyer-quota2]: NetBSD.dist.tests Log Message: Add quota tests To generate a diff of this commit: cvs rdiff -u -r1.240.2.1 -r1.240.2.2 src/distrib/sets/lists/tests/mi cvs rdiff -u -r1.23.2.2 -r1.23.2.3 src/etc/mtree/NetBSD.dist.tests Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/sets/lists/tests/mi diff -u src/distrib/sets/lists/tests/mi:1.240.2.1 src/distrib/sets/lists/tests/mi:1.240.2.2 --- src/distrib/sets/lists/tests/mi:1.240.2.1 Tue Feb 8 16:18:39 2011 +++ src/distrib/sets/lists/tests/mi Wed Feb 9 10:51:03 2011 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.240.2.1 2011/02/08 16:18:39 bouyer Exp $ +# $NetBSD: mi,v 1.240.2.2 2011/02/09 10:51:03 bouyer Exp $ # # Note: don't delete entries from here - mark them as obsolete instead. # @@ -1171,12 +1171,23 @@ ./usr/tests/fs/h_funcs.subr tests-fs-tests atf ./usr/tests/fs/ffstests-fs-tests ./usr/tests/fs/ffs/Atffile tests-fs-tests atf +./usr/tests/fs/ffs/h_quota2_server tests-fs-tests atf +./usr/tests/fs/ffs/h_quota2_tests tests-fs-tests atf +./usr/tests/fs/ffs/rump_edquota tests-fs-tests atf +./usr/tests/fs/ffs/rump_quota tests-fs-tests atf +./usr/tests/fs/ffs/rump_quotactl tests-fs-tests atf +./usr/tests/fs/ffs/rump_repquota tests-fs-tests atf ./usr/tests/fs/ffs/t_fifos tests-fs-tests atf ./usr/tests/fs/ffs/t_mount tests-fs-tests atf ./usr/tests/fs/ffs/t_renamerace tests-obsolete obsolete ./usr/tests/fs/ffs/t_snapshot tests-fs-tests atf -./usr/tests/fs/ffs/t_snapshot_log tests-fs-tests atf -./usr/tests/fs/ffs/t_snapshot_v2 tests-fs-tests atf +./usr/tests/fs/ffs/t_snapshot_log tests-fs-tests atf +./usr/tests/fs/ffs/t_snapshot_v2 tests-fs-tests atf +./usr/tests/fs/ffs/t_clearquota tests-fs-tests atf +./usr/tests/fs/ffs/t_getquota tests-fs-tests atf +./usr/tests/fs/ffs/t_quota2_1 tests-fs-tests atf +./usr/tests/fs/ffs/t_quotalimit tests-fs-tests atf +./usr/tests/fs/ffs/t_setquota tests-fs-tests atf ./usr/tests/fs/kernfstests-fs-tests ./usr/tests/fs/kernfs/Atffile tests-fs-tests atf ./usr/tests/fs/kernfs/t_basic tests-fs-tests atf @@ -1981,6 +1992,13 @@ ./usr/tests/rump/rumpvfs/t_p2kifs tests-rump-tests atf ./usr/tests/sbintests-sbin-tests ./usr/tests/sbin/Atffile tests-sbin-tests atf +./usr/tests/sbin/fsck_ffs tests-sbin-tests +./usr/tests/sbin/fsck_ffs/Atffile tests-sbin-tests atf +./usr/tests/sbin/fsck_ffs/t_check_quotas tests-sbin-tests atf +./usr/tests/sbin/fsck_ffs/t_enable_quotas tests-sbin-tests atf +./usr/tests/sbin/newfstests-sbin-tests +./usr/tests/sbin/newfs/Atffile tests-sbin-tests atf +./usr/tests/sbin/newfs/t_enable_quotas tests-sbin-tests atf ./usr/tests/sbin/resize_ffs tests-sbin-tests ./usr/tests/sbin/resize_ffs/Atffile tests-sbin-tests atf ./usr/tests/sbin/resize_ffs/t_grow tests-sbin-tests atf Index: src/etc/mtree/NetBSD.dist.tests diff -u src/etc/mtree/NetBSD.dist.tests:1.23.2.2 src/etc/mtree/NetBSD.dist.tests:1.23.2.3 --- src/etc/mtree/NetBSD.dist.tests:1.23.2.2 Tue Feb 8 16:18:50 2011 +++ src/etc/mtree/NetBSD.dist.tests Wed Feb 9 10:51:03 2011 @@ -1,4 +1,4 @@ -# $NetBSD: NetBSD.dist.tests,v 1.23.2.2 2011/02/08 16:18:50 bouyer Exp $ +# $NetBSD: NetBSD.dist.tests,v 1.23.2.3 2011/02/09 10:51:03 bouyer Exp $ ./usr/libdata/debug/usr/tests ./usr/libdata/debug/usr/tests/atf @@ -210,6 +210,7 @@ ./usr/tests/rump/rumpvfs ./usr/tests/sbin ./usr/tests/sbin/fsck_ffs +./usr/tests/sbin/newfs ./usr/tests/sbin/resize_ffs ./usr/tests/sys ./usr/tests/sys/rc
CVS commit: [bouyer-quota2] src/distrib/sets/lists/base
Module Name:src Committed By: bouyer Date: Wed Feb 9 10:55:13 UTC 2011 Modified Files: src/distrib/sets/lists/base [bouyer-quota2]: shl.mi Log Message: Sync with HEAD To generate a diff of this commit: cvs rdiff -u -r1.569.2.1 -r1.569.2.2 src/distrib/sets/lists/base/shl.mi Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/sets/lists/base/shl.mi diff -u src/distrib/sets/lists/base/shl.mi:1.569.2.1 src/distrib/sets/lists/base/shl.mi:1.569.2.2 --- src/distrib/sets/lists/base/shl.mi:1.569.2.1 Tue Feb 8 16:18:36 2011 +++ src/distrib/sets/lists/base/shl.mi Wed Feb 9 10:55:13 2011 @@ -1,4 +1,4 @@ -# $NetBSD: shl.mi,v 1.569.2.1 2011/02/08 16:18:36 bouyer Exp $ +# $NetBSD: shl.mi,v 1.569.2.2 2011/02/09 10:55:13 bouyer Exp $ # # Note: Don't delete entries from here - mark them as obsolete instead, # unless otherwise stated below. @@ -25,9 +25,6 @@ ./lib/libdevmapper.sobase-lvm-shlib lvm,dynamicroot ./lib/libdevmapper.so.1base-lvm-shlib lvm,dynamicroot ./lib/libdevmapper.so.1.0 base-lvm-shlib lvm,dynamicroot -./lib/libdm.so base-sys-shlib dynamicroot -./lib/libdm.so.0base-sys-shlib dynamicroot -./lib/libdm.so.0.0base-sys-shlib dynamicroot ./lib/libedit.sobase-sys-shlib dynamicroot ./lib/libedit.so.3base-sys-shlib dynamicroot ./lib/libedit.so.3.0base-sys-shlib dynamicroot
CVS commit: [bouyer-quota2] src/sys/arch/x86
Module Name:src Committed By: bouyer Date: Wed Feb 9 11:00:08 UTC 2011 Modified Files: src/sys/arch/x86/include [bouyer-quota2]: genfb_machdep.h src/sys/arch/x86/x86 [bouyer-quota2]: genfb_machdep.c Log Message: Sync with HEAD To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.1.14.1 src/sys/arch/x86/include/genfb_machdep.h cvs rdiff -u -r1.4.4.1 -r1.4.4.2 src/sys/arch/x86/x86/genfb_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x86/include/genfb_machdep.h diff -u src/sys/arch/x86/include/genfb_machdep.h:1.1 src/sys/arch/x86/include/genfb_machdep.h:1.1.14.1 --- src/sys/arch/x86/include/genfb_machdep.h:1.1 Tue Feb 17 01:42:52 2009 +++ src/sys/arch/x86/include/genfb_machdep.h Wed Feb 9 11:00:07 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: genfb_machdep.h,v 1.1 2009/02/17 01:42:52 jmcneill Exp $ */ +/* $NetBSD: genfb_machdep.h,v 1.1.14.1 2011/02/09 11:00:07 bouyer Exp $ */ /*- * Copyright (c) 2009 Jared D. McNeill jmcne...@invisible.ca @@ -30,5 +30,6 @@ #define _X86_GENFB_MACHDEP_H int x86_genfb_cnattach(void); +void x86_genfb_mtrr_init(uint64_t, uint32_t); #endif /* !_X86_GENFB_MACHDEP_H */ Index: src/sys/arch/x86/x86/genfb_machdep.c diff -u src/sys/arch/x86/x86/genfb_machdep.c:1.4.4.1 src/sys/arch/x86/x86/genfb_machdep.c:1.4.4.2 --- src/sys/arch/x86/x86/genfb_machdep.c:1.4.4.1 Tue Feb 8 16:19:45 2011 +++ src/sys/arch/x86/x86/genfb_machdep.c Wed Feb 9 11:00:08 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: genfb_machdep.c,v 1.4.4.1 2011/02/08 16:19:45 bouyer Exp $ */ +/* $NetBSD: genfb_machdep.c,v 1.4.4.2 2011/02/09 11:00:08 bouyer Exp $ */ /*- * Copyright (c) 2009 Jared D. McNeill jmcne...@invisible.ca @@ -31,7 +31,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: genfb_machdep.c,v 1.4.4.1 2011/02/08 16:19:45 bouyer Exp $); +__KERNEL_RCSID(0, $NetBSD: genfb_machdep.c,v 1.4.4.2 2011/02/09 11:00:08 bouyer Exp $); #include opt_mtrr.h @@ -92,7 +92,7 @@ mtrr.flags = MTRR_VALID; mtrr.owner = 0; - aprint_debug(%s: 0x%llx-0x%llx\n, __func__, + aprint_debug(%s: 0x% PRIx64 -0x% PRIx64 \n, __func__, mtrr.base, mtrr.base + mtrr.len - 1); n = 1;
CVS commit: [bouyer-quota2] src/sys/ufs
Module Name:src Committed By: bouyer Date: Wed Feb 9 11:18:30 UTC 2011 Modified Files: src/sys/ufs [bouyer-quota2]: files.ufs src/sys/ufs/lfs [bouyer-quota2]: lfs_vfsops.c src/sys/ufs/ufs [bouyer-quota2]: quota.h quota1.h ufs_quota.c ufs_quota.h ufs_quota2.c Log Message: Various build fixes To generate a diff of this commit: cvs rdiff -u -r1.24.6.1 -r1.24.6.2 src/sys/ufs/files.ufs cvs rdiff -u -r1.287 -r1.287.4.1 src/sys/ufs/lfs/lfs_vfsops.c cvs rdiff -u -r1.25.64.2 -r1.25.64.3 src/sys/ufs/ufs/quota.h cvs rdiff -u -r1.1.2.2 -r1.1.2.3 src/sys/ufs/ufs/quota1.h cvs rdiff -u -r1.68.4.9 -r1.68.4.10 src/sys/ufs/ufs/ufs_quota.c cvs rdiff -u -r1.1.2.7 -r1.1.2.8 src/sys/ufs/ufs/ufs_quota.h cvs rdiff -u -r1.1.2.10 -r1.1.2.11 src/sys/ufs/ufs/ufs_quota2.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/ufs/files.ufs diff -u src/sys/ufs/files.ufs:1.24.6.1 src/sys/ufs/files.ufs:1.24.6.2 --- src/sys/ufs/files.ufs:1.24.6.1 Thu Jan 20 14:25:01 2011 +++ src/sys/ufs/files.ufs Wed Feb 9 11:18:29 2011 @@ -1,4 +1,4 @@ -# $NetBSD: files.ufs,v 1.24.6.1 2011/01/20 14:25:01 bouyer Exp $ +# $NetBSD: files.ufs,v 1.24.6.2 2011/02/09 11:18:29 bouyer Exp $ deffs FFS deffs EXT2FS @@ -63,6 +63,7 @@ file ufs/ufs/ufs_quota1.c quota (ffs | lfs | mfs | ext2fs) file ufs/ufs/ufs_quota2.c quota2 (ffs | lfs | mfs | ext2fs) file ufs/ufs/quota2_subr.c quota2 (ffs | lfs | mfs | ext2fs) +file ufs/ufs/quota2_prop.c (quota | quota2) (ffs | lfs | mfs | ext2fs) file ufs/ufs/ufs_vfsops.c ffs | lfs | mfs | ext2fs file ufs/ufs/ufs_vnops.c ffs | lfs | mfs | ext2fs file ufs/ufs/ufs_wapbl.c ffs wapbl Index: src/sys/ufs/lfs/lfs_vfsops.c diff -u src/sys/ufs/lfs/lfs_vfsops.c:1.287 src/sys/ufs/lfs/lfs_vfsops.c:1.287.4.1 --- src/sys/ufs/lfs/lfs_vfsops.c:1.287 Thu Jun 24 13:03:19 2010 +++ src/sys/ufs/lfs/lfs_vfsops.c Wed Feb 9 11:18:29 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: lfs_vfsops.c,v 1.287 2010/06/24 13:03:19 hannken Exp $ */ +/* $NetBSD: lfs_vfsops.c,v 1.287.4.1 2011/02/09 11:18:29 bouyer Exp $ */ /*- * Copyright (c) 1999, 2000, 2001, 2002, 2003, 2007, 2007 @@ -61,7 +61,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: lfs_vfsops.c,v 1.287 2010/06/24 13:03:19 hannken Exp $); +__KERNEL_RCSID(0, $NetBSD: lfs_vfsops.c,v 1.287.4.1 2011/02/09 11:18:29 bouyer Exp $); #if defined(_KERNEL_OPT) #include opt_lfs.h @@ -1123,21 +1123,8 @@ mutex_exit(lfs_lock); #ifdef QUOTA - if (mp-mnt_flag MNT_QUOTA) { - int i; - error = vflush(mp, fs-lfs_ivnode, SKIPSYSTEM|flags); - if (error) - return (error); - for (i = 0; i MAXQUOTAS; i++) { - if (ump-um_quotas[i] == NULLVP) -continue; - quotaoff(l, mp, i); - } - /* - * Here we fall through to vflush again to ensure - * that we have gotten rid of all the system vnodes. - */ - } +if ((error = quota1_umount(mp, flags)) != 0) + return (error); #endif if ((error = vflush(mp, fs-lfs_ivnode, flags)) != 0) return (error); Index: src/sys/ufs/ufs/quota.h diff -u src/sys/ufs/ufs/quota.h:1.25.64.2 src/sys/ufs/ufs/quota.h:1.25.64.3 --- src/sys/ufs/ufs/quota.h:1.25.64.2 Mon Jan 31 15:19:21 2011 +++ src/sys/ufs/ufs/quota.h Wed Feb 9 11:18:29 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: quota.h,v 1.25.64.2 2011/01/31 15:19:21 bouyer Exp $ */ +/* $NetBSD: quota.h,v 1.25.64.3 2011/02/09 11:18:29 bouyer Exp $ */ /* * Copyright (c) 1982, 1986, 1993 @@ -59,7 +59,6 @@ #define INITQFNAMES { \ user, /* USRQUOTA */ \ group, /* GRPQUOTA */ \ - undefined, \ } /* definition of limits types for each quota */ Index: src/sys/ufs/ufs/quota1.h diff -u src/sys/ufs/ufs/quota1.h:1.1.2.2 src/sys/ufs/ufs/quota1.h:1.1.2.3 --- src/sys/ufs/ufs/quota1.h:1.1.2.2 Fri Jan 28 23:31:16 2011 +++ src/sys/ufs/ufs/quota1.h Wed Feb 9 11:18:30 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: quota1.h,v 1.1.2.2 2011/01/28 23:31:16 bouyer Exp $ */ +/* $NetBSD: quota1.h,v 1.1.2.3 2011/02/09 11:18:30 bouyer Exp $ */ /* * Copyright (c) 1982, 1986, 1993 @@ -93,6 +93,7 @@ }; /* quota1_subr.c */ +struct quota2_entry; void dqblk2q2e(const struct dqblk *, struct quota2_entry *); void q2e2dqblk(const struct quota2_entry *, struct dqblk *); Index: src/sys/ufs/ufs/ufs_quota.c diff -u src/sys/ufs/ufs/ufs_quota.c:1.68.4.9 src/sys/ufs/ufs/ufs_quota.c:1.68.4.10 --- src/sys/ufs/ufs/ufs_quota.c:1.68.4.9 Tue Feb 8 20:00:53 2011 +++ src/sys/ufs/ufs/ufs_quota.c Wed Feb 9 11:18:30 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: ufs_quota.c,v 1.68.4.9 2011/02/08 20:00:53 bouyer Exp $ */ +/* $NetBSD: ufs_quota.c,v 1.68.4.10 2011/02/09 11:18:30 bouyer Exp $ */ /* * Copyright (c) 1982, 1986, 1990, 1993, 1995 @@ -35,7 +35,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: ufs_quota.c,v 1.68.4.9 2011/02/08 20:00:53 bouyer Exp $); +__KERNEL_RCSID(0, $NetBSD: ufs_quota.c,v 1.68.4.10 2011/02/09 11:18:30 bouyer Exp $); #if defined(_KERNEL_OPT) #include
CVS commit: [bouyer-quota2] src/sys/sys
Module Name:src Committed By: bouyer Date: Wed Feb 9 11:31:25 UTC 2011 Modified Files: src/sys/sys [bouyer-quota2]: quota.h Log Message: Kill duplicate definitions To generate a diff of this commit: cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/sys/sys/quota.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/sys/quota.h diff -u src/sys/sys/quota.h:1.1.2.1 src/sys/sys/quota.h:1.1.2.2 --- src/sys/sys/quota.h:1.1.2.1 Thu Jan 20 14:25:01 2011 +++ src/sys/sys/quota.h Wed Feb 9 11:31:25 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: quota.h,v 1.1.2.1 2011/01/20 14:25:01 bouyer Exp $ */ +/* $NetBSD: quota.h,v 1.1.2.2 2011/02/09 11:31:25 bouyer Exp $ */ /*- * Copyright (c) 2010 Manuel Bouyer * All rights reserved. @@ -30,23 +30,6 @@ #ifndef _SYS_QUOTA_H_ #define _SYS_QUOTA_H_ -/* - * quota types available in the system. We expect this to be shared - * by all filesystems. - */ -#define MAXQUOTAS 2 -#define USRQUOTA 0 /* element used for user quotas */ -#define GRPQUOTA 1 /* element used for group quotas */ - -/* - * Definitions for the default names for types above - */ -#define INITQFNAMES { \ - user, /* USRQUOTA */ \ - group, /* GRPQUOTA */ \ - undefined, \ -} - #ifndef _KERNEL __BEGIN_DECLS int quotactl(const char *, struct plistref *) __RENAME(__quotactl50);
CVS commit: [bouyer-quota2] src/sys/ufs/ufs
Module Name:src Committed By: bouyer Date: Wed Feb 9 11:37:17 UTC 2011 Modified Files: src/sys/ufs/ufs [bouyer-quota2]: ufs_vfsops.c Log Message: Fix build without quotas To generate a diff of this commit: cvs rdiff -u -r1.40.8.1 -r1.40.8.2 src/sys/ufs/ufs/ufs_vfsops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/ufs/ufs/ufs_vfsops.c diff -u src/sys/ufs/ufs/ufs_vfsops.c:1.40.8.1 src/sys/ufs/ufs/ufs_vfsops.c:1.40.8.2 --- src/sys/ufs/ufs/ufs_vfsops.c:1.40.8.1 Thu Jan 20 14:25:03 2011 +++ src/sys/ufs/ufs/ufs_vfsops.c Wed Feb 9 11:37:16 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: ufs_vfsops.c,v 1.40.8.1 2011/01/20 14:25:03 bouyer Exp $ */ +/* $NetBSD: ufs_vfsops.c,v 1.40.8.2 2011/02/09 11:37:16 bouyer Exp $ */ /* * Copyright (c) 1991, 1993, 1994 @@ -37,7 +37,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: ufs_vfsops.c,v 1.40.8.1 2011/01/20 14:25:03 bouyer Exp $); +__KERNEL_RCSID(0, $NetBSD: ufs_vfsops.c,v 1.40.8.2 2011/02/09 11:37:16 bouyer Exp $); #if defined(_KERNEL_OPT) #include opt_ffs.h @@ -106,7 +106,7 @@ #if !defined(QUOTA) !defined(QUOTA2) (void) mp; - (void) pref; + (void) dict; (void) l; return (EOPNOTSUPP); #else
CVS commit: [bouyer-quota2] src/sys/ufs/ufs
Module Name:src Committed By: bouyer Date: Wed Feb 9 12:01:20 UTC 2011 Modified Files: src/sys/ufs/ufs [bouyer-quota2]: ufs_quota1.c Log Message: Fix typo To generate a diff of this commit: cvs rdiff -u -r1.1.2.3 -r1.1.2.4 src/sys/ufs/ufs/ufs_quota1.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/ufs/ufs/ufs_quota1.c diff -u src/sys/ufs/ufs/ufs_quota1.c:1.1.2.3 src/sys/ufs/ufs/ufs_quota1.c:1.1.2.4 --- src/sys/ufs/ufs/ufs_quota1.c:1.1.2.3 Tue Feb 8 20:00:53 2011 +++ src/sys/ufs/ufs/ufs_quota1.c Wed Feb 9 12:01:20 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: ufs_quota1.c,v 1.1.2.3 2011/02/08 20:00:53 bouyer Exp $ */ +/* $NetBSD: ufs_quota1.c,v 1.1.2.4 2011/02/09 12:01:20 bouyer 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.1.2.3 2011/02/08 20:00:53 bouyer Exp $); +__KERNEL_RCSID(0, $NetBSD: ufs_quota1.c,v 1.1.2.4 2011/02/09 12:01:20 bouyer Exp $); #include sys/param.h #include sys/kernel.h @@ -701,7 +701,7 @@ struct uio auio; int error; - KASSERT(mutex_locked(dq-dq_interlock)); + KASSERT(mutex_owned(dq-dq_interlock)); vn_lock(dqvp, LK_EXCLUSIVE | LK_RETRY); auio.uio_iov = aiov; auio.uio_iovcnt = 1;
CVS commit: [bouyer-quota2] src/sys/compat/netbsd32
Module Name:src Committed By: bouyer Date: Wed Feb 9 16:09:55 UTC 2011 Modified Files: src/sys/compat/netbsd32 [bouyer-quota2]: netbsd32_netbsd.c syscalls.master Log Message: Proper definitions for quotactl To generate a diff of this commit: cvs rdiff -u -r1.168.4.1 -r1.168.4.2 \ src/sys/compat/netbsd32/netbsd32_netbsd.c cvs rdiff -u -r1.84.6.1 -r1.84.6.2 src/sys/compat/netbsd32/syscalls.master Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/compat/netbsd32/netbsd32_netbsd.c diff -u src/sys/compat/netbsd32/netbsd32_netbsd.c:1.168.4.1 src/sys/compat/netbsd32/netbsd32_netbsd.c:1.168.4.2 --- src/sys/compat/netbsd32/netbsd32_netbsd.c:1.168.4.1 Thu Jan 20 14:24:55 2011 +++ src/sys/compat/netbsd32/netbsd32_netbsd.c Wed Feb 9 16:09:55 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: netbsd32_netbsd.c,v 1.168.4.1 2011/01/20 14:24:55 bouyer Exp $ */ +/* $NetBSD: netbsd32_netbsd.c,v 1.168.4.2 2011/02/09 16:09:55 bouyer Exp $ */ /* * Copyright (c) 1998, 2001, 2008 Matthew R. Green @@ -27,7 +27,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: netbsd32_netbsd.c,v 1.168.4.1 2011/01/20 14:24:55 bouyer Exp $); +__KERNEL_RCSID(0, $NetBSD: netbsd32_netbsd.c,v 1.168.4.2 2011/02/09 16:09:55 bouyer Exp $); #if defined(_KERNEL_OPT) #include opt_ddb.h @@ -1185,7 +1185,7 @@ } int -netbsd32_quotactl50(struct lwp *l, const struct netbsd32_quotactl_args *uap, register_t *retval) +compat_50_netbsd32_quotactl(struct lwp *l, const struct compat_50_netbsd32_quotactl_args *uap, register_t *retval) { /* { syscallarg(const netbsd32_charp) path; @@ -1193,23 +1193,23 @@ syscallarg(int) uid; syscallarg(netbsd32_voidp) arg; } */ - struct sys_quotactl_args ua; + struct compat_50_sys_quotactl_args ua; NETBSD32TOP_UAP(path, const char); NETBSD32TO64_UAP(cmd); NETBSD32TO64_UAP(uid); NETBSD32TOP_UAP(arg, void *); - return (sys_quotactl50(l, ua, retval)); + return (compat_50_sys_quotactl(l, ua, retval)); } int -netbsd32_quotactl(struct lwp *l, const struct netbsd32_quotactl_args *uap, register_t *retval) +netbsd32___quotactl50(struct lwp *l, const struct netbsd32___quotactl50_args *uap, register_t *retval) { /* { syscallarg(const netbsd32_charp) path; syscallarg(void *) v; } */ - struct sys_quotactl_args ua; + //struct sys___quotactl50_args ua; return EOPNOTSUPP; #if 0 Index: src/sys/compat/netbsd32/syscalls.master diff -u src/sys/compat/netbsd32/syscalls.master:1.84.6.1 src/sys/compat/netbsd32/syscalls.master:1.84.6.2 --- src/sys/compat/netbsd32/syscalls.master:1.84.6.1 Thu Jan 20 14:24:56 2011 +++ src/sys/compat/netbsd32/syscalls.master Wed Feb 9 16:09:55 2011 @@ -1,4 +1,4 @@ - $NetBSD: syscalls.master,v 1.84.6.1 2011/01/20 14:24:56 bouyer Exp $ + $NetBSD: syscalls.master,v 1.84.6.2 2011/02/09 16:09:55 bouyer Exp $ ; from: NetBSD: syscalls.master,v 1.81 1998/07/05 08:49:50 jonathan Exp ; @(#)syscalls.master 8.2 (Berkeley) 1/13/94 @@ -304,7 +304,7 @@ netbsd32_orlimitp_t rlp); } 146 COMPAT_43 { int|netbsd32||killpg(int pgid, int signum); } 147 NOARGS { int|sys||setsid(void); } -148 COMPAT_50 { int|netbsd32||quotactl50(netbsd32_charp path, int cmd, \ +148 COMPAT_50 { int|netbsd32||quotactl(netbsd32_charp path, int cmd, \ int uid, netbsd32_voidp arg); } 149 COMPAT_43 { int|sys||quota(void); } oquota 150 COMPAT_43 { int|netbsd32||ogetsockname(int fdec, \ @@ -969,5 +969,5 @@ mode_t mode, netbsd32_dev_t dev); } 451 STD { int|netbsd32|50|fhstat(const netbsd32_voidp fhp, \ netbsd32_size_t fh_size, netbsd32_statp_t sb); } -452 STD { int|sys||quotactl(const char *path, \ +452 STD { int|netbsd32|50|quotactl(const netbsd32_charp path, \ netbsd32_voidp pref); }
CVS commit: [bouyer-quota2] src/sys/compat/netbsd32
Module Name:src Committed By: bouyer Date: Wed Feb 9 16:10:19 UTC 2011 Modified Files: src/sys/compat/netbsd32 [bouyer-quota2]: netbsd32_syscall.h netbsd32_syscallargs.h netbsd32_syscalls.c netbsd32_sysent.c Log Message: Regen To generate a diff of this commit: cvs rdiff -u -r1.92.6.1 -r1.92.6.2 src/sys/compat/netbsd32/netbsd32_syscall.h \ src/sys/compat/netbsd32/netbsd32_syscallargs.h cvs rdiff -u -r1.91.6.1 -r1.91.6.2 \ src/sys/compat/netbsd32/netbsd32_syscalls.c \ src/sys/compat/netbsd32/netbsd32_sysent.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/compat/netbsd32/netbsd32_syscall.h diff -u src/sys/compat/netbsd32/netbsd32_syscall.h:1.92.6.1 src/sys/compat/netbsd32/netbsd32_syscall.h:1.92.6.2 --- src/sys/compat/netbsd32/netbsd32_syscall.h:1.92.6.1 Thu Jan 20 14:24:55 2011 +++ src/sys/compat/netbsd32/netbsd32_syscall.h Wed Feb 9 16:10:18 2011 @@ -1,10 +1,10 @@ -/* $NetBSD: netbsd32_syscall.h,v 1.92.6.1 2011/01/20 14:24:55 bouyer Exp $ */ +/* $NetBSD: netbsd32_syscall.h,v 1.92.6.2 2011/02/09 16:10:18 bouyer Exp $ */ /* * System call numbers. * * DO NOT EDIT-- this file is automatically generated. - * created from NetBSD: syscalls.master,v 1.84 2010/03/02 21:07:21 pooka Exp + * created from NetBSD: syscalls.master,v 1.84.6.2 2011/02/09 16:09:55 bouyer Exp */ #ifndef _NETBSD32_SYS_SYSCALL_H_ @@ -432,8 +432,8 @@ /* syscall: setsid ret: int args: */ #define NETBSD32_SYS_setsid 147 -/* syscall: compat_50_netbsd32_quotactl50 ret: int args: netbsd32_charp int int netbsd32_voidp */ -#define NETBSD32_SYS_compat_50_netbsd32_quotactl50 148 +/* syscall: compat_50_netbsd32_quotactl ret: int args: netbsd32_charp int int netbsd32_voidp */ +#define NETBSD32_SYS_compat_50_netbsd32_quotactl 148 /* syscall: compat_43_oquota ret: int args: */ #define NETBSD32_SYS_compat_43_oquota 149 @@ -1196,8 +1196,8 @@ /* syscall: netbsd32___fhstat50 ret: int args: const netbsd32_voidp netbsd32_size_t netbsd32_statp_t */ #define NETBSD32_SYS_netbsd32___fhstat50 451 -/* syscall: quotactl ret: int args: const char * netbsd32_voidp */ -#define NETBSD32_SYS_quotactl 452 +/* syscall: netbsd32___quotactl50 ret: int args: const netbsd32_charp netbsd32_voidp */ +#define NETBSD32_SYS_netbsd32___quotactl50 452 #define NETBSD32_SYS_MAXSYSCALL 453 #define NETBSD32_SYS_NSYSENT 512 Index: src/sys/compat/netbsd32/netbsd32_syscallargs.h diff -u src/sys/compat/netbsd32/netbsd32_syscallargs.h:1.92.6.1 src/sys/compat/netbsd32/netbsd32_syscallargs.h:1.92.6.2 --- src/sys/compat/netbsd32/netbsd32_syscallargs.h:1.92.6.1 Thu Jan 20 14:24:55 2011 +++ src/sys/compat/netbsd32/netbsd32_syscallargs.h Wed Feb 9 16:10:18 2011 @@ -1,10 +1,10 @@ -/* $NetBSD: netbsd32_syscallargs.h,v 1.92.6.1 2011/01/20 14:24:55 bouyer Exp $ */ +/* $NetBSD: netbsd32_syscallargs.h,v 1.92.6.2 2011/02/09 16:10:18 bouyer Exp $ */ /* * System call argument lists. * * DO NOT EDIT-- this file is automatically generated. - * created from NetBSD: syscalls.master,v 1.84 2010/03/02 21:07:21 pooka Exp + * created from NetBSD: syscalls.master,v 1.84.6.2 2011/02/09 16:09:55 bouyer Exp */ #ifndef _NETBSD32_SYS_SYSCALLARGS_H_ @@ -801,13 +801,13 @@ }; check_syscall_args(compat_43_netbsd32_killpg) -struct compat_50_netbsd32_quotactl50_args { +struct compat_50_netbsd32_quotactl_args { syscallarg(netbsd32_charp) path; syscallarg(int) cmd; syscallarg(int) uid; syscallarg(netbsd32_voidp) arg; }; -check_syscall_args(compat_50_netbsd32_quotactl50) +check_syscall_args(compat_50_netbsd32_quotactl) struct compat_43_netbsd32_ogetsockname_args { syscallarg(int) fdec; @@ -2303,11 +2303,11 @@ }; check_syscall_args(netbsd32___fhstat50) -struct sys_quotactl_args { - syscallarg(const char *) path; +struct netbsd32___quotactl50_args { + syscallarg(const netbsd32_charp) path; syscallarg(netbsd32_voidp) pref; }; -check_syscall_args(sys_quotactl) +check_syscall_args(netbsd32___quotactl50) /* * System call prototypes. @@ -2587,7 +2587,7 @@ int sys_setsid(struct lwp *, const void *, register_t *); -int compat_50_netbsd32_quotactl50(struct lwp *, const struct compat_50_netbsd32_quotactl50_args *, register_t *); +int compat_50_netbsd32_quotactl(struct lwp *, const struct compat_50_netbsd32_quotactl_args *, register_t *); int compat_43_sys_quota(struct lwp *, const void *, register_t *); @@ -3085,6 +3085,6 @@ int netbsd32___fhstat50(struct lwp *, const struct netbsd32___fhstat50_args *, register_t *); -int sys_quotactl(struct lwp *, const struct sys_quotactl_args *, register_t *); +int netbsd32___quotactl50(struct lwp *, const struct netbsd32___quotactl50_args *, register_t *); #endif /* _NETBSD32_SYS_SYSCALLARGS_H_ */ Index: src/sys/compat/netbsd32/netbsd32_syscalls.c diff -u src/sys/compat/netbsd32/netbsd32_syscalls.c:1.91.6.1 src/sys/compat/netbsd32/netbsd32_syscalls.c:1.91.6.2 ---
CVS commit: [bouyer-quota2] src/sys/ufs
Module Name:src Committed By: bouyer Date: Wed Feb 9 16:15:01 UTC 2011 Modified Files: src/sys/ufs [bouyer-quota2]: files.ufs src/sys/ufs/ufs [bouyer-quota2]: ufs_quota.c ufs_quota.h ufs_quota1.c Log Message: Reimplement quotactl commands for quota1 To generate a diff of this commit: cvs rdiff -u -r1.24.6.2 -r1.24.6.3 src/sys/ufs/files.ufs cvs rdiff -u -r1.68.4.10 -r1.68.4.11 src/sys/ufs/ufs/ufs_quota.c cvs rdiff -u -r1.1.2.8 -r1.1.2.9 src/sys/ufs/ufs/ufs_quota.h cvs rdiff -u -r1.1.2.4 -r1.1.2.5 src/sys/ufs/ufs/ufs_quota1.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/ufs/files.ufs diff -u src/sys/ufs/files.ufs:1.24.6.2 src/sys/ufs/files.ufs:1.24.6.3 --- src/sys/ufs/files.ufs:1.24.6.2 Wed Feb 9 11:18:29 2011 +++ src/sys/ufs/files.ufs Wed Feb 9 16:15:01 2011 @@ -1,4 +1,4 @@ -# $NetBSD: files.ufs,v 1.24.6.2 2011/02/09 11:18:29 bouyer Exp $ +# $NetBSD: files.ufs,v 1.24.6.3 2011/02/09 16:15:01 bouyer Exp $ deffs FFS deffs EXT2FS @@ -62,6 +62,7 @@ file ufs/ufs/ufs_quota.c (quota | quota2) (ffs | lfs | mfs | ext2fs) file ufs/ufs/ufs_quota1.c quota (ffs | lfs | mfs | ext2fs) file ufs/ufs/ufs_quota2.c quota2 (ffs | lfs | mfs | ext2fs) +file ufs/ufs/quota1_subr.c quota (ffs | lfs | mfs | ext2fs) file ufs/ufs/quota2_subr.c quota2 (ffs | lfs | mfs | ext2fs) file ufs/ufs/quota2_prop.c (quota | quota2) (ffs | lfs | mfs | ext2fs) file ufs/ufs/ufs_vfsops.c ffs | lfs | mfs | ext2fs Index: src/sys/ufs/ufs/ufs_quota.c diff -u src/sys/ufs/ufs/ufs_quota.c:1.68.4.10 src/sys/ufs/ufs/ufs_quota.c:1.68.4.11 --- src/sys/ufs/ufs/ufs_quota.c:1.68.4.10 Wed Feb 9 11:18:30 2011 +++ src/sys/ufs/ufs/ufs_quota.c Wed Feb 9 16:15:01 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: ufs_quota.c,v 1.68.4.10 2011/02/09 11:18:30 bouyer Exp $ */ +/* $NetBSD: ufs_quota.c,v 1.68.4.11 2011/02/09 16:15:01 bouyer Exp $ */ /* * Copyright (c) 1982, 1986, 1990, 1993, 1995 @@ -35,7 +35,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: ufs_quota.c,v 1.68.4.10 2011/02/09 11:18:30 bouyer Exp $); +__KERNEL_RCSID(0, $NetBSD: ufs_quota.c,v 1.68.4.11 2011/02/09 16:15:01 bouyer Exp $); #if defined(_KERNEL_OPT) #include opt_quota.h @@ -82,6 +82,10 @@ prop_dictionary_t, int, prop_array_t); static int quota_handle_cmd_clear(struct mount *, struct lwp *, prop_dictionary_t, int, prop_array_t); +static int quota_handle_cmd_quotaon(struct mount *, struct lwp *, +prop_dictionary_t, int, prop_array_t); +static int quota_handle_cmd_quotaoff(struct mount *, struct lwp *, +prop_dictionary_t, int, prop_array_t); /* * Initialize the quota fields of an inode. */ @@ -171,6 +175,16 @@ error = quota_handle_cmd_get_version(mp, l, cmddict, datas); goto end; } + if (strcmp(cmd, quotaon) == 0) { + error = quota_handle_cmd_quotaon(mp, l, cmddict, + q2type, datas); + goto end; + } + if (strcmp(cmd, quotaoff) == 0) { + error = quota_handle_cmd_quotaoff(mp, l, cmddict, + q2type, datas); + goto end; + } if (strcmp(cmd, get) == 0) { error = quota_handle_cmd_get(mp, l, cmddict, q2type, datas); goto end; @@ -487,6 +501,69 @@ return error; } +static int +quota_handle_cmd_quotaon(struct mount *mp, struct lwp *l, +prop_dictionary_t cmddict, int type, prop_array_t datas) +{ + prop_dictionary_t data; + struct ufsmount *ump = VFSTOUFS(mp); + int error; + const char *qfile; + + if ((ump-um_flags UFS_QUOTA2) != 0) + return EBUSY; + + if (prop_array_count(datas) != 1) + return EINVAL; + + data = prop_array_get(datas, 0); + if (data == NULL) + return ENOMEM; + if (!prop_dictionary_get_cstring_nocopy(data, quotafile, + qfile)) + return EINVAL; + + error = kauth_authorize_system(l-l_cred, KAUTH_SYSTEM_FS_QUOTA, + KAUTH_REQ_SYSTEM_FS_QUOTA_ONOFF, mp, NULL, NULL); + if (error != 0) { + return error; + } +#ifdef QUOTA + error = quota1_handle_cmd_quotaon(l, ump, type, qfile); +#else + error = EOPNOTSUPP; +#endif + + return error; +} + +static int +quota_handle_cmd_quotaoff(struct mount *mp, struct lwp *l, +prop_dictionary_t cmddict, int type, prop_array_t datas) +{ + struct ufsmount *ump = VFSTOUFS(mp); + int error; + + if ((ump-um_flags UFS_QUOTA2) != 0) + return EOPNOTSUPP; + + if (prop_array_count(datas) != 0) + return EINVAL; + + error = kauth_authorize_system(l-l_cred, KAUTH_SYSTEM_FS_QUOTA, + KAUTH_REQ_SYSTEM_FS_QUOTA_ONOFF, mp, NULL, NULL); + if (error != 0) { + return error; + } +#ifdef QUOTA + error = quota1_handle_cmd_quotaoff(l, ump, type); +#else + error = EOPNOTSUPP; +#endif + + return error; +} + /* * Initialize the quota system. */ Index: src/sys/ufs/ufs/ufs_quota.h diff -u src/sys/ufs/ufs/ufs_quota.h:1.1.2.8 src/sys/ufs/ufs/ufs_quota.h:1.1.2.9 --- src/sys/ufs/ufs/ufs_quota.h:1.1.2.8 Wed Feb 9 11:18:30 2011 +++ src/sys/ufs/ufs/ufs_quota.h Wed Feb 9 16:15:01 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: ufs_quota.h,v 1.1.2.8
CVS commit: [bouyer-quota2] src/sys/ufs/ufs
Module Name:src Committed By: bouyer Date: Wed Feb 9 17:43:53 UTC 2011 Modified Files: src/sys/ufs/ufs [bouyer-quota2]: ufs_quota1.c Log Message: Make it actually work. To generate a diff of this commit: cvs rdiff -u -r1.1.2.5 -r1.1.2.6 src/sys/ufs/ufs/ufs_quota1.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/ufs/ufs/ufs_quota1.c diff -u src/sys/ufs/ufs/ufs_quota1.c:1.1.2.5 src/sys/ufs/ufs/ufs_quota1.c:1.1.2.6 --- src/sys/ufs/ufs/ufs_quota1.c:1.1.2.5 Wed Feb 9 16:15:01 2011 +++ src/sys/ufs/ufs/ufs_quota1.c Wed Feb 9 17:43:53 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: ufs_quota1.c,v 1.1.2.5 2011/02/09 16:15:01 bouyer Exp $ */ +/* $NetBSD: ufs_quota1.c,v 1.1.2.6 2011/02/09 17:43:53 bouyer 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.1.2.5 2011/02/09 16:15:01 bouyer Exp $); +__KERNEL_RCSID(0, $NetBSD: ufs_quota1.c,v 1.1.2.6 2011/02/09 17:43:53 bouyer Exp $); #include sys/param.h #include sys/kernel.h @@ -325,9 +325,9 @@ vpp = ump-um_quotas[type]; - error = pathbuf_copyin(fname, pb); - if (error) { - return error; + pb = pathbuf_create(fname); + if (pb == NULL) { + return ENOMEM; } NDINIT(nd, LOOKUP, FOLLOW, pb); if ((error = vn_open(nd, FREAD|FWRITE, 0)) != 0) { @@ -518,8 +518,16 @@ dqblk2q2e(dq-dq_un.dq1_dqb, q2e); dqrele(NULLVP, dq); if (defaultq) { - q2e.q2e_val[QL_BLOCK].q2v_grace = q2e.q2e_val[QL_BLOCK].q2v_time; - q2e.q2e_val[QL_FILE].q2v_grace = q2e.q2e_val[QL_FILE].q2v_time; + if (q2e.q2e_val[QL_BLOCK].q2v_time 0) + q2e.q2e_val[QL_BLOCK].q2v_grace = + q2e.q2e_val[QL_BLOCK].q2v_time; + else + q2e.q2e_val[QL_BLOCK].q2v_grace = MAX_DQ_TIME; + if (q2e.q2e_val[QL_FILE].q2v_time 0) + q2e.q2e_val[QL_FILE].q2v_grace = + q2e.q2e_val[QL_FILE].q2v_time; + else + q2e.q2e_val[QL_FILE].q2v_grace = MAX_DQ_TIME; } dict = q2etoprop(q2e, defaultq); if (dict == NULL) @@ -550,10 +558,12 @@ if ((error = dqget(NULLVP, id, ump, type, dq)) != 0) return error; mutex_enter(dq-dq_interlock); - ump-umq1_btime[type] = dq-dq_btime = - q2e.q2e_val[QL_BLOCK].q2v_grace; - ump-umq1_itime[type] = dq-dq_itime = - q2e.q2e_val[QL_FILE].q2v_grace; + if (q2e.q2e_val[QL_BLOCK].q2v_grace 0) + ump-umq1_btime[type] = dq-dq_btime = + q2e.q2e_val[QL_BLOCK].q2v_grace; + if (q2e.q2e_val[QL_FILE].q2v_grace 0) + ump-umq1_itime[type] = dq-dq_itime = + q2e.q2e_val[QL_FILE].q2v_grace; mutex_exit(dq-dq_interlock); dq-dq_flags |= DQ_MOD; dqrele(NULLVP, dq);
CVS commit: [bouyer-quota2] src/usr.sbin/edquota
Module Name:src Committed By: bouyer Date: Wed Feb 9 17:48:45 UTC 2011 Modified Files: src/usr.sbin/edquota [bouyer-quota2]: edquota.c Log Message: Fix quota1 grace time format. To generate a diff of this commit: cvs rdiff -u -r1.29.16.10 -r1.29.16.11 src/usr.sbin/edquota/edquota.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/edquota/edquota.c diff -u src/usr.sbin/edquota/edquota.c:1.29.16.10 src/usr.sbin/edquota/edquota.c:1.29.16.11 --- src/usr.sbin/edquota/edquota.c:1.29.16.10 Mon Feb 7 20:31:20 2011 +++ src/usr.sbin/edquota/edquota.c Wed Feb 9 17:48:45 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: edquota.c,v 1.29.16.10 2011/02/07 20:31:20 bouyer Exp $ */ +/* $NetBSD: edquota.c,v 1.29.16.11 2011/02/09 17:48:45 bouyer Exp $ */ /* * Copyright (c) 1980, 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -41,7 +41,7 @@ #if 0 static char sccsid[] = from: @(#)edquota.c 8.3 (Berkeley) 4/27/95; #else -__RCSID($NetBSD: edquota.c,v 1.29.16.10 2011/02/07 20:31:20 bouyer Exp $); +__RCSID($NetBSD: edquota.c,v 1.29.16.11 2011/02/09 17:48:45 bouyer Exp $); #endif #endif /* not lint */ @@ -794,7 +794,7 @@ last_char(line2) = '\0'; if (dflag version == 1) { if (sscanf(line1, - \tblocks:(grace = %s\n, stime) != 1) { + \tblocks: (grace = %s\n, stime) != 1) { warnx(%s:%s: bad format, fsp, line1); goto out; } @@ -808,7 +808,7 @@ goto out; } if (sscanf(line2, - \tinodes:(grace = %s\n, stime) != 1) { + \tinodes: (grace = %s\n, stime) != 1) { warnx(%s:%s: bad format, fsp, line2); goto out; }
CVS commit: [bouyer-quota2] src/sys/ufs/ffs
Module Name:src Committed By: bouyer Date: Wed Feb 9 19:49:45 UTC 2011 Modified Files: src/sys/ufs/ffs [bouyer-quota2]: ffs_quota2.c ffs_vfsops.c Log Message: Support MNT_UPDATE for quota2 (especially r/o - r/w transitions) To generate a diff of this commit: cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/sys/ufs/ffs/ffs_quota2.c cvs rdiff -u -r1.263.4.2 -r1.263.4.3 src/sys/ufs/ffs/ffs_vfsops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/ufs/ffs/ffs_quota2.c diff -u src/sys/ufs/ffs/ffs_quota2.c:1.1.2.1 src/sys/ufs/ffs/ffs_quota2.c:1.1.2.2 --- src/sys/ufs/ffs/ffs_quota2.c:1.1.2.1 Thu Jan 20 14:25:02 2011 +++ src/sys/ufs/ffs/ffs_quota2.c Wed Feb 9 19:49:44 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: ffs_quota2.c,v 1.1.2.1 2011/01/20 14:25:02 bouyer Exp $ */ +/* $NetBSD: ffs_quota2.c,v 1.1.2.2 2011/02/09 19:49:44 bouyer Exp $ */ /*- * Copyright (c) 2010 Manuel Bouyer * All rights reserved. @@ -28,7 +28,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: ffs_quota2.c,v 1.1.2.1 2011/01/20 14:25:02 bouyer Exp $); +__KERNEL_RCSID(0, $NetBSD: ffs_quota2.c,v 1.1.2.2 2011/02/09 19:49:44 bouyer Exp $); #include sys/param.h #include sys/kernel.h @@ -82,7 +82,8 @@ if (error) return error; -if (fs-fs_quota_flags FS_Q2_DO_TYPE(USRQUOTA)) { +if (fs-fs_quota_flags FS_Q2_DO_TYPE(USRQUOTA) + ump-um_quotas[USRQUOTA] == NULLVP) { error = VFS_VGET(mp, fs-fs_quotafile[USRQUOTA], vp); if (error) { printf(%s: can't vget() user quota inode: %d\n, @@ -96,7 +97,8 @@ mutex_exit(vp-v_interlock); VOP_UNLOCK(vp); } -if (fs-fs_quota_flags FS_Q2_DO_TYPE(GRPQUOTA)) { +if (fs-fs_quota_flags FS_Q2_DO_TYPE(GRPQUOTA) + ump-um_quotas[GRPQUOTA] == NULLVP) { error = VFS_VGET(mp, fs-fs_quotafile[GRPQUOTA], vp); if (error) { vn_close(ump-um_quotas[USRQUOTA], Index: src/sys/ufs/ffs/ffs_vfsops.c diff -u src/sys/ufs/ffs/ffs_vfsops.c:1.263.4.2 src/sys/ufs/ffs/ffs_vfsops.c:1.263.4.3 --- src/sys/ufs/ffs/ffs_vfsops.c:1.263.4.2 Tue Feb 8 20:00:53 2011 +++ src/sys/ufs/ffs/ffs_vfsops.c Wed Feb 9 19:49:44 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: ffs_vfsops.c,v 1.263.4.2 2011/02/08 20:00:53 bouyer Exp $ */ +/* $NetBSD: ffs_vfsops.c,v 1.263.4.3 2011/02/09 19:49:44 bouyer Exp $ */ /*- * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc. @@ -61,7 +61,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: ffs_vfsops.c,v 1.263.4.2 2011/02/08 20:00:53 bouyer Exp $); +__KERNEL_RCSID(0, $NetBSD: ffs_vfsops.c,v 1.263.4.3 2011/02/09 19:49:44 bouyer Exp $); #if defined(_KERNEL_OPT) #include opt_ffs.h @@ -492,6 +492,16 @@ /* * Changing from read-only to read/write */ +#ifndef QUOTA2 + if (fs-fs_flags FS_DOQUOTA2) { +ump-um_flags |= UFS_QUOTA2; +uprintf(%s: options QUOTA2 not enabled%s\n, +mp-mnt_stat.f_mntonname, +(mp-mnt_flag MNT_FORCE) ? : +, not mounting); +return EINVAL; + } +#endif fs-fs_ronly = 0; fs-fs_clean = 1; fs-fs_fmod = 1; @@ -519,6 +529,14 @@ return error; #endif /* WAPBL */ +#ifdef QUOTA2 + if (!fs-fs_ronly) { + error = ffs_quota2_mount(mp); + if (error) { +return error; + } + } +#endif if (args-fspec == NULL) return 0; }
CVS commit: [bouyer-quota2] src/sys/conf
Module Name:src Committed By: bouyer Date: Wed Feb 9 20:32:49 UTC 2011 Modified Files: src/sys/conf [bouyer-quota2]: files Log Message: Put both QUOTA and QUOTA2 in opt_quota.h To generate a diff of this commit: cvs rdiff -u -r1.996.4.2 -r1.996.4.3 src/sys/conf/files Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/conf/files diff -u src/sys/conf/files:1.996.4.2 src/sys/conf/files:1.996.4.3 --- src/sys/conf/files:1.996.4.2 Tue Feb 8 16:19:47 2011 +++ src/sys/conf/files Wed Feb 9 20:32:49 2011 @@ -1,4 +1,4 @@ -# $NetBSD: files,v 1.996.4.2 2011/02/08 16:19:47 bouyer Exp $ +# $NetBSD: files,v 1.996.4.3 2011/02/09 20:32:49 bouyer Exp $ # @(#)files.newconf 7.5 (Berkeley) 5/10/93 version 20100430 @@ -225,7 +225,7 @@ # file system options # -defflagQUOTA QUOTA2 # XXX files.ufs? +defflag opt_quota.h QUOTA QUOTA2 # XXX files.ufs? defflagVNODE_LOCKDEBUG defflagMAGICLINKS
CVS commit: [bouyer-quota2] src
Module Name:src Committed By: bouyer Date: Wed Feb 9 20:53:10 UTC 2011 Modified Files: src/distrib/sets/lists/tests [bouyer-quota2]: mi src/tests/fs/ffs [bouyer-quota2]: Makefile Added Files: src/tests/fs/ffs [bouyer-quota2]: t_quota2_remount.c Log Message: Check that upgrading a R/O to R/W mount will properly enable quota2. To generate a diff of this commit: cvs rdiff -u -r1.240.2.2 -r1.240.2.3 src/distrib/sets/lists/tests/mi cvs rdiff -u -r1.14.2.5 -r1.14.2.6 src/tests/fs/ffs/Makefile cvs rdiff -u -r0 -r1.1.2.1 src/tests/fs/ffs/t_quota2_remount.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/sets/lists/tests/mi diff -u src/distrib/sets/lists/tests/mi:1.240.2.2 src/distrib/sets/lists/tests/mi:1.240.2.3 --- src/distrib/sets/lists/tests/mi:1.240.2.2 Wed Feb 9 10:51:03 2011 +++ src/distrib/sets/lists/tests/mi Wed Feb 9 20:53:10 2011 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.240.2.2 2011/02/09 10:51:03 bouyer Exp $ +# $NetBSD: mi,v 1.240.2.3 2011/02/09 20:53:10 bouyer Exp $ # # Note: don't delete entries from here - mark them as obsolete instead. # @@ -1186,6 +1186,7 @@ ./usr/tests/fs/ffs/t_clearquota tests-fs-tests atf ./usr/tests/fs/ffs/t_getquota tests-fs-tests atf ./usr/tests/fs/ffs/t_quota2_1 tests-fs-tests atf +./usr/tests/fs/ffs/t_quota2_remount tests-fs-tests atf ./usr/tests/fs/ffs/t_quotalimit tests-fs-tests atf ./usr/tests/fs/ffs/t_setquota tests-fs-tests atf ./usr/tests/fs/kernfstests-fs-tests Index: src/tests/fs/ffs/Makefile diff -u src/tests/fs/ffs/Makefile:1.14.2.5 src/tests/fs/ffs/Makefile:1.14.2.6 --- src/tests/fs/ffs/Makefile:1.14.2.5 Mon Feb 7 20:31:46 2011 +++ src/tests/fs/ffs/Makefile Wed Feb 9 20:53:10 2011 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.14.2.5 2011/02/07 20:31:46 bouyer Exp $ +# $NetBSD: Makefile,v 1.14.2.6 2011/02/09 20:53:10 bouyer Exp $ # .include bsd.own.mk @@ -28,6 +28,7 @@ TESTS_C+= t_snapshot_v2 TESTS_C+= t_mount TESTS_C+= t_quota2_1 +TESTS_C+= t_quota2_remount LDADD+=-lrumpfs_ffs # ffs LDADD+=-lrumpdev_fss # snapshot dev Added files: Index: src/tests/fs/ffs/t_quota2_remount.c diff -u /dev/null src/tests/fs/ffs/t_quota2_remount.c:1.1.2.1 --- /dev/null Wed Feb 9 20:53:10 2011 +++ src/tests/fs/ffs/t_quota2_remount.c Wed Feb 9 20:53:10 2011 @@ -0,0 +1,143 @@ +/* $NetBSD: t_quota2_remount.c,v 1.1.2.1 2011/02/09 20:53:10 bouyer Exp $ */ + +/* + * Basic tests for quota2 + */ + +#include atf-c.h + +#include ../common/h_fsmacros.h + +#include sys/types.h +#include sys/mount.h +#include sys/statvfs.h + +#include stdlib.h + +#include ufs/ufs/ufsmount.h + +#include rump/rump.h +#include rump/rump_syscalls.h + +#include ../../h_macros.h + +static void +do_quota(const atf_tc_t *tc, int n, const char *newfs_opts, int log) +{ + int i; + char buf[1024]; + int res; + int fd; + struct ufs_args uargs; + struct statvfs fst; + + snprintf(buf, sizeof(buf), newfs -q user -q group -F -s 4000 -n %d + %s %s, (n + 3), newfs_opts, FSTEST_IMGNAME); +if (system(buf) == -1) +atf_tc_fail_errno(cannot create file system); + + rump_init(); + if (rump_sys_mkdir(FSTEST_MNTNAME, 0777) == -1) + atf_tc_fail_errno(mount point create); + + rump_pub_etfs_register(/diskdev, FSTEST_IMGNAME, RUMP_ETFS_BLK); + + uargs.fspec = __UNCONST(/diskdev); + + /* read-only doens't have quota enabled */ + if (rump_sys_mount(MOUNT_FFS, FSTEST_MNTNAME, MNT_RDONLY, + uargs, sizeof(uargs)) == -1) + atf_tc_fail_errno(mount ffs ro %s, FSTEST_MNTNAME); + + if (rump_sys_statvfs1(FSTEST_MNTNAME, fst, 0) != 0) + atf_tc_fail_errno(statbfs %s (1), FSTEST_MNTNAME); + + if ((fst.f_flag ST_QUOTA) != 0) + atf_tc_fail(R/O filesystem has quota); + + /* updating to read-write enables quota */ + if (rump_sys_mount(MOUNT_FFS, FSTEST_MNTNAME, + MNT_UPDATE | (log ? MNT_LOG : 0), uargs, sizeof(uargs)) == -1) + atf_tc_fail_errno(mount ffs rw %s, FSTEST_MNTNAME); + + if (rump_sys_statvfs1(FSTEST_MNTNAME, fst, 0) != 0) + atf_tc_fail_errno(statbfs %s (2), FSTEST_MNTNAME); + + if ((fst.f_flag ST_QUOTA) == 0) + atf_tc_fail(R/W filesystem has no quota); + + /* we can update a second time */ + if (rump_sys_mount(MOUNT_FFS, FSTEST_MNTNAME, + MNT_UPDATE | (log ? MNT_LOG : 0), uargs, sizeof(uargs)) == -1) + atf_tc_fail_errno(mount ffs rw(2) %s, FSTEST_MNTNAME); + + if (rump_sys_statvfs1(FSTEST_MNTNAME, fst, 0) != 0) + atf_tc_fail_errno(statbfs %s (3), FSTEST_MNTNAME); + + if ((fst.f_flag ST_QUOTA) == 0) + atf_tc_fail(R/W filesystem has no quota); + + /* create some files so fsck has something to check */ + FSTEST_ENTER(); + RL(rump_sys_chown(., 0, 0)); + for (i = 0 ; i n; i++) { + sprintf(buf, file%d, i); + RL(fd = rump_sys_open(buf, O_CREAT | O_RDWR, 0755)); + sprintf(buf, test file no %d, i); + RL(rump_sys_write(fd, buf, strlen(buf))); + RL(rump_sys_fchown(fd, i, i+8)); + rump_sys_close(fd);
CVS commit: [bouyer-quota2] src/sys/ufs/ufs
Module Name:src Committed By: bouyer Date: Wed Feb 9 21:17:17 UTC 2011 Modified Files: src/sys/ufs/ufs [bouyer-quota2]: ufs_quota2.c Log Message: Make sure to not try to close the quota vnodes twice. To generate a diff of this commit: cvs rdiff -u -r1.1.2.11 -r1.1.2.12 src/sys/ufs/ufs/ufs_quota2.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/ufs/ufs/ufs_quota2.c diff -u src/sys/ufs/ufs/ufs_quota2.c:1.1.2.11 src/sys/ufs/ufs/ufs_quota2.c:1.1.2.12 --- src/sys/ufs/ufs/ufs_quota2.c:1.1.2.11 Wed Feb 9 11:18:30 2011 +++ src/sys/ufs/ufs/ufs_quota2.c Wed Feb 9 21:17:17 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: ufs_quota2.c,v 1.1.2.11 2011/02/09 11:18:30 bouyer Exp $ */ +/* $NetBSD: ufs_quota2.c,v 1.1.2.12 2011/02/09 21:17:17 bouyer Exp $ */ /*- * Copyright (c) 2010 Manuel Bouyer * All rights reserved. @@ -28,7 +28,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: ufs_quota2.c,v 1.1.2.11 2011/02/09 11:18:30 bouyer Exp $); +__KERNEL_RCSID(0, $NetBSD: ufs_quota2.c,v 1.1.2.12 2011/02/09 21:17:17 bouyer Exp $); #include sys/buf.h #include sys/param.h @@ -213,7 +213,7 @@ return 0; for (i = 0; i MAXQUOTAS; i++) { - if (ump-um_quotas[i]) { + if (ump-um_quotas[i] != NULLVP) { error = vn_close(ump-um_quotas[i], FREAD|FWRITE, ump-um_cred[i]); if (error) { @@ -222,6 +222,7 @@ return error; } } + ump-um_quotas[i] = NULLVP; } return 0; }
CVS commit: [bouyer-quota2] src/usr.sbin/quotacheck
Module Name:src Committed By: bouyer Date: Wed Feb 9 09:51:17 UTC 2011 Modified Files: src/usr.sbin/quotacheck [bouyer-quota2]: quotacheck.c Log Message: Make it build in new world. Don't attempt to update in-kernel quota, but instead warn if quotas are already on. The rc.d script runs quotacheck before quotaon so this shouldn't be a problem. To generate a diff of this commit: cvs rdiff -u -r1.40 -r1.40.14.1 src/usr.sbin/quotacheck/quotacheck.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [bouyer-quota2] src/usr.sbin/quotaon
Module Name:src Committed By: bouyer Date: Wed Feb 9 10:21:02 UTC 2011 Modified Files: src/usr.sbin/quotaon [bouyer-quota2]: Makefile quotaon.c Log Message: Make it compile with new quotactl To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.5.64.1 src/usr.sbin/quotaon/Makefile cvs rdiff -u -r1.23 -r1.23.2.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.
CVS commit: [bouyer-quota2] src/usr.bin/quota
Module Name:src Committed By: bouyer Date: Wed Feb 9 10:21:36 UTC 2011 Modified Files: src/usr.bin/quota [bouyer-quota2]: getvfsquota.c Log Message: Use prop_array_add_and_rel() To generate a diff of this commit: cvs rdiff -u -r1.1.2.2 -r1.1.2.3 src/usr.bin/quota/getvfsquota.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [bouyer-quota2] src/sys/dev/stbi
Module Name:src Committed By: bouyer Date: Wed Feb 9 10:44:11 UTC 2011 Added Files: src/sys/dev/stbi [bouyer-quota2]: files.stbi stb_image.c stbi.h stbiconfig.h Log Message: Sync with HEAD To generate a diff of this commit: cvs rdiff -u -r0 -r1.1.2.2 src/sys/dev/stbi/files.stbi \ src/sys/dev/stbi/stb_image.c src/sys/dev/stbi/stbi.h \ src/sys/dev/stbi/stbiconfig.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [bouyer-quota2] src
Module Name:src Committed By: bouyer Date: Wed Feb 9 10:51:03 UTC 2011 Modified Files: src/distrib/sets/lists/tests [bouyer-quota2]: mi src/etc/mtree [bouyer-quota2]: NetBSD.dist.tests Log Message: Add quota tests To generate a diff of this commit: cvs rdiff -u -r1.240.2.1 -r1.240.2.2 src/distrib/sets/lists/tests/mi cvs rdiff -u -r1.23.2.2 -r1.23.2.3 src/etc/mtree/NetBSD.dist.tests Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [bouyer-quota2] src/sys/ufs/ffs
Module Name:src Committed By: bouyer Date: Wed Feb 9 10:52:08 UTC 2011 Modified Files: src/sys/ufs/ffs [bouyer-quota2]: ffs_subr.c Log Message: Make it build without FFS_EI To generate a diff of this commit: cvs rdiff -u -r1.45.28.3 -r1.45.28.4 src/sys/ufs/ffs/ffs_subr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [bouyer-quota2] src/distrib/sets/lists/base
Module Name:src Committed By: bouyer Date: Wed Feb 9 10:55:13 UTC 2011 Modified Files: src/distrib/sets/lists/base [bouyer-quota2]: shl.mi Log Message: Sync with HEAD To generate a diff of this commit: cvs rdiff -u -r1.569.2.1 -r1.569.2.2 src/distrib/sets/lists/base/shl.mi Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [bouyer-quota2] src/sys/arch/x86
Module Name:src Committed By: bouyer Date: Wed Feb 9 11:00:08 UTC 2011 Modified Files: src/sys/arch/x86/include [bouyer-quota2]: genfb_machdep.h src/sys/arch/x86/x86 [bouyer-quota2]: genfb_machdep.c Log Message: Sync with HEAD To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.1.14.1 src/sys/arch/x86/include/genfb_machdep.h cvs rdiff -u -r1.4.4.1 -r1.4.4.2 src/sys/arch/x86/x86/genfb_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.