summaryrefslogtreecommitdiffstats
path: root/fs/f2fs/xattr.c
diff options
context:
space:
mode:
authorJaegeuk Kim2016-08-30 03:23:45 +0200
committerJaegeuk Kim2016-09-08 02:27:39 +0200
commitbbf156f7afa7f3cc07177f1119878f6f60855fd1 (patch)
treeaff5602ad821fcfeea2bd4cd3eb35017f101e7d9 /fs/f2fs/xattr.c
parentf2fs: support async discard (diff)
downloadkernel-qcow2-linux-bbf156f7afa7f3cc07177f1119878f6f60855fd1.tar.gz
kernel-qcow2-linux-bbf156f7afa7f3cc07177f1119878f6f60855fd1.tar.xz
kernel-qcow2-linux-bbf156f7afa7f3cc07177f1119878f6f60855fd1.zip
f2fs: fix lost xattrs of directories
This patch enhances the xattr consistency of dirs from suddern power-cuts. Possible scenario would be: 1. dir->setxattr used by per-file encryption 2. file->setxattr goes into inline_xattr 3. file->fsync In that case, we should do checkpoint for #1. Otherwise we'd lose dir's key information for the file given #2. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/xattr.c')
-rw-r--r--fs/f2fs/xattr.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/f2fs/xattr.c b/fs/f2fs/xattr.c
index c8898b5148eb..d39a7923de42 100644
--- a/fs/f2fs/xattr.c
+++ b/fs/f2fs/xattr.c
@@ -548,6 +548,8 @@ static int __f2fs_setxattr(struct inode *inode, int index,
!strcmp(name, F2FS_XATTR_NAME_ENCRYPTION_CONTEXT))
f2fs_set_encrypted_inode(inode);
f2fs_mark_inode_dirty_sync(inode);
+ if (!error && S_ISDIR(inode->i_mode))
+ set_sbi_flag(F2FS_I_SB(inode), SBI_NEED_CP);
exit:
kzfree(base_addr);
return error;