<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/fs/f2fs/inode.c, branch linux-3.18.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-3.18.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-3.18.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2014-10-07T18:54:41Z</updated>
<entry>
<title>f2fs: support volatile operations for transient data</title>
<updated>2014-10-07T18:54:41Z</updated>
<author>
<name>Jaegeuk Kim</name>
</author>
<published>2014-10-06T23:11:16Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=02a1335f25a386db9afc68f8315162f862aac93f'/>
<id>urn:sha1:02a1335f25a386db9afc68f8315162f862aac93f</id>
<content type='text'>
This patch adds support for volatile writes which keep data pages in memory
until f2fs_evict_inode is called by iput.

For instance, we can use this feature for the sqlite database as follows.
While supporting atomic writes for main database file, we can keep its journal
data temporarily in the page cache by the following sequence.

1. open
 -&gt; ioctl(F2FS_IOC_START_VOLATILE_WRITE);
2. writes
 : keep all the data in the page cache.
3. flush to the database file with atomic writes
  a. ioctl(F2FS_IOC_START_ATOMIC_WRITE);
  b. writes
  c. ioctl(F2FS_IOC_COMMIT_ATOMIC_WRITE);
4. close
 -&gt; drop the cached data

Signed-off-by: Jaegeuk Kim &lt;jaegeuk@kernel.org&gt;
</content>
</entry>
<entry>
<title>f2fs: support atomic writes</title>
<updated>2014-10-07T00:39:50Z</updated>
<author>
<name>Jaegeuk Kim</name>
</author>
<published>2014-10-07T00:39:50Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=88b88a66797159949cec32eaab12b4968f6fae2d'/>
<id>urn:sha1:88b88a66797159949cec32eaab12b4968f6fae2d</id>
<content type='text'>
This patch introduces a very limited functionality for atomic write support.
In order to support atomic write, this patch adds two ioctls:
 o F2FS_IOC_START_ATOMIC_WRITE
 o F2FS_IOC_COMMIT_ATOMIC_WRITE

The database engine should be aware of the following sequence.
1. open
 -&gt; ioctl(F2FS_IOC_START_ATOMIC_WRITE);
2. writes
  : all the written data will be treated as atomic pages.
3. commit
 -&gt; ioctl(F2FS_IOC_COMMIT_ATOMIC_WRITE);
  : this flushes all the data blocks to the disk, which will be shown all or
  nothing by f2fs recovery procedure.
4. repeat to #2.

The IO pattens should be:

  ,- START_ATOMIC_WRITE                  ,- COMMIT_ATOMIC_WRITE
 CP | D D D D D D | FSYNC | D D D D | FSYNC ...
                      `- COMMIT_ATOMIC_WRITE

Signed-off-by: Jaegeuk Kim &lt;jaegeuk@kernel.org&gt;
</content>
</entry>
<entry>
<title>f2fs: call f2fs_unlock_op after error was handled</title>
<updated>2014-09-30T22:34:55Z</updated>
<author>
<name>Jaegeuk Kim</name>
</author>
<published>2014-09-25T18:55:53Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=44c16156512f33c81e382a1e1df9524e26a7026a'/>
<id>urn:sha1:44c16156512f33c81e382a1e1df9524e26a7026a</id>
<content type='text'>
This patch relocates f2fs_unlock_op in every directory operations to be called
after any error was processed.
Otherwise, the checkpoint can be entered with valid node ids without its
dentry when -ENOSPC is occurred.

Signed-off-by: Jaegeuk Kim &lt;jaegeuk@kernel.org&gt;
</content>
</entry>
<entry>
<title>f2fs: expand counting dirty pages in the inode page cache</title>
<updated>2014-09-16T11:10:39Z</updated>
<author>
<name>Jaegeuk Kim</name>
</author>
<published>2014-09-12T22:53:45Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=a7ffdbe22cecaed59b5d76a5f003d68907d64240'/>
<id>urn:sha1:a7ffdbe22cecaed59b5d76a5f003d68907d64240</id>
<content type='text'>
Previously f2fs only counts dirty dentry pages, but there is no reason not to
expand the scope.

This patch changes the names on the management of dirty pages and to count
dirty pages in each inode info as well.

Signed-off-by: Jaegeuk Kim &lt;jaegeuk@kernel.org&gt;
</content>
</entry>
<entry>
<title>f2fs: need fsck.f2fs when f2fs_bug_on is triggered</title>
<updated>2014-09-09T20:15:02Z</updated>
<author>
<name>Jaegeuk Kim</name>
</author>
<published>2014-09-02T22:52:58Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=9850cf4a8908886370b1f15aacf83d291f098c72'/>
<id>urn:sha1:9850cf4a8908886370b1f15aacf83d291f098c72</id>
<content type='text'>
If any f2fs_bug_on is triggered, fsck.f2fs is needed.

Signed-off-by: Jaegeuk Kim &lt;jaegeuk@kernel.org&gt;
</content>
</entry>
<entry>
<title>f2fs: introduce F2FS_I_SB, F2FS_M_SB, and F2FS_P_SB</title>
<updated>2014-09-04T00:37:13Z</updated>
<author>
<name>Jaegeuk Kim</name>
</author>
<published>2014-09-02T22:31:18Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=4081363fbe84a7ebac6d3339dd2775df45d856d0'/>
<id>urn:sha1:4081363fbe84a7ebac6d3339dd2775df45d856d0</id>
<content type='text'>
This patch adds three inline functions to clean up dirty casting codes.

Signed-off-by: Jaegeuk Kim &lt;jaegeuk@kernel.org&gt;
</content>
</entry>
<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>
</feed>
