Skip to content

getDiskFormat() returns nil error if the given disk path doesn't exist. #19

Open
@derekbit

Description

@derekbit

We found that the getDiskFormat function (code) might return a nil error if the given disk path does not exist.

If the disk path does not exist, blkid -p ... returns errno 2, indicating that the disk format was not found. Consequently, getDiskFormat() returns a nil error to its caller. However, this nil error can be misleading because it does not clearly signal that the disk is missing.

We propose that before returning ("", nil), getDiskFormat() should explicitly verify whether the disk exists. If the disk does not exist, the function should return an appropriate error instead of nil.

More context: longhorn/longhorn#10416

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions