btrfs: use fs_holder_ops for btrfs
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v6 Latest8 patches 4 repliesIn review
- v58 patches 1 replySuperseded
- v48 patches 3 repliesSuperseded
Changes in v6 from the cover letter
- Fix an error handling bug that can lead to use-after-free Reported by syzbot, that inside btrfs_get_tree_super() that if we didn't open the devices, there are corner cases that fs_info->fs_devices can be freed twice, causing use-after-free bug.
Patches in v6 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/8 | btrfs: always open the device read-only in btrfs_scan_one_devicefs/ fs/ fs/ | +7 | 0 replies | |
| 2/8 | btrfs: get rid of the re-entry of btrfs_get_tree()fs/ | +3 | 0 replies | |
| 3/8 | btrfs: add comments to make super block creation more clearfs/ | +21 | 0 replies | |
| 4/8 | btrfs: call btrfs_close_devices from ->kill_sbfs/ fs/ | +11 | 0 replies | |
| 5/8 | btrfs: call bdev_fput() to reclaim the blk_holder immediatelyfs/ fs/ fs/ | +12 | 0 replies | |
| 6/8 | btrfs: delay btrfs_open_devices() until super block is createdfs/ fs/ fs/ | +74 | 0 replies | |
| 7/8 | btrfs: use the super_block as holder when mounting file systemsfs/ fs/ fs/ +1 more | +4 | 0 replies | |
| 8/8 | btrfs: use fs_holder_ops for all opened devicesfs/ fs/ | +3 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v6 yet.
Cover letter [PATCH v6 0/8] btrfs: use fs_holder_ops for btrfs
[CHANGELOG]
v6:
- Fix an error handling bug that can lead to use-after-free Reported by syzbot, that inside btrfs_get_tree_super() that if we didn't open the devices, there are corner cases that fs_info->fs_devices can be freed twice, causing use-after-free bug.
This one fixed two error paths:
* sget_fc() failure
Which is not the one reported by syzbot, but still possible to hit.
* btrfs_open_devices() failure
Which I believe is the one reported by syzbot.
There is a dedicated fix pushed into linux-next.
This refreshed series is for the proper merge into our for-next branch.
v5:
- Fix a tailing whitespace
This introduced by patch "btrfs: add comments to make super block creation more clear", and that patch is created during a small window where my commit checkpatch hook is broken.
And unfortunately that comment is also later updated by several patches, causing several conflicts with that whitespace error fixed.
v4:
- Fix a lockdep error
In the patch "btrfs: delay btrfs_open_devices() until super block is created", we call sget_fc() with uuid_mutex locked.
But during fs closing, we also try to lock uuid_mutex with s_umount locked.
This leads to a reserved lock sequence and resuled a lockdep warning.
Fix it by introducing btrfs_fs_devices::holding (aka, the old solution introduced by Christoph), but this time with no extra bugs during fstests.
- Add the patch to use fs_holder_ops
This patch is small and properly tested, it's more situable to include this one here, other than delaying it to the next devloss feature.
- Add the missing patch to always open device-readonly when scanning My bad, there are a little too many patches pending, and I forgot to include the first patch.
v3:
- Drop the btrfs_fs_devices::opened split
It turns out to cause problems during tests.
- Extra cleanup related to the btrfs_get_tree_*()
Now the re-entry through vfs_get_tree() is completely dropped.
- Extra comments explaining the sget_fc() behavior
- Call bdev_fput() instead of fput()
This alignes us to all the other fses.
- Updated patch to delay btrfs_open_devices() until sget_fc() Instead of relying on the previous solution (split btrfs_open_devices::opened), just expand the uuid_mutex critical section.
Christoph Hellwig (3):
btrfs: always open the device read-only in btrfs_scan_one_device
btrfs: call btrfs_close_devices from ->kill_sb
btrfs: use the super_block as holder when mounting file systems
Qu Wenruo (5):
btrfs: get rid of the re-entry of btrfs_get_tree()
btrfs: add comments to make super block creation more clear
btrfs: call bdev_fput() to reclaim the blk_holder immediately
btrfs: delay btrfs_open_devices() until super block is created
btrfs: use fs_holder_ops for all opened devices
fs/btrfs/dev-replace.c | 4 +- fs/btrfs/disk-io.c | 4 +- fs/btrfs/fs.h | 2 - fs/btrfs/ioctl.c | 4 +- fs/btrfs/super.c | 129 ++++++++++++++++++++++------------------- fs/btrfs/volumes.c | 33 ++++++----- fs/btrfs/volumes.h | 27 ++++++++- 7 files changed, 119 insertions(+), 84 deletions(-)
Signature · 1 line
2.50.0