<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-stable.git/fs/nfs/blocklayout, branch linux-3.2.y</title>
<subtitle>Linux kernel stable tree</subtitle>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/'/>
<entry>
<title>nfs: fix do_div() warning by instead using sector_div()</title>
<updated>2014-04-01T23:58:59+00:00</updated>
<author>
<name>Helge Deller</name>
<email>deller@gmx.de</email>
</author>
<published>2013-12-02T18:59:31+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=c725cf148008d81eac7fe4bebff7367ae2aa0aa2'/>
<id>c725cf148008d81eac7fe4bebff7367ae2aa0aa2</id>
<content type='text'>
commit 3873d064b8538686bbbd4b858dc8a07db1f7f43a upstream.

When compiling a 32bit kernel with CONFIG_LBDAF=n the compiler complains like
shown below.  Fix this warning by instead using sector_div() which is provided
by the kernel.h header file.

fs/nfs/blocklayout/extents.c: In function ‘normalize’:
include/asm-generic/div64.h:43:28: warning: comparison of distinct pointer types lacks a cast [enabled by default]
fs/nfs/blocklayout/extents.c:47:13: note: in expansion of macro ‘do_div’
nfs/blocklayout/extents.c:47:2: warning: right shift count &gt;= width of type [enabled by default]
fs/nfs/blocklayout/extents.c:47:2: warning: passing argument 1 of ‘__div64_32’ from incompatible pointer type [enabled by default]
include/asm-generic/div64.h:35:17: note: expected ‘uint64_t *’ but argument is of type ‘sector_t *’
extern uint32_t __div64_32(uint64_t *dividend, uint32_t divisor);

Signed-off-by: Helge Deller &lt;deller@gmx.de&gt;
Signed-off-by: Trond Myklebust &lt;Trond.Myklebust@netapp.com&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 3873d064b8538686bbbd4b858dc8a07db1f7f43a upstream.

When compiling a 32bit kernel with CONFIG_LBDAF=n the compiler complains like
shown below.  Fix this warning by instead using sector_div() which is provided
by the kernel.h header file.

fs/nfs/blocklayout/extents.c: In function ‘normalize’:
include/asm-generic/div64.h:43:28: warning: comparison of distinct pointer types lacks a cast [enabled by default]
fs/nfs/blocklayout/extents.c:47:13: note: in expansion of macro ‘do_div’
nfs/blocklayout/extents.c:47:2: warning: right shift count &gt;= width of type [enabled by default]
fs/nfs/blocklayout/extents.c:47:2: warning: passing argument 1 of ‘__div64_32’ from incompatible pointer type [enabled by default]
include/asm-generic/div64.h:35:17: note: expected ‘uint64_t *’ but argument is of type ‘sector_t *’
extern uint32_t __div64_32(uint64_t *dividend, uint32_t divisor);

Signed-off-by: Helge Deller &lt;deller@gmx.de&gt;
Signed-off-by: Trond Myklebust &lt;Trond.Myklebust@netapp.com&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>pnfs-block: removing DM device maybe cause oops when call dev_remove</title>
<updated>2013-04-10T02:20:01+00:00</updated>
<author>
<name>fanchaoting</name>
<email>fanchaoting@cn.fujitsu.com</email>
</author>
<published>2013-03-21T01:15:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=8626d723c5495ec9a276c8c13a22b374c421ba72'/>
<id>8626d723c5495ec9a276c8c13a22b374c421ba72</id>
<content type='text'>
commit 4376c94618c26225e69e17b7c91169c45a90b292 upstream.

when pnfs block using device mapper,if umounting later,it maybe
cause oops. we apply "1 + sizeof(bl_umount_request)" memory for
msg-&gt;data, the memory maybe overflow when we do "memcpy(&amp;dataptr
[sizeof(bl_msg)], &amp;bl_umount_request, sizeof(bl_umount_request))",
because the size of bl_msg is more than 1 byte.

