<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux.git/fs/f2fs/node.c, branch v5.9-rc2</title>
<subtitle>Linux kernel source tree</subtitle>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/'/>
<entry>
<title>f2fs: space related cleanup</title>
<updated>2020-07-26T15:15:40+00:00</updated>
<author>
<name>Jack Qiu</name>
<email>jack.qiu@huawei.com</email>
</author>
<published>2020-07-24T08:55:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=a87aff1d491f6d824d9cc53303544361d7eaae75'/>
<id>a87aff1d491f6d824d9cc53303544361d7eaae75</id>
<content type='text'>
Just for code style, no logic change
1. delete useless space
2. change spaces into tab

Signed-off-by: Jack Qiu &lt;jack.qiu@huawei.com&gt;
Reviewed-by: Chao Yu &lt;yuchao0@huawei.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>
Just for code style, no logic change
1. delete useless space
2. change spaces into tab

Signed-off-by: Jack Qiu &lt;jack.qiu@huawei.com&gt;
Reviewed-by: Chao Yu &lt;yuchao0@huawei.com&gt;
Signed-off-by: Jaegeuk Kim &lt;jaegeuk@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>f2fs: Change the type of f2fs_flush_inline_data() to void</title>
<updated>2020-07-24T03:22:37+00:00</updated>
<author>
<name>Jia Yang</name>
<email>jiayang5@huawei.com</email>
</author>
<published>2020-07-21T03:49:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=68e79baf41f89fcdf9edf9bf3d65a71b667d066c'/>
<id>68e79baf41f89fcdf9edf9bf3d65a71b667d066c</id>
<content type='text'>
The return value of f2fs_flush_inline_data() is not used,
so delete it.

Signed-off-by: Jia Yang &lt;jiayang5@huawei.com&gt;
Reviewed-by: Chao Yu &lt;yuchao0@huawei.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>
The return value of f2fs_flush_inline_data() is not used,
so delete it.

Signed-off-by: Jia Yang &lt;jiayang5@huawei.com&gt;
Reviewed-by: Chao Yu &lt;yuchao0@huawei.com&gt;
Signed-off-by: Jaegeuk Kim &lt;jaegeuk@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>f2fs: should avoid inode eviction in synchronous path</title>
<updated>2020-07-21T19:55:54+00:00</updated>
<author>
<name>Jaegeuk Kim</name>
<email>jaegeuk@kernel.org</email>
</author>
<published>2020-07-16T16:57:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=b0f3b87fb3abc42c81d76c6c5795f26dbdb2f04b'/>
<id>b0f3b87fb3abc42c81d76c6c5795f26dbdb2f04b</id>
<content type='text'>
https://bugzilla.kernel.org/show_bug.cgi?id=208565

PID: 257    TASK: ecdd0000  CPU: 0   COMMAND: "init"
  #0 [&lt;c0b420ec&gt;] (__schedule) from [&lt;c0b423c8&gt;]
  #1 [&lt;c0b423c8&gt;] (schedule) from [&lt;c0b459d4&gt;]
  #2 [&lt;c0b459d4&gt;] (rwsem_down_read_failed) from [&lt;c0b44fa0&gt;]
  #3 [&lt;c0b44fa0&gt;] (down_read) from [&lt;c044233c&gt;]
  #4 [&lt;c044233c&gt;] (f2fs_truncate_blocks) from [&lt;c0442890&gt;]
  #5 [&lt;c0442890&gt;] (f2fs_truncate) from [&lt;c044d408&gt;]
  #6 [&lt;c044d408&gt;] (f2fs_evict_inode) from [&lt;c030be18&gt;]
  #7 [&lt;c030be18&gt;] (evict) from [&lt;c030a558&gt;]
  #8 [&lt;c030a558&gt;] (iput) from [&lt;c047c600&gt;]
  #9 [&lt;c047c600&gt;] (f2fs_sync_node_pages) from [&lt;c0465414&gt;]
 #10 [&lt;c0465414&gt;] (f2fs_write_checkpoint) from [&lt;c04575f4&gt;]
 #11 [&lt;c04575f4&gt;] (f2fs_sync_fs) from [&lt;c0441918&gt;]
 #12 [&lt;c0441918&gt;] (f2fs_do_sync_file) from [&lt;c0441098&gt;]
 #13 [&lt;c0441098&gt;] (f2fs_sync_file) from [&lt;c0323fa0&gt;]
 #14 [&lt;c0323fa0&gt;] (vfs_fsync_range) from [&lt;c0324294&gt;]
 #15 [&lt;c0324294&gt;] (do_fsync) from [&lt;c0324014&gt;]
 #16 [&lt;c0324014&gt;] (sys_fsync) from [&lt;c0108bc0&gt;]

