Merge pull request #11206 from kimullaa/fix-xfs-rootfs-type

runtime: remove wrong xfs options
This commit is contained in:
Fabiano Fidêncio 2025-05-01 09:05:17 +02:00 committed by GitHub
commit 3dfabd42c2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 18 additions and 8 deletions

View File

@ -76,12 +76,15 @@ impl KernelParams {
VM_ROOTFS_DRIVER_PMEM => { VM_ROOTFS_DRIVER_PMEM => {
params.push(Param::new("root", VM_ROOTFS_ROOT_PMEM)); params.push(Param::new("root", VM_ROOTFS_ROOT_PMEM));
match rootfs_type { match rootfs_type {
VM_ROOTFS_FILESYSTEM_EXT4 | VM_ROOTFS_FILESYSTEM_XFS => { VM_ROOTFS_FILESYSTEM_EXT4 => {
params.push(Param::new( params.push(Param::new(
"rootflags", "rootflags",
"dax,data=ordered,errors=remount-ro ro", "dax,data=ordered,errors=remount-ro ro",
)); ));
} }
VM_ROOTFS_FILESYSTEM_XFS => {
params.push(Param::new("rootflags", "dax ro"));
}
VM_ROOTFS_FILESYSTEM_EROFS => { VM_ROOTFS_FILESYSTEM_EROFS => {
params.push(Param::new("rootflags", "dax ro")); params.push(Param::new("rootflags", "dax ro"));
} }
@ -93,9 +96,12 @@ impl KernelParams {
VM_ROOTFS_DRIVER_BLK | VM_ROOTFS_DRIVER_BLK_CCW | VM_ROOTFS_DRIVER_MMIO => { VM_ROOTFS_DRIVER_BLK | VM_ROOTFS_DRIVER_BLK_CCW | VM_ROOTFS_DRIVER_MMIO => {
params.push(Param::new("root", VM_ROOTFS_ROOT_BLK)); params.push(Param::new("root", VM_ROOTFS_ROOT_BLK));
match rootfs_type { match rootfs_type {
VM_ROOTFS_FILESYSTEM_EXT4 | VM_ROOTFS_FILESYSTEM_XFS => { VM_ROOTFS_FILESYSTEM_EXT4 => {
params.push(Param::new("rootflags", "data=ordered,errors=remount-ro ro")); params.push(Param::new("rootflags", "data=ordered,errors=remount-ro ro"));
} }
VM_ROOTFS_FILESYSTEM_XFS => {
params.push(Param::new("rootflags", "ro"));
}
VM_ROOTFS_FILESYSTEM_EROFS => { VM_ROOTFS_FILESYSTEM_EROFS => {
params.push(Param::new("rootflags", "ro")); params.push(Param::new("rootflags", "ro"));
} }
@ -259,7 +265,7 @@ mod tests {
expect_params: KernelParams { expect_params: KernelParams {
params: [ params: [
Param::new("root", VM_ROOTFS_ROOT_PMEM), Param::new("root", VM_ROOTFS_ROOT_PMEM),
Param::new("rootflags", "dax,data=ordered,errors=remount-ro ro"), Param::new("rootflags", "dax ro"),
Param::new("rootfstype", VM_ROOTFS_FILESYSTEM_XFS), Param::new("rootfstype", VM_ROOTFS_FILESYSTEM_XFS),
] ]
.to_vec(), .to_vec(),
@ -272,7 +278,7 @@ mod tests {
expect_params: KernelParams { expect_params: KernelParams {
params: [ params: [
Param::new("root", VM_ROOTFS_ROOT_BLK), Param::new("root", VM_ROOTFS_ROOT_BLK),
Param::new("rootflags", "data=ordered,errors=remount-ro ro"), Param::new("rootflags", "ro"),
Param::new("rootfstype", VM_ROOTFS_FILESYSTEM_XFS), Param::new("rootfstype", VM_ROOTFS_FILESYSTEM_XFS),
] ]
.to_vec(), .to_vec(),

View File

@ -150,7 +150,11 @@ func GetKernelRootParams(rootfstype string, disableNvdimm bool, dax bool) ([]Par
kernelRootParams = append(kernelRootParams, Param{"rootflags", "ro"}) kernelRootParams = append(kernelRootParams, Param{"rootflags", "ro"})
} }
case XFS: case XFS:
fallthrough if dax {
kernelRootParams = append(kernelRootParams, Param{"rootflags", "dax ro"})
} else {
kernelRootParams = append(kernelRootParams, Param{"rootflags", "ro"})
}
// EXT4 filesystem is used by default. // EXT4 filesystem is used by default.
case EXT4: case EXT4:
if dax { if dax {

View File

@ -64,7 +64,7 @@ func TestGetKernelRootParams(t *testing.T) {
rootfstype: string(XFS), rootfstype: string(XFS),
expected: []Param{ expected: []Param{
{"root", string(Nvdimm)}, {"root", string(Nvdimm)},
{"rootflags", "data=ordered,errors=remount-ro ro"}, {"rootflags", "ro"},
{"rootfstype", string(XFS)}, {"rootfstype", string(XFS)},
}, },
disableNvdimm: false, disableNvdimm: false,
@ -75,7 +75,7 @@ func TestGetKernelRootParams(t *testing.T) {
rootfstype: string(XFS), rootfstype: string(XFS),
expected: []Param{ expected: []Param{
{"root", string(Nvdimm)}, {"root", string(Nvdimm)},
{"rootflags", "dax,data=ordered,errors=remount-ro ro"}, {"rootflags", "dax ro"},
{"rootfstype", string(XFS)}, {"rootfstype", string(XFS)},
}, },
disableNvdimm: false, disableNvdimm: false,
@ -86,7 +86,7 @@ func TestGetKernelRootParams(t *testing.T) {
rootfstype: string(XFS), rootfstype: string(XFS),
expected: []Param{ expected: []Param{
{"root", string(VirtioBlk)}, {"root", string(VirtioBlk)},
{"rootflags", "data=ordered,errors=remount-ro ro"}, {"rootflags", "ro"},
{"rootfstype", string(XFS)}, {"rootfstype", string(XFS)},
}, },
disableNvdimm: true, disableNvdimm: true,