commit | ca9ca1a5d5a980550db1001ea825f9fdfa550b83 | [log] [tgz] |
---|---|---|
author | David Howells <[email protected]> | Mon Jan 29 09:49:19 2024 +0000 |
committer | Christian Brauner <[email protected]> | Mon Jan 29 14:53:21 2024 +0100 |
tree | 8581ba3b07f5f16066883d3d566bc35c5e314120 | |
parent | 2147caaac7349698f2a392c5e2911a6861a09650 [diff] |
netfs: Fix missing zero-length check in unbuffered write Fix netfs_unbuffered_write_iter() to return immediately if generic_write_checks() returns 0, indicating there's nothing to write. Note that netfs_file_write_iter() already does this. Also, whilst we're at it, put in checks for the size being zero before we even take the locks. Note that generic_write_checks() can still reduce the size to zero, so we still need that check. Without this, a warning similar to the following is logged to dmesg: netfs: Zero-sized write [R=1b6da] and the syscall fails with EIO, e.g.: /sbin/ldconfig.real: Writing of cache extension data failed: Input/output error This can be reproduced on 9p by: xfs_io -f -c 'pwrite 0 0' /xfstest.test/foo Fixes: 153a9961b551 ("netfs: Implement unbuffered/DIO write support") Reported-by: Eric Van Hensbergen <[email protected]> Link: https://lore.kernel.org/r/ZbQUU6QKmIftKsmo@FV7GG9FTHL/ Signed-off-by: David Howells <[email protected]> Link: https://lore.kernel.org/r/[email protected] Tested-by: Dominique Martinet <[email protected]> Reviewed-by: Jeff Layton <[email protected]> cc: Dominique Martinet <[email protected]> cc: Jeff Layton <[email protected]> cc: <[email protected]> cc: <[email protected]> cc: <[email protected]> cc: <[email protected]> Signed-off-by: Christian Brauner <[email protected]>