linux-stable/fs/nfs
Weston Andros Adamson d201c4de51 pnfs: fix race in filelayout commit path
Hold the lock while modifying commit info dataserver buckets.

The following oops can be reproduced by running iozone for a while against
a 2 DS pynfs filelayout server.

general protection fault: 0000 [#1] SMP DEBUG_PAGEALLOC
Modules linked in: nfs_layout_nfsv41_files rpcsec_gss_krb5 nfsv4 nfs fscache
CPU: 0 PID: 903 Comm: iozone Not tainted 3.15.0-rc1-branch-dros_testing+ #44
Hardware name: VMware, Inc. VMware Virtual Platform/440BX Desktop Reference
task: ffff880078164480 ti: ffff88006e972000 task.ti: ffff88006e972000
RIP: 0010:[<ffffffffa01936e1>]  [<ffffffffa01936e1>] nfs_init_commit+0x22/0x
RSP: 0018:ffff88006e973d30  EFLAGS: 00010246
RAX: ffff88006e973e00 RBX: ffff88006e828800 RCX: ffff88006e973e10
RDX: 0000000000000000 RSI: ffff88006e973e00 RDI: dead4ead00000000
RBP: ffff88006e973d38 R08: ffff88006e8289d8 R09: 0000000000000000
R10: ffff88006e8289d8 R11: 0000000000016988 R12: ffff88006e973b98
R13: ffff88007a0a6648 R14: ffff88006e973e10 R15: ffff88006e828800
FS:  00007f2ce396b740(0000) GS:ffff88007f200000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f03278a1000 CR3: 0000000079043000 CR4: 00000000001407f0
Stack:
ffff88006e8289d8 ffff88006e973da8 ffffffffa00f144f ffff88006e9478c0
ffff88006e973e00 ffff88006de21080 0000000100000002 ffff880079be6c48
ffff88006e973d70 ffff88006e973d70 ffff88006e973e10 ffff88006de21080
Call Trace:
[<ffffffffa00f144f>] filelayout_commit_pagelist+0x1ae/0x34a [nfs_layout_nfsv
[<ffffffffa0194f72>] nfs_generic_commit_list+0x92/0xc4 [nfs]
[<ffffffffa0195053>] nfs_commit_inode+0xaf/0x114 [nfs]
[<ffffffffa01892bd>] nfs_file_fsync_commit+0x82/0xbe [nfs]
[<ffffffffa01ceb0d>] nfs4_file_fsync+0x59/0x9b [nfsv4]
[<ffffffff8114ee3c>] vfs_fsync_range+0x18/0x20
[<ffffffff8114ee60>] vfs_fsync+0x1c/0x1e
[<ffffffffa01891c2>] nfs_file_flush+0x7f/0x84 [nfs]
[<ffffffff81127a43>] filp_close+0x3c/0x72
[<ffffffff81140e12>] __close_fd+0x82/0x9a
[<ffffffff81127a9c>] SyS_close+0x23/0x4c
[<ffffffff814acd12>] system_call_fastpath+0x16/0x1b
Code: 5b 41 5c 41 5d 41 5e 5d c3 0f 1f 44 00 00 55 48 89 e5 53 48 89 fb 48 8
RIP  [<ffffffffa01936e1>] nfs_init_commit+0x22/0xe1 [nfs]
RSP <ffff88006e973d30>
---[ end trace 732fe6419b235e2f ]---

Suggested-by: Trond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: Weston Andros Adamson <dros@primarydata.com>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
2014-05-29 11:11:42 -04:00
..
blocklayout NFS: Create a common read and write data struct 2014-05-28 18:12:47 -04:00
objlayout NFS: Create a common read and write data struct 2014-05-28 18:12:47 -04:00
cache_lib.c NFS: simplify and clean cache library 2013-02-15 10:43:36 -05:00
cache_lib.h NFS: simplify and clean cache library 2013-02-15 10:43:36 -05:00
callback.c nfs: Use PTR_ERR_OR_ZERO in 'nfs41_callback_up' function 2013-10-28 18:16:55 -04:00
callback.h NFS: Add in v4.2 callback operation 2013-06-08 16:20:18 -04:00
callback_proc.c NFSv4.1: Minor optimisation in get_layout_by_fh_locked() 2014-02-19 21:21:06 -05:00
callback_xdr.c Merge branch 'labeled-nfs' into linux-next 2013-06-28 16:29:51 -04:00
client.c NFS: cache parsed auth_info in nfs_server 2013-10-28 15:37:43 -04:00
delegation.c NFS: Fix a delegation callback race 2014-03-02 22:03:12 -05:00
delegation.h NFSv4: Fix CB_RECALL_ANY to only return delegations that are not in use 2013-04-05 17:03:57 -04:00
dir.c NFS client updates for Linux 3.15 2014-04-06 10:09:38 -07:00
direct.c NFS: Move the write verifier into the nfs_pgio_header 2014-05-28 18:39:38 -04:00
dns_resolve.c NFS: Enabling v4.2 should not recompile nfsd and lockd 2013-11-19 16:20:40 -05:00
dns_resolve.h
file.c mm: implement ->map_pages for page cache 2014-04-07 16:35:53 -07:00
fscache-index.c
fscache.c NFS: Use i_writecount to control whether to get an fscache cookie in nfs_open() 2013-09-27 18:40:25 +01:00
fscache.h NFS: Use i_writecount to control whether to get an fscache cookie in nfs_open() 2013-09-27 18:40:25 +01:00
getroot.c NFS: Fix memroy leak for double mounts 2014-04-15 10:29:25 -04:00
idmap.c NFSv4: Convert idmapper to use the new framework for pipefs dentries 2013-09-01 11:12:42 -04:00
inode.c NFS: Don't declare inode uptodate unless all attributes were checked 2014-04-15 23:24:43 -04:00
internal.h NFS: Create a common nfs_pageio_ops struct 2014-05-29 11:11:41 -04:00
iostat.h
Kconfig nfs: fix pnfs Kconfig defaults 2013-11-15 13:41:43 -05:00
Makefile NFS: Enable slot table helpers for NFSv4.0 2013-09-03 15:26:33 -04:00
mount_clnt.c nfs: have nfs_mount fake up a auth_flavs list when the server didn't provide it 2013-06-28 15:51:51 -04:00
namespace.c nfs: use %p[dD] instead of open-coded (and often racy) equivalents 2013-10-24 23:34:50 -04:00
netns.h nfs: include NFSv4 header in netns.h 2012-10-02 08:17:02 -07:00
nfs.h NFS: Convert v4 into a module 2012-07-30 19:06:52 -04:00
nfs2super.c NFS: Convert v2 into a module 2012-07-30 19:06:41 -04:00
nfs2xdr.c NFS: Create a common results structure for reads and writes 2014-05-28 18:12:43 -04:00
nfs3acl.c NFSv3: Fix return value of nfs3_proc_setacls 2014-02-03 13:14:23 -05:00
nfs3client.c NFS: Only initialize the ACL client in the v3 case 2012-07-30 19:05:54 -04:00
nfs3proc.c NFS: Create a common pgio_rpc_prepare function 2014-05-28 18:40:28 -04:00
nfs3super.c nfs: use generic posix ACL infrastructure for v3 Posix ACLs 2014-01-26 08:26:20 -05:00
nfs3xdr.c NFS: Create a common results structure for reads and writes 2014-05-28 18:12:43 -04:00
nfs4_fs.h NFS: Create a common read and write data struct 2014-05-28 18:12:47 -04:00
nfs4client.c NFSv4: Schedule recovery if nfs40_walk_client_list() is interrupted 2014-03-19 08:34:20 -04:00
nfs4file.c nfs: commit layouts in fdatasync 2014-05-28 17:45:30 -04:00
nfs4filelayout.c pnfs: fix race in filelayout commit path 2014-05-29 11:11:42 -04:00
nfs4filelayout.h NFSv4.1: Use layout credentials for get_deviceinfo calls 2013-06-06 16:24:37 -04:00
nfs4filelayoutdev.c nfs: fix dead code of ipv6_addr_scope 2014-01-05 15:38:21 -05:00
nfs4getroot.c NFSv4: Fix security auto-negotiation 2013-09-07 16:18:30 -04:00
nfs4namespace.c NFSv4: Use the correct net namespace in nfs4_update_server 2014-02-17 14:15:46 -05:00
nfs4proc.c NFS: Create a common pgio_rpc_prepare function 2014-05-28 18:40:28 -04:00
nfs4renewd.c workqueue: use mod_delayed_work() instead of cancel + queue 2012-08-13 16:27:37 -07:00
nfs4session.c NFSv4.1: nfs4_destroy_session must call rpc_destroy_waitqueue 2014-02-01 15:13:39 -05:00
nfs4session.h NFSv4.1: nfs4_destroy_session must call rpc_destroy_waitqueue 2014-02-01 15:13:39 -05:00
nfs4state.c NFSv4: Ensure we respect soft mount timeouts during trunking discovery 2014-03-19 08:34:40 -04:00
nfs4super.c mm + fs: store shadow entries in page cache 2014-04-03 16:21:01 -07:00
nfs4sysctl.c nfs: include nfs4_fh.h in nfs4sysctl.c 2012-10-02 08:17:03 -07:00
nfs4trace.c NFSv4.1: Add tracepoints for debugging slot table operations 2013-08-22 08:58:27 -04:00
nfs4trace.h NFS: Create a common read and write data struct 2014-05-28 18:12:47 -04:00
nfs4xdr.c NFS: Create a common results structure for reads and writes 2014-05-28 18:12:43 -04:00
nfsroot.c
nfstrace.c NFS: Add event tracing for generic NFS lookups 2013-08-22 08:58:18 -04:00
nfstrace.h NFS: fix the handling of NFS_INO_INVALID_DATA flag in nfs_revalidate_mapping 2014-01-27 15:35:56 -05:00
pagelist.c NFS: Create a common nfs_pageio_ops struct 2014-05-29 11:11:41 -04:00
pnfs.c NFS: Create a generic_pgio function 2014-05-28 18:41:12 -04:00
pnfs.h NFS: Create a common read and write data struct 2014-05-28 18:12:47 -04:00
pnfs_dev.c hlist: drop the node parameter from iterators 2013-02-27 19:10:24 -08:00
proc.c NFS: Create a common pgio_rpc_prepare function 2014-05-28 18:40:28 -04:00
read.c NFS: Create a common nfs_pageio_ops struct 2014-05-29 11:11:41 -04:00
super.c fs: push sync_filesystem() down to the file system's remount_fs() 2014-03-13 10:14:33 -04:00
symlink.c
sysctl.c NFS: Initialize v4 sysctls from nfs_init_v4() 2012-07-17 13:33:18 -04:00
unlink.c nfs: emit a fsnotify_nameremove call in sillyrename codepath 2014-03-17 15:14:17 -04:00
write.c NFS: Create a common nfs_pageio_ops struct 2014-05-29 11:11:41 -04:00