Signed-off-by: fanchaoting&lt;fanchaoting@cn.fujitsu.com&gt;
Signed-off-by: Trond Myklebust &lt;Trond.Myklebust@netapp.com&gt;
[bwh: Backported to 3.2:
 - In dev_remove(), msg is a structure not a pointer to it]
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 4376c94618c26225e69e17b7c91169c45a90b292 upstream.

when pnfs block using device mapper,if umounting later,it maybe
cause oops. we apply "1 + sizeof(bl_umount_request)" memory for
msg-&gt;data, the memory maybe overflow when we do "memcpy(&amp;dataptr
[sizeof(bl_msg)], &amp;bl_umount_request, sizeof(bl_umount_request))",
because the size of bl_msg is more than 1 byte.

Signed-off-by: fanchaoting&lt;fanchaoting@cn.fujitsu.com&gt;
Signed-off-by: Trond Myklebust &lt;Trond.Myklebust@netapp.com&gt;
[bwh: Backported to 3.2:
 - In dev_remove(), msg is a structure not a pointer to it]
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>umount oops when remove blocklayoutdriver first</title>
<updated>2013-03-06T03:24:02+00:00</updated>
<author>
<name>fanchaoting</name>
<email>fanchaoting@cn.fujitsu.com</email>
</author>
<published>2013-02-04T13:15:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=a6a26fe018f2e369692ba098c02d51728acb14e8'/>
<id>a6a26fe018f2e369692ba098c02d51728acb14e8</id>
<content type='text'>
commit 5a12cca697aca5dfba42a7d4c3356acc0445a2b0 upstream.

now pnfs client uses block layout, maybe we can remove
blocklayoutdriver first. if we umount later,
it can cause oops in unset_pnfs_layoutdriver.
because nfss-&gt;pnfs_curr_ld-&gt;clear_layoutdriver is invalid.

reproduce it:
 modprobe  blocklayoutdriver
 mount -t nfs4 -o minorversion=1 pnfsip:/ /mnt/
 rmmod blocklayoutdriver
 umount /mnt

then you can see following

CPU 0
Pid: 17023, comm: umount.nfs4 Tainted: GF          O 3.7.0-rc6-pnfs #1 VMware, Inc. VMware Virtual Platform/440BX Desktop Reference Platform
RIP: 0010:[&lt;ffffffffa04cfe6d&gt;]  [&lt;ffffffffa04cfe6d&gt;] unset_pnfs_layoutdriver+0x1d/0x70 [nfsv4]
RSP: 0018:ffff8800022d9e48  EFLAGS: 00010286
RAX: ffffffffa04a1b00 RBX: ffff88000b013800 RCX: 0000000000000001
RDX: ffffffff81ae8ee0 RSI: ffff880001ee94b8 RDI: ffff88000b013800
RBP: ffff8800022d9e58 R08: 0000000000000001 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: ffff880001ee9400
R13: ffff8800105978c0 R14: 00007fff25846c08 R15: 0000000001bba550
FS:  00007f45ae7f0700(0000) GS:ffff880012c00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
CR2: ffffffffa04a1b38 CR3: 0000000002c0c000 CR4: 00000000000006f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
Process umount.nfs4 (pid: 17023, threadinfo ffff8800022d8000, task ffff880006e48aa0)
Stack:
ffff8800105978c0 ffff88000b013800 ffff8800022d9e78 ffffffffa04cd0ce
ffff8800022d9e78 ffff88000b013800 ffff8800022d9ea8 ffffffffa04755a7
ffff8800022d9ea8 ffff880002f96400 ffff88000b013800 ffff880002f96400
Call Trace:
[&lt;ffffffffa04cd0ce&gt;] nfs4_destroy_server+0x1e/0x30 [nfsv4]
[&lt;ffffffffa04755a7&gt;] nfs_free_server+0xb7/0x150 [nfs]
[&lt;ffffffffa047d4d5&gt;] nfs_kill_super+0x35/0x40 [nfs]
[&lt;ffffffff81178d35&gt;] deactivate_locked_super+0x45/0x70
[&lt;ffffffff8117986a&gt;] deactivate_super+0x4a/0x70
[&lt;ffffffff81193ee2&gt;] mntput_no_expire+0xd2/0x130
[&lt;ffffffff81194d62&gt;] sys_umount+0x72/0xe0
[&lt;ffffffff8154af59&gt;] system_call_fastpath+0x16/0x1b
Code: 06 e1 b8 ea ff ff ff eb 9e 0f 1f 44 00 00 55 48 89 e5 53 48 83 ec 08 66 66 66 66 90 48 8b 87 80 03 00 00 48 89 fb 48 85 c0 74 29 &lt;48&gt; 8b 40 38 48 85 c0 74 02 ff d0 48 8b 03 3e ff 48 04 0f 94 c2
RIP  [&lt;ffffffffa04cfe6d&gt;] unset_pnfs_layoutdriver+0x1d/0x70 [nfsv4]
RSP &lt;ffff8800022d9e48&gt;
CR2: ffffffffa04a1b38
---[ end trace 29f75aaedda058bf ]---

