On Mon, 16 Sep 2024, NeilBrown wrote: > On Thu, 12 Sep 2024, Olga Kornievskaia wrote: > > > > What about vfs_truncate() which also calls break_lease? > > vfs_truncate() is quite different, though that isn't a good excuse for > me to leave it out. It uses break_lease() like open does - not > try_break_deleg() like rename. > It can do this because it has called get_write_access() in the inode > which has incremented i_writecount which will prevent leases from being > granted. But that DOESN'T prevent delegations from being granted. I > think it should. Actually it does. check_conflicting_opens() does cause the delegation request to fail because it is a no-op for delegations. But between getting the delegation and hashing the delegation, nfsd4_check_conflicting_opens() is called and it fails if i_writecount has been elevated. So the break_lease() from vfs_truncate() is safe - delegations are prevented until the truncation completes. NeilBrown