]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
f2fs: cover cp_file information with ilock
authorJaegeuk Kim <jaegeuk.kim@samsung.com>
Tue, 28 May 2013 03:25:47 +0000 (12:25 +0900)
committerJaegeuk Kim <jaegeuk.kim@samsung.com>
Tue, 28 May 2013 06:03:06 +0000 (15:03 +0900)
If a file is linked with other files, it should be checkpointed at every fsync
calls.
For this, we use set_cp_file() with FADVISE_CP_BIT, but previously we didn't
cover the flag by the global lock.
This patch fixes that the inode page stores this correctly.

Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
fs/f2fs/dir.c
fs/f2fs/namei.c

index b278bfbc3646ee31ff963cd7fff58c70e84796ef..67e2d1361fa296e3c1ec7f1dc54f5fdaa1c9951d 100644 (file)
@@ -346,8 +346,14 @@ static struct page *init_inode_metadata(struct inode *inode,
 
        init_dent_inode(name, page);
 
-       if (is_inode_flag_set(F2FS_I(inode), FI_INC_LINK))
+       /*
+        * This file should be checkpointed during fsync.
+        * We lost i_pino from now on.
+        */
+       if (is_inode_flag_set(F2FS_I(inode), FI_INC_LINK)) {
+               set_cp_file(inode);
                inc_nlink(inode);
+       }
        return page;
 
 error:
index efe0a127cb76acb70eb549e43ed6269fc019d12d..1fe150276fadb1026a0e5ac5fac66f55b5445761 100644 (file)
@@ -181,12 +181,6 @@ static int f2fs_link(struct dentry *old_dentry, struct inode *dir,
        if (err)
                goto out;
 
-       /*
-        * This file should be checkpointed during fsync.
-        * We lost i_pino from now on.
-        */
-       set_cp_file(inode);
-
        d_instantiate(dentry, inode);
        return 0;
 out: