Bug 727834 - mount.cifs does not accept "prefixpath" option
Summary: mount.cifs does not accept "prefixpath" option
Keywords:
Status: CLOSED NEXTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: kernel
Version: 15
Hardware: x86_64
OS: Linux
unspecified
high
Target Milestone: ---
Assignee: Jeff Layton
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-08-03 11:14 UTC by Patrick Oltmann
Modified: 2014-06-18 07:41 UTC (History)
10 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2011-08-19 16:53:18 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
patch -- convert prefixpath delimiters in cifs_build_path_to_root (1.53 KB, patch)
2011-08-05 12:03 UTC, Jeff Layton
no flags Details | Diff

Description Patrick Oltmann 2011-08-03 11:14:31 UTC
Description of problem:
When attempting to mount a CIFS share with the "prefixpath" option, mount.cifs terminates with "mount error(2): No such file or directory". Calls with "-v" enabled show that the option itself is correctly parsed.

Version-Release number of selected component (if applicable):
This problem appeared after the update to kernel-2.6.40-4. Booting the system to the previous kernel 2.6.38.8-35 resolves the problem.

How reproducible:
Every time.

Steps to Reproduce:
1. Boot system with kernel 2.6.40-4
2. Mount a share using "prefixpath" option
  
Actual results:
mount error(2): No such file or directory

Expected results:
mounting succeeds.

Additional info:
The problem also occurs when "prefixpath" is not explicitly stated but parsed automatically (e.g. for hiddes shares like //server/share$).

Comment 1 Jeff Layton 2011-08-03 12:58:27 UTC
WORKSFORME on 2.6.40-4:

# mount -v //server/scratch /mnt/salusa -o sec=none,prefixpath=/testdir
mount: no type was given - I'll assume cifs because of the // prefix
mount.cifs kernel mount options: ip=<redacted>,unc=\\server\scratch,sec=none,prefixpath=/testdir,ver=1,user=root,pass=********
# df -k /mnt/salusa
Filesystem           1K-blocks      Used Available Use% Mounted on
//salusa.poochiereds.net/scratch
                       5160576    177060   4721372   4% /mnt/salusa


...can you be more specific about what it is that you're doing?

Comment 2 Patrick Oltmann 2011-08-03 17:35:47 UTC
Basically the same:

~$ uname -r
2.6.40-4.fc15.x86_64

~$ sudo mount.cifs -v -o "user=DOMAIN/oltmann,prefixpath=user/oltmann" 
//server/department /home/patrick/cifsmount/department
Password:
mount.cifs kernel mount options: ip=<redacted>,unc=\\fileserver\department,
prefixpath=user/oltmann,ver=1,user=oltmann,domain=DOMAIN,pass=********
mount error(2): No such file or directory
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)

~$ sudo mount.cifs -v -o "user=DOMAIN/oltmann"
//server/profiles$/Desktop/oltmann /home/patrick/cifsmount/Desktop
Password:
mount.cifs kernel mount options: ip=<redacted>,unc=\\fileserver\profiles$,
,ver=1,user=oltmann,domain=DOMAIN,prefixpath=Desktop/oltmann,pass=********
mount error(2): No such file or directory
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)

---
Then I boot again into the previous kernel and repeat the commands
---

~$ uname -r
2.6.38.8-35.fc15.x86_64

~$ sudo mount.cifs -v -o "user=DOMAIN/oltmann,prefixpath=user/oltmann"
//server/department /home/patrick/cifsmount/department
Password:
mount.cifs kernel mount options: ip=<redacted>,unc=\\fileserver\department,
prefixpath=user/oltmann,ver=1,user=oltmann,domain=DOMAIN,pass=********

~$ sudo mount.cifs -v -o "user=DOMAIN/oltmann" 
//server/profiles$/Desktop/oltmann /home/patrick/cifsmount/Desktop
Password:
mount.cifs kernel mount options: ip=<redacted>,unc=\\fileserver\profiles$,
,ver=1,user=oltmann,domain=DOMAIN,prefixpath=Desktop/oltmann,pass=********

~$ df -k
Filesystem  1K-blocks       Used  Available Use% Mounted on
//server/department
           4294835196 2825255472 1469579724  66% /home/patrick/cifsmount/department
//server/profiles$/Desktop/oltmann
              1048576     282424     766152  27% /home/patrick/cifsmount/Desktop

Comment 3 Iain Arnell 2011-08-04 11:59:09 UTC
I can confirm this problem with 2.6.40-4.fc15.x86_64 (and 3.0.0-1.fc16.x86_64). And that it worked fine with kernel-2.6.38.8-35.fc15.x86_64.

In my case, I suspect that the problem is that I don't have permission to browse the top-level share itself, only the subdirectory I'm trying to access:

$ sudo mount -v -t cifs //server/data data -o user=cifsuser
Password: 
mount.cifs kernel mount options: ip=10.0.0.1,unc=\\server\data,,ver=1,user=cifsuser,pass=********
$ ls data
ls: reading directory data: Permission denied
$ sudo mount -v -t cifs //server/data/mydata mydata -o user=cifsuser
Password: 
mount.cifs kernel mount options: ip=10.0.0.1,unc=\\server\data,,ver=1,user=cifsuser,prefixpath=mydata,pass=********
mount error(2): No such file or directory
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)

