Package: quota
Version: 3.12-6
Severity: normal
Tags: patch

Hi,

I noticed that quoat{on,off,check} will block in a stat syscall on
non-responsive NFS shares even if that share is unrelated to the
arguments. The culprit is the scanner of /etc/mtab.

This patch introduces a new flag for the scanner to skip NFS mount
points completly and changes quoat{on,off,check} to set this flag as
they have no effect on NFS anyway. With this one can still use the
tools with a non-responsive NFS share.

MfG
        Goswin

-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.8-frosties-2
Locale: LANG=C, LC_CTYPE=de_DE (charmap=ISO-8859-1)
diff -u quota-3.12/quotasys.c quota-3.12/quotasys.c
--- quota-3.12/quotasys.c
+++ quota-3.12/quotasys.c
@@ -851,7 +851,12 @@
                        free((char *)devname);
                        continue;
                }
-                       
+
+               if (flags & MS_NO_NFS && !strcmp(mnt->mnt_type, MNTTYPE_NFS)) {
+                       free((char *)devname); 
+                        continue;
+               }
+               
                if (!realpath(mnt->mnt_dir, mntpointbuf)) {
                        errstr(_("Can't resolve mountpoint path %s: %s\n"), 
mnt->mnt_dir, strerror(errno));
                        free((char *)devname);
diff -u quota-3.12/debian/changelog quota-3.12/debian/changelog
--- quota-3.12/debian/changelog
+++ quota-3.12/debian/changelog
@@ -1,3 +1,18 @@
+quota (3.12-6a0.ql.2) unstable; urgency=low
+
+  * Fix that NFS mountpoints block quotacheck when the server is offline:
+    + quotacheck.c: Use MS_NO_NFS flag
+
+ -- Goswin von Brederlow <[EMAIL PROTECTED]>  Thu,  7 Sep 2006 12:10:33 +0000
+
+quota (3.12-6a0.ql.1) unstable; urgency=medium
+
+  * Fix that NFS mountpoints block quotaon/off when the server is offline:
+    + quotasys.c: Add MS_NO_NFS flag
+    + quotaon.c: Use MS_NO_NFS flag
+
+ -- Goswin von Brederlow <[EMAIL PROTECTED]>  Thu,  7 Sep 2006 13:01:13 +0200
+
 quota (3.12-6) unstable; urgency=medium
 
   * Removed patch file that I accidently left in the source tree
only in patch2:
unchanged:
--- quota-3.12.orig/quotasys.h
+++ quota-3.12/quotasys.h
@@ -125,6 +125,7 @@
 #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_NO_NFS 0x08         /* Ignore NFS mountpoints */
 /* Initialize mountpoints scan */
 int init_mounts_scan(int dcnt, char **dirs, int flags);
 
only in patch2:
unchanged:
--- quota-3.12.orig/quotaon.c
+++ quota-3.12/quotaon.c
@@ -319,7 +319,7 @@
        if (fmt != -1 && !(kernel_formats & (1 << fmt)))
                die(1, _("Required format %s not supported by kernel.\n"), 
fmt2name(fmt));
 
-       if (init_mounts_scan(mntcnt, mntpoints, 0) < 0)
+       if (init_mounts_scan(mntcnt, mntpoints, MS_NO_NFS) < 0)
                return 1;
        while ((mnt = get_next_mount())) {
                if (!strcmp(mnt->mnt_type, MNTTYPE_NFS)) {
only in patch2:
unchanged:
--- quota-3.12.orig/quotacheck.c
+++ quota-3.12/quotacheck.c
@@ -943,7 +943,7 @@
        struct mntent *mnt;
        int checked = 0;
 
-       if (init_mounts_scan((flags & FL_ALL) ? 0 : 1, &mntpoint, 0) < 0)
+       if (init_mounts_scan((flags & FL_ALL) ? 0 : 1, &mntpoint, MS_NO_NFS) < 
0)
                die(2, _("Can't initialize mountpoint scan.\n"));
        while ((mnt = get_next_mount())) {
                if (flags & FL_ALL && flags & FL_NOROOT && 
!strcmp(mnt->mnt_dir, "/"))

Reply via email to