[SRU][J:linux-gke/J:linux-gkeop/N:linux-gke/N:linux-gkeop][PATCH 0/1] nfs: clear SB_RDONLY before getting superblock

Ian Whitfield ian.whitfield at canonical.com
Wed Apr 23 22:21:30 UTC 2025


BugLink: https://bugs.launchpad.net/bugs/2108862

[Impact]
Google: "We discovered an issue with upstream patch
52cb7f8f177878b4f22397b9c4d2c8f743766be3 that caused RW nfs mounts to be mounted
as RO when there was an existing nfs RO mount on the same node."

The break commit was found on jammy:gke/gkeop and noble:gke/gkeop.

[Fix]
Apply the fix proposed on lkml at
https://lore.kernel.org/lkml/20250304130533.549840-1-lilingfeng3@huawei.com/T/

The commit titled "nfs: clear SB_RDONLY before getting superblock" should
address the issue. Because it has not been applied to any trees, it will be
initially applied as an UBUNTU: SAUCE: patch.

[Test]
A reproducer was included with the initial bug report at
https://www.spinics.net/lists/linux-nfs/msg109544.html

# Reproducer
mkdir -p /export/{stuff,things}/dir{1,2,3,4}
echo '/export/stuff *(rw)' >> /etc/exports
echo '/export/things *(rw)' >> /etc/exports
systemctl restart nfs-server

mount -t nfs -o ro,vers=3 localhost:/export/stuff /mnt/stuff
mount -t nfs -o rw,vers=3 localhost:/export/things /mnt/things
grep -w nfs /proc/mounts
# note that both mountpoints are ro, despite the explicit ro/rw options
# reversing the order of mounts gives a different result

I've confirmed that the bug is reproduced on noble:linux-gke and jammy:linux-gke
and that the patched versions of the kernel do not reproduce the issue. After
the fix, the read only mount is properly tagged as read only, and the read/write
mount is properly tagged as read/write.

[Where problems could occur]
This is a fairly small patch which directly addresses a reproducible issue,
so its scope of influence should be pretty limited. We do take some risk by
applying this patch before it has been approved by upstream maintainers, so this
won't be going into generic kernels until then.

Li Lingfeng (1):
  UBUNTU: SAUCE: nfs: clear SB_RDONLY before getting superblock

 fs/nfs/super.c | 9 +++++++++
 1 file changed, 9 insertions(+)

-- 
2.43.0




More information about the kernel-team mailing list