Comment 4 Jeff Layton 2011-08-04 14:30:17 UTC
Ahh ok, that makes sense then. I assume these are windows servers? If so, then they will sometimes pretend that files to which you don't have access do not exist, so that would make the ENOENT here make sense.

I get similar results from samba, but with an EACCES error. In any case, I've started a discussion on this regression upstream. Stay tuned:

    http://permalink.gmane.org/gmane.linux.kernel.cifs/3858

Comment 5 Iain Arnell 2011-08-04 15:34:06 UTC
Yes, windows servers - probably 2003 and 2008r2, but I can't be sure, and I can't be sure which gives which behaviour. As you've presumably guessed by now, bug 727927 seems to be another variation on the same theme - mounting top-level share is okay, but "chdir mydata" gives ENOTDIR.

Comment 6 Patrick Oltmann 2011-08-04 16:50:06 UTC
Yes, it's also an Windows Server on site here, however the problem is not related to user permissions: I tested the same mount command (as in c#2) with two different users, one with conventional permission on the share (basically read/execute) and the other one with admin permissions (full access). Both commands triggered the same "mount error(2)".

Comment 7 Jeff Layton 2011-08-04 17:28:30 UTC
Patrick, would it be possible to get cFYI debugging info from one of these mount attempts?

http://wiki.samba.org/index.php/LinuxCIFS_troubleshooting#Enabling_Debugging

Comment 8 Iain Arnell 2011-08-05 05:33:22 UTC
Sorry. I was too quick with my suspicions. I can also reproduce on a share where I do have access to the root.

From a failure with prefixpath:

sudo mount -v -t cifs //server0/cifsuser/docs docs -o user=cifsuser

