fusefs: writes should update the file size, even when data_cache_mode=0

Writes that extend a file should update the file's size.  r344185 restricted
that behavior for fusefs to only happen when the data cache was enabled.
That probably made sense at the time because the attribute cache wasn't
fully baked yet.  Now that it is, we should always update the cached file
size during write.

Sponsored by:	The FreeBSD Foundation
This commit is contained in:
Alan Somers 2019-06-25 18:36:11 +00:00
parent b9e2019755
commit 0d3a88d76c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/projects/fuse2/; revision=349382
2 changed files with 3 additions and 4 deletions

View File

@ -541,8 +541,7 @@ fuse_write_directbackend(struct vnode *vp, struct uio *uio,
diff = fwi->size - fwo->size;
as_written_offset = uio->uio_offset - diff;
if (as_written_offset - diff > filesize &&
fuse_data_cache_mode != FUSE_CACHE_UC)
if (as_written_offset - diff > filesize)
fuse_vnode_setsize(vp, as_written_offset);
if (as_written_offset - diff >= filesize)
fvdat->flag &= ~FN_SIZECHANGE;

View File

@ -1041,8 +1041,8 @@ TEST_F(WriteThrough, writethrough)
/* Deliberately leak fd. close(2) will be tested in release.cc */
}
/* With writethrough caching, writes update the cached file size */
TEST_F(WriteThrough, update_file_size)
/* Writes that extend a file should update the cached file size */
TEST_F(Write, update_file_size)
{
const char FULLPATH[] = "mountpoint/some_file.txt";
const char RELPATH[] = "some_file.txt";