Re: 2.6.20.2: kernel BUG at fs/nfs/write.c:505!

From: Trond Myklebust
Date: Mon Mar 12 2007 - 13:00:54 EST


On Mon, 2007-03-12 at 14:39 +0100, Stresslinux Kernel wrote:
> Hello List,
>
> running the following command
>
> /sbin/grub-install --root-directory=/mnt --no-floppy /dev/sda
>
> from a nfsroot system with kernel 2.6.20.2 (x86_64) results in:
>
> ------------[ cut here ]------------
> kernel BUG at fs/nfs/write.c:505!
> invalid opcode: 0000 [1] SMP
> CPU 0
> Modules linked in: ipv6 genrtc
> Pid: 1464, comm: grub-install Not tainted 2.6.20.2 #1
> RIP: 0010:[<ffffffff8032fb83>] [<ffffffff8032fb83>] nfs_wait_on_requests_locked+0x43/0xb2
> RSP: 0018:ffff81007d669ca8 EFLAGS: 00010246
> RAX: 00000000fffff0ba RBX: 0000000000000000 RCX: ffffffff802917aa
> RDX: 0000000000000000 RSI: ffff81007d669cb0 RDI: ffff810002f5f9d8
> RBP: ffff810002f5f898 R08: 0000000000000001 R09: 0000000000000286
> R10: 7fffffffffffffff R11: 0000000000000286 R12: 74d83948d2310001
> R13: 0000000000000000 R14: ffffffffffffffff R15: 0000000000000000
> FS: 00002b24eb8214a0(0000) GS:ffffffff809d6000(0000) knlGS:0000000000000000
> CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b
> CR2: 0000000000596d88 CR3: 000000007d594000 CR4: 00000000000006e0
> Process grub-install (pid: 1464, threadinfo ffff81007d668000, task ffff81007e885840)
> Stack: ffff810002f5f898 ffffffff802917aa 0000000000000000 ffff810002f5fb58
> 0000000000000020 ffff810002f5f898 ffff81007d669da8 ffffffff80331245
> 000000000000002e ffff81007d669e48 0000000000000020 0000000000000000
> Call Trace:
> [<ffffffff802917aa>] bd_forget+0x8d/0x8e
> [<ffffffff80331245>] nfs_sync_mapping_wait+0xbe/0x1ec
> [<ffffffff80331486>] nfs_sync_mapping_range+0x80/0xa1
> [<ffffffff80328a1c>] nfs_getattr+0x2e/0x9b
> [<ffffffff80272313>] vfs_getattr+0x1d/0x2b
> [<ffffffff802723aa>] vfs_lstat_fd+0x2f/0x47
> [<ffffffff8021c3ce>] do_page_fault+0x279/0x572
> [<ffffffff80237c17>] do_sigaction+0x6b/0x1b0
> [<ffffffff8027270a>] sys_newlstat+0x19/0x31
> [<ffffffff807231ed>] error_exit+0x0/0x84
> [<ffffffff80209dde>] system_call+0x7e/0x83
>
>
> Code: 0f 0b eb fe f0 ff 41 44 c7 85 18 01 00 00 01 00 00 00 48 8b
> RIP [<ffffffff8032fb83>] nfs_wait_on_requests_locked+0x43/0xb2
> RSP <ffff81007d669ca8>

Known issue. There is already a fix available in the -mm kernel
(attached).

Cheers
Trond

commit 090ad38f8ceea3cc048981e9fe9cc62ed43fee58
Author: Trond Myklebust <Trond.Myklebust@xxxxxxxxxx>
Date: Tue Feb 20 19:28:07 2007 -0500

NFS: nfs_getattr() can't call nfs_sync_mapping_range() for non-regular files

Signed-off-by: Trond Myklebust <Trond.Myklebust@xxxxxxxxxx>

diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index af53c02..93d046c 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -429,7 +429,8 @@ int nfs_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat)
int err;

/* Flush out writes to the server in order to update c/mtime */
- nfs_sync_mapping_range(inode->i_mapping, 0, 0, FLUSH_NOCOMMIT);
+ if (S_ISREG(inode->i_mode))
+ nfs_sync_mapping_range(inode->i_mapping, 0, 0, FLUSH_NOCOMMIT);

/*
* We may force a getattr if the user cares about atime.