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 => {
params.push(Param::new("root", VM_ROOTFS_ROOT_PMEM));
match rootfs_type {
VM_ROOTFS_FILESYSTEM_EXT4 | VM_ROOTFS_FILESYSTEM_XFS => {
VM_ROOTFS_FILESYSTEM_EXT4 => {
params.push(Param::new(
"rootflags",
"dax,data=ordered,errors=remount-ro ro",
));
}
VM_ROOTFS_FILESYSTEM_XFS => {
params.push(Param::new("rootflags", "dax ro"));
}
VM_ROOTFS_FILESYSTEM_EROFS => {
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 => {
params.push(Param::new("root", VM_ROOTFS_ROOT_BLK));
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"));
}
VM_ROOTFS_FILESYSTEM_XFS => {
params.push(Param::new("rootflags", "ro"));
}
VM_ROOTFS_FILESYSTEM_EROFS => {
params.push(Param::new("rootflags", "ro"));
}
@ -259,7 +265,7 @@ mod tests {
expect_params: KernelParams {
params: [
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),
]
.to_vec(),
@ -272,7 +278,7 @@ mod tests {
expect_params: KernelParams {
params: [
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),
]
.to_vec(),

View File

@ -150,7 +150,11 @@ func GetKernelRootParams(rootfstype string, disableNvdimm bool, dax bool) ([]Par
kernelRootParams = append(kernelRootParams, Param{"rootflags", "ro"})
}
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.
case EXT4:
if dax {

View File

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