This can be caused by flush_dirty_inode() in f2fs_sync_node_pages() where
iput() requires f2fs_lock_op() again resulting in livelock.

Reported-by: Zhiguo Niu &lt;Zhiguo.Niu@unisoc.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>
https://bugzilla.kernel.org/show_bug.cgi?id=208565

PID: 257    TASK: ecdd0000  CPU: 0   COMMAND: "init"
  #0 [&lt;c0b420ec&gt;] (__schedule) from [&lt;c0b423c8&gt;]
  #1 [&lt;c0b423c8&gt;] (schedule) from [&lt;c0b459d4&gt;]
  #2 [&lt;c0b459d4&gt;] (rwsem_down_read_failed) from [&lt;c0b44fa0&gt;]
  #3 [&lt;c0b44fa0&gt;] (down_read) from [&lt;c044233c&gt;]
  #4 [&lt;c044233c&gt;] (f2fs_truncate_blocks) from [&lt;c0442890&gt;]
  #5 [&lt;c0442890&gt;] (f2fs_truncate) from [&lt;c044d408&gt;]
  #6 [&lt;c044d408&gt;] (f2fs_evict_inode) from [&lt;c030be18&gt;]
  #7 [&lt;c030be18&gt;] (evict) from [&lt;c030a558&gt;]
  #8 [&lt;c030a558&gt;] (iput) from [&lt;c047c600&gt;]
  #9 [&lt;c047c600&gt;] (f2fs_sync_node_pages) from [&lt;c0465414&gt;]
 #10 [&lt;c0465414&gt;] (f2fs_write_checkpoint) from [&lt;c04575f4&gt;]
 #11 [&lt;c04575f4&gt;] (f2fs_sync_fs) from [&lt;c0441918&gt;]
 #12 [&lt;c0441918&gt;] (f2fs_do_sync_file) from [&lt;c0441098&gt;]
 #13 [&lt;c0441098&gt;] (f2fs_sync_file) from [&lt;c0323fa0&gt;]
 #14 [&lt;c0323fa0&gt;] (vfs_fsync_range) from [&lt;c0324294&gt;]
 #15 [&lt;c0324294&gt;] (do_fsync) from [&lt;c0324014&gt;]
 #16 [&lt;c0324014&gt;] (sys_fsync) from [&lt;c0108bc0&gt;]

This can be caused by flush_dirty_inode() in f2fs_sync_node_pages() where
iput() requires f2fs_lock_op() again resulting in livelock.

Reported-by: Zhiguo Niu &lt;Zhiguo.Niu@unisoc.com&gt;
Signed-off-by: Jaegeuk Kim &lt;jaegeuk@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>f2fs: fix error path in do_recover_data()</title>
<updated>2020-07-08T17:11:19+00:00</updated>
<author>
<name>Chao Yu</name>
<email>yuchao0@huawei.com</email>
</author>
<published>2020-07-06T10:23:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=9627a7b31f3c4ff8bc8f3be3683983ffe6eaebe6'/>
<id>9627a7b31f3c4ff8bc8f3be3683983ffe6eaebe6</id>
<content type='text'>
- don't panic kernel if f2fs_get_node_page() fails in
f2fs_recover_inline_data() or f2fs_recover_inline_xattr();
- return error number of f2fs_truncate_blocks() to
f2fs_recover_inline_data()'s caller;

Signed-off-by: Chao Yu &lt;yuchao0@huawei.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>
- don't panic kernel if f2fs_get_node_page() fails in
f2fs_recover_inline_data() or f2fs_recover_inline_xattr();
- return error number of f2fs_truncate_blocks() to
f2fs_recover_inline_data()'s caller;

Signed-off-by: Chao Yu &lt;yuchao0@huawei.com&gt;
Signed-off-by: Jaegeuk Kim &lt;jaegeuk@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>f2fs: lost matching-pair of trace in f2fs_truncate_inode_blocks</title>
<updated>2020-07-08T04:51:47+00:00</updated>
<author>
<name>Yubo Feng</name>
<email>fengyubo3@huawei.com</email>
</author>
<published>2020-06-20T08:39:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=9039d8355d6e37647b31a42122a26f1858a2470a'/>
<id>9039d8355d6e37647b31a42122a26f1858a2470a</id>
<content type='text'>
if get_node_path() return -E2BIG and trace of
f2fs_truncate_inode_blocks_enter/exit enabled
then the matching-pair of trace_exit will lost
in log.

