LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices



Reply
 
Search this Thread
Old 06-03-2006, 12:47 PM   #1
ankit4u1
Member
 
Registered: Apr 2006
Distribution: Red Hat, Fedora
Posts: 97

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


hi,

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.


Quote:
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?


Quote:
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, 03:08 AM   #2
raskin
Senior Member
 
Registered: Sep 2005
Location: Russia
Distribution: NixOS (http://nixos.org)
Posts: 1,893

Rep: Reputation: 68
<As_far_as_I_know>
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, 11:22 AM   #3
jyoung4
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, 11:36 AM   #4
raskin
Senior Member
 
Registered: Sep 2005
Location: Russia
Distribution: NixOS (http://nixos.org)
Posts: 1,893

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


Reply


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


All times are GMT -5. The time now is 09:49 AM.

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