kernel_optimize_test/fs/nfs
Peng Tao 7542274519 pnfsblock: fix writeback deadlock
We should check if the sector is already initialized before
trying to grab the page from page cache. Otherwise when two
pages of the same block are written back by two threads each
calling from writepage_locked, it can cause deadlock like bellow.

 [ 1080.972099] INFO: task kswapd0:25 blocked for more than 120 seconds.
 [ 1080.972377] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
 [ 1080.972812] kswapd0         D ffff88000c4926c0     0    25      2 0x00000000
 [ 1080.972816]  ffff88000df276b0 0000000000000046 ffff88000df27640 ffffffff81013ba7
 [ 1080.972821]  ffff88000c492310 ffff88000df27fd8 ffff88000df27fd8 00000000001d3440
 [ 1080.972824]  ffff88000c378000 ffff88000c492310 ffff8800175d3d40 ffff880017fc75a8
 [ 1080.972828] Call Trace:
 [ 1080.972860]  [<ffffffff81013ba7>] ? read_tsc+0x9/0x19
 [ 1080.972877]  [<ffffffff810e0b23>] ? lock_page+0x2b/0x2b
 [ 1080.972899]  [<ffffffff81475a1d>] io_schedule+0x63/0x7e
 [ 1080.972902]  [<ffffffff810e0b31>] sleep_on_page+0xe/0x12
 [ 1080.972905]  [<ffffffff81475fe8>] __wait_on_bit_lock+0x46/0x8f
 [ 1080.972916]  [<ffffffff810822d7>] ? lock_release_holdtime.part.7+0x6b/0x72
 [ 1080.972919]  [<ffffffff810e0af6>] __lock_page+0x66/0x68
 [ 1080.972928]  [<ffffffff81072705>] ? autoremove_wake_function+0x3d/0x3d
 [ 1080.972932]  [<ffffffff810e0b1f>] lock_page+0x27/0x2b
 [ 1080.972934]  [<ffffffff810e0bcf>] find_lock_page+0x34/0x57
 [ 1080.972937]  [<ffffffff810e1738>] find_or_create_page+0x34/0x8a
 [ 1080.972947]  [<ffffffffa034245b>] bl_write_pagelist+0x205/0x6da [blocklayoutdriver]
 [ 1080.972951]  [<ffffffffa034145d>] ? bl_free_lseg+0x38/0x38 [blocklayoutdriver]
 [ 1080.972995]  [<ffffffffa02e27b9>] ? nfs_write_rpcsetup+0x118/0x123 [nfs]
 [ 1080.973033]  [<ffffffffa030246b>] pnfs_generic_pg_writepages+0x10b/0x1f4 [nfs]
 [ 1080.973089]  [<ffffffffa02deaae>] nfs_pageio_doio+0x1a/0x43 [nfs]
 [ 1080.973098]  [<ffffffffa02df035>] nfs_pageio_complete+0x16/0x2d [nfs]
 [ 1080.973108]  [<ffffffffa02e2d8f>] nfs_writepage_locked+0xa0/0xbf [nfs]
 [ 1080.973119]  [<ffffffffa02e36a1>] nfs_writepage+0x16/0x2b [nfs]
 [ 1080.973122]  [<ffffffff810e8762>] ? clear_page_dirty_for_io+0x87/0x9a
 [ 1080.973133]  [<ffffffff810efc5b>] shrink_page_list+0x39b/0x6c8
 [ 1080.973139]  [<ffffffff810f03bb>] shrink_inactive_list+0x22c/0x39e
 [ 1080.973144]  [<ffffffff810822d7>] ? lock_release_holdtime.part.7+0x6b/0x72
 [ 1080.973148]  [<ffffffff810f0c33>] shrink_zone+0x445/0x588
 [ 1080.973152]  [<ffffffff810f1a11>] balance_pgdat+0x2c2/0x56b
 [ 1080.973170]  [<ffffffff81254208>] ? __bitmap_weight+0x34/0x80
 [ 1080.973175]  [<ffffffff810f1f78>] kswapd+0x2be/0x2fa
 [ 1080.973179]  [<ffffffff810726c8>] ? __init_waitqueue_head+0x4b/0x4b
 [ 1080.973183]  [<ffffffff810f1cba>] ? balance_pgdat+0x56b/0x56b
 [ 1080.973187]  [<ffffffff81071f69>] kthread+0xa8/0xb0
 [ 1080.973200]  [<ffffffff814806b4>] kernel_thread_helper+0x4/0x10
 [ 1080.973205]  [<ffffffff81071ec1>] ? __init_kthread_worker+0x5a/0x5a
 [ 1080.973210]  [<ffffffff814806b0>] ? gs_change+0x13/0x13
 [ 1080.973213] no locks held by kswapd0/25.

