<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux.git/fs/f2fs/segment.c, branch v3.16</title>
<subtitle>Linux kernel source tree</subtitle>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/'/>
<entry>
<title>f2fs: avoid to access NULL pointer in issue_flush_thread</title>
<updated>2014-07-09T12:59:55+00:00</updated>
<author>
<name>Chao Yu</name>
<email>chao2.yu@samsung.com</email>
</author>
<published>2014-07-07T01:39:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=50e1f8d22199b557337b3d1ec8520e4c5aa5c76e'/>
<id>50e1f8d22199b557337b3d1ec8520e4c5aa5c76e</id>
<content type='text'>
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=75861

Denis 2014-05-10 11:28:59 UTC reported:
"F2FS-fs (mmcblk0p28): mounting..
 Unable to handle kernel NULL pointer dereference at virtual address 00000018
 ...
 [&lt;c0a2f678&gt;] (_raw_spin_lock+0x3c/0x70) from [&lt;c03a0330&gt;] (issue_flush_thread+0x50/0x17c)
 [&lt;c03a0330&gt;] (issue_flush_thread+0x50/0x17c) from [&lt;c01b4064&gt;] (kthread+0x98/0xa4)
 [&lt;c01b4064&gt;] (kthread+0x98/0xa4) from [&lt;c0108060&gt;] (kernel_thread_exit+0x0/0x8)"

This patch assign cmd_control_info in sm_info before issue_flush_thread is being
created, so this make sure that issue flush thread will have no chance to access
invalid info in fcc.

Signed-off-by: Chao Yu &lt;chao2.yu@samsung.com&gt;
Reviewed-by: Gu Zheng &lt;guz.fnst@cn.fujitsu.com&gt;
Signed-off-by: Jaegeuk Kim &lt;jaegeuk@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=75861

Denis 2014-05-10 11:28:59 UTC reported:
"F2FS-fs (mmcblk0p28): mounting..
 Unable to handle kernel NULL pointer dereference at virtual address 00000018
 ...
 [&lt;c0a2f678&gt;] (_raw_spin_lock+0x3c/0x70) from [&lt;c03a0330&gt;] (issue_flush_thread+0x50/0x17c)
 [&lt;c03a0330&gt;] (issue_flush_thread+0x50/0x17c) from [&lt;c01b4064&gt;] (kthread+0x98/0xa4)
 [&lt;c01b4064&gt;] (kthread+0x98/0xa4) from [&lt;c0108060&gt;] (kernel_thread_exit+0x0/0x8)"

This patch assign cmd_control_info in sm_info before issue_flush_thread is being
created, so this make sure that issue flush thread will have no chance to access
invalid info in fcc.

Signed-off-by: Chao Yu &lt;chao2.yu@samsung.com&gt;
Reviewed-by: Gu Zheng &lt;guz.fnst@cn.fujitsu.com&gt;
Signed-off-by: Jaegeuk Kim &lt;jaegeuk@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>f2fs: remove unused variables in f2fs_sm_info</title>
<updated>2014-07-09T12:57:57+00:00</updated>
<author>
<name>Chao Yu</name>
<email>chao2.yu@samsung.com</email>
</author>
<published>2014-06-11T10:32:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=8bc6f60e3f7f31c4ce370b4b27b8f4b355b7f07e'/>
<id>8bc6f60e3f7f31c4ce370b4b27b8f4b355b7f07e</id>
<content type='text'>
Remove unused variables in struct f2fs_sm_info.

Signed-off-by: Chao Yu &lt;chao2.yu@samsung.com&gt;
Signed-off-by: Jaegeuk Kim &lt;jaegeuk@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Remove unused variables in struct f2fs_sm_info.

