From 3c11142a151bdb6df71773ea04e9fc0f81af5f6f Mon Sep 17 00:00:00 2001 From: Sasha Levin Date: Fri, 14 Jul 2023 16:53:32 -0400 Subject: [PATCH] Fixes for 5.15 Signed-off-by: Sasha Levin --- ..._on-on-tree-mod-log-failure-at-balan.patch | 72 +++++++++++++++++++ ...-tusb320-convert-to-i2c-s-.probe_new.patch | 49 +++++++++++++ queue-5.15/series | 2 + 3 files changed, 123 insertions(+) create mode 100644 queue-5.15/btrfs-do-not-bug_on-on-tree-mod-log-failure-at-balan.patch create mode 100644 queue-5.15/extcon-usbc-tusb320-convert-to-i2c-s-.probe_new.patch diff --git a/queue-5.15/btrfs-do-not-bug_on-on-tree-mod-log-failure-at-balan.patch b/queue-5.15/btrfs-do-not-bug_on-on-tree-mod-log-failure-at-balan.patch new file mode 100644 index 00000000000..b5c166cd2bc --- /dev/null +++ b/queue-5.15/btrfs-do-not-bug_on-on-tree-mod-log-failure-at-balan.patch @@ -0,0 +1,72 @@ +From 0d68eefaee4ab5908c73b86de4a9ec369ea322d4 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 8 Jun 2023 11:27:41 +0100 +Subject: btrfs: do not BUG_ON() on tree mod log failure at balance_level() + +From: Filipe Manana + +[ Upstream commit 39020d8abc7ec62c4de9b260e3d10d4a1c2478ce ] + +At balance_level(), instead of doing a BUG_ON() in case we fail to record +tree mod log operations, do a transaction abort and return the error to +the callers. There's really no need for the BUG_ON() as we can release +all resources in this context, and we have to abort because other future +tree searches that use the tree mod log (btrfs_search_old_slot()) may get +inconsistent results if other operations modify the tree after that +failure and before the tree mod log based search. + +CC: stable@vger.kernel.org # 5.4+ +Reviewed-by: Qu Wenruo +Signed-off-by: Filipe Manana +Reviewed-by: David Sterba +Signed-off-by: David Sterba +Signed-off-by: Sasha Levin +--- + fs/btrfs/ctree.c | 17 ++++++++++++++--- + 1 file changed, 14 insertions(+), 3 deletions(-) + +diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c +index 1a19354382b2b..8b57d691cfae8 100644 +--- a/fs/btrfs/ctree.c ++++ b/fs/btrfs/ctree.c +@@ -912,7 +912,12 @@ static noinline int balance_level(struct btrfs_trans_handle *trans, + } + + ret = btrfs_tree_mod_log_insert_root(root->node, child, true); +- BUG_ON(ret < 0); ++ if (ret < 0) { ++ btrfs_tree_unlock(child); ++ free_extent_buffer(child); ++ btrfs_abort_transaction(trans, ret); ++ goto enospc; ++ } + rcu_assign_pointer(root->node, child); + + add_root_to_dirty_list(root); +@@ -994,7 +999,10 @@ static noinline int balance_level(struct btrfs_trans_handle *trans, + btrfs_node_key(right, &right_key, 0); + ret = btrfs_tree_mod_log_insert_key(parent, pslot + 1, + BTRFS_MOD_LOG_KEY_REPLACE, GFP_NOFS); +- BUG_ON(ret < 0); ++ if (ret < 0) { ++ btrfs_abort_transaction(trans, ret); ++ goto enospc; ++ } + btrfs_set_node_key(parent, &right_key, pslot + 1); + btrfs_mark_buffer_dirty(parent); + } +@@ -1040,7 +1048,10 @@ static noinline int balance_level(struct btrfs_trans_handle *trans, + btrfs_node_key(mid, &mid_key, 0); + ret = btrfs_tree_mod_log_insert_key(parent, pslot, + BTRFS_MOD_LOG_KEY_REPLACE, GFP_NOFS); +- BUG_ON(ret < 0); ++ if (ret < 0) { ++ btrfs_abort_transaction(trans, ret); ++ goto enospc; ++ } + btrfs_set_node_key(parent, &mid_key, pslot); + btrfs_mark_buffer_dirty(parent); + } +-- +2.39.2 + diff --git a/queue-5.15/extcon-usbc-tusb320-convert-to-i2c-s-.probe_new.patch b/queue-5.15/extcon-usbc-tusb320-convert-to-i2c-s-.probe_new.patch new file mode 100644 index 00000000000..0f9d823ef71 --- /dev/null +++ b/queue-5.15/extcon-usbc-tusb320-convert-to-i2c-s-.probe_new.patch @@ -0,0 +1,49 @@ +From 8c7bf4c669c4466fd6a8e777eecdbdd795cfdf66 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 18 Nov 2022 23:35:44 +0100 +Subject: extcon: usbc-tusb320: Convert to i2c's .probe_new() +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Uwe Kleine-König + +[ Upstream commit 5313121b22fd11db0d14f305c110168b8176efdc ] + +The probe function doesn't make use of the i2c_device_id * parameter so it +can be trivially converted. + +Signed-off-by: Uwe Kleine-König +Signed-off-by: Chanwoo Choi +Stable-dep-of: 3adbaa30d973 ("extcon: usbc-tusb320: Unregister typec port on driver removal") +Signed-off-by: Sasha Levin +--- + drivers/extcon/extcon-usbc-tusb320.c | 5 ++--- + 1 file changed, 2 insertions(+), 3 deletions(-) + +diff --git a/drivers/extcon/extcon-usbc-tusb320.c b/drivers/extcon/extcon-usbc-tusb320.c +index 9dfa545427ca1..b408ce989c223 100644 +--- a/drivers/extcon/extcon-usbc-tusb320.c ++++ b/drivers/extcon/extcon-usbc-tusb320.c +@@ -428,8 +428,7 @@ static int tusb320_typec_probe(struct i2c_client *client, + return 0; + } + +-static int tusb320_probe(struct i2c_client *client, +- const struct i2c_device_id *id) ++static int tusb320_probe(struct i2c_client *client) + { + struct tusb320_priv *priv; + const void *match_data; +@@ -502,7 +501,7 @@ static const struct of_device_id tusb320_extcon_dt_match[] = { + MODULE_DEVICE_TABLE(of, tusb320_extcon_dt_match); + + static struct i2c_driver tusb320_extcon_driver = { +- .probe = tusb320_probe, ++ .probe_new = tusb320_probe, + .driver = { + .name = "extcon-tusb320", + .of_match_table = tusb320_extcon_dt_match, +-- +2.39.2 + diff --git a/queue-5.15/series b/queue-5.15/series index b208184f0c5..357e4a3a3b4 100644 --- a/queue-5.15/series +++ b/queue-5.15/series @@ -346,3 +346,5 @@ sh-dma-fix-dma-channel-offset-calculation.patch apparmor-fix-missing-error-check-for-rhashtable_inse.patch i2c-xiic-defer-xiic_wakeup-and-__xiic_start_xfer-in-.patch i2c-xiic-don-t-try-to-handle-more-interrupt-events-a.patch +extcon-usbc-tusb320-convert-to-i2c-s-.probe_new.patch +btrfs-do-not-bug_on-on-tree-mod-log-failure-at-balan.patch -- 2.47.3