<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/fs/f2fs/inode.c, branch linux-3.17.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-3.17.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-3.17.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2014-08-04T20:01:22Z</updated>
<entry>
<title>f2fs: invalidate xattr node page when evict inode</title>
<updated>2014-08-04T20:01:22Z</updated>
<author>
<name>Chao Yu</name>
</author>
<published>2014-08-04T01:54:58Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=002a41cabb5829d59c0337dcb5fa3893e0bb15fd'/>
<id>urn:sha1:002a41cabb5829d59c0337dcb5fa3893e0bb15fd</id>
<content type='text'>
When inode is evicted, all the page cache belong to this inode should be
released including the xattr node page. But previously we didn't do this, this
patch fixed this issue.

v2:
 o reposition invalidate_mapping_pages() to the right place suggested by
Jaegeuk Kim.

Signed-off-by: Chao Yu &lt;chao2.yu@samsung.com&gt;
Signed-off-by: Jaegeuk Kim &lt;jaegeuk@kernel.org&gt;
</content>
</entry>
<entry>
<title>f2fs: add info of appended or updated data writes</title>
<updated>2014-07-29T14:46:11Z</updated>
<author>
<name>Jaegeuk Kim</name>
</author>
<published>2014-07-25T14:40:59Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=fff04f90c1b9f91b9c513a89702a4b9ffe5dc1c5'/>
<id>urn:sha1:fff04f90c1b9f91b9c513a89702a4b9ffe5dc1c5</id>
<content type='text'>
This patch introduces a inode number list in which represents inodes having
appended data writes or updated data writes after last checkpoint.
This will be used at fsync to determine whether the recovery information
should be written or not.

Reviewed-by: Chao Yu &lt;chao2.yu@samsung.com&gt;
Signed-off-by: Jaegeuk Kim &lt;jaegeuk@kernel.org&gt;
</content>
</entry>
<entry>
<title>f2fs: avoid use invalid mapping of node_inode when evict meta inode</title>
<updated>2014-07-25T15:19:55Z</updated>
<author>
<name>Chao Yu</name>
</author>
<published>2014-07-25T04:00:57Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=dbf20cb259e879e2d939fd3fd5c792732d845195'/>
<id>urn:sha1:dbf20cb259e879e2d939fd3fd5c792732d845195</id>
<content type='text'>
Andrey Tsyvarev reported:
"Using memory error detector reveals the following use-after-free error
in 3.15.0:

AddressSanitizer: heap-use-after-free in f2fs_evict_inode
Read of size 8 by thread T22279:
  [&lt;ffffffffa02d8702&gt;] f2fs_evict_inode+0x102/0x2e0 [f2fs]
  [&lt;ffffffff812359af&gt;] evict+0x15f/0x290
  [&lt;     inlined    &gt;] iput+0x196/0x280 iput_final
  [&lt;ffffffff812369a6&gt;] iput+0x196/0x280
  [&lt;ffffffffa02dc416&gt;] f2fs_put_super+0xd6/0x170 [f2fs]
  [&lt;ffffffff81210095&gt;] generic_shutdown_super+0xc5/0x1b0
  [&lt;ffffffff812105fd&gt;] kill_block_super+0x4d/0xb0
  [&lt;ffffffff81210a86&gt;] deactivate_locked_super+0x66/0x80
  [&lt;ffffffff81211c98&gt;] deactivate_super+0x68/0x80
  [&lt;ffffffff8123cc88&gt;] mntput_no_expire+0x198/0x250
  [&lt;     inlined    &gt;] SyS_umount+0xe9/0x1a0 SYSC_umount
  [&lt;ffffffff8123f1c9&gt;] SyS_umount+0xe9/0x1a0
  [&lt;ffffffff81cc8df9&gt;] system_call_fastpath+0x16/0x1b

Freed by thread T3:
  [&lt;ffffffffa02dc337&gt;] f2fs_i_callback+0x27/0x30 [f2fs]
  [&lt;     inlined    &gt;] rcu_process_callbacks+0x2d6/0x930 __rcu_reclaim
  [&lt;     inlined    &gt;] rcu_process_callbacks+0x2d6/0x930 rcu_do_batch
  [&lt;     inlined    &gt;] rcu_process_callbacks+0x2d6/0x930 invoke_rcu_callbacks
  [&lt;     inlined    &gt;] rcu_process_callbacks+0x2d6/0x930 __rcu_process_callbacks
  [&lt;ffffffff810fd266&gt;] rcu_process_callbacks+0x2d6/0x930
  [&lt;ffffffff8107cce2&gt;] __do_softirq+0x142/0x380
  [&lt;ffffffff8107cf50&gt;] run_ksoftirqd+0x30/0x50
  [&lt;ffffffff810b2a87&gt;] smpboot_thread_fn+0x197/0x280
  [&lt;ffffffff810a8238&gt;] kthread+0x148/0x160
  [&lt;ffffffff81cc8d4c&gt;] ret_from_fork+0x7c/0xb0

