Skip to content

btrfs-progs: convert: fix the invalid regular extents for symbol links

Qu Wenruo linux-btrfs 2 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest4 patches 0 repliesNew
  2. v14 patches 0 repliesSuperseded

Changes in v2 from the cover letter

- Fix the words "symbol link" to "symbolic link"

- Split the inline extent size limits into two different ones One for symbolic links, as they are limited by PATH_MAX - 1. The other one for regular data inlined extents. They should be no larger than sectorsize - 1.

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4btrfs-progs: convert: fix inline extent size for symbol linkconvert/source-ext2.c convert/source-reiserfs.c kernel-shared/file-item.c +1 more+55 -80 replies
2/4btrfs-progs: check/original: detect invalid file extent items for symbolic linkscheck/main.c+7 -00 replies
3/4btrfs-progs: check/lowmem: detect invalid file extents for symbolic linkscheck/mode-lowmem.c+44 -00 replies
4/4btrfs-progs: convert-tests: add a test case to verify large symbolic link handlingtests/convert-tests/027-large-symbol-link/test.sh+27 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 0/4] btrfs-progs: convert: fix the invalid regular extents for symbol links

[CHANGELOG]
v2:
- Fix the words "symbol link" to "symbolic link"

- Split the inline extent size limits into two different ones One for symbolic links, as they are limited by PATH_MAX - 1. The other one for regular data inlined extents. They should be no larger than sectorsize - 1.

Furthremore, both will also be limited by the node size.

Test case btrfs/012 fails randomly after the rework to use fsstress to populate the fs.

It turns out that, if fsstress creates a symbol link whose target is 4095 bytes (at the max size limit), btrfs-convert will create a regular extent instead of the expected inline one.

This regular extent for symbol link inodes will be rejected by kernel, resulting test case failure.

The reason that btrfs-convert created such regular extent is, btrfs-convert accidentally added one byte for the terminating NUL, enlarge the should-be inlined file extent to be a regular one.

The first patch will fix the bug.
Then two patches to enahnce btrfs-check to detect the error (regular and lowmem mode)
Eventually a dedicated test case for btrfs-convert, so in the future we won't cause the problem again.

Qu Wenruo (4):
btrfs-progs: convert: fix inline extent size for symbol link
btrfs-progs: check/original: detect invalid file extent items for
symbolic links
btrfs-progs: check/lowmem: detect invalid file extents for symbolic
links
btrfs-progs: convert-tests: add a test case to verify large symbolic
link handling

 check/main.c                                  |  7 +++
 check/mode-lowmem.c                           | 44 +++++++++++++++++++
 convert/source-ext2.c                         | 29 +++++++++---
 convert/source-reiserfs.c                     | 10 ++++-
 kernel-shared/file-item.c                     |  6 +++
 kernel-shared/file-item.h                     | 18 ++++++++
 .../027-large-symbol-link/test.sh             | 27 ++++++++++++
 7 files changed, 133 insertions(+), 8 deletions(-)
 create mode 100755 tests/convert-tests/027-large-symbol-link/test.sh

--
2.46.0