Read only and read/write NFS mounts on Fedora

I share several directories from my Debian server to other machines on the network using NFS. On one of these machines, which runs Fedora Core, some of the directories are mounted read-only, whereas others are mounted read/write. After upgrading to FC6 recently, I noticed that they’d all become read-only.

After looking into this I discovered that starting with 2.6.19, NFS groups directories from the same filesystem on the server, and treats them as the same filesystem on the client. Trond Myklebust, the maintainer of the NFS client, explained in this post to the Linux Kernel Mailing List:

“The new NFS mount code will put those in the same superblock, and whichever directory gets mounted first will determine whether or not the superblock is marked as read-only.”

If you’re interested in the full details, the change was made in commit 54ceac4515986030c2502960be620198dd8fe25b, entitled “NFS: Share NFS superblocks per-protocol per-server per-FSID”. This change isn’t mentioned on the KernelNewbies changelog for 2.6.19, but is of course in the official 2.6.19 changelog.

Here’s what happens on a new install of FC6:

[root@fc6test ~]# uname -a
Linux fc6test 2.6.18-1.2798.fc6 #1 SMP Mon Oct 16 14:54:20 EDT 2006 i686 athlon i386 GNU/Linux
[root@fc6test ~]# mkdir /mnt/{music,tmp}
[root@fc6test ~]# mount /mnt/music -r
[root@fc6test ~]# mount /mnt/tmp -w
[root@fc6test ~]# touch /mnt/music/xxx
touch: cannot touch `/mnt/music/xxx': Read-only file system
[root@fc6test ~]# touch /mnt/tmp/xxx
touch: cannot touch `/mnt/tmp/xxx': Read-only file system

Both mounts are read-only, despite the second one being mounted read/write. Also, while the output from mount and the contents of /etc/mtab say that music is read-only and tmp is read/write, the contents of /proc/mounts says that both are read-only.

Fedora Core 6 originally came with the 2.6.18-1.2798 kernel when it was released in October. This NFS problem affected FC6 from the beginning (despite the 2.6.18 kernel) because Red Hat backported the NFS change to their 2.6.18 kernel package.

Fedora Core 5 also exhibits this behaviour if you upgrade it to the latest kernel (2.6.19-1.2288 at present).

Several other people have reported this (see Red Hat bug 207670, this LKML post and Launchpad bug #75729).

This entry was posted in Uncategorized and tagged , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s