Signed-off-by: fanchaoting&lt;fanchaoting@cn.fujitsu.com&gt;
Signed-off-by: Trond Myklebust &lt;Trond.Myklebust@netapp.com&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 5a12cca697aca5dfba42a7d4c3356acc0445a2b0 upstream.

now pnfs client uses block layout, maybe we can remove
blocklayoutdriver first. if we umount later,
it can cause oops in unset_pnfs_layoutdriver.
because nfss-&gt;pnfs_curr_ld-&gt;clear_layoutdriver is invalid.

reproduce it:
 modprobe  blocklayoutdriver
 mount -t nfs4 -o minorversion=1 pnfsip:/ /mnt/
 rmmod blocklayoutdriver
 umount /mnt

then you can see following

CPU 0
Pid: 17023, comm: umount.nfs4 Tainted: GF          O 3.7.0-rc6-pnfs #1 VMware, Inc. VMware Virtual Platform/440BX Desktop Reference Platform
RIP: 0010:[&lt;ffffffffa04cfe6d&gt;]  [&lt;ffffffffa04cfe6d&gt;] unset_pnfs_layoutdriver+0x1d/0x70 [nfsv4]
RSP: 0018:ffff8800022d9e48  EFLAGS: 00010286
RAX: ffffffffa04a1b00 RBX: ffff88000b013800 RCX: 0000000000000001
RDX: ffffffff81ae8ee0 RSI: ffff880001ee94b8 RDI: ffff88000b013800
RBP: ffff8800022d9e58 R08: 0000000000000001 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: ffff880001ee9400
R13: ffff8800105978c0 R14: 00007fff25846c08 R15: 0000000001bba550
FS:  00007f45ae7f0700(0000) GS:ffff880012c00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
CR2: ffffffffa04a1b38 CR3: 0000000002c0c000 CR4: 00000000000006f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
Process umount.nfs4 (pid: 17023, threadinfo ffff8800022d8000, task ffff880006e48aa0)
Stack:
ffff8800105978c0 ffff88000b013800 ffff8800022d9e78 ffffffffa04cd0ce
ffff8800022d9e78 ffff88000b013800 ffff8800022d9ea8 ffffffffa04755a7
ffff8800022d9ea8 ffff880002f96400 ffff88000b013800 ffff880002f96400
Call Trace:
[&lt;ffffffffa04cd0ce&gt;] nfs4_destroy_server+0x1e/0x30 [nfsv4]
[&lt;ffffffffa04755a7&gt;] nfs_free_server+0xb7/0x150 [nfs]
[&lt;ffffffffa047d4d5&gt;] nfs_kill_super+0x35/0x40 [nfs]
[&lt;ffffffff81178d35&gt;] deactivate_locked_super+0x45/0x70
[&lt;ffffffff8117986a&gt;] deactivate_super+0x4a/0x70
[&lt;ffffffff81193ee2&gt;] mntput_no_expire+0xd2/0x130
[&lt;ffffffff81194d62&gt;] sys_umount+0x72/0xe0
[&lt;ffffffff8154af59&gt;] system_call_fastpath+0x16/0x1b
Code: 06 e1 b8 ea ff ff ff eb 9e 0f 1f 44 00 00 55 48 89 e5 53 48 83 ec 08 66 66 66 66 90 48 8b 87 80 03 00 00 48 89 fb 48 85 c0 74 29 &lt;48&gt; 8b 40 38 48 85 c0 74 02 ff d0 48 8b 03 3e ff 48 04 0f 94 c2
RIP  [&lt;ffffffffa04cfe6d&gt;] unset_pnfs_layoutdriver+0x1d/0x70 [nfsv4]
RSP &lt;ffff8800022d9e48&gt;
CR2: ffffffffa04a1b38
---[ end trace 29f75aaedda058bf ]---

