Message ID | cover.1697716427.git.fdmanana@suse.com (mailing list archive) |
---|---|
Headers | show |
Series | btrfs: fix a corruption after snapshoting a new subvolume | expand |
On Thu, Oct 19, 2023 at 01:19:27PM +0100, fdmanana@kernel.org wrote: > From: Filipe Manana <fdmanana@suse.com> > > Starting with kernel 6.5, we no longer commit the transaction used to > create a subvolume when we finish creating the subvolume. This behaviour > was introduced for performance reasons and done with commit 1b53e51a4a8f > ("btrfs: don't commit transaction for every subvol create"). However this > allows for a corruption if we snapshot a subvolume created in the current > transaction, where basically we get a snapshot root that points to an > extent buffer that was not written. This makes attempt to read the extent > buffer later to fail, either with the infamous "parent transid verify > failed ..." error or with checksum failures. > > More details on the changelog of the first patch, and the remaining patches > are just cleanups. > > Filipe Manana (3): > btrfs: fix unwritten extent buffer after snapshoting a new subvolume > btrfs: use bool for return type of btrfs_block_can_be_shared() > btrfs: make the logic from btrfs_block_can_be_shared() easier to read > Reviewed-by: Josef Bacik <josef@toxicpanda.com> Thanks, Josef
On Thu, Oct 19, 2023 at 01:19:27PM +0100, fdmanana@kernel.org wrote: > From: Filipe Manana <fdmanana@suse.com> > > Starting with kernel 6.5, we no longer commit the transaction used to > create a subvolume when we finish creating the subvolume. This behaviour > was introduced for performance reasons and done with commit 1b53e51a4a8f > ("btrfs: don't commit transaction for every subvol create"). However this > allows for a corruption if we snapshot a subvolume created in the current > transaction, where basically we get a snapshot root that points to an > extent buffer that was not written. This makes attempt to read the extent > buffer later to fail, either with the infamous "parent transid verify > failed ..." error or with checksum failures. > > More details on the changelog of the first patch, and the remaining patches > are just cleanups. > > Filipe Manana (3): > btrfs: fix unwritten extent buffer after snapshoting a new subvolume > btrfs: use bool for return type of btrfs_block_can_be_shared() > btrfs: make the logic from btrfs_block_can_be_shared() easier to read Thanks for catching it and for the fix, patch has been meanwhile merged to 6.6-rc7 so it'll be in the next stable update.
From: Filipe Manana <fdmanana@suse.com> Starting with kernel 6.5, we no longer commit the transaction used to create a subvolume when we finish creating the subvolume. This behaviour was introduced for performance reasons and done with commit 1b53e51a4a8f ("btrfs: don't commit transaction for every subvol create"). However this allows for a corruption if we snapshot a subvolume created in the current transaction, where basically we get a snapshot root that points to an extent buffer that was not written. This makes attempt to read the extent buffer later to fail, either with the infamous "parent transid verify failed ..." error or with checksum failures. More details on the changelog of the first patch, and the remaining patches are just cleanups. Filipe Manana (3): btrfs: fix unwritten extent buffer after snapshoting a new subvolume btrfs: use bool for return type of btrfs_block_can_be_shared() btrfs: make the logic from btrfs_block_can_be_shared() easier to read fs/btrfs/backref.c | 14 +++++++++----- fs/btrfs/backref.h | 3 ++- fs/btrfs/ctree.c | 39 +++++++++++++++++++++++++++++---------- fs/btrfs/ctree.h | 5 +++-- fs/btrfs/relocation.c | 7 ++++--- 5 files changed, 47 insertions(+), 21 deletions(-)