From: Chao Yu <chao@kernel.org>
To: Sheng Yong <shengyong1@huawei.com>,
jaegeuk@kernel.org, yuchao0@huawei.com
Cc: linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [RFC PATCH] f2fs: do not set LOST_PINO for created/renamed dir
Date: Sat, 24 Jun 2017 23:12:16 +0800 [thread overview]
Message-ID: <6c8726e9-add3-fca8-902c-4624c6180d30@kernel.org> (raw)
In-Reply-To: <20170622064726.35016-1-shengyong1@huawei.com>
Hi Sheng Yong,
On 2017/6/22 14:47, Sheng Yong wrote:
> Since directories will be written back with checkpoint and fsync a
> directory will always write CP, there is no need to set LOST_PINO
Could you make another patch to fix unneeded flag setting in directory?
Thanks,
> after creating or renaming a directory. During rename, fix dir's
> p_ino directly. Otherwise, fsck will find out that the pino does
> not match. The scenario can be reproduced as the following:
>
> $ mkdir /bar/subbar /foo
> $ rename /bar/subbar /foo
>
> Then fsck will report:
> [ASSERT] (__chk_dots_dentries:1182) --> Bad inode number[0x3] for '..', parent parent ino is [0x4]>
> Signed-off-by: Sheng Yong <shengyong1@huawei.com>
> ---
> fs/f2fs/dir.c | 3 ++-
> fs/f2fs/namei.c | 5 ++++-
> 2 files changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/fs/f2fs/dir.c b/fs/f2fs/dir.c
> index 94756f55a97e..37f9c7f55605 100644
> --- a/fs/f2fs/dir.c
> +++ b/fs/f2fs/dir.c
> @@ -415,7 +415,8 @@ struct page *init_inode_metadata(struct inode *inode, struct inode *dir,
> * We lost i_pino from now on.
> */
> if (is_inode_flag_set(inode, FI_INC_LINK)) {
> - file_lost_pino(inode);
> + if (!S_ISDIR(inode->i_mode))
> + file_lost_pino(inode);
> /*
> * If link the tmpfile to alias through linkat path,
> * we should remove this inode from orphan list.
> diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c
> index c31b40e5f9cf..b75dc2f4ad57 100644
> --- a/fs/f2fs/namei.c
> +++ b/fs/f2fs/namei.c
> @@ -772,7 +772,10 @@ static int f2fs_rename(struct inode *old_dir, struct dentry *old_dentry,
> }
>
> down_write(&F2FS_I(old_inode)->i_sem);
> - file_lost_pino(old_inode);
> + if (!old_dir_entry || whiteout)
> + file_lost_pino(old_inode);
> + else
> + F2FS_I(old_inode)->i_pino = new_dir->i_ino;
> up_write(&F2FS_I(old_inode)->i_sem);
>
> old_inode->i_ctime = current_time(old_inode);
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
prev parent reply other threads:[~2017-06-24 15:13 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-22 6:47 [RFC PATCH] f2fs: do not set LOST_PINO for created/renamed dir Sheng Yong
2017-06-24 15:12 ` Chao Yu [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6c8726e9-add3-fca8-902c-4624c6180d30@kernel.org \
--to=chao@kernel.org \
--cc=jaegeuk@kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=shengyong1@huawei.com \
--cc=yuchao0@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).