Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 06-03-2006, 11:47 AM   #1
Registered: Apr 2006
Distribution: Red Hat, Fedora
Posts: 97

Rep: Reputation: 15
Help needed regarding MOUNT sys. call in UNIX


I am studying UNIX file system. And i am trying to understand MOUNT system call.

Now there's are two sentences given in the book, which i could not understand.

1. There reference count of the directory inode must not be greater than 1(it must be at least 1 -why?), because of potentially dangerous side effects.
What exactly is this reference count in this case. I know wat is reference count. But can you explain me with an example? And why the reference should not be greater than 1?

2. By noting the device number of the attempted mount, the kernel can prevent other processes from mounting the same file system again, because strange things could happen if a double mount were allowed.
I tried mounting /dev/hda6 ( which is e drive in windows for my computer) on two mount points
a. on /mnt/ddrive
b. on /mnt/edrive

There was no error. And also i tried to update one of the mount points. Like i added a file to ddrive, and i observed that edrive also got updated automaticall. Then y is it written in the second sentence that strange things could happen? I already did double mounting and i din't face any problem. Yes I am using FEDORA CORE 2. Is there any difference betwn mount system call of UNIX and FEDORA CORE 2?

Hope to get a reply from you soon. Thank you.
Old 06-05-2006, 02:08 AM   #2
Senior Member
Registered: Sep 2005
Location: France
Distribution: approximately NixOS (
Posts: 1,900

Rep: Reputation: 68
1. Reference count of a directory is the number of names it has in filesystem. But in Linux it is always at least 2: its name <path> and "<path>/." . I guess these two are technically the same object in UNIX file system (which is reasonable). If reference count is bigger, it means that there are subdirectories. It is bad for mounting, because we would better care about processes with current directory inside them, which can want to make chdir(".."); repeatedly afterwards.
2. FC is not vanilla even with respect to Linux kernel, not to mention UNIX traditions. It uses heavily patched kernels. And in old traditional UNIX systems the said effect was used to evade the fun with synchronizing cached writes on different filesystems.
Old 06-05-2006, 10:22 AM   #3
LQ Newbie
Registered: Apr 2006
Location: Minneapolis, Minnesota, USA
Posts: 16

Rep: Reputation: 1
In "The Design of the UNIX Operating System" Bach says that the use count is the number of processes that are using a particular file - see section 4.1, inode use count. If another process already is using the mount point for something (e.g. open for writing) and you come along and mount a new file system on top of the mount point, the next write to that directory from the process with it already open could trash the newly mounted file system. Analogously, when you unmount file systems, no one can be using any files in the file system. That's why most shutdown scripts kill all active processes except themselves prior to unmounting the file systems.

I think raskin may be confusing reference count with link count which works as he described.
Old 06-05-2006, 10:36 AM   #4
Senior Member
Registered: Sep 2005
Location: France
Distribution: approximately NixOS (
Posts: 1,900

Rep: Reputation: 68
Yes I am, sorry. Thank you for correction.


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
question about select sys call xatzipol Programming 1 10-30-2005 09:22 AM
Write sys call failing ppy Programming 1 11-05-2004 08:57 AM
Any sys call to list all users ? dileepkk Linux - General 5 07-06-2004 06:04 PM
Kill sys call eshwar_ind Programming 4 05-07-2004 11:41 AM
any sys call to get ip address of NIC jmdey Linux - General 2 05-30-2002 03:09 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11: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