Signed-off-by: Yubo Feng &lt;fengyubo3@huawei.com&gt;
Reviewed-by: Chao Yu &lt;yuchao0@huawei.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>
if get_node_path() return -E2BIG and trace of
f2fs_truncate_inode_blocks_enter/exit enabled
then the matching-pair of trace_exit will lost
in log.

Signed-off-by: Yubo Feng &lt;fengyubo3@huawei.com&gt;
Reviewed-by: Chao Yu &lt;yuchao0@huawei.com&gt;
Signed-off-by: Jaegeuk Kim &lt;jaegeuk@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>f2fs: remove useless parameter of __insert_free_nid()</title>
<updated>2020-07-08T04:51:45+00:00</updated>
<author>
<name>Liu Song</name>
<email>liu.song11@zte.com.cn</email>
</author>
<published>2020-06-28T13:48:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=b815bdc7817d5a27410a33475f3401bd47f5854e'/>
<id>b815bdc7817d5a27410a33475f3401bd47f5854e</id>
<content type='text'>
In current version, @state will only be FREE_NID. This parameter
has no real effect so remove it to keep clean.

Signed-off-by: Liu Song &lt;liu.song11@zte.com.cn&gt;
Reviewed-by: Chao Yu &lt;yuchao0@huawei.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>
In current version, @state will only be FREE_NID. This parameter
has no real effect so remove it to keep clean.

Signed-off-by: Liu Song &lt;liu.song11@zte.com.cn&gt;
Reviewed-by: Chao Yu &lt;yuchao0@huawei.com&gt;
Signed-off-by: Jaegeuk Kim &lt;jaegeuk@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>f2fs: don't return vmalloc() memory from f2fs_kmalloc()</title>
<updated>2020-06-09T03:34:58+00:00</updated>
<author>
<name>Eric Biggers</name>
<email>ebiggers@google.com</email>
</author>
<published>2020-06-05T04:57:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=0b6d4ca04a86b9dababbb76e58d33c437e127b77'/>
<id>0b6d4ca04a86b9dababbb76e58d33c437e127b77</id>
<content type='text'>
kmalloc() returns kmalloc'ed memory, and kvmalloc() returns either
kmalloc'ed or vmalloc'ed memory.  But the f2fs wrappers, f2fs_kmalloc()
and f2fs_kvmalloc(), both return both kinds of memory.

It's redundant to have two functions that do the same thing, and also
breaking the standard naming convention is causing bugs since people
assume it's safe to kfree() memory allocated by f2fs_kmalloc().  See
e.g. the various allocations in fs/f2fs/compress.c.

Fix this by making f2fs_kmalloc() just use kmalloc().  And to avoid
re-introducing the allocation failures that the vmalloc fallback was
intended to fix, convert the largest allocations to use f2fs_kvmalloc().

Signed-off-by: Eric Biggers &lt;ebiggers@google.com&gt;
Reviewed-by: Chao Yu &lt;yuchao0@huawei.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>
kmalloc() returns kmalloc'ed memory, and kvmalloc() returns either
kmalloc'ed or vmalloc'ed memory.  But the f2fs wrappers, f2fs_kmalloc()
and f2fs_kvmalloc(), both return both kinds of memory.

It's redundant to have two functions that do the same thing, and also
breaking the standard naming convention is causing bugs since people
assume it's safe to kfree() memory allocated by f2fs_kmalloc().  See
e.g. the various allocations in fs/f2fs/compress.c.

Fix this by making f2fs_kmalloc() just use kmalloc().  And to avoid
re-introducing the allocation failures that the vmalloc fallback was
intended to fix, convert the largest allocations to use f2fs_kvmalloc().

Signed-off-by: Eric Biggers &lt;ebiggers@google.com&gt;
Reviewed-by: Chao Yu &lt;yuchao0@huawei.com&gt;
Signed-off-by: Jaegeuk Kim &lt;jaegeuk@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>f2fs: avoid inifinite loop to wait for flushing node pages at cp_error</title>
<updated>2020-05-25T03:54:34+00:00</updated>
<author>
<name>Jaegeuk Kim</name>
<email>jaegeuk@kernel.org</email>
</author>
<published>2020-05-19T01:00:33+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=6d7c865c2714b122a940774990cfb1d87b57294a'/>
<id>6d7c865c2714b122a940774990cfb1d87b57294a</id>
<content type='text'>
Shutdown test is somtimes hung, since it keeps trying to flush dirty node pages
in an inifinite loop. Let's drop dirty pages at umount in that case.