Signed-off-by: Chao Yu &lt;chao2.yu@samsung.com&gt;
Signed-off-by: Jaegeuk Kim &lt;jaegeuk@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>f2fs: avoid to use slab memory in f2fs_issue_flush for efficiency</title>
<updated>2014-05-08T09:23:21+00:00</updated>
<author>
<name>Chao Yu</name>
<email>chao2.yu@samsung.com</email>
</author>
<published>2014-05-08T09:00:35+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=adf8d90b6a949dc80e827263fccb31f8eb08a55d'/>
<id>adf8d90b6a949dc80e827263fccb31f8eb08a55d</id>
<content type='text'>
If we use slab memory in f2fs_issue_flush(), we will face memory pressure and
latency time caused by racing of kmem_cache_{alloc,free}.

Let's alloc memory in stack instead of slab.

Signed-off-by: Chao Yu &lt;chao2.yu@samsung.com&gt;
Signed-off-by: Jaegeuk Kim &lt;jaegeuk.kim@samsung.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
If we use slab memory in f2fs_issue_flush(), we will face memory pressure and
latency time caused by racing of kmem_cache_{alloc,free}.

Let's alloc memory in stack instead of slab.

Signed-off-by: Chao Yu &lt;chao2.yu@samsung.com&gt;
Signed-off-by: Jaegeuk Kim &lt;jaegeuk.kim@samsung.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>f2fs: introduce help function {create,destroy}_flush_cmd_control</title>
<updated>2014-05-07T01:21:57+00:00</updated>
<author>
<name>Gu Zheng</name>
<email>guz.fnst@cn.fujitsu.com</email>
</author>
<published>2014-04-27T06:21:33+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=2163d19815b3dfdb243cee2de2478ae7efce1942'/>
<id>2163d19815b3dfdb243cee2de2478ae7efce1942</id>
<content type='text'>
Introduce help function {create,destroy}_flush_cmd_control to clean up
the create/destory flush merge operation.

Signed-off-by: Gu Zheng &lt;guz.fnst@cn.fujitsu.com&gt;
Signed-off-by: Jaegeuk Kim &lt;jaegeuk.kim@samsung.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Introduce help function {create,destroy}_flush_cmd_control to clean up
the create/destory flush merge operation.

Signed-off-by: Gu Zheng &lt;guz.fnst@cn.fujitsu.com&gt;
Signed-off-by: Jaegeuk Kim &lt;jaegeuk.kim@samsung.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>f2fs: introduce struct flush_cmd_control to wrap the flush_merge fields</title>
<updated>2014-05-07T01:21:56+00:00</updated>
<author>
<name>Gu Zheng</name>
<email>guz.fnst@cn.fujitsu.com</email>
</author>
<published>2014-04-27T06:21:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=a688b9d9e5cbec76edab74e724297b5488c07829'/>
<id>a688b9d9e5cbec76edab74e724297b5488c07829</id>
<content type='text'>
Split the flush_merge fields from sm_i, and use the new struct flush_cmd_control
to wrap it, so that we can igonre these fileds if flush_merge is disable, and
it alse can the structs more neat.

Signed-off-by: Gu Zheng &lt;guz.fnst@cn.fujitsu.com&gt;
Signed-off-by: Jaegeuk Kim &lt;jaegeuk.kim@samsung.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Split the flush_merge fields from sm_i, and use the new struct flush_cmd_control
to wrap it, so that we can igonre these fileds if flush_merge is disable, and
it alse can the structs more neat.

Signed-off-by: Gu Zheng &lt;guz.fnst@cn.fujitsu.com&gt;
Signed-off-by: Jaegeuk Kim &lt;jaegeuk.kim@samsung.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>f2fs: add the flush_merge handle in the remount flow</title>
<updated>2014-05-07T01:21:55+00:00</updated>
<author>
<name>Gu Zheng</name>
<email>guz.fnst@cn.fujitsu.com</email>
</author>
<published>2014-04-11T09:50:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=876dc59eb1f0131c092803d0d206d47dd0119dfe'/>
<id>876dc59eb1f0131c092803d0d206d47dd0119dfe</id>
<content type='text'>
Add the *remount* handle of flush_merge option, so that the users
can enable flush_merge in the runtime, such as the underlying device
handles the cache_flush command relatively slowly.

