]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
fusefs: correctly handle short reads
authorasomers <asomers@FreeBSD.org>
Fri, 21 Jun 2019 21:44:31 +0000 (21:44 +0000)
committerasomers <asomers@FreeBSD.org>
Fri, 21 Jun 2019 21:44:31 +0000 (21:44 +0000)
commitb21daa362e81f23e997ac0e930609881326fa00e
treeb708aad2c47fe4bf8f0c0ef5f258ba8b7a3e30ec
parent5af747b4d8149cd15cc53d3edbc6fe0d22878865
fusefs: correctly handle short reads

A fuse server may return a short read for three reasons:

* The file is opened with FOPEN_DIRECT_IO.  In this case, the short read
  should be returned directly to userland.  We already handled this case
  correctly.

* The file was truncated server-side, and the read hit EOF.  In this case,
  the kernel should update the file size.  Fixed in the case of VOP_READ.
  Fixing this for VOP_GETPAGES is TODO.

* The file is opened in writeback mode, there are dirty buffers past what
  the server thinks is the file's EOF, and the read hit what the server
  thinks is the file's EOF.  In this case, the client is trying to read a
  hole, and should zero-fill it.  We already handled this case, and I added
  a test for it.

Sponsored by: The FreeBSD Foundation
sys/fs/fuse/fuse_io.c
tests/sys/fs/fusefs/read.cc
tests/sys/fs/fusefs/write.cc