From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: Naohiro Aota <naota@elisp.net>, linux-btrfs@vger.kernel.org
Cc: quwenruo@cn.fujitsu.com
Subject: Re: [PATCH 0/3] btrfs-progs: fix file restore to lost+found bug
Date: Sat, 5 Dec 2015 09:35:07 +0800 [thread overview]
Message-ID: <56623F4B.80502@gmx.com> (raw)
In-Reply-To: <1449207447-1203-1-git-send-email-naota@elisp.net>
On 12/04/2015 01:37 PM, Naohiro Aota wrote:
> This series address an issue of btrfsck to restore infinite number of
> same file into `lost+found' directory. The issue occur on a file which
> is linked from two different directory A and B. If links from dir A is
> corrupted and links from dir B is kept valid, btrfsck won't stop
> creating a file in lost+found like this:
>
> -----
> Moving file 'file.del.51' to 'lost+found' dir since it has no valid backref
> Fixed the nlink of inode 1876
> Trying to rebuild inode:1877
> Moving file 'del' to 'lost+found' dir since it has no valid backref
> Fixed the nlink of inode 1877
> Can't get file name for inode 1876, using '1876' as fallback
> Moving file '1876' to 'lost+found' dir since it has no valid backref
> Fixed the nlink of inode 1876
> Can't get file name for inode 1876, using '1876' as fallback
> Moving file '1876.1876' to 'lost+found' dir since it has no valid backref
> Fixed the nlink of inode 1876
> (snip)
> Moving file '1876.1876.1876.1876.1876.1876.1876.1876.1876.1876.1876.1876.1876.1876.1876.1876.1876.1876.1876.1876.1876.1876.1876.1876.1876.1876.1876.1876.1876.1876.1876.1876.1876.1876.1876.1876.1876.1876.1876.1876.1876.1876.1876.1876.1876.1876.1876.1876.1876.1876.1876' to 'lost+found' dir since it has no valid backref
> Fixed the nlink of inode 1876
> Can't get file name for inode 1876, using '1876' as fallback
> Can't get file name for inode 1876, using '1876' as fallback
> Can't get file name for inode 1876, using '1876' as fallback
> -----
>
> The problem is early release of inode backrefs. The release prevents
> `reset_nlink()' to add back valid backrefs to an inode. In the result,
> the following results occur:
>
> 0. btrfsck scan a FS tree
> 1. It finds valid links and invalid links (some links are lost)
> 2. All valid links are released
> 3. btrfsck detects found_links != nlink
> 4. reset_nlink() reset nlink to 0
> 5. No valid links are restored (thus still nlink = 0)
> 6. The file is restored to lost+found since nlink == 0 (now, nlink = 1)
> 7. btrfsck rescan the FS tree
> 8. It finds `found_links' = #valid_links+1 (in lost+found) and nlink = 1
> 9. again all valid links are lost, and restore to lost+found
Right, that's one case I missed in the repair code.
Thanks for the fix.
>
> The first patch add clean up code to the test. It umount test
> directory on failure path. The second patch fix the above problem. And
> the last patch extend the test to check a case of multiple-linked file
> corruption.
But I only see the first 2 patches in maillist...
The last test case seems missing?
Thanks,
Qu
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
next prev parent reply other threads:[~2015-12-05 1:35 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-04 5:37 [PATCH 0/3] btrfs-progs: fix file restore to lost+found bug Naohiro Aota
2015-12-04 5:37 ` [PATCH 1/3] btrfs-progs: test: umount if confirmation failed Naohiro Aota
2015-12-07 15:33 ` David Sterba
2015-12-08 2:18 ` Naohiro Aota
2015-12-04 5:37 ` [PATCH 2/3] btrfs-progs: properly reset nlink of multi-linked file Naohiro Aota
2015-12-05 1:34 ` Qu Wenruo
2015-12-07 15:37 ` David Sterba
2015-12-05 1:35 ` Qu Wenruo [this message]
2015-12-07 2:59 ` [PATCH 0/3] btrfs-progs: fix file restore to lost+found bug Naohiro Aota
2015-12-07 3:02 ` Qu Wenruo
2015-12-07 15:35 ` David Sterba
2015-12-08 2:06 ` Naohiro Aota
2015-12-15 10:13 ` David Sterba
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=56623F4B.80502@gmx.com \
--to=quwenruo.btrfs@gmx.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=naota@elisp.net \
--cc=quwenruo@cn.fujitsu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.