[Bug 1041377] [NEW] mountall ignores NFS mount option "timeo"

Launchpad Bug Tracker 1041377 at bugs.launchpad.net
Wed Dec 19 17:36:12 UTC 2012


You have been subscribed to a public bug by Dave Chiluk (chiluk):

If the mount option "timeo" is specified for an NFS mount in /etc/fstab,
mountall does not pass it to mount.nfs. The bug is in the function
cut_options() in mountall.c. It is called with the following arguments:

        opts = cut_options (NULL, mnt, "showthrough", "optional",
                            "bootwait", "nobootwait", "timeout",
                            NULL);

Although it should only remove the specified options, it also removes
any option that is a prefix of one of those, e.g. "timeo".

The call to strncmp() in line 661 compares only up to the length of the
option from the fstab, without comparing the length of both strings.
Hence I propose the following patch:

*(updated patch in comment #6).
--- mountall-2.36/src/mountall.c.orig   2012-08-24 20:25:07.445892095 +0200
+++ mountall-2.36/src/mountall.c        2012-08-24 21:29:10.098595843 +0200
@@ -658,7 +658,8 @@

                va_copy (options, args);
                while ((option = va_arg (options, const char *)) != NULL)
{
-                       if (j && ! strncmp (opts + i, option, j))
+                       if (j && option[j] == '\0'
+                             && ! strncmp (opts + i, option, j))
                                break;
                }
                va_end (options);


[Impact]
Mounts that have options that are substrings of (showthrough, optional, bootwait, nobootwait or timeout) Are being stripped by mountall and not being passed to the mount. Such is the case of timeo in nfs.

The change is minimal, and simply checks that the option being stripped
matches the length of option being checked against. This solves the case
where one is a substring of the other.

[Test Case]
1. Create an nfs mount option in /etc/fstab with the timeo=2 option. Like the below.
server:/raid /raid nfs user,timeo=2,timeout=6	 0 0
2. Run mountall as root
3. run mount and verify that the nfs mount specified above has the options user,timeo=2 , but not timeout=6.

[Regression Potential]
Regression potential is minimal, but regressions are most likely to manifest themselves in mount options disappearing or new options appearing (some new options appearing will be valid as is the case of timeo).

** Affects: mountall (Ubuntu)
     Importance: Medium
     Assignee: Dave Chiluk (chiluk)
         Status: Triaged

** Affects: mountall (Ubuntu Precise)
     Importance: Medium
     Assignee: Dave Chiluk (chiluk)
         Status: Confirmed

** Affects: mountall (Ubuntu Quantal)
     Importance: Medium
     Assignee: Dave Chiluk (chiluk)
         Status: Confirmed

** Affects: mountall (Ubuntu Raring)
     Importance: Medium
     Assignee: Dave Chiluk (chiluk)
         Status: Triaged


** Tags: precise
-- 
mountall ignores NFS mount option "timeo"
https://bugs.launchpad.net/bugs/1041377
You received this bug notification because you are a member of Ubuntu Sponsors Team, which is subscribed to the bug report.



More information about the Ubuntu-sponsors mailing list