[59348.278410] fs/cifs/cifsfs.c: Devname: //server0/cifsuser/docs flags: 0 
[59348.278424] fs/cifs/connect.c: prefix path /docs
[59348.278426] fs/cifs/connect.c: Username: cifsuser
[59348.278433] fs/cifs/connect.c: file mode: 0x1ed  dir mode: 0x1ed
[59348.279424] fs/cifs/connect.c: CIFS VFS: in cifs_mount as Xid: 65 with uid: 0
[59348.279428] fs/cifs/connect.c: UNC: \\server0\cifsuser ip: 10.0.0.1
[59348.279460] fs/cifs/connect.c: Socket created
[59348.279462] fs/cifs/connect.c: sndbuf 16384 rcvbuf 87380 rcvtimeo 0x1b58
[59348.279943] fs/cifs/fscache.c: cifs_fscache_get_client_cookie: (0xffff880037c7b800/0xffff88003ba0a050)
[59348.279947] fs/cifs/connect.c: CIFS VFS: in cifs_get_smb_ses as Xid: 66 with uid: 0
[59348.279950] fs/cifs/connect.c: Existing smb sess not found
[59348.279957] fs/cifs/cifssmb.c: secFlags 0x7
[59348.279963] fs/cifs/transport.c: For smb_command 114
[59348.280006] fs/cifs/transport.c: Sending smb:  total_len 82
[59348.280190] fs/cifs/connect.c: Demultiplex PID: 18651
[59348.280595] fs/cifs/connect.c: rfc1002 length 0x71
[59348.280606] fs/cifs/transport.c: cifs_sync_mid_result: cmd=114 mid=1 state=4
[59348.280610] fs/cifs/cifssmb.c: Dialect: 2
[59348.280621] fs/cifs/cifssmb.c: negprot rc 0
[59348.280624] fs/cifs/connect.c: Security Mode: 0x3 Capabilities: 0x1f3fc TimeAdjust: -7200
[59348.280627] fs/cifs/sess.c: sess setup type 1
[59348.280664] fs/cifs/transport.c: For smb_command 115
[59348.280666] fs/cifs/transport.c: Sending smb:  total_len 254
[59348.288335] fs/cifs/connect.c: rfc1002 length 0xf7
[59348.288360] fs/cifs/transport.c: cifs_sync_mid_result: cmd=115 mid=2 state=4
[59348.288363] fs/cifs/misc.c: Null buffer passed to cifs_small_buf_release
[59348.288365] fs/cifs/sess.c: UID = 2048 
[59348.288368] fs/cifs/sess.c: bleft 201
[59348.288373] fs/cifs/sess.c: serverOS=Windows Server 2008 R2 Enterprise 7601 Service Pack 1
[59348.288376] fs/cifs/sess.c: serverNOS=Windows Server 2008 R2 Enterprise 6.1
[59348.288379] fs/cifs/sess.c: serverDomain=INTERNAL
[59348.288382] fs/cifs/sess.c: ssetup freeing small buf ffff8800378588c0
[59348.288384] fs/cifs/connect.c: CIFS Session Established successfully
[59348.288387] fs/cifs/connect.c: CIFS VFS: leaving cifs_get_smb_ses (xid = 66) rc = 0
[59348.288392] fs/cifs/connect.c: CIFS VFS: in cifs_get_tcon as Xid: 67 with uid: 0
[59348.288409] fs/cifs/transport.c: For smb_command 117
[59348.288411] fs/cifs/transport.c: Sending smb:  total_len 100
[59348.288907] fs/cifs/connect.c: rfc1002 length 0x42
[59348.288915] fs/cifs/transport.c: cifs_sync_mid_result: cmd=117 mid=3 state=4
[59348.288918] fs/cifs/connect.c: disk share connection
[59348.288921] fs/cifs/connect.c: nativeFileSystem=NTFS
[59348.288923] fs/cifs/connect.c: Tcon flags: 0x1 
[59348.288925] fs/cifs/connect.c: CIFS VFS: leaving cifs_get_tcon (xid = 67) rc = 0
[59348.288927] fs/cifs/connect.c: CIFS Tcon rc = 0
[59348.288937] fs/cifs/fscache.c: cifs_fscache_get_super_cookie: (0xffff88003ba0a050/0xffff88003ba0a0a0)
[59348.288940] fs/cifs/cifssmb.c: In QFSDeviceInfo
[59348.288943] fs/cifs/transport.c: For smb_command 50
[59348.288945] fs/cifs/transport.c: Sending smb:  total_len 72
[59348.289687] fs/cifs/connect.c: rfc1002 length 0x44
[59348.289697] fs/cifs/transport.c: cifs_sync_mid_result: cmd=50 mid=4 state=4
[59348.289701] fs/cifs/cifssmb.c: In QFSAttributeInfo
[59348.289703] fs/cifs/transport.c: For smb_command 50
[59348.289705] fs/cifs/transport.c: Sending smb:  total_len 72
[59348.290115] fs/cifs/connect.c: rfc1002 length 0x50
[59348.290126] fs/cifs/transport.c: cifs_sync_mid_result: cmd=50 mid=5 state=4
[59348.290130] fs/cifs/connect.c: build_unc_path_to_root: full_path=\\server0\cifsuser\docs
[59348.290134] fs/cifs/transport.c: For smb_command 117
[59348.290135] fs/cifs/transport.c: Sending smb:  total_len 88
[59348.290439] fs/cifs/connect.c: rfc1002 length 0x3c
[59348.290447] fs/cifs/transport.c: cifs_sync_mid_result: cmd=117 mid=6 state=4
[59348.290456] fs/cifs/connect.c: CIFS Tcon rc = 0 ipc_tid = 2049
[59348.290459] fs/cifs/cifssmb.c: In GetDFSRefer the path \server0\cifsuser
[59348.290462] fs/cifs/transport.c: For smb_command 50
[59348.290464] fs/cifs/transport.c: Sending smb:  total_len 118
[59348.290828] fs/cifs/connect.c: rfc1002 length 0x27
[59348.290831] fs/cifs/connect.c: invalid transact2 word count
[59348.290837] fs/cifs/transport.c: cifs_sync_mid_result: cmd=50 mid=7 state=4
[59348.290852] Status code returned 0xc0000225 NT_STATUS_NOT_FOUND
[59348.290872] fs/cifs/netmisc.c: Mapping smb error code 0xc0000225 to POSIX err -5
[59348.290874] fs/cifs/cifssmb.c: Send error in GetDFSRefer = -5
[59348.290879] fs/cifs/transport.c: For smb_command 50
[59348.290881] fs/cifs/transport.c: Sending smb:  total_len 88
[59348.291401] fs/cifs/connect.c: rfc1002 length 0x27
[59348.291405] fs/cifs/connect.c: invalid transact2 word count
[59348.291413] fs/cifs/transport.c: cifs_sync_mid_result: cmd=50 mid=8 state=4
[59348.291416] Status code returned 0xc0000033 NT_STATUS_OBJECT_NAME_INVALID
[59348.291420] fs/cifs/netmisc.c: Mapping smb error code 0xc0000033 to POSIX err -2
[59348.291422] fs/cifs/cifssmb.c: Send error in QPathInfo = -2
[59348.291425] fs/cifs/connect.c: cifs_put_tcon: tc_count=1
[59348.291426] 
[59348.291428] fs/cifs/connect.c: CIFS VFS: in cifs_put_tcon as Xid: 68 with uid: 0
[59348.291430] fs/cifs/cifssmb.c: In tree disconnect
[59348.291433] fs/cifs/transport.c: For smb_command 113
[59348.291434] fs/cifs/transport.c: Sending smb:  total_len 39
[59348.291735] fs/cifs/connect.c: rfc1002 length 0x27
[59348.291743] fs/cifs/transport.c: cifs_sync_mid_result: cmd=113 mid=9 state=4
[59348.291746] fs/cifs/fscache.c: cifs_fscache_release_super_cookie: (0xffff88003ba0a0a0)
[59348.291750] fs/cifs/connect.c: cifs_put_smb_ses: ses_count=1
[59348.291752] 
[59348.291754] fs/cifs/connect.c: CIFS VFS: in cifs_put_smb_ses as Xid: 69 with uid: 0
[59348.291756] fs/cifs/cifssmb.c: In SMBLogoff for session disconnect
[59348.291759] fs/cifs/transport.c: For smb_command 116
[59348.291761] fs/cifs/transport.c: Sending smb:  total_len 43
[59348.292353] fs/cifs/connect.c: rfc1002 length 0x2b
[59348.292363] fs/cifs/transport.c: cifs_sync_mid_result: cmd=116 mid=10 state=4
[59348.292373] fs/cifs/fscache.c: cifs_fscache_release_client_cookie: (0xffff880037c7b800/0xffff88003ba0a050)
[59348.292445] fs/cifs/connect.c: CIFS VFS: leaving cifs_mount (xid = 65) rc = -2
[59348.292447] CIFS VFS: cifs_mount failed w/return code = -2


