I saw a mention that this issue has been fixed in CIFS implementation, however I probably misunderstood since it is not working correctly: When trying to mount subdirectory of a share: //server/dir1/dir2 mount.cifs strips down unc to //server\dir1. I have a situation where my Windows home directory is dir2 as above, however I don't have permissions to mount dir1 directly, I can only mount dir2. So using "mount.cifs //server/dir1/dir2 -o prefixpath=dir1" will not work, resulting in error 13 permission denied since it still tries to mount //server\dir1. It would be good to have an option to mount a subdirectory (dir2 in this case) directly, rather then mounting dir1 only. This works fine on Windows, where I can browse and then map that dir2 without any issues. I can also browse that directory with smbclient, but cannot mount it using mount.cifs. I tested this on Ubuntu 8.10 with both default smbfs 3.2.3-1ubuntu3.3 and compiled 3.3.0rc1.
Looks like you are right that we are always passing an empty path when we get the root inode of the mount (the root path should be the prefixpath, if present, not null). So although using a prefixpath works for most cases, with current cifs.ko cod you have to have (at least) permission enough to do SMB QuerPathInfo in cifs_get_inode_info. /* gets root inode */ struct inode *cifs_iget(struct super_block *sb, unsigned long ino) { int xid; struct cifs_sb_info *cifs_sb; struct inode *inode; long rc; inode = iget_locked(sb, ino); if (!inode) return ERR_PTR(-ENOMEM); if (!(inode->i_state & I_NEW)) return inode; cifs_sb = CIFS_SB(inode->i_sb); xid = GetXid(); if (cifs_sb->tcon->unix_ext) rc = cifs_get_inode_info_unix(&inode, "", inode->i_sb, xid); else rc = cifs_get_inode_info(&inode, "", NULL, inode->i_sb, xid, NULL);
Created attachment 3783 [details] fix to cifs.ko against 2.6.28 (rc6) but should work on any reasonably recent kernel tested and reviewed and checked into cifs-2.6.git tree. Will push into 2.6.29 mainline kernel when it opens up in a few weeks
checked into cifs-2.6.git and patch provided