All of lore.kernel.org
 help / color / mirror / Atom feed
* how to execute a script from NFS mount (which disconnected)?
@ 2007-05-22 10:37 Tomasz Chmielewski
  2007-05-22 12:10 ` Trond Myklebust
  2007-05-22 12:42 ` Neil Brown
  0 siblings, 2 replies; 7+ messages in thread
From: Tomasz Chmielewski @ 2007-05-22 10:37 UTC (permalink / raw)
  To: nfs

This question may sound silly, but I didn't find a proper solution to it.

I have a script on a NFS share. The purpose of this script is to do some 
network reconfiguration for Xen.

Unfortunately, it fails to execute somewhere in the middle.

Basically, the script brings the network interface down, does a bit of 
reconfiguring, and then, the interface is brought up.


In a short form, the script looks like that:

#!/bin/bash

echo Start

ifdown bond0

echo Step 1...
sleep 4s

echo Step 2...
sleep 4s

echo Step 3...
sleep 4s

echo Step 4...
sleep 4s

echo Step 5...
sleep 4s

ifup bond0

echo End



Unfortunately, when I execute it locally, the script freezes somewhere 
about step 2 or 3. Which I could perfectly understand - as the system 
can't read it.
But I did a "cat script" just before running it - so the system should 
have it cached, right?
Sometimes only, the script executes fully.


How can I execute a script from NSF mount - a script which reconfigures 
a network interface, and there is a period of network disconnection?


-- 
Tomasz Chmielewski
http://wpkg.org

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
NFS maillist  -  NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: how to execute a script from NFS mount (which disconnected)?
  2007-05-22 10:37 how to execute a script from NFS mount (which disconnected)? Tomasz Chmielewski
@ 2007-05-22 12:10 ` Trond Myklebust
  2007-05-22 12:17   ` Tomasz Chmielewski
  2007-05-22 12:42 ` Neil Brown
  1 sibling, 1 reply; 7+ messages in thread
From: Trond Myklebust @ 2007-05-22 12:10 UTC (permalink / raw)
  To: Tomasz Chmielewski; +Cc: nfs

On Tue, 2007-05-22 at 12:37 +0200, Tomasz Chmielewski wrote:
> How can I execute a script from NSF mount - a script which reconfigures 
> a network interface, and there is a period of network disconnection?

Copy it to a RAMFS partition and execute it there.

Trond


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
NFS maillist  -  NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: how to execute a script from NFS mount (which disconnected)?
  2007-05-22 12:10 ` Trond Myklebust
@ 2007-05-22 12:17   ` Tomasz Chmielewski
  2007-05-22 12:25     ` Jeff Layton
  2007-05-22 12:41     ` Trond Myklebust
  0 siblings, 2 replies; 7+ messages in thread
From: Tomasz Chmielewski @ 2007-05-22 12:17 UTC (permalink / raw)
  To: Trond Myklebust; +Cc: nfs

Trond Myklebust schrieb:
> On Tue, 2007-05-22 at 12:37 +0200, Tomasz Chmielewski wrote:
>> How can I execute a script from NSF mount - a script which reconfigures 
>> a network interface, and there is a period of network disconnection?
> 
> Copy it to a RAMFS partition and execute it there.

No, that's not a good solution. Or a solution I would want to use.

I use the same script on systems having rootfs on iSCSI. And they also 
disconnect for a brief period of time.
There, everything works properly if I just "preload"/cache the 
script/programs with something like:

	cat script &>/dev/null
	program --help &>/dev/null

Then, I can disconnect the station for several minutes, but the system 
will have the programs/scripts cached, and will be able to use them.


I would like to do something similar with NFS. Isn't there a 
"disconnected" mode for NSF (or "cached", etc.)?


-- 
Tomasz Chmielewski
http://wpkg.org

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
NFS maillist  -  NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: how to execute a script from NFS mount (which disconnected)?
  2007-05-22 12:17   ` Tomasz Chmielewski