And for comparison, directly mounting the root share:

sudo mount -v -t cifs //server0/cifsuser home -o user=cifsuser

[59207.309106] fs/cifs/cifsfs.c: Devname: //server0/cifsuser flags: 0 
[59207.309119] fs/cifs/connect.c: Username: cifsuser
[59207.309125] fs/cifs/connect.c: file mode: 0x1ed  dir mode: 0x1ed
[59207.310063] fs/cifs/connect.c: CIFS VFS: in cifs_mount as Xid: 50 with uid: 0
[59207.310066] fs/cifs/connect.c: UNC: \\server0\cifsuser ip: 10.0.0.1
[59207.310096] fs/cifs/connect.c: Socket created
[59207.310099] fs/cifs/connect.c: sndbuf 16384 rcvbuf 87380 rcvtimeo 0x1b58
[59207.310541] fs/cifs/fscache.c: cifs_fscache_get_client_cookie: (0xffff880037e92000/0xffff88003ba0a050)
[59207.310545] fs/cifs/connect.c: CIFS VFS: in cifs_get_smb_ses as Xid: 51 with uid: 0
[59207.310548] fs/cifs/connect.c: Existing smb sess not found
[59207.310555] fs/cifs/cifssmb.c: secFlags 0x7
[59207.310562] fs/cifs/transport.c: For smb_command 114
[59207.310564] fs/cifs/transport.c: Sending smb:  total_len 82
[59207.310584] fs/cifs/connect.c: Demultiplex PID: 18625
[59207.311308] fs/cifs/connect.c: rfc1002 length 0x71
[59207.311320] fs/cifs/transport.c: cifs_sync_mid_result: cmd=114 mid=1 state=4
[59207.311324] fs/cifs/cifssmb.c: Dialect: 2
[59207.311329] fs/cifs/cifssmb.c: negprot rc 0
[59207.311331] fs/cifs/connect.c: Security Mode: 0x3 Capabilities: 0x1f3fc TimeAdjust: -7200
[59207.311334] fs/cifs/sess.c: sess setup type 1
[59207.311372] fs/cifs/transport.c: For smb_command 115
[59207.311375] fs/cifs/transport.c: Sending smb:  total_len 254
[59207.318861] fs/cifs/connect.c: rfc1002 length 0xf7
[59207.318883] fs/cifs/transport.c: cifs_sync_mid_result: cmd=115 mid=2 state=4
[59207.318894] fs/cifs/misc.c: Null buffer passed to cifs_small_buf_release
[59207.318897] fs/cifs/sess.c: UID = 4098 
[59207.318899] fs/cifs/sess.c: bleft 201
[59207.318904] fs/cifs/sess.c: serverOS=Windows Server 2008 R2 Enterprise 7601 Service Pack 1
[59207.318908] fs/cifs/sess.c: serverNOS=Windows Server 2008 R2 Enterprise 6.1
[59207.318911] fs/cifs/sess.c: serverDomain=INTERNAL
[59207.318914] fs/cifs/sess.c: ssetup freeing small buf ffff880037858700
[59207.318916] fs/cifs/connect.c: CIFS Session Established successfully
[59207.318919] fs/cifs/connect.c: CIFS VFS: leaving cifs_get_smb_ses (xid = 51) rc = 0
[59207.318924] fs/cifs/connect.c: CIFS VFS: in cifs_get_tcon as Xid: 52 with uid: 0
[59207.318933] fs/cifs/transport.c: For smb_command 117
[59207.318935] fs/cifs/transport.c: Sending smb:  total_len 100
[59207.319498] fs/cifs/connect.c: rfc1002 length 0x42
[59207.319509] fs/cifs/transport.c: cifs_sync_mid_result: cmd=117 mid=3 state=4
[59207.319512] fs/cifs/connect.c: disk share connection
[59207.319515] fs/cifs/connect.c: nativeFileSystem=NTFS
[59207.319516] fs/cifs/connect.c: Tcon flags: 0x1 
[59207.319519] fs/cifs/connect.c: CIFS VFS: leaving cifs_get_tcon (xid = 52) rc = 0
[59207.319521] fs/cifs/connect.c: CIFS Tcon rc = 0
[59207.319524] fs/cifs/fscache.c: cifs_fscache_get_super_cookie: (0xffff88003ba0a050/0xffff88003ba0a0a0)
[59207.319527] fs/cifs/cifssmb.c: In QFSDeviceInfo
[59207.319530] fs/cifs/transport.c: For smb_command 50
[59207.319532] fs/cifs/transport.c: Sending smb:  total_len 72
[59207.319849] fs/cifs/connect.c: rfc1002 length 0x44
[59207.319856] fs/cifs/transport.c: cifs_sync_mid_result: cmd=50 mid=4 state=4
[59207.319859] fs/cifs/cifssmb.c: In QFSAttributeInfo
[59207.319862] fs/cifs/transport.c: For smb_command 50
[59207.319863] fs/cifs/transport.c: Sending smb:  total_len 72
[59207.320426] fs/cifs/connect.c: rfc1002 length 0x50
[59207.320436] fs/cifs/transport.c: cifs_sync_mid_result: cmd=50 mid=5 state=4
[59207.320440] fs/cifs/connect.c: build_unc_path_to_root: full_path=\\server0\cifsuser
[59207.320444] fs/cifs/transport.c: For smb_command 117
[59207.320446] fs/cifs/transport.c: Sending smb:  total_len 88
[59207.320768] fs/cifs/connect.c: rfc1002 length 0x3c
[59207.320775] fs/cifs/transport.c: cifs_sync_mid_result: cmd=117 mid=6 state=4
[59207.320778] fs/cifs/connect.c: CIFS Tcon rc = 0 ipc_tid = 8195
[59207.320781] fs/cifs/cifssmb.c: In GetDFSRefer the path \server0\cifsuser
[59207.320784] fs/cifs/transport.c: For smb_command 50
[59207.320786] fs/cifs/transport.c: Sending smb:  total_len 118
[59207.321345] fs/cifs/connect.c: rfc1002 length 0x27
[59207.321348] fs/cifs/connect.c: invalid transact2 word count
[59207.321356] fs/cifs/transport.c: cifs_sync_mid_result: cmd=50 mid=7 state=4
[59207.321369] Status code returned 0xc0000225 NT_STATUS_NOT_FOUND
[59207.321383] fs/cifs/netmisc.c: Mapping smb error code 0xc0000225 to POSIX err -5
[59207.321385] fs/cifs/cifssmb.c: Send error in GetDFSRefer = -5
[59207.321390] fs/cifs/transport.c: For smb_command 50
[59207.321391] fs/cifs/transport.c: Sending smb:  total_len 78
[59207.321884] fs/cifs/connect.c: rfc1002 length 0xa8
[59207.321892] fs/cifs/transport.c: cifs_sync_mid_result: cmd=50 mid=8 state=4
[59207.321898] fs/cifs/connect.c: CIFS VFS: leaving cifs_mount (xid = 50) rc = 0
[59207.321912] fs/cifs/inode.c: CIFS VFS: in cifs_root_iget as Xid: 53 with uid: 0
[59207.321915] fs/cifs/inode.c: Getting info on 
[59207.321918] fs/cifs/transport.c: For smb_command 50
[59207.321920] fs/cifs/transport.c: Sending smb:  total_len 78
[59207.322476] fs/cifs/connect.c: rfc1002 length 0xa8
[59207.322485] fs/cifs/transport.c: cifs_sync_mid_result: cmd=50 mid=9 state=4
[59207.322489] fs/cifs/cifssmb.c: In GetSrvInodeNum for 
[59207.322492] fs/cifs/transport.c: For smb_command 50
[59207.322494] fs/cifs/transport.c: Sending smb:  total_len 78
[59207.322942] fs/cifs/connect.c: rfc1002 length 0x48
[59207.322954] fs/cifs/transport.c: cifs_sync_mid_result: cmd=50 mid=10 state=4
[59207.322958] fs/cifs/inode.c: looking for uniqueid=281474976773921
[59207.322965] fs/cifs/inode.c: cifs_revalidate_cache: revalidating inode 281474976773921
[59207.322968] fs/cifs/inode.c: cifs_revalidate_cache: inode 281474976773921 is new
[59207.322971] fs/cifs/inode.c: inode 0xffff88002c71d040 old_time=0 new_time=4353996366
[59207.322977] fs/cifs/cifsfs.c: Get root dentry for 
[59207.322980] fs/cifs/cifsfs.c: CIFS VFS: in cifs_get_root as Xid: 54 with uid: 0
[59207.322988] fs/cifs/cifsfs.c: dentry root is: ffff88002c707b40
[59207.323001] SELinux: initialized (dev cifs, type cifs), uses genfs_contexts

