Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Linux - Kernel This forum is for all discussion relating to the Linux kernel.


  Search this Thread
Old 05-05-2010, 10:56 AM   #1
Pepijn Schmitz
LQ Newbie
Registered: Sep 2006
Location: Amersfoort, The Netherlands
Posts: 8

Rep: Reputation: 0
Bug in mount bind: files turn into directories

I'm sorry for this lengthy post, but the problem is complex and hard to explain. In short: Linux sometimes thinks that everything in directories mounted with the bind option is a directory! Hopefully someone here can tell me what's going on or help me debug the problem.

I'm having a bizarre problem on my Ubuntu Karmic 64-bit workstation: a number of directories mounted using the "bind" option has suddenly started to show every file in them with the same permissions as the directory itself, including the fact that it is a directory! In other words, Linux suddenly thinks all the files in my bound directories are directories!

Here's a part of my /etc/fstab:

//diskstation/home /home/pepijn_remote cifs credentials=/home/pepijn.smbcredentials,uid=pepijn,gid=pepijn,iocharset=utf8 0 0
/home/pepijn_remote/Documents /home/pepijn/Documents none bind 0 0
/home/pepijn_remote/Downloads /home/pepijn/Downloads none bind 0 0
As you can see, I mount my remote home directory from my NAS on /home/pepijn_remote using CIFS. I then bind some of the directories from that share in my real home directory. This has worked perfectly for months now.

But then suddenly all hell broke loose. Programs started going haywire. It turned out that this was because Linux had suddenly decided that all the files in my directories were now directories! As you can imagine my IDE went berserk. To illustrate, here's (the first few lines of) the result of an "ls -al" in /home/pepijn_remote/Documents:

total 256
drwxrwxrw- 12 pepijn pepijn 0 2010-03-07 12:24 .
drwxr-xr-x 10 pepijn pepijn 0 2010-02-09 22:50 ..
-rw-r--r-- 1 pepijn pepijn 14702 2010-02-12 12:43 Afrekening Merlot.ods
-rw-r--r-- 1 pepijn pepijn 22287 2010-01-15 19:37 Afrekening New York en Atlanta.ods
-rw-r--r-- 1 pepijn pepijn 13153 2010-02-18 11:34 Amerika 2010.ods
drwxrwxrwx 3 pepijn pepijn 0 2010-01-06 13:04 Belastingdienst
Perfectly normal. But here's the result of the same command in /home/pepijn/Documents (which should be exactly the same, and has been for months):

total 12
drwxrwxrw- 12 pepijn pepijn 0 2010-03-07 12:24 .
drwxr-xr-x 139 pepijn pepijn 12288 2010-03-07 12:44 ..
drwxrwxrw- 12 pepijn pepijn 0 2010-03-07 12:24 Afrekening Merlot.ods
drwxrwxrw- 12 pepijn pepijn 0 2010-03-07 12:24 Afrekening New York en Atlanta.ods
drwxrwxrw- 12 pepijn pepijn 0 2010-03-07 12:24 Amerika 2010.ods
drwxrwxrw- 12 pepijn pepijn 0 2010-03-07 12:24 Belastingdienst
As you can see it thinks every file is a directory! In fact, the permissions of every entry are precisely the same as for ., the current directory. I have verified that the same goes for the other directories redirected using the "bind" option, they all have the same permissions as . for every file in the directory.

When it happens it plays havoc with my system, since any process which processes directories recursively (such as trackerd, the search indexer) gets stuck in an endless loop, consuming more and more resources.

It gets even more bizarre: not only does Linux think every file is a directory, but it even thinks non-existent files are directories!!! I can "cd" to a non-existent directory completely successfully as far as the shell is concerned, it even thinks I'm in the directory. Here's a snippet I copy and pasted from my terminal window:

~/Documents$ cd aasdghf
~/Documents/aasdghf$ cd fnurk
~/Documents/aasdghf/fnurk$ cd blah
Needless to say, I don't have a directory (nor a file) called aasdghf in my Documents directory. If I do an "ls" at this point I see the contents of the Documents directory (with every file listed as a directory with the same permissions as the Documents directory itself). If I try to do the same from /home/pepijn_remote I get:

/home/pepijn_remote/Documents$ cd aasdghf
bash: cd: aasdghf: No such file or directory
The problem is recurrent, but very unpredictable. When it happens, I can unmount all bound directories (after hunting down every process with open files on them) and mount them again and it will be fine for a while. When it first happened I was working in Netbeans (which I don't think had anything to do with the problem), it was not after rebooting or installing something or anything like that.

One program which seems to trigger the bug very often is Filezilla. For some reason when I start that the problem will almost always immediately occur. But not every time, and it also sometimes happens when Filezilla is not running.

I've filed a bug with Ubuntu, but they seem uninterested in helping me. I haven't received one single reply.

Hopefully someone here can help me! Is this a known problem? How can I debug it and try and find out what on Earth is going on? Many thanks in advance to anyone who can help me!

uname -a:
Linux peregrin 2.6.31-21-generic #59-Ubuntu SMP Wed Mar 24 07:28:27 UTC 2010 x86_64 GNU/Linux

mount --version:
mount from util-linux-ng 2.16 (with libblkid and selinux support)

Kind regards,
Pepijn Schmitz
Old 05-09-2010, 06:19 AM   #2
Senior Member
Registered: Oct 2004
Distribution: Fedora Core 4, 12, 13, 14, 15, 17
Posts: 2,279

Rep: Reputation: 249Reputation: 249Reputation: 249
I think you ought to read man mount and man fstab.
Forget what I wrote before, I was looking at an old version of man mount.

I suggest you use symlinks to your home directory, or use bind as specified in man mount.

Last edited by smoker; 05-09-2010 at 06:24 AM.
Old 05-10-2010, 03:34 AM   #3
Pepijn Schmitz
LQ Newbie
Registered: Sep 2006
Location: Amersfoort, The Netherlands
Posts: 8

Original Poster
Rep: Reputation: 0
Forget what you wrote before? What do you mean? Yours is the first reply.

And I am using bind exactly as specified in man mount. If you think I'm not, could you please specify what you think I'm doing wrong?

Reg. Linux user - 74778


bind, mount

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
mount --bind with vsftpd, du -h sums multiple copies of the same files stodge Linux - Software 1 12-17-2009 10:28 AM
Bind problem: config files are missing after re-install bind 9.5 on Fedora Core 8 elvisious Linux - Software 1 07-15-2008 07:49 PM
Mount NTFS so that files are not executable buts directories are nasty_daemon Slackware 6 09-20-2005 01:51 AM
How to bind users to their home directories? trees Linux - Security 6 09-16-2004 05:32 PM
BIND bug stand Linux - General 3 11-20-2002 12:45 AM > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 12:09 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration