On 3/7/24 17:09, Josef Bacik wrote: > On Thu, Mar 07, 2024 at 10:08:13AM -0500, Sweet Tea Dorminy wrote: >> All calls into generic vfs functions need to make sure that the inode >> attributes used by those functions are up to date, by calling >> fuse_update_attributes() as appropriate. >> >> generic_write_checks() accesses inode size in order to get the >> appropriate file offset for files opened with O_APPEND. Currently, in >> some cases, fuse_update_attributes() is not called before >> generic_write_checks(), potentially resulting in corruption/overwrite of >> previously appended data if i_size is out of date in the cached inode. >> >> Therefore, make sure fuse_update_attributes() is always >> called before generic_write_checks(), and add a note about why it's not >> necessary for some llseek calls. >> >> Signed-off-by: Sweet Tea Dorminy <sweettea-kernel@xxxxxxxxxx> > > I had to ask questions and go look at the code, mostly because I'm not a FUSE > developer. fuse_update_attributes() doesn't actually do anything if the stats > aren't invalidated, I was concerned we were suddenly adding a lot of overhead > for every write call. Unless the timeout is set to 0? > > Reviewed-by: Josef Bacik <josef@xxxxxxxxxxxxxx> > > I have a question for the normal FUSE developers, how would one test this? > There doesn't appear to be a mechanism for writing stub FUSE fs's to exercise a > case like this in fstests. Is there some other way you guys would test this or > is this something we need to build out ourselves? Thanks, You mean for xfstests? I'm testing fuse all the time with it. Thanks, Bernd