[PATCH 2/2] netfs: Fix missing zero-length check in unbuffered write

Dominique Martinet asmadeus at codewreck.org
Tue Jan 30 13:57:23 PST 2024


David Howells wrote on Mon, Jan 29, 2024 at 09:49:19AM +0000:
> 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 <ericvh at kernel.org>
> Link: https://lore.kernel.org/r/ZbQUU6QKmIftKsmo@FV7GG9FTHL/
> Signed-off-by: David Howells <dhowells at redhat.com>
> cc: Dominique Martinet <asmadeus at codewreck.org>

Thanks!

Tested-by: Dominique Martinet <asmadeus at codewreck.org>

-- 
Dominique Martinet | Asmadeus



More information about the linux-afs mailing list