Signed-off-by: fanchaoting&lt;fanchaoting@cn.fujitsu.com&gt;
Signed-off-by: Trond Myklebust &lt;Trond.Myklebust@netapp.com&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>pnfsblock: fix partial page buffer wirte</title>
<updated>2012-10-17T02:49:21+00:00</updated>
<author>
<name>Peng Tao</name>
<email>bergwolf@gmail.com</email>
</author>
<published>2012-08-23T16:27:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=9392e7db7bc62b61ec72c8aa020f4d7e07118bff'/>
<id>9392e7db7bc62b61ec72c8aa020f4d7e07118bff</id>
<content type='text'>
commit fe6e1e8d9fad86873eb74a26e80a8f91f9e870b5 upstream.

If applications use flock to protect its write range, generic NFS
will not do read-modify-write cycle at page cache level. Therefore
LD should know how to handle non-sector aligned writes. Otherwise
there will be data corruption.

Signed-off-by: Peng Tao &lt;tao.peng@emc.com&gt;
Signed-off-by: Trond Myklebust &lt;Trond.Myklebust@netapp.com&gt;
[bwh: Backported to Linux 3.2:
 - Adjust context
 - s/wdata-&gt;pages\.npages/wdata-&gt;npages/
 - s/header-&gt;pnfs_error/wdata-&gt;pnfs_error/
 - Drop change in missing out_mds exit path]
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit fe6e1e8d9fad86873eb74a26e80a8f91f9e870b5 upstream.

If applications use flock to protect its write range, generic NFS
will not do read-modify-write cycle at page cache level. Therefore
LD should know how to handle non-sector aligned writes. Otherwise
there will be data corruption.

Signed-off-by: Peng Tao &lt;tao.peng@emc.com&gt;
Signed-off-by: Trond Myklebust &lt;Trond.Myklebust@netapp.com&gt;
[bwh: Backported to Linux 3.2:
 - Adjust context
 - s/wdata-&gt;pages\.npages/wdata-&gt;npages/
 - s/header-&gt;pnfs_error/wdata-&gt;pnfs_error/
 - Drop change in missing out_mds exit path]
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>fix page number calculation bug for block layout decode buffer</title>
<updated>2012-09-12T02:36:49+00:00</updated>
<author>
<name>Jim Rees</name>
<email>rees@umich.edu</email>
</author>
<published>2012-04-10T02:33:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=6af55b4401610228dec74fa2c1c3add42f71e038'/>
<id>6af55b4401610228dec74fa2c1c3add42f71e038</id>
<content type='text'>
commit 10bd295a0b6488ebe634b72a11d8986bd3af3819 upstream.