Allocated by thread T22276:
  [&lt;ffffffffa02dc7dd&gt;] f2fs_alloc_inode+0x2d/0x170 [f2fs]
  [&lt;ffffffff81235e2a&gt;] iget_locked+0x10a/0x230
  [&lt;ffffffffa02d7495&gt;] f2fs_iget+0x35/0xa80 [f2fs]
  [&lt;ffffffffa02e2393&gt;] f2fs_fill_super+0xb53/0xff0 [f2fs]
  [&lt;ffffffff81211bce&gt;] mount_bdev+0x1de/0x240
  [&lt;ffffffffa02dbce0&gt;] f2fs_mount+0x10/0x20 [f2fs]
  [&lt;ffffffff81212a85&gt;] mount_fs+0x55/0x220
  [&lt;ffffffff8123c026&gt;] vfs_kern_mount+0x66/0x200
  [&lt;     inlined    &gt;] do_mount+0x2b4/0x1120 do_new_mount
  [&lt;ffffffff812400d4&gt;] do_mount+0x2b4/0x1120
  [&lt;     inlined    &gt;] SyS_mount+0xb2/0x110 SYSC_mount
  [&lt;ffffffff812414a2&gt;] SyS_mount+0xb2/0x110
  [&lt;ffffffff81cc8df9&gt;] system_call_fastpath+0x16/0x1b

The buggy address ffff8800587866c8 is located 48 bytes inside
  of 680-byte region [ffff880058786698, ffff880058786940)

Memory state around the buggy address:
  ffff880058786100: ffffffff ffffffff ffffffff ffffffff
  ffff880058786200: ffffffff ffffffff ffffffrr rrrrrrrr
  ffff880058786300: rrrrrrrr rrffffff ffffffff ffffffff
  ffff880058786400: ffffffff ffffffff ffffffff ffffffff
  ffff880058786500: ffffffff ffffffff ffffffff fffffffr
 &gt;ffff880058786600: rrrrrrrr rrrrrrrr rrrfffff ffffffff
                                                ^
  ffff880058786700: ffffffff ffffffff ffffffff ffffffff
  ffff880058786800: ffffffff ffffffff ffffffff ffffffff
  ffff880058786900: ffffffff rrrrrrrr rrrrrrrr rrrr....
  ffff880058786a00: ........ ........ ........ ........
  ffff880058786b00: ........ ........ ........ ........
Legend:
  f - 8 freed bytes
  r - 8 redzone bytes
  . - 8 allocated bytes
  x=1..7 - x allocated bytes + (8-x) redzone bytes

Investigation shows, that f2fs_evict_inode, when called for
'meta_inode', uses invalidate_mapping_pages() for 'node_inode'.
But 'node_inode' is deleted before 'meta_inode' in f2fs_put_super via
iput().

It seems that in common usage scenario this use-after-free is benign,
because 'node_inode' remains partially valid data even after
kmem_cache_free().
But things may change if, while 'meta_inode' is evicted in one f2fs
filesystem, another (mounted) f2fs filesystem requests inode from cache,
and formely
'node_inode' of the first filesystem is returned."

Nids for both meta_inode and node_inode are reservation, so it's not necessary
for us to invalidate pages which will never be allocated.
To fix this issue, let's skipping needlessly invalidating pages for
{meta,node}_inode in f2fs_evict_inode.

Reported-by: Andrey Tsyvarev &lt;tsyvarev@ispras.ru&gt;
Tested-by: Andrey Tsyvarev &lt;tsyvarev@ispras.ru&gt;
Signed-off-by: Gu Zheng &lt;guz.fnst@cn.fujitsu.com&gt;
Signed-off-by: Chao Yu &lt;chao2.yu@samsung.com&gt;
Signed-off-by: Jaegeuk Kim &lt;jaegeuk@kernel.org&gt;
</content>
</entry>
<entry>
<title>f2fs: check lower bound nid value in check_nid_range</title>
<updated>2014-07-09T12:58:08Z</updated>
<author>
<name>Chao Yu</name>
</author>
<published>2014-06-12T05:23:41Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d6b7d4b31dfd5a454a71c445b8086bc098237334'/>
<id>urn:sha1:d6b7d4b31dfd5a454a71c445b8086bc098237334</id>
<content type='text'>
This patch add lower bound verification for nid in check_nid_range, so nids
reserved like 0, node, meta passed by caller could be checked there.

And then check_nid_range could be used in f2fs_nfs_get_inode for simplifying
code.

