On 2/7/24 14:44, Jingbo Xu wrote: > > > On 2/7/24 9:38 PM, Bernd Schubert wrote: >> >> >> On 2/6/24 10:20, Jingbo Xu wrote: >>> >>> >>> On 2/1/24 7:08 AM, Bernd Schubert wrote: >>>> @@ -1591,10 +1616,10 @@ static ssize_t fuse_direct_write_iter(struct kiocb *iocb, struct iov_iter *from) >>>> else { >>>> inode_lock_shared(inode); >>>> >>>> - /* A race with truncate might have come up as the decision for >>>> - * the lock type was done without holding the lock, check again. >>>> + /* >>>> + * Previous check was without any lock and might have raced. >>>> */ > > >>>> - if (fuse_direct_write_extending_i_size(iocb, from)) { >>>> + if (fuse_dio_wr_exclusive_lock(iocb, from)) { >>> ^ > > I mean, in patch 2/5 > >> - if (fuse_direct_write_extending_i_size(iocb, from)) { >> + if (fuse_io_past_eof(iocb, from)) { > > is better, otherwise it's not an equivalent change. Ah thanks, good catch! Now I see what you mean. Yeah, we can switch to fuse_io_past_eof() here. And yeah, 3/5 changes it back. Fortunately there is actually not much harm, as fuse_dio_wr_exclusive_lock also calls into fuse_io_past_eof. Thanks, Bernd