@ 2007-05-22 12:25     ` Jeff Layton
  2007-05-22 12:29       ` Jeff Layton
  2007-05-22 12:41     ` Trond Myklebust
  1 sibling, 1 reply; 7+ messages in thread
From: Jeff Layton @ 2007-05-22 12:25 UTC (permalink / raw)
  To: nfs

On Tue, 22 May 2007 14:17:49 +0200
Tomasz Chmielewski <mangoo@wpkg.org> wrote:

> Trond Myklebust schrieb:
> > On Tue, 2007-05-22 at 12:37 +0200, Tomasz Chmielewski wrote:
> >> How can I execute a script from NSF mount - a script which reconfigures 
> >> a network interface, and there is a period of network disconnection?
> > 
> > Copy it to a RAMFS partition and execute it there.
> 
> No, that's not a good solution. Or a solution I would want to use.
> 
> I use the same script on systems having rootfs on iSCSI. And they also 
> disconnect for a brief period of time.
> There, everything works properly if I just "preload"/cache the 
> script/programs with something like:
> 
> 	cat script &>/dev/null
> 	program --help &>/dev/null
> 
> Then, I can disconnect the station for several minutes, but the system 
> will have the programs/scripts cached, and will be able to use them.
> 
> 
> I would like to do something similar with NFS. Isn't there a 
> "disconnected" mode for NSF (or "cached", etc.)?
> 

Nope. NFS will (likely) want to check the attributes on the file to make sure
it's not changed before executing it. Copying it to a secondary location is
what you'll want to do.

<idle speculation>
I wonder if you could do something like this on NFSv4 with delegations?
</idle speculation>

> 
> -- 
> Tomasz Chmielewski
> http://wpkg.org
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> NFS maillist  -  NFS@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/nfs
> 


-- 
Jeff Layton <jlayton@redhat.com>

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
NFS maillist  -  NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: how to execute a script from NFS mount (which disconnected)?
  2007-05-22 12:25     ` Jeff Layton
@ 2007-05-22 12:29       ` Jeff Layton
  0 siblings, 0 replies; 7+ messages in thread
From: Jeff Layton @ 2007-05-22 12:29 UTC (permalink / raw)
  To: mangoo; +Cc: nfs

On Tue, 22 May 2007 08:25:54 -0400
Jeff Layton <jlayton@redhat.com> wrote:

> On Tue, 22 May 2007 14:17:49 +0200
> Tomasz Chmielewski <mangoo@wpkg.org> wrote:
> 
> > Trond Myklebust schrieb:
> > > On Tue, 2007-05-22 at 12:37 +0200, Tomasz Chmielewski wrote:
> > >> How can I execute a script from NSF mount - a script which reconfigures 
> > >> a network interface, and there is a period of network disconnection?
> > > 
> > > Copy it to a RAMFS partition and execute it there.
> > 
> > No, that's not a good solution. Or a solution I would want to use.
> > 
> > I use the same script on systems having rootfs on iSCSI. And they also 
> > disconnect for a brief period of time.
> > There, everything works properly if I just "preload"/cache the 
> > script/programs with something like:
> > 
> > 	cat script &>/dev/null
> > 	program --help &>/dev/null
> > 
> > Then, I can disconnect the station for several minutes, but the system 
> > will have the programs/scripts cached, and will be able to use them.
> > 
> > 
> > I would like to do something similar with NFS. Isn't there a 
> > "disconnected" mode for NSF (or "cached", etc.)?
> > 
> 
> Nope. NFS will (likely) want to check the attributes on the file to make sure
> it's not changed before executing it. Copying it to a secondary location is
> what you'll want to do.
> 
> <idle speculation>
> I wonder if you could do something like this on NFSv4 with delegations?
> </idle speculation>
> 

If it's falling down in the middle of execution, however, the problem may be
that the path or something is crossing onto an NFS mount, or it could be
hanging on something like NIS. You may want to try stracing it to see what
system call it's trying to execute when the hang occurs...

> > 
> > -- 
> > Tomasz Chmielewski
> > http://wpkg.org
> > 
> > -------------------------------------------------------------------------
> > This SF.net email is sponsored by DB2 Express
> > Download DB2 Express C - the FREE version of DB2 express and take
> > control of your XML. No limits. Just data. Click to get it now.
> > http://sourceforge.net/powerbar/db2/
> > _______________________________________________
> > NFS maillist  -  NFS@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/nfs
> > 
> 
> 
> -- 
> Jeff Layton <jlayton@redhat.com>
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> NFS maillist  -  NFS@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/nfs
> 


-- 
Jeff Layton <jlayton@redhat.com>

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
NFS maillist  -  NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: how to execute a script from NFS mount (which disconnected)?
  2007-05-22 12:17   ` Tomasz Chmielewski
  2007-05-22 12:25     ` Jeff Layton
@ 2007-05-22 12:41     ` Trond Myklebust
  1 sibling, 0 replies; 7+ messages in thread
