From bbf156f7afa7f3cc07177f1119878f6f60855fd1 Mon Sep 17 00:00:00 2001 From: Jaegeuk Kim Date: Mon, 29 Aug 2016 18:23:45 -0700 Subject: 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 --- fs/f2fs/file.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'fs/f2fs/file.c') diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 7c6ee7ec88f2..21aa99b220d7 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -135,6 +135,8 @@ static inline bool need_do_checkpoint(struct inode *inode) if (!S_ISREG(inode->i_mode) || inode->i_nlink != 1) need_cp = true; + else if (is_sbi_flag_set(sbi, SBI_NEED_CP)) + need_cp = true; else if (file_enc_name(inode) && need_dentry_mark(sbi, inode->i_ino)) need_cp = true; else if (file_wrong_pino(inode)) -- cgit v1.2.3