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:
asomers 2019-06-25 18:36:11 +00:00
parent 5c38f95631
commit 89efdc3591
2 changed files with 3 additions and 4 deletions

View File

@ -541,8 +541,7 @@ retry:
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";