Skip to content

Commit 7057572

Browse files
LiBaokun96richardweinberger
authored andcommitted
ubifs: rename_whiteout: correct old_dir size computing
When renaming the whiteout file, the old whiteout file is not deleted. Therefore, we add the old dentry size to the old dir like XFS. Otherwise, an error may be reported due to `fscki->calc_sz != fscki->size` in check_indes. Fixes: 9e0a1ff ("ubifs: Implement RENAME_WHITEOUT") Reported-by: Zhihao Cheng <chengzhihao1@huawei.com> Signed-off-by: Baokun Li <libaokun1@huawei.com> Signed-off-by: Richard Weinberger <richard@nod.at>
1 parent 9cdd312 commit 7057572

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

fs/ubifs/dir.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1402,6 +1402,9 @@ static int do_rename(struct inode *old_dir, struct dentry *old_dentry,
14021402
iput(whiteout);
14031403
goto out_release;
14041404
}
1405+
1406+
/* Add the old_dentry size to the old_dir size. */
1407+
old_sz -= CALC_DENT_SIZE(fname_len(&old_nm));
14051408
}
14061409

14071410
lock_4_inodes(old_dir, new_dir, new_inode, whiteout);

0 commit comments

Comments
 (0)