Signed-off-by: Jim Rees &lt;rees@umich.edu&gt;
Suggested-by: Andy Adamson &lt;andros@netapp.com&gt;
Suggested-by: Fred Isaman &lt;iisaman@netapp.com&gt;
Signed-off-by: Trond Myklebust &lt;Trond.Myklebust@netapp.com&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 10bd295a0b6488ebe634b72a11d8986bd3af3819 upstream.

Signed-off-by: Jim Rees &lt;rees@umich.edu&gt;
Suggested-by: Andy Adamson &lt;andros@netapp.com&gt;
Suggested-by: Fred Isaman &lt;iisaman@netapp.com&gt;
Signed-off-by: Trond Myklebust &lt;Trond.Myklebust@netapp.com&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>NFS: Use kcalloc() when allocating arrays</title>
<updated>2012-09-12T02:36:48+00:00</updated>
<author>
<name>Trond Myklebust</name>
<email>Trond.Myklebust@netapp.com</email>
</author>
<published>2012-01-20T23:57:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=59f704cddfbc75c9118ce0e669295e1afed6db03'/>
<id>59f704cddfbc75c9118ce0e669295e1afed6db03</id>
<content type='text'>
commit 7d9dea915fe333357912bce2d624ee848dfbd890 upstream.

Signed-off-by: Trond Myklebust &lt;Trond.Myklebust@netapp.com&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 7d9dea915fe333357912bce2d624ee848dfbd890 upstream.

Signed-off-by: Trond Myklebust &lt;Trond.Myklebust@netapp.com&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>pnfsblock: limit bio page count</title>
<updated>2012-01-26T00:13:37+00:00</updated>
<author>
<name>Peng Tao</name>
<email>bergwolf@gmail.com</email>
</author>
<published>2012-01-12T15:18:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=b4e8ff2994fa04444d813a3dfd2e8762756a00ec'/>
<id>b4e8ff2994fa04444d813a3dfd2e8762756a00ec</id>
<content type='text'>
commit 74a6eeb44ca6174d9cc93b9b8b4d58211c57bc80 upstream.

One bio can have at most BIO_MAX_PAGES pages. We should limit it bec otherwise
bio_alloc will fail when there are many pages in one read/write_pagelist.

Signed-off-by: Peng Tao &lt;peng_tao@emc.com&gt;
Signed-off-by: Benny Halevy &lt;bhalevy@tonian.com&gt;
Signed-off-by: Trond Myklebust &lt;Trond.Myklebust@netapp.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 74a6eeb44ca6174d9cc93b9b8b4d58211c57bc80 upstream.

One bio can have at most BIO_MAX_PAGES pages. We should limit it bec otherwise
bio_alloc will fail when there are many pages in one read/write_pagelist.

Signed-off-by: Peng Tao &lt;peng_tao@emc.com&gt;
Signed-off-by: Benny Halevy &lt;bhalevy@tonian.com&gt;
Signed-off-by: Trond Myklebust &lt;Trond.Myklebust@netapp.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>pnfsblock: don't spinlock when freeing block_dev</title>
<updated>2012-01-26T00:13:36+00:00</updated>
<author>
<name>Peng Tao</name>
<email>bergwolf@gmail.com</email>
</author>
<published>2012-01-12T15:18:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=7e0f9f47b49048c1a809a9bfff85002cb7fbf8e3'/>
<id>7e0f9f47b49048c1a809a9bfff85002cb7fbf8e3</id>
<content type='text'>
commit 93a3844ee0f843b05a1df4b52e1a19ff26b98d24 upstream.

bl_free_block_dev() may sleep. We can not call it with spinlock held.
Besides, there is no need to take bm_lock as we are last user freeing bm_devlist.

Signed-off-by: Peng Tao &lt;peng_tao@emc.com&gt;
Signed-off-by: Benny Halevy &lt;bhalevy@tonian.com&gt;
Signed-off-by: Trond Myklebust &lt;Trond.Myklebust@netapp.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 93a3844ee0f843b05a1df4b52e1a19ff26b98d24 upstream.

