From: David Sterba <dsterba@suse.cz>
To: fdmanana@kernel.org
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] Btrfs: fix wrong dentries after fsync of file that got its parent replaced
Date: Tue, 9 Oct 2018 18:18:35 +0200 [thread overview]
Message-ID: <20181009161835.GL29418@twin.jikos.cz> (raw)
In-Reply-To: <20181009140529.21196-1-fdmanana@kernel.org>
On Tue, Oct 09, 2018 at 03:05:29PM +0100, fdmanana@kernel.org wrote:
> From: Filipe Manana <fdmanana@suse.com>
>
> In a scenario like the following:
>
> mkdir /mnt/A # inode 258
> mkdir /mnt/B # inode 259
> touch /mnt/B/bar # inode 260
>
> sync
>
> mv /mnt/B/bar /mnt/A/bar
> mv -T /mnt/A /mnt/B
> fsync /mnt/B/bar
>
> <power fail>
>
> After replaying the log we end up with file bar having 2 hard links, both
> with the name 'bar' and one in the directory with inode number 258 and the
> other in the directory with inode number 259. Also, we end up with the
> directory inode 259 still existing and with the directory inode 258 still
> named as 'A', instead of 'B'. In this scenario, file 'bar' should only
> have one hard link, located at directory inode 258, the directory inode
> 259 should not exist anymore and the name for directory inode 258 should
> be 'B'.
>
> This incorrect behaviour happens because when attempting to log the old
> parents of an inode, we skip any parents that no longer exist. Fix this
> by forcing a full commit if an old parent no longer exists.
>
> A test case for fstests follows soon.
>
> Signed-off-by: Filipe Manana <fdmanana@suse.com>
Thanks, queued for 4.20 with CC: stable 4.4+ .
prev parent reply other threads:[~2018-10-09 16:18 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-09 14:05 [PATCH] Btrfs: fix wrong dentries after fsync of file that got its parent replaced fdmanana
2018-10-09 16:18 ` David Sterba [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=20181009161835.GL29418@twin.jikos.cz \
--to=dsterba@suse.cz \
--cc=fdmanana@kernel.org \
--cc=linux-btrfs@vger.kernel.org \
/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