Signed-off-by: Chao Yu &lt;chao2.yu@samsung.com&gt;
Signed-off-by: Jaegeuk Kim &lt;jaegeuk@kernel.org&gt;
</content>
</entry>
<entry>
<title>f2fs: deactivate inode page if the inode is evicted</title>
<updated>2014-05-07T01:21:58Z</updated>
<author>
<name>Jaegeuk Kim</name>
</author>
<published>2014-04-30T06:04:39Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=8198899b94b74bb16c0b240483fd81269b199d2e'/>
<id>urn:sha1:8198899b94b74bb16c0b240483fd81269b199d2e</id>
<content type='text'>
If the inode page is clean during its inode eviction, it'd better drop the page
to reduce further memory pressure.

Signed-off-by: Jaegeuk Kim &lt;jaegeuk.kim@samsung.com&gt;
</content>
</entry>
<entry>
<title>f2fs: atomically set inode-&gt;i_flags in f2fs_set_inode_flags()</title>
<updated>2014-05-07T01:21:54Z</updated>
<author>
<name>Zhang Zhen</name>
</author>
<published>2014-04-15T06:19:38Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=8abfb36ab396377ea712cd640c525fd5535d1dc9'/>
<id>urn:sha1:8abfb36ab396377ea712cd640c525fd5535d1dc9</id>
<content type='text'>
Use set_mask_bits() to atomically set i_flags instead of clearing out the
S_IMMUTABLE, S_APPEND, etc. flags and then setting them from the
FS_IMMUTABLE_FL, FS_APPEND_FL, etc. flags, since this opens up a race
where an immutable file has the immutable flag cleared for a brief
window of time.

Signed-off-by: Zhang Zhen &lt;zhenzhang.zhang@huawei.com&gt;
Signed-off-by: Jaegeuk Kim &lt;jaegeuk.kim@samsung.com&gt;
</content>
</entry>
<entry>
<title>Merge tag 'for-f2fs-3.15' of git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs</title>
<updated>2014-04-07T17:55:36Z</updated>
<author>
<name>Linus Torvalds</name>
</author>
<published>2014-04-07T17:55:36Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=3021112598d2b722eee54d8a662fea2089abbdbc'/>
<id>urn:sha1:3021112598d2b722eee54d8a662fea2089abbdbc</id>
<content type='text'>
Pull f2fs updates from Jaegeuk Kim:
 "This patch-set includes the following major enhancement patches.
   - introduce large directory support
   - introduce f2fs_issue_flush to merge redundant flush commands
   - merge write IOs as much as possible aligned to the segment
   - add sysfs entries to tune the f2fs configuration
   - use radix_tree for the free_nid_list to reduce in-memory operations
   - remove costly bit operations in f2fs_find_entry
   - enhance the readahead flow for CP/NAT/SIT/SSA blocks

  The other bug fixes are as follows:
   - recover xattr node blocks correctly after sudden-power-cut
   - fix to calculate the maximum number of node ids
   - enhance to handle many error cases

  And, there are a bunch of cleanups"

* tag 'for-f2fs-3.15' of git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs: (62 commits)
  f2fs: fix wrong statistics of inline data
  f2fs: check the acl's validity before setting
  f2fs: introduce f2fs_issue_flush to avoid redundant flush issue
  f2fs: fix to cover io-&gt;bio with io_rwsem
  f2fs: fix error path when fail to read inline data
  f2fs: use list_for_each_entry{_safe} for simplyfying code
  f2fs: avoid free slab cache under spinlock
  f2fs: avoid unneeded lookup when xattr name length is too long
  f2fs: avoid unnecessary bio submit when wait page writeback
  f2fs: return -EIO when node id is not matched
  f2fs: avoid RECLAIM_FS-ON-W warning
  f2fs: skip unnecessary node writes during fsync
  f2fs: introduce fi-&gt;i_sem to protect fi's info
  f2fs: change reclaim rate in percentage
  f2fs: add missing documentation for dir_level
  f2fs: remove unnecessary threshold
  f2fs: throttle the memory footprint with a sysfs entry
  f2fs: avoid to drop nat entries due to the negative nr_shrink
  f2fs: call f2fs_wait_on_page_writeback instead of native function
  f2fs: introduce nr_pages_to_write for segment alignment
  ...
</content>
</entry>
<entry>
<title>mm + fs: store shadow entries in page cache</title>
<updated>2014-04-03T23:21:01Z</updated>
<author>
<name>Johannes Weiner</name>
</author>
<published>2014-04-03T21:47:49Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=91b0abe36a7b2b3b02d7500925a5f8455334f0e5'/>
<id>urn:sha1:91b0abe36a7b2b3b02d7500925a5f8455334f0e5</id>
<content type='text'>
Reclaim will be leaving shadow entries in the page cache radix tree upon
evicting the real page.  As those pages are found from the LRU, an
iput() can lead to the inode being freed concurrently.  At this point,
reclaim must no longer install shadow pages because the inode freeing
code needs to ensure the page tree is really empty.

