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:
parent
b9e2019755
commit
0d3a88d76c
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/projects/fuse2/; revision=349382
@ -541,8 +541,7 @@ fuse_write_directbackend(struct vnode *vp, struct uio *uio,
|
|||||||
diff = fwi->size - fwo->size;
|
diff = fwi->size - fwo->size;
|
||||||
as_written_offset = uio->uio_offset - diff;
|
as_written_offset = uio->uio_offset - diff;
|
||||||
|
|
||||||
if (as_written_offset - diff > filesize &&
|
if (as_written_offset - diff > filesize)
|
||||||
fuse_data_cache_mode != FUSE_CACHE_UC)
|
|
||||||
fuse_vnode_setsize(vp, as_written_offset);
|
fuse_vnode_setsize(vp, as_written_offset);
|
||||||
if (as_written_offset - diff >= filesize)
|
if (as_written_offset - diff >= filesize)
|
||||||
fvdat->flag &= ~FN_SIZECHANGE;
|
fvdat->flag &= ~FN_SIZECHANGE;
|
||||||
|
@ -1041,8 +1041,8 @@ TEST_F(WriteThrough, writethrough)
|
|||||||
/* Deliberately leak fd. close(2) will be tested in release.cc */
|
/* Deliberately leak fd. close(2) will be tested in release.cc */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* With writethrough caching, writes update the cached file size */
|
/* Writes that extend a file should update the cached file size */
|
||||||
TEST_F(WriteThrough, update_file_size)
|
TEST_F(Write, update_file_size)
|
||||||
{
|
{
|
||||||
const char FULLPATH[] = "mountpoint/some_file.txt";
|
const char FULLPATH[] = "mountpoint/some_file.txt";
|
||||||
const char RELPATH[] = "some_file.txt";
|
const char RELPATH[] = "some_file.txt";
|
||||||
|
Loading…
Reference in New Issue
Block a user