Comment 9 Patrick Oltmann 2011-08-05 11:18:32 UTC
Here are the dmesg outputs for the following command:

mount -t cifs -v -o "user=DOMAIN/oltmann,ro,uid=500,gid=500,
prefixpath=user/oltmann" //server/department /mnt/loop

The first one is for kernel-2.6.38.8-35.fc15.x86_64 where the mount succeeded, the second one is for kernel-2.6.40-4.fc15.x86_64 where mounting failed with error #2.

=== 2.6.38.8-35.fc15.x86_64 ===
fs/cifs/cifsfs.c: Devname: //server/department flags: 1 
fs/cifs/connect.c: CIFS VFS: in cifs_mount as Xid: 0 with uid: 0
fs/cifs/connect.c: prefix path /user/oltmann
fs/cifs/connect.c: Domain name set
fs/cifs/connect.c: Username: oltmann
fs/cifs/connect.c: UNC: \\server\department ip: <redacted>
fs/cifs/connect.c: Socket created
fs/cifs/connect.c: sndbuf 16384 rcvbuf 87380 rcvtimeo 0x1b58
fs/cifs/fscache.c: CIFS: get client cookie (0xffff8802ef288400/0xffff8802ef2e9050)
fs/cifs/connect.c: CIFS VFS: in cifs_get_smb_ses as Xid: 1 with uid: 0
fs/cifs/connect.c: Existing smb sess not found
fs/cifs/cifssmb.c: secFlags 0x7
fs/cifs/connect.c: Demultiplex PID: 1678
fs/cifs/transport.c: For smb_command 114
fs/cifs/transport.c: Sending smb:  total_len 82
fs/cifs/connect.c: rfc1002 length 0x65
fs/cifs/transport.c: sync_mid_result: cmd=114 mid=1 state=4
fs/cifs/cifssmb.c: Dialect: 2
fs/cifs/cifssmb.c: negprot rc 0
fs/cifs/connect.c: Security Mode: 0x3 Capabilities: 0x1f3fd TimeAdjust: -7200
fs/cifs/sess.c: sess setup type 1
fs/cifs/transport.c: For smb_command 115
fs/cifs/transport.c: Sending smb:  total_len 264
fs/cifs/connect.c: rfc1002 length 0xb7
fs/cifs/transport.c: sync_mid_result: cmd=115 mid=2 state=4
fs/cifs/misc.c: Null buffer passed to cifs_small_buf_release
fs/cifs/sess.c: UID = 47106 
fs/cifs/sess.c: bleft 137
fs/cifs/sess.c: serverOS=Windows Server 2003 3790 Service Pack 2
fs/cifs/sess.c: serverNOS=Windows Server 2003 5.2
fs/cifs/sess.c: serverDomain=DOMAIN
fs/cifs/sess.c: ssetup freeing small buf ffff8802ef863480
fs/cifs/connect.c: CIFS Session Established successfully
fs/cifs/connect.c: CIFS VFS: leaving cifs_get_smb_ses (xid = 1) rc = 0
fs/cifs/connect.c: file mode: 0x1ed  dir mode: 0x1ed
fs/cifs/connect.c: CIFS VFS: in cifs_get_tcon as Xid: 2 with uid: 0
fs/cifs/transport.c: For smb_command 117
fs/cifs/transport.c: Sending smb:  total_len 108
fs/cifs/connect.c: rfc1002 length 0x42
fs/cifs/transport.c: sync_mid_result: cmd=117 mid=3 state=4
fs/cifs/connect.c: disk share connection
fs/cifs/connect.c: nativeFileSystem=NTFS
fs/cifs/connect.c: Tcon flags: 0x1 
fs/cifs/connect.c: CIFS VFS: leaving cifs_get_tcon (xid = 2) rc = 0
fs/cifs/connect.c: CIFS Tcon rc = 0
fs/cifs/fscache.c: CIFS: get superblock cookie (0xffff8802ef2e9050/0xffff8802f51aa000)
fs/cifs/cifssmb.c: In QFSDeviceInfo
fs/cifs/transport.c: For smb_command 50
fs/cifs/transport.c: Sending smb:  total_len 72
fs/cifs/connect.c: rfc1002 length 0x44
fs/cifs/transport.c: sync_mid_result: cmd=50 mid=4 state=4
fs/cifs/cifssmb.c: In QFSAttributeInfo
fs/cifs/transport.c: For smb_command 50
fs/cifs/transport.c: Sending smb:  total_len 72
fs/cifs/connect.c: rfc1002 length 0x50
fs/cifs/transport.c: sync_mid_result: cmd=50 mid=5 state=4
fs/cifs/transport.c: For smb_command 50
fs/cifs/transport.c: Sending smb:  total_len 100
fs/cifs/connect.c: rfc1002 length 0xba
fs/cifs/transport.c: sync_mid_result: cmd=50 mid=6 state=4
fs/cifs/connect.c: CIFS VFS: leaving cifs_mount (xid = 0) rc = 0
fs/cifs/inode.c: CIFS VFS: in cifs_root_iget as Xid: 3 with uid: 0
fs/cifs/inode.c: Getting info on \user\oltmann
fs/cifs/transport.c: For smb_command 50
fs/cifs/transport.c: Sending smb:  total_len 100
fs/cifs/connect.c: rfc1002 length 0xba
fs/cifs/transport.c: sync_mid_result: cmd=50 mid=7 state=4
fs/cifs/cifssmb.c: In GetSrvInodeNum for \user\oltmann
fs/cifs/transport.c: For smb_command 50
fs/cifs/transport.c: Sending smb:  total_len 100
fs/cifs/connect.c: rfc1002 length 0x48
fs/cifs/transport.c: sync_mid_result: cmd=50 mid=8 state=4
fs/cifs/inode.c: looking for uniqueid=281474977614896
fs/cifs/inode.c: cifs_revalidate_cache: revalidating inode 281474977614896
fs/cifs/inode.c: cifs_revalidate_cache: inode 281474977614896 is new
fs/cifs/inode.c: inode 0xffff8802f42a8050 old_time=0 new_time=4294739459
fs/cifs/cifsfs.c: export ops supported
SELinux: initialized (dev cifs, type cifs), uses genfs_contexts