bl_free_block_dev() may sleep. We can not call it with spinlock held.
Besides, there is no need to take bm_lock as we are last user freeing bm_devlist.

Signed-off-by: Peng Tao &lt;peng_tao@emc.com&gt;
Signed-off-by: Benny Halevy &lt;bhalevy@tonian.com&gt;
Signed-off-by: Trond Myklebust &lt;Trond.Myklebust@netapp.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>pnfsblock: acquire im_lock in _preload_range</title>
<updated>2012-01-26T00:13:36+00:00</updated>
<author>
<name>Peng Tao</name>
<email>bergwolf@gmail.com</email>
</author>
<published>2012-01-12T15:18:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=ae6481331e29dd7a055c70b7abaaef9e01c60ced'/>
<id>ae6481331e29dd7a055c70b7abaaef9e01c60ced</id>
<content type='text'>
commit 39e567ae36fe03c2b446e1b83ee3d39bea08f90b upstream.

When calling _add_entry, we should take the im_lock to protect
agains other modifiers.

Signed-off-by: Peng Tao &lt;peng_tao@emc.com&gt;
Signed-off-by: Benny Halevy &lt;bhalevy@tonian.com&gt;
Signed-off-by: Trond Myklebust &lt;Trond.Myklebust@netapp.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 39e567ae36fe03c2b446e1b83ee3d39bea08f90b upstream.

When calling _add_entry, we should take the im_lock to protect
agains other modifiers.

