linux/fs/nfs
Neil Brown 4c1fe2f78a kernel BUG at fs/nfs/namespace.c:108! - can be triggered by bad server
Hi Trond,

I have discovered that the BUG_ON in nfs_follow_mountpoint:

	BUG_ON(IS_ROOT(dentry));

can be triggered by a misbehaving server.

What happens is the client does a lookup and discoveres that the named
directory has a different fsid, so it initiates a mount.
It then performs a GETATTR on the mounted directory and gets a
different fsid again (due to a bug in the NFS server).
This causes nfs_follow_mountpoint to be called on the newly mounted
root, which triggers the BUG_ON.

To duplicate this, have a directory which contains some mountpoints,
and export that directory with the "crossmnt" flag using nfs-utils
1.1.1 (or 1.1.0 I think)

The GETATTR on the root of the mounted filesystem will return the
information for the top exportpoint, while a lookup will return the
correct information.  This difference causes the NFS client to BUG.

I think the best way to fix this is to trap this possibility early, so
just before completing the mount in the NFS client, check that it isn't
going to use nfs_mountpoint_inode_operations.
As long as i_op will never change once set (is that true?), this
should be adequately safe.

The following patch shows a possible approach, and it works for me.
i.e. when the NFS server is misbehaving, I get ESTALE on those
mountpoints, while when the NFS server is working correctly, I get
correct behaviour on the client.

NeilBrown

Signed-off-by: Neil Brown <neilb@suse.de>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
2007-11-17 13:08:48 -05:00
..
callback.c Freezer: make kernel threads nonfreezable by default 2007-07-17 10:23:02 -07:00
callback.h NFS: Fix more sparse warnings 2007-05-14 19:33:46 -04:00
callback_proc.c [PATCH] fs/nfs/callback* passes error values big-endian 2006-10-20 10:26:40 -07:00
callback_xdr.c NFSv4: debug print ntohl(status) in nfs client callback xdr code 2007-07-19 15:21:40 -04:00
client.c mm: bdi init hooks 2007-10-17 08:42:45 -07:00
delegation.c NFSv4: Fix an rpc_cred reference leakage in fs/nfs/delegation.c 2007-10-19 17:19:30 -04:00
delegation.h NFSv4: Use RCU to protect delegations 2007-07-10 23:40:41 -04:00
dir.c NFS: Fix a race in sillyrename 2007-10-19 17:19:16 -04:00
direct.c NFS: Fix for bug in handling of errors for O_DIRECT writes 2007-10-23 16:41:21 -07:00
file.c NFSv4: Ensure that we wait for the CLOSE request to complete 2007-10-19 17:19:25 -04:00
getroot.c NFS: Fix the ustat() regression 2007-11-17 13:08:44 -05:00
idmap.c NFS: use __set_current_state() 2007-05-09 17:58:01 -04:00
inode.c NFSv4: Ensure that we wait for the CLOSE request to complete 2007-10-19 17:19:25 -04:00
internal.h NFS: use in-kernel mount argument structure for nfsv4 mounts 2007-10-09 17:17:28 -04:00
iostat.h NFSv4: Fix an oops in nfs4_fill_super 2006-03-20 13:44:48 -05:00
Makefile [NFS] [PATCH] nfs: tiny makefile cleanup 2007-10-09 17:15:36 -04:00
mount_clnt.c NFS: Improve debugging output in NFS in-kernel mount client 2007-07-10 23:40:47 -04:00
namespace.c NFS: Fix use of cancel_delayed_work_sync in nfs_release_automount_timer 2007-09-01 10:14:36 -04:00
nfs2xdr.c SUNRPC: mark bulk read/write data in xdrbuf 2007-10-09 17:17:34 -04:00
nfs3acl.c NFS: Remove nfs_begin_data_update/nfs_end_data_update 2007-10-09 17:19:53 -04:00
nfs3proc.c NFS: Use nfs_refresh_inode() in ops that aren't expected to change the inode 2007-10-09 17:20:45 -04:00
nfs3xdr.c SUNRPC: mark bulk read/write data in xdrbuf 2007-10-09 17:17:34 -04:00
nfs4_fs.h nfs: Fix build break with CONFIG_NFS_V4=n 2007-10-19 19:27:46 -07:00
nfs4namespace.c NFSv4: /proc/mounts displays the wrong server name for referrals 2007-02-03 15:35:10 -08:00
nfs4proc.c NFSv4: Ensure that we wait for the CLOSE request to complete 2007-10-19 17:19:25 -04:00
nfs4renewd.c NFS: Replace flush_scheduled_work with cancel_work_sync() and friends 2007-08-07 16:12:50 -04:00
nfs4state.c NFSv4: Ensure that we wait for the CLOSE request to complete 2007-10-19 17:19:25 -04:00
nfs4xdr.c NFSv4: Make NFSv4 ACCESS calls return attributes too... 2007-10-09 17:18:38 -04:00
nfsroot.c Convert files to UTF-8 and some cleanups 2007-10-19 23:21:04 +02:00
pagelist.c mm: Remove slab destructors from kmem_cache_create(). 2007-07-20 10:11:58 +09:00
proc.c NFSv2: Ensure that the directory metadata gets revalidated on file create 2007-10-21 13:37:02 -04:00
read.c NFS: Fix atime revalidation in read() 2007-10-09 17:19:06 -04:00
super.c kernel BUG at fs/nfs/namespace.c:108! - can be triggered by bad server 2007-11-17 13:08:48 -05:00
symlink.c header cleaning: don't include smp_lock.h when not used 2007-05-08 11:15:07 -07:00
sysctl.c [PATCH] nfs: fix congestion control 2007-03-16 19:25:05 -07:00
unlink.c NFS: Fix a typo in nfs_call_unlink() 2007-10-21 13:37:07 -04:00
write.c NFS: Fix a writeback race... 2007-10-19 17:18:57 -04:00