=== 2.6.40-4.fc15.x86_64 ===
fs/cifs/cifsfs.c: Devname: //server/department flags: 1 
fs/cifs/connect.c: prefix path /user/oltmann
fs/cifs/connect.c: Domain name set
fs/cifs/connect.c: Username: oltmann
fs/cifs/connect.c: file mode: 0x1ed  dir mode: 0x1ed
fs/cifs/connect.c: CIFS VFS: in cifs_mount as Xid: 0 with uid: 0
fs/cifs/connect.c: UNC: \\server\department ip: <redacted>
fs/cifs/connect.c: Socket created
fs/cifs/connect.c: sndbuf 16384 rcvbuf 87380 rcvtimeo 0x1b58
fs/cifs/fscache.c: cifs_fscache_get_client_cookie: (0xffff88030a472400/0xffff8803095a8050)
fs/cifs/connect.c: Demultiplex PID: 1766
fs/cifs/connect.c: CIFS VFS: in cifs_get_smb_ses as Xid: 1 with uid: 0
fs/cifs/connect.c: Existing smb sess not found
CIFS VFS: default security mechanism requested.  The default security mechanism will be upgraded from ntlm to ntlmv2 in kernel release 3.1
fs/cifs/cifssmb.c: secFlags 0x7
fs/cifs/transport.c: For smb_command 114
fs/cifs/transport.c: Sending smb:  total_len 82
fs/cifs/connect.c: rfc1002 length 0x65
fs/cifs/transport.c: cifs_sync_mid_result: cmd=114 mid=1 state=4
fs/cifs/cifssmb.c: Dialect: 2
fs/cifs/cifssmb.c: negprot rc 0
fs/cifs/connect.c: Security Mode: 0x3 Capabilities: 0x1f3fd TimeAdjust: -7200
fs/cifs/sess.c: sess setup type 1
fs/cifs/transport.c: For smb_command 115
fs/cifs/transport.c: Sending smb:  total_len 258
fs/cifs/connect.c: rfc1002 length 0xb7
fs/cifs/transport.c: cifs_sync_mid_result: cmd=115 mid=2 state=4
fs/cifs/misc.c: Null buffer passed to cifs_small_buf_release
fs/cifs/sess.c: UID = 32768 
fs/cifs/sess.c: bleft 137
fs/cifs/sess.c: serverOS=Windows Server 2003 3790 Service Pack 2
fs/cifs/sess.c: serverNOS=Windows Server 2003 5.2
fs/cifs/sess.c: serverDomain=DOMAIN
fs/cifs/sess.c: ssetup freeing small buf ffff880309984000
fs/cifs/connect.c: CIFS Session Established successfully
fs/cifs/connect.c: CIFS VFS: leaving cifs_get_smb_ses (xid = 1) rc = 0
fs/cifs/connect.c: CIFS VFS: in cifs_get_tcon as Xid: 2 with uid: 0
fs/cifs/transport.c: For smb_command 117
fs/cifs/transport.c: Sending smb:  total_len 108
fs/cifs/connect.c: rfc1002 length 0x42
fs/cifs/transport.c: cifs_sync_mid_result: cmd=117 mid=3 state=4
fs/cifs/connect.c: disk share connection
fs/cifs/connect.c: nativeFileSystem=NTFS
fs/cifs/connect.c: Tcon flags: 0x1 
fs/cifs/connect.c: CIFS VFS: leaving cifs_get_tcon (xid = 2) rc = 0
fs/cifs/connect.c: CIFS Tcon rc = 0
fs/cifs/fscache.c: cifs_fscache_get_super_cookie: (0xffff8803095a8050/0xffff8803095a80a0)
fs/cifs/cifssmb.c: In QFSDeviceInfo
fs/cifs/transport.c: For smb_command 50
fs/cifs/transport.c: Sending smb:  total_len 72
fs/cifs/connect.c: rfc1002 length 0x44
fs/cifs/transport.c: cifs_sync_mid_result: cmd=50 mid=4 state=4
fs/cifs/cifssmb.c: In QFSAttributeInfo
fs/cifs/transport.c: For smb_command 50
fs/cifs/transport.c: Sending smb:  total_len 72
fs/cifs/connect.c: rfc1002 length 0x50
fs/cifs/transport.c: cifs_sync_mid_result: cmd=50 mid=5 state=4
fs/cifs/connect.c: build_unc_path_to_root: full_path=\\server\department\user\oltmann
fs/cifs/transport.c: For smb_command 117
fs/cifs/transport.c: Sending smb:  total_len 98
fs/cifs/connect.c: rfc1002 length 0x3c
fs/cifs/transport.c: cifs_sync_mid_result: cmd=117 mid=6 state=4
fs/cifs/connect.c: CIFS Tcon rc = 0 ipc_tid = 40980
fs/cifs/cifssmb.c: In GetDFSRefer the path \server\department
fs/cifs/transport.c: For smb_command 50
fs/cifs/transport.c: Sending smb:  total_len 126
fs/cifs/connect.c: rfc1002 length 0x27
fs/cifs/connect.c: invalid transact2 word count
fs/cifs/transport.c: cifs_sync_mid_result: cmd=50 mid=7 state=4
fs/cifs/netmisc.c: Mapping smb error code 0xc000000e to POSIX err -2
fs/cifs/cifssmb.c: Send error in GetDFSRefer = -2
fs/cifs/transport.c: For smb_command 50
fs/cifs/transport.c: Sending smb:  total_len 100
fs/cifs/connect.c: rfc1002 length 0x27
fs/cifs/connect.c: invalid transact2 word count
fs/cifs/transport.c: cifs_sync_mid_result: cmd=50 mid=8 state=4
fs/cifs/netmisc.c: Mapping smb error code 0xc0000033 to POSIX err -2
fs/cifs/cifssmb.c: Send error in QPathInfo = -2
fs/cifs/connect.c: cifs_put_tcon: tc_count=1
fs/cifs/connect.c: CIFS VFS: in cifs_put_tcon as Xid: 3 with uid: 0
fs/cifs/cifssmb.c: In tree disconnect
fs/cifs/transport.c: For smb_command 113
fs/cifs/transport.c: Sending smb:  total_len 39
fs/cifs/connect.c: rfc1002 length 0x27
fs/cifs/transport.c: cifs_sync_mid_result: cmd=113 mid=9 state=4
fs/cifs/fscache.c: cifs_fscache_release_super_cookie: (0xffff8803095a80a0)
fs/cifs/connect.c: cifs_put_smb_ses: ses_count=1
fs/cifs/connect.c: CIFS VFS: in cifs_put_smb_ses as Xid: 4 with uid: 0
fs/cifs/cifssmb.c: In SMBLogoff for session disconnect
fs/cifs/transport.c: For smb_command 116
fs/cifs/transport.c: Sending smb:  total_len 43
fs/cifs/connect.c: rfc1002 length 0x2b
fs/cifs/transport.c: cifs_sync_mid_result: cmd=116 mid=10 state=4
fs/cifs/fscache.c: cifs_fscache_release_client_cookie: (0xffff88030a472400/0xffff8803095a8050)
fs/cifs/connect.c: CIFS VFS: leaving cifs_mount (xid = 0) rc = -2
CIFS VFS: cifs_mount failed w/return code = -2