Signed-off-by: Peng Tao &lt;peng_tao@emc.com&gt;
Signed-off-by: Benny Halevy &lt;bhalevy@tonian.com&gt;
Signed-off-by: Trond Myklebust &lt;Trond.Myklebust@netapp.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>pnfsblock: fix writeback deadlock</title>
<updated>2011-10-18T16:08:15+00:00</updated>
<author>
<name>Peng Tao</name>
<email>bergwolf@gmail.com</email>
</author>
<published>2011-09-23T01:50:17+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=7542274519b3ba87555410c66e8356ac1e3bc9b3'/>
<id>7542274519b3ba87555410c66e8356ac1e3bc9b3</id>
<content type='text'>
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 &gt; /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]  [&lt;ffffffff81013ba7&gt;] ? read_tsc+0x9/0x19
 [ 1080.972877]  [&lt;ffffffff810e0b23&gt;] ? lock_page+0x2b/0x2b
 [ 1080.972899]  [&lt;ffffffff81475a1d&gt;] io_schedule+0x63/0x7e
 [ 1080.972902]  [&lt;ffffffff810e0b31&gt;] sleep_on_page+0xe/0x12
 [ 1080.972905]  [&lt;ffffffff81475fe8&gt;] __wait_on_bit_lock+0x46/0x8f
 [ 1080.972916]  [&lt;ffffffff810822d7&gt;] ? lock_release_holdtime.part.7+0x6b/0x72
 [ 1080.972919]  [&lt;ffffffff810e0af6&gt;] __lock_page+0x66/0x68
 [ 1080.972928]  [&lt;ffffffff81072705&gt;] ? autoremove_wake_function+0x3d/0x3d
 [ 1080.972932]  [&lt;ffffffff810e0b1f&gt;] lock_page+0x27/0x2b
 [ 1080.972934]  [&lt;ffffffff810e0bcf&gt;] find_lock_page+0x34/0x57
 [ 1080.972937]  [&lt;ffffffff810e1738&gt;] find_or_create_page+0x34/0x8a
 [ 1080.972947]  [&lt;ffffffffa034245b&gt;] bl_write_pagelist+0x205/0x6da [blocklayoutdriver]
 [ 1080.972951]  [&lt;ffffffffa034145d&gt;] ? bl_free_lseg+0x38/0x38 [blocklayoutdriver]
 [ 1080.972995]  [&lt;ffffffffa02e27b9&gt;] ? nfs_write_rpcsetup+0x118/0x123 [nfs]
 [ 1080.973033]  [&lt;ffffffffa030246b&gt;] pnfs_generic_pg_writepages+0x10b/0x1f4 [nfs]
 [ 1080.973089]  [&lt;ffffffffa02deaae&gt;] nfs_pageio_doio+0x1a/0x43 [nfs]
 [ 1080.973098]  [&lt;ffffffffa02df035&gt;] nfs_pageio_complete+0x16/0x2d [nfs]
 [ 1080.973108]  [&lt;ffffffffa02e2d8f&gt;] nfs_writepage_locked+0xa0/0xbf [nfs]
 [ 1080.973119]  [&lt;ffffffffa02e36a1&gt;] nfs_writepage+0x16/0x2b [nfs]
 [ 1080.973122]  [&lt;ffffffff810e8762&gt;] ? clear_page_dirty_for_io+0x87/0x9a
 [ 1080.973133]  [&lt;ffffffff810efc5b&gt;] shrink_page_list+0x39b/0x6c8
 [ 1080.973139]  [&lt;ffffffff810f03bb&gt;] shrink_inactive_list+0x22c/0x39e
 [ 1080.973144]  [&lt;ffffffff810822d7&gt;] ? lock_release_holdtime.part.7+0x6b/0x72
 [ 1080.973148]  [&lt;ffffffff810f0c33&gt;] shrink_zone+0x445/0x588
 [ 1080.973152]  [&lt;ffffffff810f1a11&gt;] balance_pgdat+0x2c2/0x56b
 [ 1080.973170]  [&lt;ffffffff81254208&gt;] ? __bitmap_weight+0x34/0x80
 [ 1080.973175]  [&lt;ffffffff810f1f78&gt;] kswapd+0x2be/0x2fa
 [ 1080.973179]  [&lt;ffffffff810726c8&gt;] ? __init_waitqueue_head+0x4b/0x4b
 [ 1080.973183]  [&lt;ffffffff810f1cba&gt;] ? balance_pgdat+0x56b/0x56b
 [ 1080.973187]  [&lt;ffffffff81071f69&gt;] kthread+0xa8/0xb0
 [ 1080.973200]  [&lt;ffffffff814806b4&gt;] kernel_thread_helper+0x4/0x10
 [ 1080.973205]  [&lt;ffffffff81071ec1&gt;] ? __init_kthread_worker+0x5a/0x5a
 [ 1080.973210]  [&lt;ffffffff814806b0&gt;] ? gs_change+0x13/0x13
 [ 1080.973213] no locks held by kswapd0/25.

