Page MenuHomeFreeBSD

Fix "mount -uw /" when the filesystem type doesn't match.
ClosedPublic

Authored by trasz on Jun 23 2017, 12:52 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Jul 2, 8:22 AM
Unknown Object (File)
Apr 21 2024, 8:46 PM
Unknown Object (File)
Apr 21 2024, 8:40 PM
Unknown Object (File)
Mar 22 2024, 9:34 PM
Unknown Object (File)
Mar 22 2024, 9:34 PM
Unknown Object (File)
Mar 22 2024, 9:34 PM
Unknown Object (File)
Mar 9 2024, 2:29 PM
Unknown Object (File)
Jan 5 2024, 11:25 AM
Subscribers

Details

Summary

This basically makes "mount -uw /" work when the filesystem mountedon / is NFS, but the one configured in fstab(5) is UFS, which canhappen when you forget to modify fstab to work with... which for some reason happens every single time.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

trasz retitled this revision from Fix "mount -uw /" when the filesystem type doesn't match. This basically makes "mount -uw /" work when the filesystem mounted on / is NFS, but the one configured in fstab(5) is UFS, which can happen when you forget to modify fstab to work with... to Fix "mount -uw /" when the filesystem type doesn't match..Jun 23 2017, 12:53 PM
trasz edited the summary of this revision. (Show Details)
trasz added a reviewer: kib.

Can you explain why this special case is required ?

I find it somewhat surprising if the mount -uw / worked when my fstab is wrong, i.e. I expect that mount /something should fail if fstab is not correct.

Also, you check the fstab filesystem type. What if the type is right, but options are incompatible ?

I don't have a slightest idea why the special case is required. But it might be, and removing it altogether might break somebody's system. Adding additional condition is much less intrusive, and thus safer.

I don't have a slightest idea why the special case is required. But it might be, and removing it altogether might break somebody's system. Adding additional condition is much less intrusive, and thus safer.

By 'special case' I mean the fs type inconsistency, not the case of root mount update.

That said, the comment before the if (getfsfile()) line explaining the special case is wrong. The working "mount -u /" should be not special, as in, "mount -u <other fs mnt point>" ought to work, IMO.

The special case of checking the filesystem is added to reduce the other special case - the one for / - so it doesn't apply if the filesystem doesn't match. I kind of agree that "mount -u /" shouldn't be special, but as I've said - there might be something out there that will get broken by removing it. So instead I'm trying to just fix the case that's clearly broken (it results in mount(8) executing something like "mount_nfs -o remount,rw /dev/ada0 /") and not touching others.

This revision was automatically updated to reflect the committed changes.