Home > Archive > Unix Programming > July 2004 > umount function call on Solaris
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
umount function call on Solaris
|
|
| Bigdakine 2004-07-28, 9:05 pm |
| I have code which requires the remote mount of a file system. Before accessing
this file system, this code first checks to see if the file server is alive. If
so, then it goes ahead and does what it needs to do on the remote file system.
Mounting this remote file system is done by the automounter.
If the file server isn't alive, I'd like this code to then umount this file
system if it is already mounted.
So as a little test, I made a small c-program which calls umount, and unmounts
a particular file system. Before running I do an ls -l on the file system which
causes it to be mounted, and then I execute the code as root. I get an error
code of zero on return.
I then run df -k, not expecting to see the remote file system present. What I
actually see is pretty weird.
server:/export/junk 0 0 0 0% /export/junk
I did an ls -l again, and then ran the code again. df -k shows two lines like
the one above.
Is there something else I should be doing besides the call to umount? Is this
perhaps do the fact that the remote fs was mounted by the automounter?
Thanks in advance,
Stuart
Dr. Stuart A. Weinstein
Ewa Beach Institute of Tectonics
"To err is human, but to really foul things up requires a creationist"
"Creationists aren't impervious to Logic: They're oblivious to it."
| |
| Barry Margolin 2004-07-28, 9:05 pm |
| In article <20040724215431.09145.00000343@mb-m01.aol.com>,
bigdakine@aol.comGetaGrip (Bigdakine) wrote:
> So as a little test, I made a small c-program which calls umount, and
> unmounts
> a particular file system. Before running I do an ls -l on the file system
> which
> causes it to be mounted, and then I execute the code as root. I get an error
> code of zero on return.
>
> I then run df -k, not expecting to see the remote file system present. What
> I
> actually see is pretty weird.
>
> server:/export/junk 0 0 0 0% /export/junk
>
> I did an ls -l again, and then ran the code again. df -k shows two lines like
> the one above.
>
> Is there something else I should be doing besides the call to umount? Is this
> perhaps do the fact that the remote fs was mounted by the automounter?
The umount() system call doesn't update /etc/fstab, /etc/xtab, or
whatever /etc file your OS uses to make the mount points visible to
user-mode applications, it just updates kernel data structures.
Applications like the mount and umount commands, and the automounter,
update this file after performing the system calls.
--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
| |
| Bigdakine 2004-07-28, 9:05 pm |
| >Subject: Re: umount function call on Solaris
>From: Barry Margolin barmar@alum.mit.edu
>Date: 7/24/04 4:30 PM Hawaiian Standard Time
>Message-id: <barmar-E6BC41.22304424072004@comcast.dca.giganews.com>
>
>In article <20040724215431.09145.00000343@mb-m01.aol.com>,
> bigdakine@aol.comGetaGrip (Bigdakine) wrote:
>
>error
>
>like
>this
>
>The umount() system call doesn't update /etc/fstab, /etc/xtab, or
>whatever /etc file your OS uses to make the mount points visible to
>user-mode applications, it just updates kernel data structures.
>Applications like the mount and umount commands, and the automounter,
>update this file after performing the system calls.
Got it. THanks.
Stuart
Dr. Stuart A. Weinstein
Ewa Beach Institute of Tectonics
"To err is human, but to really foul things up requires a creationist"
"Creationists aren't impervious to Logic: They're oblivious to it."
| |
| Andrew Gabriel 2004-07-28, 9:05 pm |
| In article <barmar-E6BC41.22304424072004@comcast.dca.giganews.com>,
Barry Margolin <barmar@alum.mit.edu> writes:
> The umount() system call doesn't update /etc/fstab, /etc/xtab, or
> whatever /etc file your OS uses to make the mount points visible to
> user-mode applications, it just updates kernel data structures.
> Applications like the mount and umount commands, and the automounter,
> update this file after performing the system calls.
In Solaris (since Solaris 8 IIRC), /etc/mnttab is not a regular
file, but is created by the kernel every time it's read, and is
a true representation of what the kernel has mounted. It is no
longer edited by the umount(1M) and other similar commands,
indeed it can't be edited anymore.
--
Andrew Gabriel
Consultant Software Engineer
| |
| Christian 2004-07-28, 9:05 pm |
| andrew@cucumber.demon.co.uk (Andrew Gabriel) wrote in message news:<ce40bc$ot0$3@new-usenet.uk.sun.com>...
> In article <barmar-E6BC41.22304424072004@comcast.dca.giganews.com>,
> Barry Margolin <barmar@alum.mit.edu> writes:
>
> In Solaris (since Solaris 8 IIRC), /etc/mnttab is not a regular
> file, but is created by the kernel every time it's read, and is
> a true representation of what the kernel has mounted. It is no
> longer edited by the umount(1M) and other similar commands,
> indeed it can't be edited anymore.
Yes, see http://blogs.sun.com/roller/page/eschrock/20040724.
| |
| Bigdakine 2004-07-28, 9:05 pm |
| >Subject: Re: umount function call on Solaris
>From: andrew@cucumber.demon.co.uk (Andrew Gabriel)
>Date: 7/26/04 12:24 PM Hawaiian Standard Time
>Message-id: <ce40bc$ot0$3@new-usenet.uk.sun.com>
>
>In article <barmar-E6BC41.22304424072004@comcast.dca.giganews.com>,
> Barry Margolin <barmar@alum.mit.edu> writes:
>
>In Solaris (since Solaris 8 IIRC), /etc/mnttab is not a regular
>file, but is created by the kernel every time it's read, and is
>a true representation of what the kernel has mounted. It is no
>longer edited by the umount(1M) and other similar commands,
>indeed it can't be edited anymore.
The system I was testing calls to umount was running 5.7. I don't know remember
if I mentioned that in my original post. For what its worth those weird entries
in the mnttab eventually disappeared.
I will try it on a system running 5.9.
Stuart
Dr. Stuart A. Weinstein
Ewa Beach Institute of Tectonics
"To err is human, but to really foul things up requires a creationist"
"Creationists aren't impervious to Logic: They're oblivious to it."
|
|
|
|
|