Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't write to FIFO file mouted via NFS

Tags:

linux

nfs

fifo

I'm trying to write to FIFO file locate on NFS mount and it blocks. What could be the problem?

My /etc/export:

/tmp/test/ 10.0.0.0/24(rw,no_root_squash,async)

ls /tmp/test on NFS server and client is the same

prw--w--w- 1 root root 0 2009-06-24 17:28 ui-input

and I'm writing as root

Thanks.

like image 806
jackhab Avatar asked Jun 24 '09 14:06

jackhab


People also ask

Which command is used for FIFO special file creation?

A program creates a FIFO special file with a mkfifo command or a mkfifo() function.

What is NFS squash?

Here, squash literally means to squash (destroy) the power of the remote root user or don't squash the power of the remote root user. root_squash prevents remote root users from having superuser (root) privileges on remote NFS-mounted volumes.


2 Answers

This response is probably too late to help you now, but it's notable that you could achieve a similar effect using named pipes and the "nc" (netcat) command. Netcat can accept input from standard input (or a named pipe) and echo it out over a socket to another instance of netcat on another host, optionally to a named pipe.

So basically, your setup would look like this:

Host1$ mkfifo Host1_named_pipe
Host1$ nc -l 1234 > Host1_named_pipe

Host2$ mkfifo Host2_named_pipe
Host2$ nc Host1 1234 < Host2_named_pipe

Now, when you run a program on Host2 and send its output to Host2_named_pipe, that output will come out of Host1_named_pipe on Host1.

or via ssh :

Host1$ mknode Host1_named_pipe p
Host2$ mknode Host2_named_pipe p

Host1$ cat Host1_named_pipe | ssh Host2 'cat - > Host2_named_pipe'
like image 70
jeremytrimble Avatar answered Oct 30 '22 18:10

jeremytrimble


A FIFO is meant to be an inter-process communication mechanism. By trying to export the FIFO via NFS, you are asking the kernel to treat the local inter-process communication as more of a network communication mechanism.

There are a number of issues associated with that, the most obvious one being that the FIFO read implementation inside the kernel expects a buffer in userspace to copy the data to. Such a buffer is not directly available in NFS. Thus, the Kernel does not support the export of FIFOs over NFS.

You may want to use sockets for network communication instead.

like image 33
Divye Kapoor Avatar answered Oct 30 '22 20:10

Divye Kapoor