linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/7] Fix long standing -EOPNOTSUPP problem caused by large inline extent
@ 2018-03-13  1:56 Qu Wenruo
  2018-03-13  1:56 ` [PATCH v2 1/7] btrfs-progs: convert/ext2: Fix inline extent creation check Qu Wenruo
                   ` (6 more replies)
  0 siblings, 7 replies; 14+ messages in thread
From: Qu Wenruo @ 2018-03-13  1:56 UTC (permalink / raw)
  To: linux-btrfs; +Cc: dsterba

The patch is based on v4.15.1, and is designed to replace the old patch
in devel branch.

Kernel doesn't support dropping range inside inline extent, and prevents
such thing happening by limiting max inline extent size to
min(max_inline, sectorsize - 1) in cow_file_range_inline().

However btrfs-progs only inherit the BTRFS_MAX_INLINE_DATA_SIZE() macro,
which doesn't have sectorsize check.
And since btrfs-progs defaults to 16K nodesize, above macro allows large
inline extent over 15K size.

This leads to unexpected kernel behavior.

The bug exists in several parts of btrfs-progs, any tool which creates
file extent is involved, including:
1) btrfs-convert
2) mkfs --rootdir

This patchset fixes the problems in convert (both ext2 and reiserfs),
mkfs --rootdir, then add check support for both original and lowmem
mode, and finally adds 2 test cases, one for mkfs and one for convert.

For mkfs test case, it can already be exposed by misc/002, but a
pin-point test case will be much better.

Tested with test-convert, test-fsck, test-misc and test-mkfs.

Qu Wenruo (7):
  btrfs-progs: convert/ext2: Fix inline extent creation check
  btrfs-progs: convert/reiserfs: Fix inline file extent creation check
  btrfs-progs: mkfs/rootdir: Fix inline extent creation check
  btrfs-progs: check/original mode: Check inline extent size
  btrfs-progs: check/lowmem mode: Check inline extent size
  btrfs-progs: test/convert: Add test case for invalid large inline data
    extent
  btrfs-progs: test/mkfs: Add test case for rootdir inline extent size

 check/main.c                                       | 16 +++++
 check/mode-lowmem.c                                | 28 ++++++++
 check/mode-original.h                              |  1 +
 convert/source-ext2.c                              |  2 +-
 convert/source-reiserfs.c                          |  3 +-
 mkfs/rootdir.c                                     |  6 +-
 .../016-invalid-large-inline-extent/test.sh        | 22 ++++++
 tests/mkfs-tests/014-rootdir-inline-extent/test.sh | 81 ++++++++++++++++++++++
 8 files changed, 155 insertions(+), 4 deletions(-)
 create mode 100755 tests/convert-tests/016-invalid-large-inline-extent/test.sh
 create mode 100755 tests/mkfs-tests/014-rootdir-inline-extent/test.sh

-- 
2.16.2


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2018-03-19 13:27 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-13  1:56 [PATCH v2 0/7] Fix long standing -EOPNOTSUPP problem caused by large inline extent Qu Wenruo
2018-03-13  1:56 ` [PATCH v2 1/7] btrfs-progs: convert/ext2: Fix inline extent creation check Qu Wenruo
2018-03-19 13:20   ` David Sterba
2018-03-13  1:56 ` [PATCH v2 2/7] btrfs-progs: convert/reiserfs: Fix inline file " Qu Wenruo
2018-03-13  1:56 ` [PATCH v2 3/7] btrfs-progs: mkfs/rootdir: Fix inline " Qu Wenruo
2018-03-13  1:56 ` [PATCH v2 4/7] btrfs-progs: check/original mode: Check inline extent size Qu Wenruo
2018-03-13  8:40   ` Nikolay Borisov
2018-03-13  9:06     ` Qu Wenruo
2018-03-13  1:56 ` [PATCH v2 5/7] btrfs-progs: check/lowmem " Qu Wenruo
2018-03-13  8:39   ` Nikolay Borisov
2018-03-13  9:04     ` Qu Wenruo
2018-03-13  1:56 ` [PATCH v2 6/7] btrfs-progs: test/convert: Add test case for invalid large inline data extent Qu Wenruo
2018-03-13  1:56 ` [PATCH v2 7/7] btrfs-progs: test/mkfs: Add test case for rootdir inline extent size Qu Wenruo
2018-03-19 13:25   ` David Sterba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).