[Unionfs] mode=nfsro (Read only NFS) in 2.0

Erez Zadok ezk at cs.sunysb.edu
Sun Jul 22 18:53:43 EDT 2007


In message <469BB369.4040506 at hellosam.net>, Sam Wong writes:
> Hi,
> 
> I would like to know if mode=nfsro is gone or even in a "won't fix"
> status? It was working in Union 1.x but unfortunately I have to stick
> with a recent kernel.
> 
> As far as I can see, the NFSRO defines is still left in the inodes.c, I
> would suspect that it would be easy to add the support back into the
> code. Or am I totally wrong about that?
> 
> Many Thanks,
> Sam

Sam, I tested the latest Unionfs code with a Linux 2.6.22 NFSv3 client and
server.  I tried various options mixing readonly and readwrite exports and
mounts.  As of now, I believe that the older mode=nfsro option is no longer
necessary, as the NFS client/server code nowadays do the right thing.  In
other words, I don't think you need it at all and everything "should" work
right.

Explanation: for Unionfs to perform a copyup, it needs to know that a branch
is readonly.  That's easy when the branch itself is mounted readonly, or the
underlying f/s is mounted readonly.  However, if the branch is mounted
readwrite, but comes from an NFS server which exports the f/s as readonly,
we used to have a problem.  The problem was that the NFS client/server code,
in the case of a readonly-exported volume, was returning -EACCES instead of
-EROFS.  An EACCES error should not trigger a copyup, as that would be a
security violation.  So we had to create a special mount option which
translates EACCES on an NFS branch, to an EROFS.  That option was a hack at
best; the real answer was to get the NFS code to behave more consistently,
and it looks like it does so now (Jeff and I had a few close chats with the
NFS maintainers a few months ago -- looks like it worked :-)

You're right in that there's still some old NFSRO code left over in
unionfs2, and we might just remove it.

That said, I'd like to be sure before I remove code that may be necessary.
After all, I only tried this with a recent Linux NFS server and client
(2.6.22).  But what about other NFS servers (Solaris? BSD? etc.)

I'd like to ask those of you on this list: do you know of situations with
the latest unionfs2 code, where you *do* need an "nfsro" mount option?  Or
does unionfs2 work for you ok even with a readonly-exported NFS volume?

If it doesn't work for you, and you find that you do need nfsro support,
then please give me enough details so I can reproduce this problem on my end
and see how to best resolve it.  Otherwise I'd like to remove the remains of
this hacky code.

Thanks,
Erez.


More information about the unionfs mailing list