[linux-cifs-client] CIFS non-existant recursive directory--if you like filesystem/sharing puzzles...

Peter Cook cookpj at gmail.com
Sat Jul 21 03:55:22 GMT 2007


Before I start into this, I want to thank you for looking through this to
begin with. I'm posting here as a more specific continuation of a thread I
originally posted on ubuntuforums.org at the following URL:
http://ubuntuforums.org/showthread.php?p=3026260

I have one note that wasn't mentioned on that thread, that came to me now.
The only way I could get cifs to mount the share with the correct uid/gid
was to manually set /proc/fs/cifs/LinuxExtensionsEnabled to 0. I
accomplished this by adding the share to fstab but not automounting it, then
running an echo and the mount command at the end of my startup scripts. The
uid/gid that gets set otherwise is 1001/1001. I believe this is due to
misconfigured VFS on the server, but I'm not sure--this workaround solved
that problem. Hopefully it is not the cause of the one I'm having now.

I'm going to reprint a bit of the information from that thread here.

----Begin thread repost-----

Problem in short: *On a CIFS share (problem didn't exist when same share
mounted as smbfs) I can access a directory that doesn't exist, which takes
me back to the root of the share.* IE: /media/fileserver/Unsorted/mp3/
doesn't actually exist (verified directly on the server, via WinXP share,
and an ls -al from the Ubuntu machine that the problem is occurring on) but
if I "cd /media/fileserver/Unsorted/mp3/" I end up back at the directory
listing for the root of the share, ie: /media/fileserver/ This recursion
does not continue (/media/fileserver/Unsorted/mp3/Unsorted/ exists, but
/media/fileserver/Unsorted/mp3/Unsorted/mp3/ does not, and attempting to cd
etc. doesn't work--ie; expected behavior.)

Problem in long: (is that a turn of phrase?)

I have a file server, also running Ubuntu Feisty, setup with a main Samba (
3.0.24) share that I access with a variety of computers, both Ubuntu and
WinXP. I have never had any problems accessing this share, and am relatively
sure that the problem is not on the server side.

When I had the share mounted using smbfs, (which I had always done since..
kernel 2.2? and all the current howtos still direct you to do so...) I was
having frequent problems with smbiod going into a 100% cpu use state when I
was trying to do large catalogs of the fileserver over a share. After a bit
of searching, I discovered this page:
http://joey.ubuntu-rocks.org/blog/20...ont-use-smbfs/<http://joey.ubuntu-rocks.org/blog/2007/04/25/resolution-to-mounting-samba-shares-dont-use-smbfs/>which
told me, essentially, that smbfs is depreciated and cifs is the way to
go. Switching the share to cifs did, in fact, fix the problems I was having.

I am not entirely sure if this is relevant to the problem at hand, but I
figure the more information the better. I am going to post this resolution
elsewhere on the forums so that it might help someone else, but not before
I'm sure it's a reasonable solution. I had a very strange problem when I
switched the syntax to cifs--essentially, the uid and gid were no longer
being set correctly. The mount was fine, but I couldn't write to it because,
despite what I put in the mount line, it was mounting using a different uid
and gid. Based off of the information here:
http://lwn.net/Articles/183704/I setup a very shoddy hack to disable
LinuxExtensionsEnabled (which is only
available after the cifs module loads) and then mount the share much later
in my boot. Again, I'm going to share that whole procedure elsewhere, but it
might be relevant here, so that's the summary.

The directory in question, /media/fileserver/Unsorted/mp3/ did exist when I
noticed the problem. My initial thought was that it was simply too large a
directory for cifs to handle (~5000 files+ subdirectories), so I decided to
split the directory into 4 separate, smaller directories. This served two
purposes: 1. It excluded the large directory size hypothesis. 2. It allowed
me to completely delete the original /media/fileserver/Unsorted/mp3/
directory. I made these changes via ssh directly on the fileserver. This
being done, (and for any other changes on either side, so it's clear) I
unmounted the share locally, restarted samba on the fileserver via ssh, and
then remounted the share locally.

Here's the fun part. After I deleted the directory mp3 from the server (done
while logged into the server using ssh, so it was verified not there) I
could still navigate into the directory if I did a "cd
/media/fileserver/Unsorted/mp3/". This brought me back to the root of the
share (/media/fileserver/), as described in the initial problem; this does
not recurse.

A few things I've tried:

Server side:
I re-created a directory mp3. Within this directory, I created a directory
called test. I restarted everything as mentioned above. The local mount
ignores the existence of this directory entirely, unless I recurse through
to it (ie: /media/fileserver/Unsorted/mp3/Unsorted/mp3/test/). This makes me
think it is a issue with the cifs mount client side. Additionally, all
windows and smbfs shares detected this change without issue.

I added "follow symlinks = no" and "dont descend = /pub/Music/Unsorted/mp3"
to the share settings in smb.conf on the server, and then restarted as
above. These settings made no difference.

I tried ln -s to another empty directory. Ie: I made a symbolic link from an
empty mp3test directory to mp3 (of which there was no such file or
directory, after my above modifications). This had no effect. I removed
this.

Client side:

I have tried mounting using both the command line mount command as well as
fstab. Here is the fstab command line I'm using:

//192.168.2.2/mp3 /media/fileserver cifs
noauto,uid=maytag,gid=mp3,credentials=/etc/cifspw,iocharset=utf8,file_mode=0777,dir_mode=0777
0 0

I've tried this with and without the filemode/dirmode, iocharset, and
gid/uid entires. The removal/addition of each has the expected result, but
does not affect the existence of the non-existent directory.

I looked all over, thinking that cifs or smbfs or something might make a
client side cache of the share. I was unable to find anything useful in
terms of information about this online. /var/cache/samba/ does exists, but I
renamed all existing files to .old and then restarted samba and remounted my
shares, and the problem still happened. I don't think much, if any, caching
happens on the client side, and doubt that is the problem.

I looked into the possibility that it's a bug with the kernel (running "
2.6.20-16-lowlatency"). I have been unable to find any specific bug report
related to this with any kernel version. 2.6.22 is available, and the kind
Ubuntu kernel team finally decided to make it somewhat possible for users to
compile their own kernel (previously this was next to impossible--I've
compiled thousands of kernels, and Ubuntu was always a giant pain...) via
this website: https://wiki.ubuntu.com/KernelCustomBuild and its sister site:
https://wiki.ubuntu.com/KernelGitGuide. I have yet to get this possibility
to work due to dependency issues after the compile, which is irrelevant for
this thread.

I've probably tried other things too, but at this point am running out of
ideas, so I posted this monster. If you read the whole damn thing, thanks.
If you respond, even more thanks. Any ideas would be welcome--I'm stumped,
and would like to straighten this out so I can post and help others...

My fstab line was in the original post, but here it is again:
 Code:

//192.168.2.2/mp3 /media/fileserver cifs
noauto,uid=maytag,gid=mp3,credentials=/etc/cifspw,iocharset=utf8,file_mode=0777,dir_mode=0777
0 0

As I said before, I've tried this with and without the filemode/dirmode,
iocharset, and gid/uid entires. The removal/addition of each has the
expected result, but does not affect the existence of the non-existent
directory.

As per your suggestion, I have tried this:

 Code:

sudo mount -t cifs //192.168.2.2/mp3 /media/fileserver -o
iocharset=utf8,file_mode=0777,dir_mode=0777,credentials=/etc/cifspw,sync,dirsync,uid=maytag,gid=mp3

Then these commands, truncated for relevancy:

 Code:

cd /media/fileserver
maytag at BigBlue:/media/fileserver$ ls -al
total 32000
drwxrwxrwx  21 maytag mp3         0 2007-07-15 21:40 .
drwxr-xr-x  13 root   root     4096 2007-07-15 20:32 ..
-rwxrwxrwx   1 maytag mp3       937 2005-07-03 00:41 adblock.txt
drwxrwxrwx 360 maytag mp3         0 2007-07-07 14:29 Albums
(snip)

maytag at BigBlue:/$ cd /media/fileserver/Unsorted/
maytag at BigBlue:/media/fileserver/Unsorted$ ls -al
(snip)
drwxrwxrwx   1 maytag mp3        0 2004-08-11 23:46 Misc. Sounds
drwxrwxrwx   1 maytag mp3        0 2007-07-09 09:34 mp3ae
drwxrwxrwx   1 maytag mp3        0 2007-07-09 09:37 mp3fm
drwxrwxrwx   1 maytag mp3        0 2007-07-09 09:37 mp3ns
drwxrwxrwx   1 maytag mp3        0 2007-07-09 09:43 mp3t9
(snip)

As you can see, there is no directory "mp3" in /media/fileserver/Unsorted.

 Code:

maytag at BigBlue:/media/fileserver$ cd /media/fileserver/Unsorted/mp3
maytag at BigBlue:/media/fileserver/Unsorted/mp3$ ls -al
total 31996
drwxrwxrwx 21 maytag mp3        0 2007-07-15 21:40 .
drwxrwxrwx 74 maytag mp3        0 2007-07-09 23:27 ..
-rwxrwxrwx  1 maytag mp3      937 2005-07-03 00:41 adblock.txt
drwxrwxrwx  1 maytag mp3        0 2007-07-07 14:29 Albums
(snip)

So this shows the same directory listing in /media/fileserver/Unsorted/mp3
as the mount point, /media/fileserver, despite the fact that mp3 doesn't
appear in the directory listing.

 Code:

maytag at BigBlue:/$ cd /media/fileserver/Unsorted
maytag at BigBlue:/media/fileserver/Unsorted$ mkdir mp3
mkdir: cannot create directory `mp3': File exists

Something thinks the directory does exist, but ls -al doesn't see it.

 Code:

maytag at BigBlue:/$ cd /media/fileserver
maytag at BigBlue:/media/fileserver$ ls -al
total 32000
drwxrwxrwx  21 maytag mp3         0 2007-07-15 21:40 .
drwxr-xr-x  13 root   root     4096 2007-07-15 20:32 ..
-rwxrwxrwx   1 maytag mp3       937 2005-07-03 00:41 adblock.txt
(snip)

maytag at BigBlue:/media/fileserver$ mkdir 1test
maytag at BigBlue:/media/fileserver$ ls -al
total 32000
drwxrwxrwx  22 maytag mp3         0 2007-07-15 21:56 .
drwxr-xr-x  13 root   root     4096 2007-07-15 20:32 ..
drwxr-xr-x   2 maytag mp3         0 2007-07-15 21:56 1test
-rwxrwxrwx   1 maytag mp3       937 2005-07-03 00:41 adblock.txt
(snip)

maytag at BigBlue:/media/fileserver$ cd /media/fileserver/Unsorted/mp3
maytag at BigBlue:/media/fileserver/Unsorted/mp3$ ls -al
total 31996
drwxrwxrwx 22 maytag mp3        0 2007-07-15 21:56 .
drwxrwxrwx 74 maytag mp3        0 2007-07-09 23:27 ..
drwxrwxrwx  1 maytag mp3        0 2007-07-15 21:56 1test
-rwxrwxrwx  1 maytag mp3      937 2005-07-03 00:41 adblock.txt
(snip)

So now I've made a new test directory in the root of the mount, and the
directory appears in the non-existant /media/fileserver/Unsorted/mp3
immediately.

My initial thoughts were on caches too, but I have no idea where they are or
how to clear them. This immediate appearance of directories inside the
offending recursive directory makes me doubt caches.

The same results happen with and without the sync and dirsync options. The
mount man page states that those options may not be implemented on all
filesystems, and the mount.cifs man page does not mention those options at
all.

-------End thread repost------

Thanks for reading this far! I'm completely at a loss, so any input would be
greatly appreciated!

-- 
Peter C
-------------- next part --------------
HTML attachment scrubbed and removed


More information about the linux-cifs-client mailing list