Signed-off-by: Gu Zheng &lt;guz.fnst@cn.fujitsu.com&gt;
Signed-off-by: Jaegeuk Kim &lt;jaegeuk.kim@samsung.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Add the *remount* handle of flush_merge option, so that the users
can enable flush_merge in the runtime, such as the underlying device
handles the cache_flush command relatively slowly.

Signed-off-by: Gu Zheng &lt;guz.fnst@cn.fujitsu.com&gt;
Signed-off-by: Jaegeuk Kim &lt;jaegeuk.kim@samsung.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>f2fs: avoid to conduct roll-forward due to the remained garbage blocks</title>
<updated>2014-05-07T01:21:54+00:00</updated>
<author>
<name>Jaegeuk Kim</name>
<email>jaegeuk.kim@samsung.com</email>
</author>
<published>2014-04-15T04:57:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=1e87a78d95ecea7a989349860feb42db3e4b7db5'/>
<id>1e87a78d95ecea7a989349860feb42db3e4b7db5</id>
<content type='text'>
The f2fs always scans the next chain of direct node blocks.
But some garbage blocks are able to be remained due to no discard support or
SSR triggers.
This occasionally wreaks recovering wrong inodes that were used or BUG_ONs
due to reallocating node ids as follows.

When mount this f2fs image:
http://linuxtesting.org/downloads/f2fs_fault_image.zip
BUG_ON is triggered in f2fs driver (messages below are generated on
kernel 3.13.2; for other kernels output is similar):

kernel BUG at fs/f2fs/node.c:215!
 Call Trace:
 [&lt;ffffffffa032ebad&gt;] recover_inode_page+0x1fd/0x3e0 [f2fs]
 [&lt;ffffffff811446e7&gt;] ? __lock_page+0x67/0x70
 [&lt;ffffffff81089990&gt;] ? autoremove_wake_function+0x50/0x50
 [&lt;ffffffffa0337788&gt;] recover_fsync_data+0x1398/0x15d0 [f2fs]
 [&lt;ffffffff812b9e5c&gt;] ? selinux_d_instantiate+0x1c/0x20
 [&lt;ffffffff811cb20b&gt;] ? d_instantiate+0x5b/0x80
 [&lt;ffffffffa0321044&gt;] f2fs_fill_super+0xb04/0xbf0 [f2fs]
 [&lt;ffffffff811b861e&gt;] ? mount_bdev+0x7e/0x210
 [&lt;ffffffff811b8769&gt;] mount_bdev+0x1c9/0x210
 [&lt;ffffffffa0320540&gt;] ? validate_superblock+0x210/0x210 [f2fs]
 [&lt;ffffffffa031cf8d&gt;] f2fs_mount+0x1d/0x30 [f2fs]
 [&lt;ffffffff811b9497&gt;] mount_fs+0x47/0x1c0
 [&lt;ffffffff81166e00&gt;] ? __alloc_percpu+0x10/0x20
 [&lt;ffffffff811d4032&gt;] vfs_kern_mount+0x72/0x110
 [&lt;ffffffff811d6763&gt;] do_mount+0x493/0x910
 [&lt;ffffffff811615cb&gt;] ? strndup_user+0x5b/0x80
 [&lt;ffffffff811d6c70&gt;] SyS_mount+0x90/0xe0
 [&lt;ffffffff8166f8d9&gt;] system_call_fastpath+0x16/0x1b

Found by Linux File System Verification project (linuxtesting.org).

Reported-by: Andrey Tsyvarev &lt;tsyvarev@ispras.ru&gt;
Signed-off-by: Jaegeuk Kim &lt;jaegeuk.kim@samsung.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The f2fs always scans the next chain of direct node blocks.
But some garbage blocks are able to be remained due to no discard support or
SSR triggers.
This occasionally wreaks recovering wrong inodes that were used or BUG_ONs
due to reallocating node ids as follows.

When mount this f2fs image:
http://linuxtesting.org/downloads/f2fs_fault_image.zip
BUG_ON is triggered in f2fs driver (messages below are generated on
kernel 3.13.2; for other kernels output is similar):

