From 1cd14cafc694bcedc5017a4f0dcb3c3faddec622 Mon Sep 17 00:00:00 2001 From: Jaegeuk Kim Date: Thu, 18 Jul 2013 18:02:31 +0900 Subject: f2fs: update file name in the inode block during f2fs_rename The error is reproducible by: 0. mkfs.f2fs /dev/sdb1 & mount 1. touch test1 2. touch test2 3. mv test1 test2 4. umount 5. dumpt.f2fs -i 4 /dev/sdb1 After this, when we retrieve the inode->i_name of test2 by dump.f2fs, we get test1 instead of test2. This is because f2fs didn't update the file name during the f2fs_rename. So, this patch fixes that. Signed-off-by: Jaegeuk Kim --- fs/f2fs/dir.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'fs/f2fs/dir.c') diff --git a/fs/f2fs/dir.c b/fs/f2fs/dir.c index 89ecb3785321..d1bb2606b313 100644 --- a/fs/f2fs/dir.c +++ b/fs/f2fs/dir.c @@ -276,6 +276,21 @@ static void init_dent_inode(const struct qstr *name, struct page *ipage) set_page_dirty(ipage); } +int update_dent_inode(struct inode *inode, const struct qstr *name) +{ + struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb); + struct page *page; + + page = get_node_page(sbi, inode->i_ino); + if (IS_ERR(page)) + return PTR_ERR(page); + + init_dent_inode(name, page); + f2fs_put_page(page, 1); + + return 0; +} + static int make_empty_dir(struct inode *inode, struct inode *parent, struct page *page) { -- cgit v1.2.3