From 15d74e39c5005a85c35fd98dd21a4538b2320784 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 8 Jul 2025 16:59:59 +0200 Subject: [PATCH] drop 5.15 btrfs patches Some are not in newer trees, and a build error happens with them anyway, so drop for now --- ...lookup-error-handling-during-log-rep.patch | 451 ------------------ ...last_unlink_trans-earlier-when-doing.patch | 101 ---- ...ove-noinline-from-btrfs_update_inode.patch | 42 -- ...undant-root-argument-from-fixup_inod.patch | 108 ----- ...record_snapshot_destroy-during-rmdir.patch | 46 -- queue-5.15/series | 5 - 6 files changed, 753 deletions(-) delete mode 100644 queue-5.15/btrfs-fix-inode-lookup-error-handling-during-log-rep.patch delete mode 100644 queue-5.15/btrfs-propagate-last_unlink_trans-earlier-when-doing.patch delete mode 100644 queue-5.15/btrfs-remove-noinline-from-btrfs_update_inode.patch delete mode 100644 queue-5.15/btrfs-remove-redundant-root-argument-from-fixup_inod.patch delete mode 100644 queue-5.15/btrfs-use-btrfs_record_snapshot_destroy-during-rmdir.patch diff --git a/queue-5.15/btrfs-fix-inode-lookup-error-handling-during-log-rep.patch b/queue-5.15/btrfs-fix-inode-lookup-error-handling-during-log-rep.patch deleted file mode 100644 index 8868aae0d7..0000000000 --- a/queue-5.15/btrfs-fix-inode-lookup-error-handling-during-log-rep.patch +++ /dev/null @@ -1,451 +0,0 @@ -From 66b39b200cc42b3e4d9962311739f75d8ce20c45 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Wed, 18 Jun 2025 15:58:31 +0100 -Subject: btrfs: fix inode lookup error handling during log replay - -From: Filipe Manana - -[ Upstream commit 5f61b961599acbd2bed028d3089105a1f7d224b8 ] - -When replaying log trees we use read_one_inode() to get an inode, which is -just a wrapper around btrfs_iget_logging(), which in turn is a wrapper for -btrfs_iget(). But read_one_inode() always returns NULL for any error -that btrfs_iget_logging() / btrfs_iget() may return and this is a problem -because: - -1) In many callers of read_one_inode() we convert the NULL into -EIO, - which is not accurate since btrfs_iget() may return -ENOMEM and -ENOENT - for example, besides -EIO and other errors. So during log replay we - may end up reporting a false -EIO, which is confusing since we may - not have had any IO error at all; - -2) When replaying directory deletes, at replay_dir_deletes(), we assume - the NULL returned from read_one_inode() means that the inode doesn't - exist and then proceed as if no error had happened. This is wrong - because unless btrfs_iget() returned ERR_PTR(-ENOENT), we had an - actual error and the target inode may exist in the target subvolume - root - this may later result in the log replay code failing at a - later stage (if we are "lucky") or succeed but leaving some - inconsistency in the filesystem. - -So fix this by not ignoring errors from btrfs_iget_logging() and as -a consequence remove the read_one_inode() wrapper and just use -btrfs_iget_logging() directly. Also since btrfs_iget_logging() is -supposed to be called only against subvolume roots, just like -read_one_inode() which had a comment about it, add an assertion to -btrfs_iget_logging() to check that the target root corresponds to a -subvolume root. - -Fixes: 5d4f98a28c7d ("Btrfs: Mixed back reference (FORWARD ROLLING FORMAT CHANGE)") -Reviewed-by: Johannes Thumshirn -Reviewed-by: Qu Wenruo -Signed-off-by: Filipe Manana -Signed-off-by: David Sterba -Signed-off-by: Sasha Levin ---- - fs/btrfs/tree-log.c | 206 +++++++++++++++++++++++++++++--------------- - 1 file changed, 138 insertions(+), 68 deletions(-) - -diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c -index 10db10544c96c..459b85268bc6b 100644 ---- a/fs/btrfs/tree-log.c -+++ b/fs/btrfs/tree-log.c -@@ -130,6 +130,31 @@ static void wait_log_commit(struct btrfs_root *root, int transid); - * and once to do all the other items. - */ - -+static struct btrfs_inode *btrfs_iget_logging(u64 objectid, struct btrfs_root *root) -+{ -+ unsigned int nofs_flag; -+ struct inode *inode; -+ -+ /* Only meant to be called for subvolume roots and not for log roots. */ -+ ASSERT(root->root_key.objectid != BTRFS_TREE_LOG_OBJECTID && -+ root->root_key.objectid != BTRFS_TREE_LOG_FIXUP_OBJECTID); -+ -+ /* -+ * We're holding a transaction handle whether we are logging or -+ * replaying a log tree, so we must make sure NOFS semantics apply -+ * because btrfs_alloc_inode() may be triggered and it uses GFP_KERNEL -+ * to allocate an inode, which can recurse back into the filesystem and -+ * attempt a transaction commit, resulting in a deadlock. -+ */ -+ nofs_flag = memalloc_nofs_save(); -+ inode = btrfs_iget(root->fs_info->sb, objectid, root); -+ memalloc_nofs_restore(nofs_flag); -+ -+ if (IS_ERR(inode)) -+ return ERR_CAST(inode); -+ -+ return BTRFS_I(inode); -+} - /* - * start a sub transaction and setup the log tree - * this increments the log tree writer count to make the people -@@ -584,19 +609,18 @@ static noinline int overwrite_item(struct btrfs_trans_handle *trans, - return 0; - } - --/* -- * simple helper to read an inode off the disk from a given root -- * This can only be called for subvolume roots and not for the log -- */ --static noinline struct inode *read_one_inode(struct btrfs_root *root, -- u64 objectid) -+static int read_alloc_one_name(struct extent_buffer *eb, void *start, int len, -+ char **name) - { -- struct inode *inode; -+ char *buf; - -- inode = btrfs_iget(root->fs_info->sb, objectid, root); -- if (IS_ERR(inode)) -- inode = NULL; -- return inode; -+ buf = kmalloc(len, GFP_NOFS); -+ if (!buf) -+ return -ENOMEM; -+ -+ read_extent_buffer(eb, buf, (unsigned long)start, len); -+ *name = buf; -+ return 0; - } - - /* replays a single extent in 'eb' at 'slot' with 'key' into the -@@ -652,10 +676,14 @@ static noinline int replay_one_extent(struct btrfs_trans_handle *trans, - goto out; - } - -- inode = read_one_inode(root, key->objectid); -- if (!inode) { -- ret = -EIO; -- goto out; -+ { -+ struct btrfs_inode *btrfs_inode; -+ btrfs_inode = btrfs_iget_logging(key->objectid, root); -+ if (IS_ERR(btrfs_inode)) { -+ ret = PTR_ERR(btrfs_inode); -+ goto out; -+ } -+ inode = &btrfs_inode->vfs_inode; - } - - /* -@@ -918,6 +946,7 @@ static noinline int drop_one_dir_item(struct btrfs_trans_handle *trans, - struct btrfs_inode *dir, - struct btrfs_dir_item *di) - { -+ struct btrfs_inode *btrfs_inode; - struct inode *inode; - char *name; - int name_len; -@@ -936,11 +965,13 @@ static noinline int drop_one_dir_item(struct btrfs_trans_handle *trans, - read_extent_buffer(leaf, name, (unsigned long)(di + 1), name_len); - btrfs_release_path(path); - -- inode = read_one_inode(root, location.objectid); -- if (!inode) { -- ret = -EIO; -+ btrfs_inode = btrfs_iget_logging(location.objectid, root); -+ if (IS_ERR(btrfs_inode)) { -+ ret = PTR_ERR(btrfs_inode); -+ inode = NULL; - goto out; - } -+ inode = &btrfs_inode->vfs_inode; - - ret = link_to_fixup_dir(trans, root, path, location.objectid); - if (ret) -@@ -1140,6 +1171,7 @@ static inline int __add_inode_ref(struct btrfs_trans_handle *trans, - u32 item_size; - u32 cur_offset = 0; - unsigned long base; -+ struct btrfs_inode *victim_parent_btrfs; - struct inode *victim_parent; - - leaf = path->nodes[0]; -@@ -1173,10 +1205,11 @@ static inline int __add_inode_ref(struct btrfs_trans_handle *trans, - kfree(victim_name); - return ret; - } else if (!ret) { -- ret = -ENOENT; -- victim_parent = read_one_inode(root, -- parent_objectid); -- if (victim_parent) { -+ victim_parent_btrfs = btrfs_iget_logging(parent_objectid, root); -+ if (IS_ERR(victim_parent_btrfs)) { -+ ret = PTR_ERR(victim_parent_btrfs); -+ } else { -+ victim_parent = &victim_parent_btrfs->vfs_inode; - inc_nlink(&inode->vfs_inode); - btrfs_release_path(path); - -@@ -1333,11 +1366,15 @@ static int unlink_old_inode_refs(struct btrfs_trans_handle *trans, - struct inode *dir; - - btrfs_release_path(path); -- dir = read_one_inode(root, parent_id); -- if (!dir) { -- ret = -ENOENT; -- kfree(name); -- goto out; -+ { -+ struct btrfs_inode *btrfs_dir; -+ btrfs_dir = btrfs_iget_logging(parent_id, root); -+ if (IS_ERR(btrfs_dir)) { -+ ret = PTR_ERR(btrfs_dir); -+ kfree(name); -+ goto out; -+ } -+ dir = &btrfs_dir->vfs_inode; - } - ret = unlink_inode_for_log_replay(trans, BTRFS_I(dir), - inode, name, namelen); -@@ -1432,10 +1469,14 @@ static int add_link(struct btrfs_trans_handle *trans, struct btrfs_root *root, - */ - btrfs_dir_item_key_to_cpu(path->nodes[0], dir_item, &key); - btrfs_release_path(path); -- other_inode = read_one_inode(root, key.objectid); -- if (!other_inode) { -- ret = -ENOENT; -- goto out; -+ { -+ struct btrfs_inode *btrfs_other_inode; -+ btrfs_other_inode = btrfs_iget_logging(key.objectid, root); -+ if (IS_ERR(btrfs_other_inode)) { -+ ret = PTR_ERR(btrfs_other_inode); -+ goto out; -+ } -+ other_inode = &btrfs_other_inode->vfs_inode; - } - ret = unlink_inode_for_log_replay(trans, BTRFS_I(dir), BTRFS_I(other_inode), - name, namelen); -@@ -1470,6 +1511,8 @@ static noinline int add_inode_ref(struct btrfs_trans_handle *trans, - struct extent_buffer *eb, int slot, - struct btrfs_key *key) - { -+ struct btrfs_inode *dir_btrfs = NULL; -+ struct btrfs_inode *inode_btrfs = NULL; - struct inode *dir = NULL; - struct inode *inode = NULL; - unsigned long ref_ptr; -@@ -1506,17 +1549,21 @@ static noinline int add_inode_ref(struct btrfs_trans_handle *trans, - * copy the back ref in. The link count fixup code will take - * care of the rest - */ -- dir = read_one_inode(root, parent_objectid); -- if (!dir) { -- ret = -ENOENT; -+ dir_btrfs = btrfs_iget_logging(parent_objectid, root); -+ if (IS_ERR(dir_btrfs)) { -+ ret = PTR_ERR(dir_btrfs); -+ dir = NULL; - goto out; - } -+ dir = &dir_btrfs->vfs_inode; - -- inode = read_one_inode(root, inode_objectid); -- if (!inode) { -- ret = -EIO; -+ inode_btrfs = btrfs_iget_logging(inode_objectid, root); -+ if (IS_ERR(inode_btrfs)) { -+ ret = PTR_ERR(inode_btrfs); -+ inode = NULL; - goto out; - } -+ inode = &inode_btrfs->vfs_inode; - - while (ref_ptr < ref_end) { - if (log_ref_ver) { -@@ -1526,11 +1573,14 @@ static noinline int add_inode_ref(struct btrfs_trans_handle *trans, - * parent object can change from one array - * item to another. - */ -- if (!dir) -- dir = read_one_inode(root, parent_objectid); - if (!dir) { -- ret = -ENOENT; -- goto out; -+ dir_btrfs = btrfs_iget_logging(parent_objectid, root); -+ if (IS_ERR(dir_btrfs)) { -+ ret = PTR_ERR(dir_btrfs); -+ dir = NULL; -+ goto out; -+ } -+ dir = &dir_btrfs->vfs_inode; - } - } else { - ret = ref_get_fields(eb, ref_ptr, &namelen, &name, -@@ -1805,6 +1855,7 @@ static noinline int fixup_inode_link_counts(struct btrfs_trans_handle *trans, - { - int ret; - struct btrfs_key key; -+ struct btrfs_inode *btrfs_inode; - struct inode *inode; - - key.objectid = BTRFS_TREE_LOG_FIXUP_OBJECTID; -@@ -1832,11 +1883,12 @@ static noinline int fixup_inode_link_counts(struct btrfs_trans_handle *trans, - break; - - btrfs_release_path(path); -- inode = read_one_inode(root, key.offset); -- if (!inode) { -- ret = -EIO; -+ btrfs_inode = btrfs_iget_logging(key.offset, root); -+ if (IS_ERR(btrfs_inode)) { -+ ret = PTR_ERR(btrfs_inode); - break; - } -+ inode = &btrfs_inode->vfs_inode; - - ret = fixup_inode_link_count(trans, inode); - iput(inode); -@@ -1867,11 +1919,13 @@ static noinline int link_to_fixup_dir(struct btrfs_trans_handle *trans, - { - struct btrfs_key key; - int ret = 0; -+ struct btrfs_inode *btrfs_inode; - struct inode *inode; - -- inode = read_one_inode(root, objectid); -- if (!inode) -- return -EIO; -+ btrfs_inode = btrfs_iget_logging(objectid, root); -+ if (IS_ERR(btrfs_inode)) -+ return PTR_ERR(btrfs_inode); -+ inode = &btrfs_inode->vfs_inode; - - key.objectid = BTRFS_TREE_LOG_FIXUP_OBJECTID; - key.type = BTRFS_ORPHAN_ITEM_KEY; -@@ -1907,17 +1961,21 @@ static noinline int insert_one_name(struct btrfs_trans_handle *trans, - { - struct inode *inode; - struct inode *dir; -+ struct btrfs_inode *btrfs_inode; -+ struct btrfs_inode *btrfs_dir; - int ret; - -- inode = read_one_inode(root, location->objectid); -- if (!inode) -- return -ENOENT; -+ btrfs_inode = btrfs_iget_logging(location->objectid, root); -+ if (IS_ERR(btrfs_inode)) -+ return PTR_ERR(btrfs_inode); -+ inode = &btrfs_inode->vfs_inode; - -- dir = read_one_inode(root, dirid); -- if (!dir) { -+ btrfs_dir = btrfs_iget_logging(dirid, root); -+ if (IS_ERR(btrfs_dir)) { - iput(inode); -- return -EIO; -+ return PTR_ERR(btrfs_dir); - } -+ dir = &btrfs_dir->vfs_inode; - - ret = btrfs_add_link(trans, BTRFS_I(dir), BTRFS_I(inode), name, - name_len, 1, index); -@@ -1957,6 +2015,7 @@ static noinline int replay_one_name(struct btrfs_trans_handle *trans, - struct btrfs_dir_item *dst_di; - struct btrfs_key found_key; - struct btrfs_key log_key; -+ struct btrfs_inode *dir_btrfs; - struct inode *dir; - u8 log_type; - bool exists; -@@ -1964,9 +2023,10 @@ static noinline int replay_one_name(struct btrfs_trans_handle *trans, - bool update_size = (key->type == BTRFS_DIR_INDEX_KEY); - bool name_added = false; - -- dir = read_one_inode(root, key->objectid); -- if (!dir) -- return -EIO; -+ dir_btrfs = btrfs_iget_logging(key->objectid, root); -+ if (IS_ERR(dir_btrfs)) -+ return PTR_ERR(dir_btrfs); -+ dir = &dir_btrfs->vfs_inode; - - name_len = btrfs_dir_name_len(eb, di); - name = kmalloc(name_len, GFP_NOFS); -@@ -2273,6 +2333,7 @@ static noinline int check_item_in_log(struct btrfs_trans_handle *trans, - struct btrfs_dir_item *di; - int name_len; - char *name; -+ struct btrfs_inode *btrfs_inode = NULL; - struct inode *inode = NULL; - struct btrfs_key location; - -@@ -2316,11 +2377,13 @@ static noinline int check_item_in_log(struct btrfs_trans_handle *trans, - btrfs_dir_item_key_to_cpu(eb, di, &location); - btrfs_release_path(path); - btrfs_release_path(log_path); -- inode = read_one_inode(root, location.objectid); -- if (!inode) { -- ret = -EIO; -+ btrfs_inode = btrfs_iget_logging(location.objectid, root); -+ if (IS_ERR(btrfs_inode)) { -+ ret = PTR_ERR(btrfs_inode); -+ inode = NULL; - goto out; - } -+ inode = &btrfs_inode->vfs_inode; - - ret = link_to_fixup_dir(trans, root, path, location.objectid); - if (ret) -@@ -2462,6 +2525,7 @@ static noinline int replay_dir_deletes(struct btrfs_trans_handle *trans, - struct btrfs_key dir_key; - struct btrfs_key found_key; - struct btrfs_path *log_path; -+ struct btrfs_inode *dir_btrfs; - struct inode *dir; - - dir_key.objectid = dirid; -@@ -2470,15 +2534,19 @@ static noinline int replay_dir_deletes(struct btrfs_trans_handle *trans, - if (!log_path) - return -ENOMEM; - -- dir = read_one_inode(root, dirid); -- /* it isn't an error if the inode isn't there, that can happen -- * because we replay the deletes before we copy in the inode item -- * from the log -+ dir_btrfs = btrfs_iget_logging(dirid, root); -+ /* -+ * It isn't an error if the inode isn't there, that can happen because -+ * we replay the deletes before we copy in the inode item from the log. - */ -- if (!dir) { -+ if (IS_ERR(dir_btrfs)) { - btrfs_free_path(log_path); -- return 0; -+ ret = PTR_ERR(dir_btrfs); -+ if (ret == -ENOENT) -+ ret = 0; -+ return ret; - } -+ dir = &dir_btrfs->vfs_inode; - - range_start = 0; - range_end = 0; -@@ -2629,14 +2697,16 @@ static int replay_one_buffer(struct btrfs_root *log, struct extent_buffer *eb, - */ - if (S_ISREG(mode)) { - struct btrfs_drop_extents_args drop_args = { 0 }; -+ struct btrfs_inode *btrfs_inode; - struct inode *inode; - u64 from; - -- inode = read_one_inode(root, key.objectid); -- if (!inode) { -- ret = -EIO; -+ btrfs_inode = btrfs_iget_logging(key.objectid, root); -+ if (IS_ERR(btrfs_inode)) { -+ ret = PTR_ERR(btrfs_inode); - break; - } -+ inode = &btrfs_inode->vfs_inode; - from = ALIGN(i_size_read(inode), - root->fs_info->sectorsize); - drop_args.start = from; --- -2.39.5 - diff --git a/queue-5.15/btrfs-propagate-last_unlink_trans-earlier-when-doing.patch b/queue-5.15/btrfs-propagate-last_unlink_trans-earlier-when-doing.patch deleted file mode 100644 index ee6d955121..0000000000 --- a/queue-5.15/btrfs-propagate-last_unlink_trans-earlier-when-doing.patch +++ /dev/null @@ -1,101 +0,0 @@ -From cd133f62cfbbbee8a2bbca746aaefc6e52f9e2a8 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Fri, 20 Jun 2025 15:54:05 +0100 -Subject: btrfs: propagate last_unlink_trans earlier when doing a rmdir - -From: Filipe Manana - -[ Upstream commit c466e33e729a0ee017d10d919cba18f503853c60 ] - -In case the removed directory had a snapshot that was deleted, we are -propagating its inode's last_unlink_trans to the parent directory after -we removed the entry from the parent directory. This leaves a small race -window where someone can log the parent directory after we removed the -entry and before we updated last_unlink_trans, and as a result if we ever -try to replay such a log tree, we will fail since we will attempt to -remove a snapshot during log replay, which is currently not possible and -results in the log replay (and mount) to fail. This is the type of failure -described in commit 1ec9a1ae1e30 ("Btrfs: fix unreplayable log after -snapshot delete + parent dir fsync"). - -So fix this by propagating the last_unlink_trans to the parent directory -before we remove the entry from it. - -Fixes: 44f714dae50a ("Btrfs: improve performance on fsync against new inode after rename/unlink") -Reviewed-by: Johannes Thumshirn -Signed-off-by: Filipe Manana -Signed-off-by: David Sterba -Signed-off-by: Sasha Levin ---- - fs/btrfs/inode.c | 36 ++++++++++++++++++------------------ - 1 file changed, 18 insertions(+), 18 deletions(-) - -diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c -index 32ae349b6abfb..76a59f95e7613 100644 ---- a/fs/btrfs/inode.c -+++ b/fs/btrfs/inode.c -@@ -4655,7 +4655,6 @@ static int btrfs_rmdir(struct inode *dir, struct dentry *dentry) - struct inode *inode = d_inode(dentry); - int err = 0; - struct btrfs_trans_handle *trans; -- u64 last_unlink_trans; - - if (inode->i_size > BTRFS_EMPTY_DIR_SIZE) - return -ENOTEMPTY; -@@ -4666,6 +4665,23 @@ static int btrfs_rmdir(struct inode *dir, struct dentry *dentry) - if (IS_ERR(trans)) - return PTR_ERR(trans); - -+ /* -+ * Propagate the last_unlink_trans value of the deleted dir to its -+ * parent directory. This is to prevent an unrecoverable log tree in the -+ * case we do something like this: -+ * 1) create dir foo -+ * 2) create snapshot under dir foo -+ * 3) delete the snapshot -+ * 4) rmdir foo -+ * 5) mkdir foo -+ * 6) fsync foo or some file inside foo -+ * -+ * This is because we can't unlink other roots when replaying the dir -+ * deletes for directory foo. -+ */ -+ if (BTRFS_I(inode)->last_unlink_trans >= trans->transid) -+ BTRFS_I(dir)->last_unlink_trans = BTRFS_I(inode)->last_unlink_trans; -+ - if (unlikely(btrfs_ino(BTRFS_I(inode)) == BTRFS_EMPTY_SUBVOL_DIR_OBJECTID)) { - err = btrfs_unlink_subvol(trans, dir, dentry); - goto out; -@@ -4675,28 +4691,12 @@ static int btrfs_rmdir(struct inode *dir, struct dentry *dentry) - if (err) - goto out; - -- last_unlink_trans = BTRFS_I(inode)->last_unlink_trans; -- - /* now the directory is empty */ - err = btrfs_unlink_inode(trans, BTRFS_I(dir), - BTRFS_I(d_inode(dentry)), dentry->d_name.name, - dentry->d_name.len); -- if (!err) { -+ if (!err) - btrfs_i_size_write(BTRFS_I(inode), 0); -- /* -- * Propagate the last_unlink_trans value of the deleted dir to -- * its parent directory. This is to prevent an unrecoverable -- * log tree in the case we do something like this: -- * 1) create dir foo -- * 2) create snapshot under dir foo -- * 3) delete the snapshot -- * 4) rmdir foo -- * 5) mkdir foo -- * 6) fsync foo or some file inside foo -- */ -- if (last_unlink_trans >= trans->transid) -- BTRFS_I(dir)->last_unlink_trans = last_unlink_trans; -- } - out: - btrfs_end_transaction(trans); - btrfs_btree_balance_dirty(BTRFS_I(dir)->root->fs_info); --- -2.39.5 - diff --git a/queue-5.15/btrfs-remove-noinline-from-btrfs_update_inode.patch b/queue-5.15/btrfs-remove-noinline-from-btrfs_update_inode.patch deleted file mode 100644 index c4415103f2..0000000000 --- a/queue-5.15/btrfs-remove-noinline-from-btrfs_update_inode.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 749a04213654801d0644d81baf712cb3f7daba35 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Fri, 22 Sep 2023 11:37:20 +0100 -Subject: btrfs: remove noinline from btrfs_update_inode() - -From: Filipe Manana - -[ Upstream commit cddaaacca9339d2f13599a822dc2f68be71d2e0d ] - -The noinline attribute of btrfs_update_inode() is pointless as the -function is exported and widely used, so remove it. - -Reviewed-by: Qu Wenruo -Signed-off-by: Filipe Manana -Reviewed-by: David Sterba -Signed-off-by: David Sterba -Stable-dep-of: 5f61b961599a ("btrfs: fix inode lookup error handling during log replay") -Signed-off-by: Sasha Levin ---- - fs/btrfs/inode.c | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c -index e3e5bd4fb477a..32ae349b6abfb 100644 ---- a/fs/btrfs/inode.c -+++ b/fs/btrfs/inode.c -@@ -4074,9 +4074,9 @@ static noinline int btrfs_update_inode_item(struct btrfs_trans_handle *trans, - /* - * copy everything in the in-memory inode into the btree. - */ --noinline int btrfs_update_inode(struct btrfs_trans_handle *trans, -- struct btrfs_root *root, -- struct btrfs_inode *inode) -+int btrfs_update_inode(struct btrfs_trans_handle *trans, -+ struct btrfs_root *root, -+ struct btrfs_inode *inode) - { - struct btrfs_fs_info *fs_info = root->fs_info; - int ret; --- -2.39.5 - diff --git a/queue-5.15/btrfs-remove-redundant-root-argument-from-fixup_inod.patch b/queue-5.15/btrfs-remove-redundant-root-argument-from-fixup_inod.patch deleted file mode 100644 index 84a67eeca8..0000000000 --- a/queue-5.15/btrfs-remove-redundant-root-argument-from-fixup_inod.patch +++ /dev/null @@ -1,108 +0,0 @@ -From 0a86a37de55a083ad6ddb17ee782640f238fdb6e Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Fri, 22 Sep 2023 11:37:26 +0100 -Subject: btrfs: remove redundant root argument from fixup_inode_link_count() - -From: Filipe Manana - -[ Upstream commit 8befc61cbba2d4567122d400542da8900a352971 ] - -The root argument for fixup_inode_link_count() always matches the root of -the given inode, so remove the root argument and get it from the inode -argument. This also applies to the helpers count_inode_extrefs() and -count_inode_refs() used by fixup_inode_link_count() - they don't need the -root argument, as it always matches the root of the inode passed to them. - -Reviewed-by: Qu Wenruo -Signed-off-by: Filipe Manana -Reviewed-by: David Sterba -Signed-off-by: David Sterba -Stable-dep-of: 5f61b961599a ("btrfs: fix inode lookup error handling during log replay") -Signed-off-by: Sasha Levin ---- - fs/btrfs/tree-log.c | 20 +++++++++----------- - 1 file changed, 9 insertions(+), 11 deletions(-) - -diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c -index 7049a19e07baf..10db10544c96c 100644 ---- a/fs/btrfs/tree-log.c -+++ b/fs/btrfs/tree-log.c -@@ -1638,8 +1638,7 @@ static noinline int add_inode_ref(struct btrfs_trans_handle *trans, - return ret; - } - --static int count_inode_extrefs(struct btrfs_root *root, -- struct btrfs_inode *inode, struct btrfs_path *path) -+static int count_inode_extrefs(struct btrfs_inode *inode, struct btrfs_path *path) - { - int ret = 0; - int name_len; -@@ -1653,8 +1652,8 @@ static int count_inode_extrefs(struct btrfs_root *root, - struct extent_buffer *leaf; - - while (1) { -- ret = btrfs_find_one_extref(root, inode_objectid, offset, path, -- &extref, &offset); -+ ret = btrfs_find_one_extref(inode->root, inode_objectid, offset, -+ path, &extref, &offset); - if (ret) - break; - -@@ -1682,8 +1681,7 @@ static int count_inode_extrefs(struct btrfs_root *root, - return nlink; - } - --static int count_inode_refs(struct btrfs_root *root, -- struct btrfs_inode *inode, struct btrfs_path *path) -+static int count_inode_refs(struct btrfs_inode *inode, struct btrfs_path *path) - { - int ret; - struct btrfs_key key; -@@ -1698,7 +1696,7 @@ static int count_inode_refs(struct btrfs_root *root, - key.offset = (u64)-1; - - while (1) { -- ret = btrfs_search_slot(NULL, root, &key, path, 0, 0); -+ ret = btrfs_search_slot(NULL, inode->root, &key, path, 0, 0); - if (ret < 0) - break; - if (ret > 0) { -@@ -1750,9 +1748,9 @@ static int count_inode_refs(struct btrfs_root *root, - * will free the inode. - */ - static noinline int fixup_inode_link_count(struct btrfs_trans_handle *trans, -- struct btrfs_root *root, - struct inode *inode) - { -+ struct btrfs_root *root = BTRFS_I(inode)->root; - struct btrfs_path *path; - int ret; - u64 nlink = 0; -@@ -1762,13 +1760,13 @@ static noinline int fixup_inode_link_count(struct btrfs_trans_handle *trans, - if (!path) - return -ENOMEM; - -- ret = count_inode_refs(root, BTRFS_I(inode), path); -+ ret = count_inode_refs(BTRFS_I(inode), path); - if (ret < 0) - goto out; - - nlink = ret; - -- ret = count_inode_extrefs(root, BTRFS_I(inode), path); -+ ret = count_inode_extrefs(BTRFS_I(inode), path); - if (ret < 0) - goto out; - -@@ -1840,7 +1838,7 @@ static noinline int fixup_inode_link_counts(struct btrfs_trans_handle *trans, - break; - } - -- ret = fixup_inode_link_count(trans, root, inode); -+ ret = fixup_inode_link_count(trans, inode); - iput(inode); - if (ret) - break; --- -2.39.5 - diff --git a/queue-5.15/btrfs-use-btrfs_record_snapshot_destroy-during-rmdir.patch b/queue-5.15/btrfs-use-btrfs_record_snapshot_destroy-during-rmdir.patch deleted file mode 100644 index bb904462d5..0000000000 --- a/queue-5.15/btrfs-use-btrfs_record_snapshot_destroy-during-rmdir.patch +++ /dev/null @@ -1,46 +0,0 @@ -From c9d4e50e114d31aab2c9842c0498b032dfa441d2 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Fri, 20 Jun 2025 16:37:01 +0100 -Subject: btrfs: use btrfs_record_snapshot_destroy() during rmdir - -From: Filipe Manana - -[ Upstream commit 157501b0469969fc1ba53add5049575aadd79d80 ] - -We are setting the parent directory's last_unlink_trans directly which -may result in a concurrent task starting to log the directory not see the -update and therefore can log the directory after we removed a child -directory which had a snapshot within instead of falling back to a -transaction commit. Replaying such a log tree would result in a mount -failure since we can't currently delete snapshots (and subvolumes) during -log replay. This is the type of failure described in commit 1ec9a1ae1e30 -("Btrfs: fix unreplayable log after snapshot delete + parent dir fsync"). - -Fix this by using btrfs_record_snapshot_destroy() which updates the -last_unlink_trans field while holding the inode's log_mutex lock. - -Fixes: 44f714dae50a ("Btrfs: improve performance on fsync against new inode after rename/unlink") -Reviewed-by: Johannes Thumshirn -Signed-off-by: Filipe Manana -Signed-off-by: David Sterba -Signed-off-by: Sasha Levin ---- - fs/btrfs/inode.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c -index 76a59f95e7613..92a4c1a9d639b 100644 ---- a/fs/btrfs/inode.c -+++ b/fs/btrfs/inode.c -@@ -4680,7 +4680,7 @@ static int btrfs_rmdir(struct inode *dir, struct dentry *dentry) - * deletes for directory foo. - */ - if (BTRFS_I(inode)->last_unlink_trans >= trans->transid) -- BTRFS_I(dir)->last_unlink_trans = BTRFS_I(inode)->last_unlink_trans; -+ btrfs_record_snapshot_destroy(trans, BTRFS_I(dir)); - - if (unlikely(btrfs_ino(BTRFS_I(inode)) == BTRFS_EMPTY_SUBVOL_DIR_OBJECTID)) { - err = btrfs_unlink_subvol(trans, dir, dentry); --- -2.39.5 - diff --git a/queue-5.15/series b/queue-5.15/series index f1467b2ff6..9da2c5a960 100644 --- a/queue-5.15/series +++ b/queue-5.15/series @@ -139,11 +139,6 @@ regulator-gpio-add-input_supply-support-in-gpio_regu.patch regulator-gpio-fix-the-out-of-bounds-access-to-drvda.patch drm-v3d-disable-interrupts-before-resetting-the-gpu.patch nfsv4-flexfiles-fix-handling-of-nfs-level-errors-in-.patch -btrfs-remove-noinline-from-btrfs_update_inode.patch -btrfs-remove-redundant-root-argument-from-fixup_inod.patch -btrfs-fix-inode-lookup-error-handling-during-log-rep.patch -btrfs-propagate-last_unlink_trans-earlier-when-doing.patch -btrfs-use-btrfs_record_snapshot_destroy-during-rmdir.patch ethernet-atl1-add-missing-dma-mapping-error-checks-a.patch dpaa2-eth-update-dpni_get_single_step_cfg-command.patch dpaa2-eth-update-single_step-register-access.patch -- 2.47.2