kernel BUG at fs/f2fs/node.c:215!
 Call Trace:
 [&lt;ffffffffa032ebad&gt;] recover_inode_page+0x1fd/0x3e0 [f2fs]
 [&lt;ffffffff811446e7&gt;] ? __lock_page+0x67/0x70
 [&lt;ffffffff81089990&gt;] ? autoremove_wake_function+0x50/0x50
 [&lt;ffffffffa0337788&gt;] recover_fsync_data+0x1398/0x15d0 [f2fs]
 [&lt;ffffffff812b9e5c&gt;] ? selinux_d_instantiate+0x1c/0x20
 [&lt;ffffffff811cb20b&gt;] ? d_instantiate+0x5b/0x80
 [&lt;ffffffffa0321044&gt;] f2fs_fill_super+0xb04/0xbf0 [f2fs]
 [&lt;ffffffff811b861e&gt;] ? mount_bdev+0x7e/0x210
 [&lt;ffffffff811b8769&gt;] mount_bdev+0x1c9/0x210
 [&lt;ffffffffa0320540&gt;] ? validate_superblock+0x210/0x210 [f2fs]
 [&lt;ffffffffa031cf8d&gt;] f2fs_mount+0x1d/0x30 [f2fs]
 [&lt;ffffffff811b9497&gt;] mount_fs+0x47/0x1c0
 [&lt;ffffffff81166e00&gt;] ? __alloc_percpu+0x10/0x20
 [&lt;ffffffff811d4032&gt;] vfs_kern_mount+0x72/0x110
 [&lt;ffffffff811d6763&gt;] do_mount+0x493/0x910
 [&lt;ffffffff811615cb&gt;] ? strndup_user+0x5b/0x80
 [&lt;ffffffff811d6c70&gt;] SyS_mount+0x90/0xe0
 [&lt;ffffffff8166f8d9&gt;] system_call_fastpath+0x16/0x1b

Found by Linux File System Verification project (linuxtesting.org).

Reported-by: Andrey Tsyvarev &lt;tsyvarev@ispras.ru&gt;
Signed-off-by: Jaegeuk Kim &lt;jaegeuk.kim@samsung.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>f2fs: enable flush_merge only in f2fs is not read-only</title>
<updated>2014-05-07T01:21:54+00:00</updated>
<author>
<name>Gu Zheng</name>
<email>guz.fnst@cn.fujitsu.com</email>
</author>
<published>2014-04-11T09:49:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=b270ad6f0aedd27bdc689fc15f26bc650a59b12b'/>
<id>b270ad6f0aedd27bdc689fc15f26bc650a59b12b</id>
<content type='text'>
Enable flush_merge only in f2fs is not read-only, so does the mount
option show.

Signed-off-by: Gu Zheng &lt;guz.fnst@cn.fujitsu.com&gt;
Signed-off-by: Jaegeuk Kim &lt;jaegeuk.kim@samsung.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Enable flush_merge only in f2fs is not read-only, so does the mount
option show.