Signed-off-by: Peng Tao &lt;peng_tao@emc.com&gt;
Signed-off-by: Jim Rees &lt;rees@umich.edu&gt;
Cc: stable@kernel.org [3.0]
Signed-off-by: Trond Myklebust &lt;Trond.Myklebust@netapp.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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 &gt; /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]  [&lt;ffffffff81013ba7&gt;] ? read_tsc+0x9/0x19
 [ 1080.972877]  [&lt;ffffffff810e0b23&gt;] ? lock_page+0x2b/0x2b
 [ 1080.972899]  [&lt;ffffffff81475a1d&gt;] io_schedule+0x63/0x7e
 [ 1080.972902]  [&lt;ffffffff810e0b31&gt;] sleep_on_page+0xe/0x12
 [ 1080.972905]  [&lt;ffffffff81475fe8&gt;] __wait_on_bit_lock+0x46/0x8f
 [ 1080.972916]  [&lt;ffffffff810822d7&gt;] ? lock_release_holdtime.part.7+0x6b/0x72
 [ 1080.972919]  [&lt;ffffffff810e0af6&gt;] __lock_page+0x66/0x68
 [ 1080.972928]  [&lt;ffffffff81072705&gt;] ? autoremove_wake_function+0x3d/0x3d
 [ 1080.972932]  [&lt;ffffffff810e0b1f&gt;] lock_page+0x27/0x2b
 [ 1080.972934]  [&lt;ffffffff810e0bcf&gt;] find_lock_page+0x34/0x57
 [ 1080.972937]  [&lt;ffffffff810e1738&gt;] find_or_create_page+0x34/0x8a
 [ 1080.972947]  [&lt;ffffffffa034245b&gt;] bl_write_pagelist+0x205/0x6da [blocklayoutdriver]
 [ 1080.972951]  [&lt;ffffffffa034145d&gt;] ? bl_free_lseg+0x38/0x38 [blocklayoutdriver]
 [ 1080.972995]  [&lt;ffffffffa02e27b9&gt;] ? nfs_write_rpcsetup+0x118/0x123 [nfs]
 [ 1080.973033]  [&lt;ffffffffa030246b&gt;] pnfs_generic_pg_writepages+0x10b/0x1f4 [nfs]
 [ 1080.973089]  [&lt;ffffffffa02deaae&gt;] nfs_pageio_doio+0x1a/0x43 [nfs]
 [ 1080.973098]  [&lt;ffffffffa02df035&gt;] nfs_pageio_complete+0x16/0x2d [nfs]
 [ 1080.973108]  [&lt;ffffffffa02e2d8f&gt;] nfs_writepage_locked+0xa0/0xbf [nfs]
 [ 1080.973119]  [&lt;ffffffffa02e36a1&gt;] nfs_writepage+0x16/0x2b [nfs]
 [ 1080.973122]  [&lt;ffffffff810e8762&gt;] ? clear_page_dirty_for_io+0x87/0x9a
 [ 1080.973133]  [&lt;ffffffff810efc5b&gt;] shrink_page_list+0x39b/0x6c8
 [ 1080.973139]  [&lt;ffffffff810f03bb&gt;] shrink_inactive_list+0x22c/0x39e
 [ 1080.973144]  [&lt;ffffffff810822d7&gt;] ? lock_release_holdtime.part.7+0x6b/0x72
 [ 1080.973148]  [&lt;ffffffff810f0c33&gt;] shrink_zone+0x445/0x588
 [ 1080.973152]  [&lt;ffffffff810f1a11&gt;] balance_pgdat+0x2c2/0x56b
 [ 1080.973170]  [&lt;ffffffff81254208&gt;] ? __bitmap_weight+0x34/0x80
 [ 1080.973175]  [&lt;ffffffff810f1f78&gt;] kswapd+0x2be/0x2fa
 [ 1080.973179]  [&lt;ffffffff810726c8&gt;] ? __init_waitqueue_head+0x4b/0x4b
 [ 1080.973183]  [&lt;ffffffff810f1cba&gt;] ? balance_pgdat+0x56b/0x56b
 [ 1080.973187]  [&lt;ffffffff81071f69&gt;] kthread+0xa8/0xb0
 [ 1080.973200]  [&lt;ffffffff814806b4&gt;] kernel_thread_helper+0x4/0x10
 [ 1080.973205]  [&lt;ffffffff81071ec1&gt;] ? __init_kthread_worker+0x5a/0x5a
 [ 1080.973210]  [&lt;ffffffff814806b0&gt;] ? gs_change+0x13/0x13
 [ 1080.973213] no locks held by kswapd0/25.

Signed-off-by: Peng Tao &lt;peng_tao@emc.com&gt;
Signed-off-by: Jim Rees &lt;rees@umich.edu&gt;
Cc: stable@kernel.org [3.0]
Signed-off-by: Trond Myklebust &lt;Trond.Myklebust@netapp.com&gt;
</pre>
</div>
</content>
</entry>
</feed>
