summaryrefslogtreecommitdiffstats
path: root/fs/f2fs/recovery.c
diff options
context:
space:
mode:
authorChao Yu <yuchao0@huawei.com>2018-09-25 09:36:02 +0200
committerJaegeuk Kim <jaegeuk@kernel.org>2018-10-23 02:54:48 +0200
commit78130819695f17f5c042d8ba097802639478faf5 (patch)
tree468624c7bdc9ab656be4982a635cca65526444c2 /fs/f2fs/recovery.c
parentf2fs: guarantee journalled quota data by checkpoint (diff)
downloadlinux-78130819695f17f5c042d8ba097802639478faf5.tar.xz
linux-78130819695f17f5c042d8ba097802639478faf5.zip
f2fs: fix to keep project quota consistent
This patch does below changes to keep consistence of project quota data in sudden power-cut case: - update inode.i_projid and project quota atomically under lock_op() in f2fs_ioc_setproject() - recover inode.i_projid and project quota in recover_inode() Signed-off-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/recovery.c')
-rw-r--r--fs/f2fs/recovery.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/fs/f2fs/recovery.c b/fs/f2fs/recovery.c
index df2123759ac7..1dfb17f9f9ff 100644
--- a/fs/f2fs/recovery.c
+++ b/fs/f2fs/recovery.c
@@ -254,10 +254,18 @@ static int recover_inode(struct inode *inode, struct page *page)
F2FS_FITS_IN_INODE(raw, le16_to_cpu(raw->i_extra_isize),
i_projid)) {
projid_t i_projid;
+ kprojid_t kprojid;
i_projid = (projid_t)le32_to_cpu(raw->i_projid);
- F2FS_I(inode)->i_projid =
- make_kprojid(&init_user_ns, i_projid);
+ kprojid = make_kprojid(&init_user_ns, i_projid);
+
+ if (!projid_eq(kprojid, F2FS_I(inode)->i_projid)) {
+ err = f2fs_transfer_project_quota(inode,
+ kprojid);
+ if (err)
+ return err;
+ F2FS_I(inode)->i_projid = kprojid;
+ }
}
}