* Patch "Btrfs: fix empty symlink after creating symlink and fsync parent dir" has been added to the 4.5-stable tree
@ 2016-06-05 21:48 gregkh
0 siblings, 0 replies; only message in thread
From: gregkh @ 2016-06-05 21:48 UTC (permalink / raw)
To: fdmanana, gregkh; +Cc: stable, stable-commits
This is a note to let you know that I've just added the patch titled
Btrfs: fix empty symlink after creating symlink and fsync parent dir
to the 4.5-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
btrfs-fix-empty-symlink-after-creating-symlink-and-fsync-parent-dir.patch
and it can be found in the queue-4.5 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.
>From 3f9749f6e9edcf8ec569fb542efc3be35e06e84a Mon Sep 17 00:00:00 2001
From: Filipe Manana <fdmanana@suse.com>
Date: Mon, 25 Apr 2016 04:45:02 +0100
Subject: Btrfs: fix empty symlink after creating symlink and fsync parent dir
From: Filipe Manana <fdmanana@suse.com>
commit 3f9749f6e9edcf8ec569fb542efc3be35e06e84a upstream.
If we create a symlink, fsync its parent directory, crash/power fail and
mount the filesystem, we end up with an empty symlink, which not only is
useless it's also not allowed in linux (the man page symlink(2) is well
explicit about that). So we just need to make sure to fully log an inode
if it's a symlink, to ensure its inline extent gets logged, ensuring the
same behaviour as ext3, ext4, xfs, reiserfs, f2fs, nilfs2, etc.
Example reproducer:
$ mkfs.btrfs -f /dev/sdb
$ mount /dev/sdb /mnt
$ mkdir /mnt/testdir
$ sync
$ ln -s /mnt/foo /mnt/testdir/bar
$ xfs_io -c fsync /mnt/testdir
<power fail>
$ mount /dev/sdb /mnt
$ readlink /mnt/testdir/bar
<empty string>
A test case for fstests follows soon.
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
fs/btrfs/tree-log.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -5157,7 +5157,7 @@ process_leaf:
}
ctx->log_new_dentries = false;
- if (type == BTRFS_FT_DIR)
+ if (type == BTRFS_FT_DIR || type == BTRFS_FT_SYMLINK)
log_mode = LOG_INODE_ALL;
btrfs_release_path(path);
ret = btrfs_log_inode(trans, root, di_inode,
Patches currently in stable-queue which might be from fdmanana@suse.com are
queue-4.5/btrfs-fix-empty-symlink-after-creating-symlink-and-fsync-parent-dir.patch
queue-4.5/btrfs-fix-for-incorrect-directory-entries-after-fsync-log-replay.patch
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2016-06-05 22:03 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-05 21:48 Patch "Btrfs: fix empty symlink after creating symlink and fsync parent dir" has been added to the 4.5-stable tree gregkh
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.