Re: [PATCH 4/3] xfs_db: support the needsrepair feature flag in the version command

Eric Sandeen
2020-12-04T21:17:36Z

On 12/4/20 3:09 PM, Darrick J. Wong wrote:
>>> @@ -543,6 +549,12 @@ label_f(
>>> return 0;
>>> }
>>>
>>> + if (xfs_sb_version_needsrepair(&mp->m_sb)) {
>>> + dbprintf(_("%s: filesystem needs xfs_repair\n"),
>>> + progname);
>>> + return 0;
>>> + }
>>> +
>> why are uuid_f and label_f uniquely disallowed from operating on a needsrepair
>> filesystem? (is it because they are unique in that they rewrite all superblocks?)
> Because ... the fs needs repair, so the admin should repair the fs
> before they try to modify the fs. We don't allow mounting, so we
> shouldn't allow label/uuid changes.

But xfs_db can change LOTS more than just these two things.

So this seems a bit ad-hoc and something that will drift as time
goes by.

So what is the "can't change" criteria here - only xfs_admin-invoked routines?

If so, could we put this in a central place, and reject if
!(strcmp(progname, "xfs_admin")) but let the xfs_db power user proceed?

Mostly I prefer to get this check centralized and not sprinkled around.

-Eric