Commit 9183e033 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull btrfs fixes from David Sterba:
 "A few more one-liners that fix some user visible problems:

   - use correct range when clearing qgroup reservations after COW

   - properly reset freed delayed ref list head

   - fix ro/rw subvolume mounts to be backward compatible with old and
     new mount API"

* tag 'for-6.12-rc6-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux:
  btrfs: fix the length of reserved qgroup to free
  btrfs: reinitialize delayed ref list after deleting it from the list
  btrfs: fix per-subvolume RO/RW flags with new mount API
parents b5f1b488 2b084d82
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -649,7 +649,7 @@ static bool insert_delayed_ref(struct btrfs_trans_handle *trans,
					      &href->ref_add_list);
			else if (ref->action == BTRFS_DROP_DELAYED_REF) {
				ASSERT(!list_empty(&exist->add_list));
				list_del(&exist->add_list);
				list_del_init(&exist->add_list);
			} else {
				ASSERT(0);
			}
+1 −1
Original line number Diff line number Diff line
@@ -1618,7 +1618,7 @@ static noinline int cow_file_range(struct btrfs_inode *inode,
		clear_bits |= EXTENT_CLEAR_DATA_RESV;
		extent_clear_unlock_delalloc(inode, start, end, locked_folio,
					     &cached, clear_bits, page_ops);
		btrfs_qgroup_free_data(inode, NULL, start, cur_alloc_size, NULL);
		btrfs_qgroup_free_data(inode, NULL, start, end - start + 1, NULL);
	}
	return ret;
}
+5 −20
Original line number Diff line number Diff line
@@ -1979,25 +1979,10 @@ static int btrfs_get_tree_super(struct fs_context *fc)
 *     fsconfig(FSCONFIG_SET_FLAG, "ro"). This option is seen by the filesystem
 *     in fc->sb_flags.
 *
 * This disambiguation has rather positive consequences.  Mounting a subvolume
 * ro will not also turn the superblock ro. Only the mount for the subvolume
 * will become ro.
 *
 * So, if the superblock creation request comes from the new mount API the
 * caller must have explicitly done:
 *
 *      fsconfig(FSCONFIG_SET_FLAG, "ro")
 *      fsmount/mount_setattr(MOUNT_ATTR_RDONLY)
 *
 * IOW, at some point the caller must have explicitly turned the whole
 * superblock ro and we shouldn't just undo it like we did for the old mount
 * API. In any case, it lets us avoid the hack in the new mount API.
 *
 * Consequently, the remounting hack must only be used for requests originating
 * from the old mount API and should be marked for full deprecation so it can be
 * turned off in a couple of years.
 *
 * The new mount API has no reason to support this hack.
 * But, currently the util-linux mount command already utilizes the new mount
 * API and is still setting fsconfig(FSCONFIG_SET_FLAG, "ro") no matter if it's
 * btrfs or not, setting the whole super block RO.  To make per-subvolume mounting
 * work with different options work we need to keep backward compatibility.
 */
static struct vfsmount *btrfs_reconfigure_for_mount(struct fs_context *fc)
{
@@ -2019,7 +2004,7 @@ static struct vfsmount *btrfs_reconfigure_for_mount(struct fs_context *fc)
	if (IS_ERR(mnt))
		return mnt;

	if (!fc->oldapi || !ro2rw)
	if (!ro2rw)
		return mnt;

	/* We need to convert to rw, call reconfigure. */