FAILED: patch "[PATCH] btrfs: fix log context list corruption after rename whiteout" failed to apply to 4.14-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 4.14-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 236ebc20d9afc5e9ff52f3cf3f365a91583aac10 Mon Sep 17 00:00:00 2001
From: Filipe Manana <[email protected]>
Date: Tue, 10 Mar 2020 12:13:53 +0000
Subject: [PATCH] btrfs: fix log context list corruption after rename whiteout
error
During a rename whiteout, if btrfs_whiteout_for_rename() returns an error we can end up returning from btrfs_rename() with the log context object still in the root's log context list - this happens if 'sync_log' was set to true before we called btrfs_whiteout_for_rename() and it is dangerous because we end up with a corrupt linked list (root->log_ctxs) as the log context object was allocated on the stack.
After btrfs_rename() returns, any task that is running btrfs_sync_log() concurrently can end up crashing because that linked list is traversed by btrfs_sync_log() (through btrfs_remove_all_log_ctxs()). That results in the same issue that commit e6c617102c7e4 ("Btrfs: fix log context list corruption after rename exchange operation") fixed.
fs/btrfs/inode.c +4 -0
@@ -9496,6 +9496,10 @@ static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry, ret =btrfs_sync_log (trans,BTRFS_I (old_inode)->root, &ctx);if (ret) commit_transaction = true; + }else if (sync_log) { +mutex_lock (&root->log_mutex); +list_del (&ctx.list); +mutex_unlock (&root->log_mutex); }if (commit_transaction) { ret =btrfs_commit_transaction (trans);
Sasha Levin
maintainerQuoted 31 lines · On Mon, Mar 23, 2020 at 03:43:02PM +0100, [email protected] wrote:
The patch below does not apply to the 4.14-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From
236ebc20d9afc5e9ff52f3cf3f365a91583aac10Mon Sep 17 00:00:00 2001
From: Filipe Manana <[email protected]>
Date: Tue, 10 Mar 2020 12:13:53 +0000
Subject: [PATCH] btrfs: fix log context list corruption after rename whiteout errorDuring a rename whiteout, if
btrfs_whiteout_for_rename()returns an error we can end up returning frombtrfs_rename()with the log context object still in the root's log context list - this happens if 'sync_log' was set to true before we calledbtrfs_whiteout_for_rename()and it is dangerous because we end up with a corrupt linked list (root->log_ctxs) as the log context object was allocated on the stack.After
btrfs_rename()returns, any task that is runningbtrfs_sync_log()concurrently can end up crashing because that linked list is traversed bybtrfs_sync_log()(throughbtrfs_remove_all_log_ctxs()). That results in the same issue that commite6c617102c7e4("Btrfs: fix log context list corruption after rename exchange operation") fixed.
Quoted 4 lines
Fixes d4682ba03ef618 ("Btrfs: sync log after logging new name")CC [email protected] # 4.19+Signed-off-by Filipe Manana <[email protected]>Signed-off-by David Sterba <[email protected]>
Greg, I'm not sure why you tried this for 4.14 - it's tagged 4.19+ and we don't have d4682ba03ef618 in 4.14 either.
Signature · 2 lines
Thanks, Sasha
Greg KH
maintainerQuoted 32 lines · Sasha Levin
Quoted 31 lines · On Mon, Mar 23, 2020 at 03:43:02PM +0100, [email protected] wrote:
The patch below does not apply to the 4.14-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
Quoted 1 line
From
236ebc20d9afc5e9ff52f3cf3f365a91583aac10Mon Sep 17 00:00:00 2001From: Filipe Manana <[email protected]>
Date: Tue, 10 Mar 2020 12:13:53 +0000
Subject: [PATCH] btrfs: fix log context list corruption after rename whiteout errorDuring a rename whiteout, if
btrfs_whiteout_for_rename()returns an error we can end up returning frombtrfs_rename()with the log context object still in the root's log context list - this happens if 'sync_log' was set to true before we calledbtrfs_whiteout_for_rename()and it is dangerous because we end up with a corrupt linked list (root->log_ctxs) as the log context object was allocated on the stack.After
btrfs_rename()returns, any task that is runningbtrfs_sync_log()concurrently can end up crashing because that linked list is traversed bybtrfs_sync_log()(throughbtrfs_remove_all_log_ctxs()). That results in the same issue that commite6c617102c7e4("Btrfs: fix log context list corruption after rename exchange operation") fixed.
Quoted 7 lines
Quoted 4 lines
Fixes d4682ba03ef618 ("Btrfs: sync log after logging new name")CC [email protected] # 4.19+Signed-off-by Filipe Manana <[email protected]>Signed-off-by David Sterba <[email protected]>Greg, I'm not sure why you tried this for 4.14 - it's tagged 4.19+ and we don't have
d4682ba03ef618in 4.14 either.
Ah, I thought this was backported, as "simple" grep shows it showing up in 4.14.110, but that was just a reference to the short git commit id.
I need to fix my scripts to always expand it to the full sha1 to prevent that from catching.
thanks,
greg k-h