Signed-off-by: Gu Zheng &lt;guz.fnst@cn.fujitsu.com&gt;
Signed-off-by: Jaegeuk Kim &lt;jaegeuk.kim@samsung.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>f2fs: use __GFP_ZERO to avoid appending set-NULL</title>
<updated>2014-05-07T01:21:53+00:00</updated>
<author>
<name>Gu Zheng</name>
<email>guz.fnst@cn.fujitsu.com</email>
</author>
<published>2014-04-11T09:49:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=197d46476c3ba5f8595209025d20953a0c851748'/>
<id>197d46476c3ba5f8595209025d20953a0c851748</id>
<content type='text'>
Signed-off-by: Gu Zheng &lt;guz.fnst@cn.fujitsu.com&gt;
Signed-off-by: Jaegeuk Kim &lt;jaegeuk.kim@samsung.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Signed-off-by: Gu Zheng &lt;guz.fnst@cn.fujitsu.com&gt;
Signed-off-by: Jaegeuk Kim &lt;jaegeuk.kim@samsung.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>f2fs: put the bio when issue_flush completed</title>
<updated>2014-05-07T01:21:53+00:00</updated>
<author>
<name>Gu Zheng</name>
<email>guz.fnst@cn.fujitsu.com</email>
</author>
<published>2014-04-11T09:49:35+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=a4ed23f2f1a875f4b50d5f7e3dd5b0abbedda1ff'/>
<id>a4ed23f2f1a875f4b50d5f7e3dd5b0abbedda1ff</id>
<content type='text'>
Put the bio when the flush cmd issued, it also can fix the following
kmemleak:
unreferenced object 0xffff8800270c73c0 (size 200):
  comm "f2fs_flush-7:0", pid 27161, jiffies 4312127988 (age 988.503s)
  hex dump (first 32 bytes):
    00 00 00 00 00 00 00 00 40 07 81 19 01 88 ff ff  ........@.......
    01 00 00 00 00 00 00 f0 11 14 00 00 00 00 00 00  ................
  backtrace:
    [&lt;ffffffff81559866&gt;] kmemleak_alloc+0x72/0x96
    [&lt;ffffffff81156f7e&gt;] slab_post_alloc_hook+0x28/0x2a
    [&lt;ffffffff811595b1&gt;] kmem_cache_alloc+0xec/0x157
    [&lt;ffffffff8111924d&gt;] mempool_alloc_slab+0x15/0x17
    [&lt;ffffffff81119513&gt;] mempool_alloc+0x71/0x138
    [&lt;ffffffff81193548&gt;] bio_alloc_bioset+0x93/0x18c
    [&lt;ffffffffa040f857&gt;] issue_flush_thread+0x8d/0x145 [f2fs]
    [&lt;ffffffff8107ac16&gt;] kthread+0xba/0xc2
    [&lt;ffffffff81571b2c&gt;] ret_from_fork+0x7c/0xb0
    [&lt;ffffffffffffffff&gt;] 0xffffffffffffffff

Signed-off-by: Gu Zheng &lt;guz.fnst@cn.fujitsu.com&gt;
Signed-off-by: Jaegeuk Kim &lt;jaegeuk.kim@samsung.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Put the bio when the flush cmd issued, it also can fix the following
kmemleak:
unreferenced object 0xffff8800270c73c0 (size 200):
  comm "f2fs_flush-7:0", pid 27161, jiffies 4312127988 (age 988.503s)
  hex dump (first 32 bytes):
    00 00 00 00 00 00 00 00 40 07 81 19 01 88 ff ff  ........@.......
    01 00 00 00 00 00 00 f0 11 14 00 00 00 00 00 00  ................
  backtrace:
    [&lt;ffffffff81559866&gt;] kmemleak_alloc+0x72/0x96
    [&lt;ffffffff81156f7e&gt;] slab_post_alloc_hook+0x28/0x2a
    [&lt;ffffffff811595b1&gt;] kmem_cache_alloc+0xec/0x157
    [&lt;ffffffff8111924d&gt;] mempool_alloc_slab+0x15/0x17
    [&lt;ffffffff81119513&gt;] mempool_alloc+0x71/0x138
    [&lt;ffffffff81193548&gt;] bio_alloc_bioset+0x93/0x18c
    [&lt;ffffffffa040f857&gt;] issue_flush_thread+0x8d/0x145 [f2fs]
    [&lt;ffffffff8107ac16&gt;] kthread+0xba/0xc2
    [&lt;ffffffff81571b2c&gt;] ret_from_fork+0x7c/0xb0
    [&lt;ffffffffffffffff&gt;] 0xffffffffffffffff

Signed-off-by: Gu Zheng &lt;guz.fnst@cn.fujitsu.com&gt;
Signed-off-by: Jaegeuk Kim &lt;jaegeuk.kim@samsung.com&gt;
</pre>
</div>
</content>
</entry>
</feed>
