Page MenuHomeFreeBSD

sbin/swapon: allow late swap option with geli swap
ClosedPublic

Authored by AMDmi3 on Feb 28 2017, 11:44 AM.
Tags
None
Referenced Files
Unknown Object (File)
May 2 2024, 1:24 PM
Unknown Object (File)
May 2 2024, 1:22 PM
Unknown Object (File)
May 2 2024, 12:49 PM
Unknown Object (File)
May 2 2024, 10:03 AM
Unknown Object (File)
May 2 2024, 7:44 AM
Unknown Object (File)
Apr 27 2024, 11:33 PM
Unknown Object (File)
Apr 27 2024, 10:23 PM
Unknown Object (File)
Sep 30 2023, 9:33 PM
Subscribers

Details

Summary

With following in fstab:

/dev/gpt/swap.eli none swap sw,late 0 0

swap will not be enabled, with swapon -aL complaining:

swapon: Invalid option: late

This is incorrect and happens because swap_on_geli_args() which
parses geli arguments out of mount options doesn't expect late or
noauto there. Fix this by explicitly allowing these arguments.

With this fix, I was able to get late geli swap working.

Test Plan

Tested on real box

Diff Detail

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

Event Timeline

AMDmi3 retitled this revision from to sbin/swapon: allow late swap option with geli swap.
AMDmi3 updated this object.
AMDmi3 edited the test plan for this revision. (Show Details)
AMDmi3 added reviewers: hrs, jilles.
AMDmi3 updated this object.
AMDmi3 updated this object.

The idea looks good to me.

I don't like the dead store into p and useless use of strstr() (which is equivalent to strncmp()), although there is precedent in the above line for notrim.

With a slight change of behaviour, else if (strcmp(token, "late") == 0) should be good.

AMDmi3 edited edge metadata.

Use proper way of string comparison

Oh, pardon my negligence, I've just copypasted these without examining the code properly. Use strcmp for string comparison, and fix another similar case along the way.

This revision is now accepted and ready to land.Mar 9 2017, 10:11 PM
This revision was automatically updated to reflect the committed changes.