Filipe Manana
2b99ff4c3e
btrfs: always log symlinks in full mode
...
commit d0e64a981fd841cb0f28fcd6afcac55e6f1e6994 upstream.
On Linux, empty symlinks are invalid, and attempting to create one with
the system call symlink(2) results in an -ENOENT error and this is
explicitly documented in the man page.
If we rename a symlink that was created in the current transaction and its
parent directory was logged before, we actually end up logging the symlink
without logging its content, which is stored in an inline extent. That
means that after a power failure we can end up with an empty symlink,
having no content and an i_size of 0 bytes.
It can be easily reproduced like this:
$ mkfs.btrfs -f /dev/sdc
$ mount /dev/sdc /mnt
$ mkdir /mnt/testdir
$ sync
# Create a file inside the directory and fsync the directory.
$ touch /mnt/testdir/foo
$ xfs_io -c "fsync" /mnt/testdir
# Create a symlink inside the directory and then rename the symlink.
$ ln -s /mnt/testdir/foo /mnt/testdir/bar
$ mv /mnt/testdir/bar /mnt/testdir/baz
# Now fsync again the directory, this persist the log tree.
$ xfs_io -c "fsync" /mnt/testdir
<power failure>
$ mount /dev/sdc /mnt
$ stat -c %s /mnt/testdir/baz
0
$ readlink /mnt/testdir/baz
$
Fix this by always logging symlinks in full mode (LOG_INODE_ALL), so that
their content is also logged.
A test case for fstests will follow.
CC: [email protected] # 4.9+
Signed-off-by: Filipe Manana <[email protected] >
Signed-off-by: David Sterba <[email protected] >
Signed-off-by: Greg Kroah-Hartman <[email protected] >
2022-05-12 12:23:46 +02:00
..
tests
acl.c
async-thread.c
btrfs: fix memory ordering between normal and ordered work functions
2021-11-26 10:47:21 +01:00
async-thread.h
backref.c
btrfs: remove BUG_ON(!eie) in find_parent_nodes
2022-01-27 09:19:45 +01:00
backref.h
block-group.c
btrfs: remove unused variable in btrfs_{start,write}_dirty_block_groups()
2022-04-20 09:19:38 +02:00
block-group.h
btrfs: scrub: Don't check free space before marking a block group RO
2021-03-20 10:39:46 +01:00
block-rsv.c
block-rsv.h
btrfs_inode.h
btrfs: fix race between marking inode needs to be logged and log syncing
2021-09-03 10:08:15 +02:00
check-integrity.c
check-integrity.h
compression.c
btrfs: mark compressed range uptodate only if all bio succeed
2021-08-04 12:27:37 +02:00
compression.h
ctree.c
btrfs: check the root node for uptodate before returning it
2022-01-27 09:19:50 +01:00
ctree.h
btrfs: fix lockdep splat when enabling and disabling qgroups
2021-08-15 13:08:05 +02:00
delalloc-space.c
btrfs: make btrfs_qgroup_reserve_data take btrfs_inode
2021-08-15 13:08:04 +02:00
delalloc-space.h
delayed-inode.c
btrfs: don't flush from btrfs_delayed_inode_reserve_metadata
2021-08-15 13:08:06 +02:00
delayed-inode.h
delayed-ref.c
delayed-ref.h
dev-replace.c
btrfs: dev-replace: fail mount if we don't have replace item with target device
2020-11-18 19:20:29 +01:00
dev-replace.h
dir-item.c
disk-io.c
btrfs: check-integrity: fix a warning on write caching disabled disk
2021-12-08 09:01:09 +01:00
disk-io.h
export.c
export.h
extent-tree.c
btrfs: unlock newly allocated extent buffer after error
2021-10-20 11:40:13 +02:00
extent_io.c
btrfs: clear extent buffer uptodate when we fail to write it
2021-12-14 14:49:01 +01:00
extent_io.h
btrfs: fix qgroup reserve overflow the qgroup limit
2022-04-15 14:18:39 +02:00
extent_map.c
extent_map.h
file-item.c
btrfs: fix error handling in btrfs_del_csums
2021-06-10 13:37:13 +02:00
file.c
btrfs: fix race between marking inode needs to be logged and log syncing
2021-09-03 10:08:15 +02:00
free-space-cache.c
btrfs: delete duplicated words + other fixes in comments
2021-08-08 09:04:07 +02:00
free-space-cache.h
free-space-tree.c
btrfs: fix possible free space tree corruption with online conversion
2021-02-03 23:25:57 +01:00
free-space-tree.h
inode-item.c
inode-map.c
inode-map.h
inode.c
btrfs: respect the max size in the header when activating swap file
2022-01-27 09:19:51 +01:00
ioctl.c
fsnotify: invalidate dcache before IN_DELETE event
2022-02-01 17:24:39 +01:00
Kconfig
btrfs: disable build on platforms having page size 256K
2021-07-14 16:53:14 +02:00
locking.c
locking.h
lzo.c
Makefile
misc.h
ordered-data.c
ordered-data.h
orphan.c
print-tree.c
print-tree.h
props.c
props.h
qgroup.c
btrfs: qgroup: fix deadlock between rescan worker and remove qgroup
2022-03-08 19:07:50 +01:00
qgroup.h
btrfs: export and rename qgroup_reserve_meta
2021-08-15 13:08:06 +02:00
raid56.c
btrfs: fix raid6 qstripe kmap
2021-03-09 11:09:37 +01:00
raid56.h
rcu-string.h
reada.c
btrfs: fix readahead hang and use-after-free after removing a device
2020-11-05 11:43:27 +01:00
ref-verify.c
btrfs: ref-verify: fix memory leak in btrfs_ref_tree_mod
2020-11-18 19:20:28 +01:00
ref-verify.h
relocation.c
btrfs: convert logic BUG_ON()'s in replace_path to ASSERT()'s
2021-05-11 14:04:07 +02:00
root-tree.c
btrfs: replace the BUG_ON in btrfs_del_root_ref with proper error handling
2021-12-14 14:49:01 +01:00
scrub.c
btrfs: scrub: Don't check free space before marking a block group RO
2021-03-20 10:39:46 +01:00
send.c
btrfs: send: in case of IO error log it
2022-02-23 11:59:55 +01:00
send.h
space-info.c
btrfs: prevent __btrfs_dump_space_info() to underflow its free space
2021-09-30 10:09:22 +02:00
space-info.h
btrfs: take overcommit into account in inc_block_group_ro
2020-10-17 10:11:21 +02:00
struct-funcs.c
super.c
btrfs: fix transaction leak and crash after RO remount caused by qgroup rescan
2021-01-19 18:26:14 +01:00
sysfs.c
sysfs.h
transaction.c
btrfs: qgroup: remove ASYNC_COMMIT mechanism in favor of reserve retry-after-EDQUOT
2021-08-15 13:08:05 +02:00
transaction.h
btrfs: fix race between marking inode needs to be logged and log syncing
2021-09-03 10:08:15 +02:00
tree-checker.c
btrfs: tree-checker: do not error out if extent ref hash doesn't match
2021-06-10 13:37:01 +02:00
tree-checker.h
tree-defrag.c
tree-log.c
btrfs: always log symlinks in full mode
2022-05-12 12:23:46 +02:00
tree-log.h
btrfs: do not commit logs and transactions during link and rename operations
2021-08-08 09:04:07 +02:00
ulist.c
ulist.h
uuid-tree.c
volumes.c
btrfs: mark resumed async balance as writing
2022-04-20 09:19:38 +02:00
volumes.h
btrfs: fix readahead hang and use-after-free after removing a device
2020-11-05 11:43:27 +01:00
xattr.c
btrfs: fix warning when creating a directory with smack enabled
2021-03-09 11:09:37 +01:00
xattr.h
zlib.c
zstd.c