On Tue, 11 Oct 2022 at 22:45, Jeff Layton <jlayton@xxxxxxxxxx> wrote: > The NFS client maintains lock records in the local VFS. This is what fuse does, unless server explicitly requests remote posix locking with the FUSE_POSIX_LOCKS init flag. Not sure how many real fuse filesystem out there actually implement this, probably not a lot. > When a file is > closed, the VFS issues a whole file unlock. You're probably getting > bitten by this in locks_remove_posix: > > ctx = smp_load_acquire(&inode->i_flctx); > if (!ctx || list_empty(&ctx->flc_posix)) > return; > > Because FUSE doesn't set any locks in the local kernel, that final > unlock never occurs. Fuse doesn't care, because if remote posix locks are enabled, then unlocking should be done in the FUSE_FLUSH request. > There are a couple of options here: You could have FUSE start setting > local lock records, or you could look at pushing the above check down > into the individual ->lock ops. I don't remember the details, but setting local locks wasn't a good option. Thanks, Miklos