Signed-off-by: Jaegeuk Kim &lt;jaegeuk@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Shutdown test is somtimes hung, since it keeps trying to flush dirty node pages
in an inifinite loop. Let's drop dirty pages at umount in that case.

Signed-off-by: Jaegeuk Kim &lt;jaegeuk@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>f2fs: Avoid double lock for cp_rwsem during checkpoint</title>
<updated>2020-05-12T03:36:47+00:00</updated>
<author>
<name>Sayali Lokhande</name>
<email>sayalil@codeaurora.org</email>
</author>
<published>2020-04-30T10:58:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=34c061ad85a2f5d5e9e3b045d72f3b211db6e282'/>
<id>34c061ad85a2f5d5e9e3b045d72f3b211db6e282</id>
<content type='text'>
There could be a scenario where f2fs_sync_node_pages gets
called during checkpoint, which in turn tries to flush
inline data and calls iput(). This results in deadlock as
iput() tries to hold cp_rwsem, which is already held at the
beginning by checkpoint-&gt;block_operations().

Call stack :

Thread A		Thread B
f2fs_write_checkpoint()
- block_operations(sbi)
 - f2fs_lock_all(sbi);
  - down_write(&amp;sbi-&gt;cp_rwsem);

                        - open()
                         - igrab()
                        - write() write inline data
                        - unlink()
- f2fs_sync_node_pages()
 - if (is_inline_node(page))
  - flush_inline_data()
   - ilookup()
     page = f2fs_pagecache_get_page()
     if (!page)
      goto iput_out;
     iput_out:
			-close()
			-iput()
       iput(inode);
       - f2fs_evict_inode()
        - f2fs_truncate_blocks()
         - f2fs_lock_op()
           - down_read(&amp;sbi-&gt;cp_rwsem);

Fixes: 2049d4fcb057 ("f2fs: avoid multiple node page writes due to inline_data")
Signed-off-by: Sayali Lokhande &lt;sayalil@codeaurora.org&gt;
Signed-off-by: Jaegeuk Kim &lt;jaegeuk@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
There could be a scenario where f2fs_sync_node_pages gets
called during checkpoint, which in turn tries to flush
inline data and calls iput(). This results in deadlock as
iput() tries to hold cp_rwsem, which is already held at the
beginning by checkpoint-&gt;block_operations().

Call stack :

Thread A		Thread B
f2fs_write_checkpoint()
- block_operations(sbi)
 - f2fs_lock_all(sbi);
  - down_write(&amp;sbi-&gt;cp_rwsem);

                        - open()
                         - igrab()
                        - write() write inline data
                        - unlink()
- f2fs_sync_node_pages()
 - if (is_inline_node(page))
  - flush_inline_data()
   - ilookup()
     page = f2fs_pagecache_get_page()
     if (!page)
      goto iput_out;
     iput_out:
			-close()
			-iput()
       iput(inode);
       - f2fs_evict_inode()
        - f2fs_truncate_blocks()
         - f2fs_lock_op()
           - down_read(&amp;sbi-&gt;cp_rwsem);

Fixes: 2049d4fcb057 ("f2fs: avoid multiple node page writes due to inline_data")
Signed-off-by: Sayali Lokhande &lt;sayalil@codeaurora.org&gt;
Signed-off-by: Jaegeuk Kim &lt;jaegeuk@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>f2fs: shrink spinlock coverage</title>
<updated>2020-05-12T03:36:46+00:00</updated>
<author>
<name>Chao Yu</name>
<email>yuchao0@huawei.com</email>
</author>
<published>2020-05-08T09:50:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=042be373adf719ab64c4a44ae809d110826becbf'/>
<id>042be373adf719ab64c4a44ae809d110826becbf</id>
<content type='text'>
In f2fs_try_to_free_nids(), .nid_list_lock spinlock critical region will
increase as expected shrink number increase, to avoid spining other CPUs
for long time, we change to release nid caches with small batch each time
under .nid_list_lock coverage.

Signed-off-by: Chao Yu &lt;yuchao0@huawei.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>
In f2fs_try_to_free_nids(), .nid_list_lock spinlock critical region will
increase as expected shrink number increase, to avoid spining other CPUs
for long time, we change to release nid caches with small batch each time
under .nid_list_lock coverage.

Signed-off-by: Chao Yu &lt;yuchao0@huawei.com&gt;
Signed-off-by: Jaegeuk Kim &lt;jaegeuk@kernel.org&gt;
</pre>
</div>
</content>
</entry>
</feed>
