Commit e1dc191d authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'bcachefs-2024-04-10' of https://evilpiepirate.org/git/bcachefs

Pull more bcachefs fixes from Kent Overstreet:
 "Notable user impacting bugs

   - On multi device filesystems, recovery was looping in
     btree_trans_too_many_iters(). This checks if a transaction has
     touched too many btree paths (because of iteration over many keys),
     and isuses a restart to drop unneeded paths.

     But it's now possible for some paths to exceed the previous limit
     without iteration in the interior btree update path, since the
     transaction commit will do alloc updates for every old and new
     btree node, and during journal replay we don't use the btree write
     buffer for locking reasons and thus those updates use btree paths
     when they wouldn't normally.

   - Fix a corner case in rebalance when moving extents on a
     durability=0 device. This wouldn't be hit when a device was
     formatted with durability=0 since in that case we'll only use it as
     a write through cache (only cached extents will live on it), but
     durability can now be changed on an existing device.

   - bch2_get_acl() could rarely forget to handle a transaction restart;
     this manifested as the occasional missing acl that came back after
     dropping caches.

   - Fix a major performance regression on high iops multithreaded write
     workloads (only since 6.9-rc1); a previous fix for a deadlock in
     the interior btree update path to check the journal watermark
     introduced a dependency on the state of btree write buffer flushing
     that we didn't want.

   - Assorted other repair paths and recovery fixes"

* tag 'bcachefs-2024-04-10' of https://evilpiepirate.org/git/bcachefs: (25 commits)
  bcachefs: Fix __bch2_btree_and_journal_iter_init_node_iter()
  bcachefs: Kill read lock dropping in bch2_btree_node_lock_write_nofail()
  bcachefs: Fix a race in btree_update_nodes_written()
  bcachefs: btree_node_scan: Respect member.data_allowed
  bcachefs: Don't scan for btree nodes when we can reconstruct
  bcachefs: Fix check_topology() when using node scan
  bcachefs: fix eytzinger0_find_gt()
  bcachefs: fix bch2_get_acl() transaction restart handling
  bcachefs: fix the count of nr_freed_pcpu after changing bc->freed_nonpcpu list
  bcachefs: Fix gap buffer bug in bch2_journal_key_insert_take()
  bcachefs: Rename struct field swap to prevent macro naming collision
  MAINTAINERS: Add entry for bcachefs documentation
  Documentation: filesystems: Add bcachefs toctree
  bcachefs: JOURNAL_SPACE_LOW
  bcachefs: Disable errors=panic for BCH_IOCTL_FSCK_OFFLINE
  bcachefs: Fix BCH_IOCTL_FSCK_OFFLINE for encrypted filesystems
  bcachefs: fix rand_delete unit test
  bcachefs: fix ! vs ~ typo in __clear_bit_le64()
  bcachefs: Fix rebalance from durability=0 device
  bcachefs: Print shutdown journal sequence number
  ...
parents 346668f0 1189bdda
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
.. SPDX-License-Identifier: GPL-2.0

======================
bcachefs Documentation
======================

.. toctree::
   :maxdepth: 2
   :numbered:

   errorcodes
+1 −0
Original line number Diff line number Diff line
@@ -69,6 +69,7 @@ Documentation for filesystem implementations.
   afs
   autofs
   autofs-mount-control
   bcachefs/index
   befs
   bfs
   btrfs
+1 −0
Original line number Diff line number Diff line
@@ -3573,6 +3573,7 @@ S: Supported
C:	irc://irc.oftc.net/bcache
T:	git https://evilpiepirate.org/git/bcachefs.git
F:	fs/bcachefs/
F:	Documentation/filesystems/bcachefs/
BDISP ST MEDIA DRIVER
M:	Fabien Dessenne <fabien.dessenne@foss.st.com>
+14 −16
Original line number Diff line number Diff line
@@ -281,7 +281,6 @@ struct posix_acl *bch2_get_acl(struct mnt_idmap *idmap,
	struct xattr_search_key search = X_SEARCH(acl_to_xattr_type(type), "", 0);
	struct btree_trans *trans = bch2_trans_get(c);
	struct btree_iter iter = { NULL };
	struct bkey_s_c_xattr xattr;
	struct posix_acl *acl = NULL;
	struct bkey_s_c k;
	int ret;
@@ -290,28 +289,27 @@ struct posix_acl *bch2_get_acl(struct mnt_idmap *idmap,

	ret = bch2_hash_lookup(trans, &iter, bch2_xattr_hash_desc,
			&hash, inode_inum(inode), &search, 0);
	if (ret) {
		if (!bch2_err_matches(ret, ENOENT))
			acl = ERR_PTR(ret);
		goto out;
	}
	if (ret)
		goto err;

	k = bch2_btree_iter_peek_slot(&iter);
	ret = bkey_err(k);
	if (ret) {
		acl = ERR_PTR(ret);
		goto out;
	}
	if (ret)
		goto err;

	xattr = bkey_s_c_to_xattr(k);
	struct bkey_s_c_xattr xattr = bkey_s_c_to_xattr(k);
	acl = bch2_acl_from_disk(trans, xattr_val(xattr.v),
				 le16_to_cpu(xattr.v->x_val_len));
	ret = PTR_ERR_OR_ZERO(acl);
err:
	if (bch2_err_matches(ret, BCH_ERR_transaction_restart))
		goto retry;

	if (!IS_ERR(acl))
	if (ret)
		acl = !bch2_err_matches(ret, ENOENT) ? ERR_PTR(ret) : NULL;

	if (!IS_ERR_OR_NULL(acl))
		set_cached_acl(&inode->v, type, acl);
out:
	if (bch2_err_matches(PTR_ERR_OR_ZERO(acl), BCH_ERR_transaction_restart))
		goto retry;

	bch2_trans_iter_exit(trans, &iter);
	bch2_trans_put(trans);
+14 −0
Original line number Diff line number Diff line
@@ -1535,6 +1535,20 @@ enum btree_id {
	BTREE_ID_NR
};

static inline bool btree_id_is_alloc(enum btree_id id)
{
	switch (id) {
	case BTREE_ID_alloc:
	case BTREE_ID_backpointers:
	case BTREE_ID_need_discard:
	case BTREE_ID_freespace:
	case BTREE_ID_bucket_gens:
		return true;
	default:
		return false;
	}
}

#define BTREE_MAX_DEPTH		4U

/* Btree nodes */
Loading