Add an address_space flag, AS_EXITING, that the inode freeing code sets
under the tree lock before doing the final truncate.  Reclaim will check
for this flag before installing shadow pages.

Signed-off-by: Johannes Weiner &lt;hannes@cmpxchg.org&gt;
Reviewed-by: Rik van Riel &lt;riel@redhat.com&gt;
Reviewed-by: Minchan Kim &lt;minchan@kernel.org&gt;
Cc: Andrea Arcangeli &lt;aarcange@redhat.com&gt;
Cc: Bob Liu &lt;bob.liu@oracle.com&gt;
Cc: Christoph Hellwig &lt;hch@infradead.org&gt;
Cc: Dave Chinner &lt;david@fromorbit.com&gt;
Cc: Greg Thelen &lt;gthelen@google.com&gt;
Cc: Hugh Dickins &lt;hughd@google.com&gt;
Cc: Jan Kara &lt;jack@suse.cz&gt;
Cc: KOSAKI Motohiro &lt;kosaki.motohiro@jp.fujitsu.com&gt;
Cc: Luigi Semenzato &lt;semenzato@google.com&gt;
Cc: Mel Gorman &lt;mgorman@suse.de&gt;
Cc: Metin Doslu &lt;metin@citusdata.com&gt;
Cc: Michel Lespinasse &lt;walken@google.com&gt;
Cc: Ozgun Erdogan &lt;ozgun@citusdata.com&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: Roman Gushchin &lt;klamm@yandex-team.ru&gt;
Cc: Ryan Mallon &lt;rmallon@gmail.com&gt;
Cc: Tejun Heo &lt;tj@kernel.org&gt;
Cc: Vlastimil Babka &lt;vbabka@suse.cz&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>f2fs: introduce get_dirty_dents for readability</title>
<updated>2014-03-18T03:34:30Z</updated>
<author>
<name>Jaegeuk Kim</name>
</author>
<published>2014-03-18T03:33:06Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=f8b2c1f940dca2843fe13b55ba5868bac8040551'/>
<id>urn:sha1:f8b2c1f940dca2843fe13b55ba5868bac8040551</id>
<content type='text'>
The get_dirty_dents gives us the number of dirty dentry pages.

Signed-off-by: Jaegeuk Kim &lt;jaegeuk.kim@samsung.com&gt;
</content>
</entry>
<entry>
<title>f2fs: introduce large directory support</title>
<updated>2014-02-27T10:56:09Z</updated>
<author>
<name>Jaegeuk Kim</name>
</author>
<published>2014-02-27T09:20:00Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=3843154598a00408f4214a68bd536fdf27b1df10'/>
<id>urn:sha1:3843154598a00408f4214a68bd536fdf27b1df10</id>
<content type='text'>
This patch introduces an i_dir_level field to support large directory.

Previously, f2fs maintains multi-level hash tables to find a dentry quickly
from a bunch of chiild dentries in a directory, and the hash tables consist of
the following tree structure as below.

In Documentation/filesystems/f2fs.txt,

----------------------
A : bucket
B : block
N : MAX_DIR_HASH_DEPTH
----------------------

level #0   | A(2B)
           |
level #1   | A(2B) - A(2B)
           |
level #2   | A(2B) - A(2B) - A(2B) - A(2B)
     .     |   .       .       .       .
level #N/2 | A(2B) - A(2B) - A(2B) - A(2B) - A(2B) - ... - A(2B)
     .     |   .       .       .       .
level #N   | A(4B) - A(4B) - A(4B) - A(4B) - A(4B) - ... - A(4B)

But, if we can guess that a directory will handle a number of child files,
we don't need to traverse the tree from level #0 to #N all the time.
Since the lower level tables contain relatively small number of dentries,
the miss ratio of the target dentry is likely to be high.

In order to avoid that, we can configure the hash tables sparsely from level #0
like this.

level #0   | A(2B) - A(2B) - A(2B) - A(2B)

level #1   | A(2B) - A(2B) - A(2B) - A(2B) - A(2B) - ... - A(2B)
     .     |   .       .       .       .
level #N/2 | A(2B) - A(2B) - A(2B) - A(2B) - A(2B) - ... - A(2B)
     .     |   .       .       .       .
level #N   | A(4B) - A(4B) - A(4B) - A(4B) - A(4B) - ... - A(4B)

With this structure, we can skip the ineffective tree searches in lower level
hash tables.

This patch adds just a facility for this by introducing i_dir_level in
f2fs_inode.

Signed-off-by: Jaegeuk Kim &lt;jaegeuk.kim@samsung.com&gt;
</content>
</entry>
</feed>
