fs/open: make do_truncate() killable

Allows killing processes that are waiting for the inode lock.

Signed-off-by: Max Kellermann <max.kellermann@ionos.com>
Link: https://lore.kernel.org/20250513150327.1373061-3-max.kellermann@ionos.com
Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
Max Kellermann 2025-05-13 17:03:26 +02:00 committed by Christian Brauner
parent 28a3f6ab2f
commit d686875642
No known key found for this signature in database
GPG Key ID: 91C61BC06578DCA2

View File

@ -60,7 +60,10 @@ int do_truncate(struct mnt_idmap *idmap, struct dentry *dentry,
if (ret)
newattrs.ia_valid |= ret | ATTR_FORCE;
inode_lock(dentry->d_inode);
ret = inode_lock_killable(dentry->d_inode);
if (ret)
return ret;
/* Note any delegations or leases have already been broken: */
ret = notify_change(idmap, dentry, &newattrs, NULL);
inode_unlock(dentry->d_inode);