From: Trond Myklebust @ 2007-05-22 12:41 UTC (permalink / raw)
  To: Tomasz Chmielewski; +Cc: nfs

On Tue, 2007-05-22 at 14:17 +0200, Tomasz Chmielewski wrote:
> Trond Myklebust schrieb:
> > On Tue, 2007-05-22 at 12:37 +0200, Tomasz Chmielewski wrote:
> >> How can I execute a script from NSF mount - a script which reconfigures 
> >> a network interface, and there is a period of network disconnection?
> > 
> > Copy it to a RAMFS partition and execute it there.
> 
> No, that's not a good solution. Or a solution I would want to use.
> 
> I use the same script on systems having rootfs on iSCSI. And they also 
> disconnect for a brief period of time.
> There, everything works properly if I just "preload"/cache the 
> script/programs with something like:
> 
> 	cat script &>/dev/null
> 	program --help &>/dev/null
> 
> Then, I can disconnect the station for several minutes, but the system 
> will have the programs/scripts cached, and will be able to use them.
> 
> 
> I would like to do something similar with NFS. Isn't there a 
> "disconnected" mode for NSF (or "cached", etc.)?

Feel free to write one. Otherwise, the only solution I can propose for
you is the one I just mentioned.

Trond


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
NFS maillist  -  NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: how to execute a script from NFS mount (which disconnected)?
  2007-05-22 10:37 how to execute a script from NFS mount (which disconnected)? Tomasz Chmielewski
  2007-05-22 12:10 ` Trond Myklebust
@ 2007-05-22 12:42 ` Neil Brown
  1 sibling, 0 replies; 7+ messages in thread
From: Neil Brown @ 2007-05-22 12:42 UTC (permalink / raw)
  To: Tomasz Chmielewski; +Cc: nfs

On Tuesday May 22, mangoo@wpkg.org wrote:
> This question may sound silly, but I didn't find a proper solution to it.
> 
> I have a script on a NFS share. The purpose of this script is to do some 
> network reconfiguration for Xen.
> 
> Unfortunately, it fails to execute somewhere in the middle.
> 
> Basically, the script brings the network interface down, does a bit of 
> reconfiguring, and then, the interface is brought up.
...
> 
> 
> Unfortunately, when I execute it locally, the script freezes somewhere 
> about step 2 or 3. Which I could perfectly understand - as the system 
> can't read it.

Not really.  bash reads the whole script before executing it - or at
least it did in my limited tests.  strace would confirm.

My guess is that your $PATH includes a directory that is on the NFS
mounted volume - so when bash looks for e.g. 'sleep', it looks on the
NFS mounted volume and hangs.
Try running the script with "strace -f".  It might be noisy, but it
will show you what is blocking.

NeilBrown

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
NFS maillist  -  NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2007-05-22 12:42 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-22 10:37 how to execute a script from NFS mount (which disconnected)? Tomasz Chmielewski
2007-05-22 12:10 ` Trond Myklebust
2007-05-22 12:17   ` Tomasz Chmielewski
2007-05-22 12:25     ` Jeff Layton
2007-05-22 12:29       ` Jeff Layton
2007-05-22 12:41     ` Trond Myklebust
2007-05-22 12:42 ` Neil Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.