mbox series

[0/2] btrfs: fixes for the new fd-based API

Message ID cover.1730249396.git.wqu@suse.com (mailing list archive)
Headers show
Series btrfs: fixes for the new fd-based API | expand

Message

Qu Wenruo Oct. 30, 2024, 12:55 a.m. UTC
There are two critical bugs, all introduced by the same new fd-based
mount API migration.

The first one will break the per-subvolume RW/RO mount, if using the
new fd-based mount API.
This is caused by the untrue promise that the new API will not set the
RO flag for the fsconfig() call (which sets the super flags), but only
set RO attribute for the mount point.

Based on the bad promise, we skip the RO->RW reconfiguration for the new
API based mount call. But since the new fd-based mount is already
rolling out to the end users, and it still sets RO flags for both super
and mount point.

So we should still do the same RO->RW reconfiguration, no matter the
API.


The second one is a long existing problem related the RO->RW
reconfiguration itself, where we retry without any lock, resulting race
between reconfiguration and RO/RW mounts.

This will leads to a failure to mount, exposed by SLE-micro bug report.


Those two bugs are all small but critical to the core function of btrfs,
thus should be queued for -rc kernels.

Qu Wenruo (2):
  btrfs: fix per-subvolume RO/RW flags with new mount API
  btrfs: fix mount failure due to remount races

 fs/btrfs/super.c | 88 +++++++++++++++++-------------------------------
 1 file changed, 31 insertions(+), 57 deletions(-)