[pve-devel] applied: [RFC PATCH common] sysfstools: file_write: properly catch errors

Thomas Lamprecht t.lamprecht at proxmox.com
Thu Oct 24 18:32:41 CEST 2024


Am 23/07/2024 um 10:29 schrieb Dominik Csapak:
> since `print` is doing buffered IO, we don't always get an error there,
> even if the underlying write does not work.
> 
> To properly catch that, do an unbuffered `syswrite` which circumvents
> all buffers and writes directly to the file handle.
> 
> We aren't actually interested in the specific error here, but only if
> the write was successful or not.
> 
> Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
> ---
> 
> Note: this is heavily used when doing PCI passthrough, and it seems we
> did not catch as many errors as we thought. Maybe we should introduce an
> 'noerr' parameter and pass that on all current code paths, since i fear
> that there are many situations where the sysfs write had failed but it
> still works because we ignored it and qemu/the kernel do the right thing
> anyway.
> 

I also see some regression potential, but IMO it's something that would
be very good to know, and so erroring out explicitly for now is IMO worth
it. We can then adapt this as needed on actual feedback.

>  src/PVE/SysFSTools.pm | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
>

applied, with Christoph's T-b thanks!




More information about the pve-devel mailing list