Skip to content

Commit 03f4eb2

Browse files
jeckersbcgwalters
authored andcommitted
fsverity: Add nicer error variant for ETXTBSY
Reviving the more sane part of #120. We should provide a clearer error variant here instead of just passing ETXTBSY through to the caller. Signed-off-by: John Eckersberg <[email protected]>
1 parent 1f7064d commit 03f4eb2

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

crates/composefs/src/fsverity/ioctl.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ pub(super) fn fs_ioc_enable_verity<H: FsVerityHashValue>(
5454
Err(EnableVerityError::FilesystemNotSupported)
5555
}
5656
Err(Errno::EXIST) => Err(EnableVerityError::AlreadyEnabled),
57+
Err(Errno::TXTBSY) => Err(EnableVerityError::FileOpenedForWrite),
5758
Err(e) => Err(Error::from(e).into()),
5859
Ok(_) => Ok(()),
5960
}

crates/composefs/src/fsverity/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ pub enum EnableVerityError {
3030
FilesystemNotSupported,
3131
#[error("fs-verity is already enabled on file")]
3232
AlreadyEnabled,
33+
#[error("File is opened for writing")]
34+
FileOpenedForWrite,
3335
}
3436

3537
/// A verity comparison failed.

0 commit comments

Comments
 (0)