From: "Theodore Ts'o" <tytso@mit.edu>
To: yangerkun <yangerkun@huawei.com>
Cc: linux-ext4@vger.kernel.org, adilger.kernel@dilger.ca,
jack@suse.cz, yi.zhang@huawei.com, lihaotian9@huawei.com,
lutianxiong@huawei.com, linfeilong@huawei.com
Subject: Re: [PATCH v3] ext4: fix bug for rename with RENAME_WHITEOUT
Date: Wed, 13 Jan 2021 22:51:58 -0500 [thread overview]
Message-ID: <X/+/3ui/TQ9LjtNZ@mit.edu> (raw)
In-Reply-To: <20210105062857.3566-1-yangerkun@huawei.com>
On Tue, Jan 05, 2021 at 02:28:57PM +0800, yangerkun wrote:
> We got a "deleted inode referenced" warning cross our fsstress test. The
> bug can be reproduced easily with following steps:
>
> cd /dev/shm
> mkdir test/
> fallocate -l 128M img
> mkfs.ext4 -b 1024 img
> mount img test/
> dd if=/dev/zero of=test/foo bs=1M count=128
> mkdir test/dir/ && cd test/dir/
> for ((i=0;i<1000;i++)); do touch file$i; done # consume all block
> cd ~ && renameat2(AT_FDCWD, /dev/shm/test/dir/file1, AT_FDCWD,
> /dev/shm/test/dir/dst_file, RENAME_WHITEOUT) # ext4_add_entry in
> ext4_rename will return ENOSPC!!
> cd /dev/shm/ && umount test/ && mount img test/ && ls -li test/dir/file1
> We will get the output:
> "ls: cannot access 'test/dir/file1': Structure needs cleaning"
> and the dmesg show:
> "EXT4-fs error (device loop0): ext4_lookup:1626: inode #2049: comm ls:
> deleted inode referenced: 139"
>
> ext4_rename will create a special inode for whiteout and use this 'ino'
> to replace the source file's dir entry 'ino'. Once error happens
> latter(the error above was the ENOSPC return from ext4_add_entry in
> ext4_rename since all space has been consumed), the cleanup do drop the
> nlink for whiteout, but forget to restore 'ino' with source file. This
> will trigger the bug describle as above.
>
> Signed-off-by: yangerkun <yangerkun@huawei.com>
Thanks, replied.
- Ted
next prev parent reply other threads:[~2021-01-14 3:53 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-05 6:28 [PATCH v3] ext4: fix bug for rename with RENAME_WHITEOUT yangerkun
2021-01-05 14:27 ` Jan Kara
2021-01-14 3:51 ` Theodore Ts'o [this message]
2021-01-20 6:57 ` Amir Goldstein
2021-01-20 8:42 ` Miklos Szeredi
2021-01-22 19:20 ` harshad shirwadkar
2021-01-22 20:32 ` Amir Goldstein
2021-03-09 7:30 ` Amir Goldstein
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=X/+/3ui/TQ9LjtNZ@mit.edu \
--to=tytso@mit.edu \
--cc=adilger.kernel@dilger.ca \
--cc=jack@suse.cz \
--cc=lihaotian9@huawei.com \
--cc=linfeilong@huawei.com \
--cc=linux-ext4@vger.kernel.org \
--cc=lutianxiong@huawei.com \
--cc=yangerkun@huawei.com \
--cc=yi.zhang@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).