Skip to content

Commit 9183e03

Browse files
committed
Merge tag 'for-6.12-rc6-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux
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
2 parents b5f1b48 + 2b084d8 commit 9183e03

File tree

3 files changed

+7
-22
lines changed

3 files changed

+7
-22
lines changed

fs/btrfs/delayed-ref.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,7 @@ static bool insert_delayed_ref(struct btrfs_trans_handle *trans,
649649
&href->ref_add_list);
650650
else if (ref->action == BTRFS_DROP_DELAYED_REF) {
651651
ASSERT(!list_empty(&exist->add_list));
652-
list_del(&exist->add_list);
652+
list_del_init(&exist->add_list);
653653
} else {
654654
ASSERT(0);
655655
}

fs/btrfs/inode.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1618,7 +1618,7 @@ static noinline int cow_file_range(struct btrfs_inode *inode,
16181618
clear_bits |= EXTENT_CLEAR_DATA_RESV;
16191619
extent_clear_unlock_delalloc(inode, start, end, locked_folio,
16201620
&cached, clear_bits, page_ops);
1621-
btrfs_qgroup_free_data(inode, NULL, start, cur_alloc_size, NULL);
1621+
btrfs_qgroup_free_data(inode, NULL, start, end - start + 1, NULL);
16221622
}
16231623
return ret;
16241624
}

fs/btrfs/super.c

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1979,25 +1979,10 @@ static int btrfs_get_tree_super(struct fs_context *fc)
19791979
* fsconfig(FSCONFIG_SET_FLAG, "ro"). This option is seen by the filesystem
19801980
* in fc->sb_flags.
19811981
*
1982-
* This disambiguation has rather positive consequences. Mounting a subvolume
1983-
* ro will not also turn the superblock ro. Only the mount for the subvolume
1984-
* will become ro.
1985-
*
1986-
* So, if the superblock creation request comes from the new mount API the
1987-
* caller must have explicitly done:
1988-
*
1989-
* fsconfig(FSCONFIG_SET_FLAG, "ro")
1990-
* fsmount/mount_setattr(MOUNT_ATTR_RDONLY)
1991-
*
1992-
* IOW, at some point the caller must have explicitly turned the whole
1993-
* superblock ro and we shouldn't just undo it like we did for the old mount
1994-
* API. In any case, it lets us avoid the hack in the new mount API.
1995-
*
1996-
* Consequently, the remounting hack must only be used for requests originating
1997-
* from the old mount API and should be marked for full deprecation so it can be
1998-
* turned off in a couple of years.
1999-
*
2000-
* The new mount API has no reason to support this hack.
1982+
* But, currently the util-linux mount command already utilizes the new mount
1983+
* API and is still setting fsconfig(FSCONFIG_SET_FLAG, "ro") no matter if it's
1984+
* btrfs or not, setting the whole super block RO. To make per-subvolume mounting
1985+
* work with different options work we need to keep backward compatibility.
20011986
*/
20021987
static struct vfsmount *btrfs_reconfigure_for_mount(struct fs_context *fc)
20031988
{
@@ -2019,7 +2004,7 @@ static struct vfsmount *btrfs_reconfigure_for_mount(struct fs_context *fc)
20192004
if (IS_ERR(mnt))
20202005
return mnt;
20212006

2022-
if (!fc->oldapi || !ro2rw)
2007+
if (!ro2rw)
20232008
return mnt;
20242009

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

0 commit comments

Comments
 (0)