umount function call on Solaris
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Unix and Linux reviews > Free Unix support > Unix Programming > umount function call on Solaris




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    umount function call on Solaris  
Bigdakine


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
07-28-04 11:19 PM

I have code which requires the remote mount of a file system. Before accessi
ng
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 syste
m.
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 unmoun
ts
a particular file system. Before running I do an ls -l on the file system wh
ich
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 lik
e
the one above.

Is there something else I should be doing besides the call to umount? Is thi
s
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."





[ Post a follow-up to this message ]



    Re: umount function call on Solaris  
Barry Margolin


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
07-28-04 11:19 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 err
or
> code of zero on return.
>
> I then run df -k, not expecting to see the remote file system present. Wha
t
> 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 l
ike
> the one above.
>
> Is there something else I should be doing besides the call to umount? Is t
his
> 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 ***





[ Post a follow-up to this message ]



    Re: umount function call on Solaris  
Bigdakine


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
07-28-04 11:19 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."





[ Post a follow-up to this message ]



    Re: umount function call on Solaris  
Andrew Gabriel


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
07-28-04 11:19 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





[ Post a follow-up to this message ]



    Re: umount function call on Solaris  
Christian


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
07-28-04 11:19 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.





[ Post a follow-up to this message ]



    Re: umount function call on Solaris  
Bigdakine


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
07-28-04 11:19 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 remem
ber
if I mentioned that in my original post. For what its worth those weird entr
ies
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."





[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 11:19 AM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register