Comment 10 Jeff Layton 2011-08-05 12:03:06 UTC
Created attachment 516886 [details]
patch -- convert prefixpath delimiters in cifs_build_path_to_root

Ok, I think I see the problem...

The delimiters in the prefixpath are not being converted properly in the initial check to see if the path is accessible. Can you test this patch and let me know whether it helps?

Note that it will probably fix the problem where each path component is accessible by the mounting user, but will likely not fix the case where one of the upper level directories is not accessible.

Comment 11 Iain Arnell 2011-08-05 14:00:32 UTC
This patch fixes everything for me - even where upper level directories aren't accessible. It even avoids triggering the oops from bug 727927 (and yes, I /did/ rebuild with only this one patch applied).

Comment 12 Jeff Layton 2011-08-05 14:26:27 UTC
(In reply to comment #11)
> This patch fixes everything for me - even where upper level directories aren't
> accessible.

Thanks for testing it. It may fix some common cases (like yours).

I think there may still be problems when you have multiple levels in the prefixpath, and some of the ones in the middle are not accessible. For instance:

//server/share/dir1/dir2/dir3

...and dir2 is inaccessable to the mounting user. To make it even more complicated, it may also depend on what sort of access that user actually has and server implementation.

> It even avoids triggering the oops from bug 727927 (and yes, I
> /did/ rebuild with only this one patch applied).

Yes, I'd sort of expect that here. I think the oops was a result of the lookup failure establishing a negative dentry and then proceeding to walk down the path. That said, it might still be possible to get a negative dentry from lookup_one_len even with this patch in place, so I'm going to propose both patches for 3.1 and stable.

Comment 13 Patrick Oltmann 2011-08-05 16:04:07 UTC
The patch also resolved all problems I initially reported. I haven't done extensive testing in regard to lacking user permission, but I could do if it would be of any help.

Comment 14 Patrick Oltmann 2011-08-19 16:53:18 UTC
The bug is resolved in kernel-2.6.40.3-0.fc15.x86_64.


Note You need to log in before you can comment on or make changes to this bug.