On 25/06/07, Maxim Veksler <[EMAIL PROTECTED]> wrote:

>  What are you trying to achieve with this trick?
>

I'm trying to develop some way to recognize if an NFS mount is active,
one way I was thinking of was transferring data from one side, and
checking if the data matched on the other.


I'm curios about few more details:

1. You know who are the client and you assume they have this NFS export
mounted but you want to make sure that they actually can read changes on the
exporter's filesystem?
2. What types of failures are you trying to identify? Server crash, client
crash/reboot? Network timeouts?
3. Is the NFS mount done dynamically or statically?
4. What NFS version?
5. Is it configured to use UDP or TCP?
6. Do all parties run Linux 2.6?

Why do you need this? Be aware that whatever test you make, you can't relay
on on it 100% because the status of the connection could change any time,
including immediately after the test passed, so whatever code relays on this
test should still accommodate for failure situations.

You are right, this is a workaround for the real problem which is : I
can't find an option to get information about the connected clients to
my exported NFS path. I assume that this is because NFS does not
maintain an active session table (It uses RPC calls, AFAIK).
This leaves to no other choice but test for mount/export validness by
transferring data over it for OK indicator.


If you want to continue in this direction then how about just writing to a
file, fsync(2) it then try to read it through NFS?
Another option (and I don't speak from experience, I don't have proper NFS
setup to test here), might be to investigate the content of /proc/fs/nfsd
(this is usually documented under the kernel source's Documentation
directory).

Cheers,

--Amos

Reply via email to