f2fs: update inode page after creation
authorJaegeuk Kim <jaegeuk.kim@samsung.com>
Mon, 20 May 2013 01:10:29 +0000 (10:10 +0900)
committerHuang, Tao <huangtao@rock-chips.com>
Wed, 26 Nov 2014 10:42:26 +0000 (18:42 +0800)
commit48ec812dccb0df3f5406e9565b92b0e44107f74f
treea72bdf941fa1ad8ddc52fc85caf72e8a268eacd2
parent44cd996db34015b908ba024d7478ad47d8ca25fd
f2fs: update inode page after creation

I found a bug when testing power-off-recovery as follows.

[Bug Scenario]
1. create a file
2. fsync the file
3. reboot w/o any sync
4. try to recover the file
 - found its fsync mark
 - found its dentry mark
   : try to recover its dentry
    - get its file name
    - get its parent inode number
     : here we got zero value

The reason why we get the wrong parent inode number is that we didn't
synchronize the inode page with its newly created inode information perfectly.

Especially, previous f2fs stores fi->i_pino and writes it to the cached
node page in a wrong order, which incurs the zero-valued i_pino during the
recovery.

So, this patch modifies the creation flow to fix the synchronization order of
inode page with its inode.

Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
(cherry picked from commit 44a83ff6a81d84ab83bcb43a49ff1ba6c7e17cd1)
fs/f2fs/data.c
fs/f2fs/dir.c
fs/f2fs/f2fs.h
fs/f2fs/node.c