diff options
author | jkar8572 <jkar8572> | 2005-10-25 13:01:14 +0000 |
---|---|---|
committer | jkar8572 <jkar8572> | 2005-10-25 13:01:14 +0000 |
commit | d18a867ac9cdab3d3a6b176d242141be969351ec (patch) | |
tree | a3ec90d64fe7b50feb354f31d0380f90fced0690 | |
parent | b6d2587199b6d924511573719b513e278d3dad62 (diff) | |
download | linuxquota-d18a867ac9cdab3d3a6b176d242141be969351ec.tar.gz |
Changed mountpoint scanning so that we don't even stat NFS mountpoints when
local-only flag was specified. Hence we don't block if NFS is down. (Jan Kara)
-rw-r--r-- | Changelog | 1 | ||||
-rw-r--r-- | convertquota.c | 2 | ||||
-rw-r--r-- | edquota.c | 4 | ||||
-rw-r--r-- | quota.c | 4 | ||||
-rw-r--r-- | quotasys.c | 7 | ||||
-rw-r--r-- | quotasys.h | 6 | ||||
-rw-r--r-- | repquota.c | 4 | ||||
-rw-r--r-- | setquota.c | 4 | ||||
-rw-r--r-- | warnquota.c | 6 |
9 files changed, 22 insertions, 16 deletions
@@ -1,4 +1,5 @@ Changes in quota-tools from 3.13 to 3.14 +* we cannot even stat NFS mounts in local mode as server may be unreachable (Jan Kara) * fixed error messages in getprivs() (Jan Kara, Brian Morris) * made UID/GID prints unsigned (Matthew Kent) * fixed very verbose printing for quotacheck (Jan Kara) diff --git a/convertquota.c b/convertquota.c index 2d46748..cf7e3ea 100644 --- a/convertquota.c +++ b/convertquota.c @@ -266,7 +266,7 @@ static int convert_format(int type, struct mntent *mnt) struct quota_handle *qo; int ret = 0; - if (!(qo = init_io(mnt, type, QF_VFSOLD, IOI_LOCALONLY | IOI_OPENFILE))) { + if (!(qo = init_io(mnt, type, QF_VFSOLD, IOI_OPENFILE))) { errstr(_("Can't open old format file for %ss on %s\n"), type2name(type), mnt->mnt_dir); return -1; @@ -34,7 +34,7 @@ #ident "$Copyright: (c) 1980, 1990 Regents of the University of California. $" #ident "$Copyright: All rights reserved. $" -#ident "$Id: edquota.c,v 1.16 2005/03/31 11:48:02 jkar8572 Exp $" +#ident "$Id: edquota.c,v 1.17 2005/10/25 13:01:14 jkar8572 Exp $" /* * Disk quota editor. @@ -148,7 +148,7 @@ int main(int argc, char **argv) usage(); init_kernel_interface(); - handles = create_handle_list(dirname ? 1 : 0, dirname ? &dirname : NULL, quotatype, fmt, rflag ? 0 : IOI_LOCALONLY, 0); + handles = create_handle_list(dirname ? 1 : 0, dirname ? &dirname : NULL, quotatype, fmt, 0, rflag ? 0 : MS_LOCALONLY); if (!handles[0]) { dispose_handle_list(handles); fputs(_("No filesystems with quota detected.\n"), stderr); @@ -34,7 +34,7 @@ #ident "$Copyright: (c) 1980, 1990 Regents of the University of California. $" #ident "$Copyright: All rights reserved. $" -#ident "$Id: quota.c,v 1.17 2005/09/13 15:54:01 jkar8572 Exp $" +#ident "$Id: quota.c,v 1.18 2005/10/25 13:01:14 jkar8572 Exp $" /* * Disk quota reporting program. @@ -189,7 +189,7 @@ int showquotas(int type, qid_t id) time(&now); id2name(id, type, name); - handles = create_handle_list(0, NULL, type, fmt, IOI_READONLY | ((flags & FL_LOCALONLY) ? IOI_LOCALONLY : 0), ((flags & FL_NOAUTOFS) ? MS_NO_AUTOFS : 0)); + handles = create_handle_list(0, NULL, type, fmt, IOI_READONLY, ((flags & FL_NOAUTOFS) ? MS_NO_AUTOFS : 0) | ((flags & FL_LOCALONLY) ? MS_LOCALONLY : 0)); qlist = getprivs(id, handles, !!(flags & FL_QUIETREFUSE)); over = 0; for (q = qlist; q; q = q->dq_next) { @@ -583,7 +583,7 @@ add_entry: continue; gotmnt++; } - else if (!(ioflags & IOI_LOCALONLY) && (fmt == -1 || fmt == QF_RPC)) { /* Use NFS? */ + else if (fmt == -1 || fmt == QF_RPC) { /* Use NFS? */ #ifdef RPC goto add_entry; #endif @@ -862,6 +862,11 @@ static int cache_mnt_table(int flags) continue; } + if (flags & MS_LOCALONLY && nfs_fstype(mnt->mnt_type)) { + free((char *)devname); + continue; + } + /* Further we are not interested in mountpoints without quotas and we don't want to touch them */ if (!hasquota(mnt, USRQUOTA) && !hasquota(mnt, GRPQUOTA)) { @@ -19,9 +19,8 @@ #define TF_ROUND 0x1 /* Should be printed time rounded? */ /* Flags for IO initialization */ -#define IOI_LOCALONLY 0x1 /* Operate only on local quota */ -#define IOI_READONLY 0x2 /* Only readonly access */ -#define IOI_OPENFILE 0x4 /* Open file even if kernel has quotas turned on */ +#define IOI_READONLY 0x1 /* Only readonly access */ +#define IOI_OPENFILE 0x2 /* Open file even if kernel has quotas turned on */ #define KERN_KNOWN_QUOTA_VERSION (6*10000 + 5*100 + 1) @@ -130,6 +129,7 @@ int kern_quota_on(const char *dev, int type, int fmt); #define MS_NO_MNTPOINT 0x01 /* Specified directory needn't be mountpoint */ #define MS_NO_AUTOFS 0x02 /* Ignore autofs mountpoints */ #define MS_QUIET 0x04 /* Be quiet with error reporting */ +#define MS_LOCALONLY 0x08 /* Ignore nfs mountpoints */ /* Initialize mountpoints scan */ int init_mounts_scan(int dcnt, char **dirs, int flags); @@ -262,9 +262,9 @@ static void report(int type) int i; if (flags & FL_ALL) - handles = create_handle_list(0, NULL, type, fmt, IOI_LOCALONLY | IOI_READONLY | IOI_OPENFILE, (flags & FL_NOAUTOFS ? MS_NO_AUTOFS : 0)); + handles = create_handle_list(0, NULL, type, fmt, IOI_READONLY | IOI_OPENFILE, MS_LOCALONLY | (flags & FL_NOAUTOFS ? MS_NO_AUTOFS : 0)); else - handles = create_handle_list(mntcnt, mnt, type, fmt, IOI_LOCALONLY | IOI_READONLY | IOI_OPENFILE, (flags & FL_NOAUTOFS ? MS_NO_AUTOFS : 0)); + handles = create_handle_list(mntcnt, mnt, type, fmt, IOI_READONLY | IOI_OPENFILE, MS_LOCALONLY | (flags & FL_NOAUTOFS ? MS_NO_AUTOFS : 0)); for (i = 0; handles[i]; i++) report_it(handles[i], type); dispose_handle_list(handles); @@ -344,9 +344,9 @@ int main(int argc, char **argv) init_kernel_interface(); if (flags & FL_ALL) - handles = create_handle_list(0, NULL, flag2type(flags), fmt, (flags & FL_RPC) ? 0 : IOI_LOCALONLY, 0); + handles = create_handle_list(0, NULL, flag2type(flags), fmt, 0, (flags & FL_RPC) ? 0 : MS_LOCALONLY); else - handles = create_handle_list(mntcnt, mnt, flag2type(flags), fmt, (flags & FL_RPC) ? 0 : IOI_LOCALONLY, 0); + handles = create_handle_list(mntcnt, mnt, flag2type(flags), fmt, 0, (flags & FL_RPC) ? 0 : MS_LOCALONLY); if (flags & FL_GRACE) ret = setgraces(handles); diff --git a/warnquota.c b/warnquota.c index 25ea8f7..b009f52 100644 --- a/warnquota.c +++ b/warnquota.c @@ -10,7 +10,7 @@ * * Author: Marco van Wieringen <mvw@planets.elm.net> * - * Version: $Id: warnquota.c,v 1.23 2005/06/29 08:47:44 jkar8572 Exp $ + * Version: $Id: warnquota.c,v 1.24 2005/10/25 13:01:14 jkar8572 Exp $ * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -889,7 +889,7 @@ static void warn_quota(void) wc_exit(1); if (flags & FL_USER) { - handles = create_handle_list(0, NULL, USRQUOTA, -1, IOI_LOCALONLY | IOI_READONLY | IOI_OPENFILE, (flags & FL_NOAUTOFS ? MS_NO_AUTOFS : 0)); + handles = create_handle_list(0, NULL, USRQUOTA, -1, IOI_READONLY | IOI_OPENFILE, MS_LOCALONLY | (flags & FL_NOAUTOFS ? MS_NO_AUTOFS : 0)); if (!maildev[0] || !strcasecmp(maildev, "any")) maildev_handle = NULL; else @@ -901,7 +901,7 @@ static void warn_quota(void) if (flags & FL_GROUP) { if (get_groupadmins() < 0) wc_exit(1); - handles = create_handle_list(0, NULL, GRPQUOTA, -1, IOI_LOCALONLY | IOI_READONLY | IOI_OPENFILE, (flags & FL_NOAUTOFS ? MS_NO_AUTOFS : 0)); + handles = create_handle_list(0, NULL, GRPQUOTA, -1, IOI_READONLY | IOI_OPENFILE, MS_LOCALONLY | (flags & FL_NOAUTOFS ? MS_NO_AUTOFS : 0)); if (!maildev[0] || !strcasecmp(maildev, "any")) maildev_handle = NULL; else |