Re: [PATCH v2 1/3] btrfs: add "rescue=usebackuproot" into forced read-only options

Qu Wenruo <[email protected]>
Newsgroups org.kernel.vger.linux-btrfs
Message-ID <[email protected]>

在 2026/7/3 18:51, Dongjiang Zhu 写道:
> 在 2026/7/3 16:41, Qu Wenruo 写道:
>> According to btrfs(5) man page, all rescue options should require an
>> read-only mount.
>>
>> But that read-only check is only introduced for newer rescue options,
>> not for the pre-existing "usebackuproot" one.
>>
>> Unify the behavior to match the document.
>>
>> Signed-off-by: Qu Wenruo <[email protected]>
>> ---
>>    fs/btrfs/super.c | 3 ++-
>>    1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
>> index 0a6ce6c19d8c..fef9025a2f76 100644
>> --- a/fs/btrfs/super.c
>> +++ b/fs/btrfs/super.c
>> @@ -692,7 +692,8 @@ bool btrfs_check_options(const struct btrfs_fs_info *info,
>>    	bool ret = true;
>>    
>>    	if (!(flags & SB_RDONLY) &&
>> -	    (check_ro_option(info, *mount_opt, BTRFS_MOUNT_NOLOGREPLAY, "nologreplay") ||
>> +	    (check_ro_option(info, *mount_opt, BTRFS_MOUNT_USEBACKUPROOT, "usebackuproot") ||
>> +	     check_ro_option(info, *mount_opt, BTRFS_MOUNT_NOLOGREPLAY, "nologreplay") ||
>>    	     check_ro_option(info, *mount_opt, BTRFS_MOUNT_IGNOREBADROOTS, "ignorebadroots") ||
>>    	     check_ro_option(info, *mount_opt, BTRFS_MOUNT_IGNOREDATACSUMS, "ignoredatacsums") ||
>>    	     check_ro_option(info, *mount_opt, BTRFS_MOUNT_IGNOREMETACSUMS, "ignoremetacsums") ||
> 
> Hi Qu,
> 
> One more thing I noticed: should BTRFS_MOUNT_USEBACKUPROOT also be added
> to BTRFS_MOUNT_FULL_RO_MASK?

Thanks for pointing this out, you're completely right.

> 
> Thanks,
> Dongjiang
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.