Signed-off-by: Peng Tao <peng_tao@emc.com>
Signed-off-by: Jim Rees <rees@umich.edu>
Cc: stable@kernel.org [3.0]
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
2011-10-18 09:08:15 -07:00
..
blocklayout pnfsblock: fix writeback deadlock 2011-10-18 09:08:15 -07:00
objlayout pnfs-obj: Fix the comp_index != 0 case 2011-08-04 11:54:48 -04:00
cache_lib.c
cache_lib.h atomic: use <linux/atomic.h> 2011-07-26 16:49:47 -07:00
callback_proc.c NFSv4.1: Return NFS4ERR_BADSESSION to callbacks during session resets 2011-08-04 11:55:35 -04:00
callback_xdr.c NFSv4.1: Fix the callback 'highest_used_slotid' behaviour 2011-08-04 11:55:35 -04:00
callback.c
callback.h NFSv4.1: Fix the callback 'highest_used_slotid' behaviour 2011-08-04 11:55:35 -04:00
client.c nfs: fix bug about IPv6 address scope checking 2011-10-18 09:08:10 -07:00
delegation.c NFSv4: Don't use the delegation->inode in nfs_mark_return_delegation() 2011-07-25 15:37:29 -04:00
delegation.h
dir.c Additional readdir cookie loop information 2011-07-30 14:37:14 -04:00
direct.c atomic: use <linux/atomic.h> 2011-07-26 16:49:47 -07:00
dns_resolve.c
dns_resolve.h
file.c
fscache-index.c
fscache.c
fscache.h
getroot.c
idmap.c SUNRPC/NFS: make rpc pipe upcall generic 2011-10-18 09:08:12 -07:00
inode.c
internal.h
iostat.h
Kconfig pnfs: Automatically select blocks & objects layouts 2011-08-11 17:51:27 -07:00
Makefile pnfsblock: add blocklayout Kconfig option, Makefile, and stubs 2011-07-31 12:18:15 -04:00
mount_clnt.c
namespace.c
nfs2xdr.c
nfs3acl.c switch posix_acl_create() to umode_t * 2011-08-01 02:09:42 -04:00
nfs3proc.c switch posix_acl_create() to umode_t * 2011-08-01 02:09:42 -04:00
nfs3xdr.c
nfs4_fs.h NFSv4: renewd needs to be able to handle the NFS4ERR_CB_PATH_DOWN error 2011-08-24 15:07:37 -04:00
nfs4filelayout.c pnfs: make _set_lo_fail generic 2011-10-18 09:08:13 -07:00
nfs4filelayout.h
nfs4filelayoutdev.c
nfs4namespace.c
nfs4proc.c NFSv4: renewd needs to be able to handle the NFS4ERR_CB_PATH_DOWN error 2011-08-24 15:07:37 -04:00
nfs4renewd.c NFSv4: The NFSv4.0 client must send RENEW calls if it holds a delegation 2011-08-24 15:07:37 -04:00
nfs4state.c NFSv4: renewd needs to be able to handle the NFS4ERR_CB_PATH_DOWN error 2011-08-24 15:07:37 -04:00
nfs4xdr.c pnfs: cleanup_layoutcommit 2011-07-31 12:18:15 -04:00
nfsroot.c
pagelist.c
pnfs_dev.c
pnfs.c pnfs: recoalesce when ld read pagelist fails 2011-10-18 09:08:14 -07:00
pnfs.h pnfs: recoalesce when ld read pagelist fails 2011-10-18 09:08:14 -07:00
proc.c
read.c pnfs: recoalesce when ld read pagelist fails 2011-10-18 09:08:14 -07:00
super.c VFS: Fix the remaining automounter semantics regressions 2011-09-26 19:16:46 -07:00
symlink.c
sysctl.c
unlink.c
write.c pnfs: recoalesce when ld write pagelist fails 2011-10-18 09:08:13 -07:00