Skip to contentSkip to conversation

Add additional error text for missing mount.cifs

PATCH In review Mike Pagano 3 participants 3 messages Apr 23, 2014 – May 12, 2014 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add additional error text for missing mount.cifs

If a cifs mount is attempted without mount.cifs present on the system the following appears via dmesg:

[   25.949378] CIFS VFS: No username specified

The purpose of this patch is to better inform the user of the possible cause of the error and show a potential solution.

The output for this error condition will look approximately like this:

[   11.183392] CIFS VFS: No username specified. Could not find 

/sbin/mount.cifs. Please ensure your system has this userspace program installed.

---
 fs/cifs/connect.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
fs/cifs/connect.c +10 -1
index 8813ff7..2091709 100644
@@ -3359,6 +3359,7 @@ cifs_setup_volume_info(struct smb_vol *volume_info, char *mount_data,
            const char *devname)
 {
    int rc = 0;
+   struct path path;
 
    if (cifs_parse_mount_options(mount_data, devname, volume_info))
        return -EINVAL;
@@ -3371,7 +3372,15 @@ cifs_setup_volume_info(struct smb_vol *volume_info, char *mount_data,
        /* BB fixme parse for domain name here */
        cifs_dbg(FYI, "Username: %s\n", volume_info->username);
    } else {
-       cifs_dbg(VFS, "No username specified\n");
+   /* As an extra step, check for missing /sbin/mount.cifs. Append
+      to error message as we cannot guarantee the location of this
+      binary in userspace */
+       if (kern_path("/sbin/mount.cifs", 0, &path)) {
+           cifs_dbg(VFS, "No username specified. Could not find /sbin/mount.cifs. Please ensure your system has this userspace program installed.\n");
+       }
+       else {
+           cifs_dbg(VFS, "No username specified\n");
+       }
    /* In userspace mount helper we can get user name from alternate
       locations such as env variables and files on disk */
        return -EINVAL;

--
1.8.3.2

A message that is not in the archive (sent off-list or not yet received): 20140423184055.GA18378-WkJ4KB730YtOk+SH+krGketnjj8NnB7F@public.gmane.org

#2 lore raw
Quoted 32 lines · On Wed, 23 Apr 2014 14:40:56 -0400 Mike Pagano…

If a cifs mount is attempted without mount.cifs present on the system the following appears via dmesg:

[   25.949378] CIFS VFS: No username specified

The purpose of this patch is to better inform the user of the possible cause of the error and show a potential solution.

The output for this error condition will look approximately like this:

[   11.183392] CIFS VFS: No username specified. Could not find 

/sbin/mount.cifs. Please ensure your system has this userspace program installed.

---
 fs/cifs/connect.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
fs/cifs/connect.c +1 -0
index 8813ff7..2091709 100644
@@ -3359,6 +3359,7 @@ cifs_setup_volume_info(struct smb_vol *volume_info, char *mount_data,
            const char *devname)
 {
    int rc = 0;
+   struct path path;
 
    if (cifs_parse_mount_options(mount_data, devname, volume_info))
        return -EINVAL;

fs/cifs/connect.c cifs_setup_volume_info(struct smb_vol *volume_info, char *mount_data, · line 3378

Quoted 8 lines
fs/cifs/connect.c +4 -1
@@ -3371,7 +3372,15 @@ cifs_setup_volume_info(struct smb_vol *volume_info, char *mount_data,
        /* BB fixme parse for domain name here */
        cifs_dbg(FYI, "Username: %s\n", volume_info->username);
    } else {
-       cifs_dbg(VFS, "No username specified\n");
+   /* As an extra step, check for missing /sbin/mount.cifs. Append
+      to error message as we cannot guarantee the location of this
+      binary in userspace */
+       if (kern_path("/sbin/mount.cifs", 0, &path)) {

Ugh, no -- a pathwalk has no business here, IMO.

Quoted 9 lines
fs/cifs/connect.c +5 -1
+           cifs_dbg(VFS, "No username specified. Could not find /sbin/mount.cifs. Please ensure your system has this userspace program installed.\n");
+       }
+       else {
+           cifs_dbg(VFS, "No username specified\n");
+       }
    /* In userspace mount helper we can get user name from alternate
       locations such as env variables and files on disk */
        return -EINVAL;
--
Quoted 5 lines

1.8.3.2
--
To unsubscribe from this list: send the line "unsubscribe linux-cifs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

I dunno. This doesn't seem like it's fixing a real problem to me.

While we highly recommend that people use the mount helper. It's not specifically *required* per-se. If you can roll up the right mount options and hand them to the kernel then there's no real problem.

If you really want this sort of warning, why not put it into /bin/mount? Then you could even output the warning message to the terminal instead of the kernel's ring buffer.

Signature · 1 line
Jeff Layton <[email protected]>

A message that is not in the archive (sent off-list or not yet received): 20140502155346.023f2170-9yPaYZwiELC+kQycOl6kW4xkIHaj4LzF@public.gmane.org

#4 lore raw
Quoted 16 lines · Jeff Layton
Quoted 13 lines · On Wed, 23 Apr 2014 14:40:56 -0400 Mike Pagano…

If a cifs mount is attempted without mount.cifs present on the system the following appears via dmesg:

[   25.949378] CIFS VFS: No username specified

The purpose of this patch is to better inform the user of the possible cause of the error and show a potential solution.

The output for this error condition will look approximately like this:

[   11.183392] CIFS VFS: No username specified. Could not find

/sbin/mount.cifs. Please ensure your system has this userspace program installed.

<snip>

Quoted 9 lines

I dunno. This doesn't seem like it's fixing a real problem to me.

While we highly recommend that people use the mount helper. It's not specifically *required* per-se. If you can roll up the right mount options and hand them to the kernel then there's no real problem.

If you really want this sort of warning, why not put it into /bin/mount? Then you could even output the warning message to the terminal instead of the kernel's ring buffer.

I don't have a strong opinion on this, although the patch is probably harmless. I slightly prefer that it go in /bin/mount instead of mount.cifs but would reconsider if new arguments in favor of it going in the kernel

Signature · 3 lines
Thanks,

Steve