Skip to content

Commit d686875

Browse files
MaxKellermannbrauner
authored andcommitted
fs/open: make do_truncate() killable
Allows killing processes that are waiting for the inode lock. Signed-off-by: Max Kellermann <[email protected]> Link: https://lore.kernel.org/[email protected] Signed-off-by: Christian Brauner <[email protected]>
1 parent 28a3f6a commit d686875

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

fs/open.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,10 @@ int do_truncate(struct mnt_idmap *idmap, struct dentry *dentry,
6060
if (ret)
6161
newattrs.ia_valid |= ret | ATTR_FORCE;
6262

63-
inode_lock(dentry->d_inode);
63+
ret = inode_lock_killable(dentry->d_inode);
64+
if (ret)
65+
return ret;
66+
6467
/* Note any delegations or leases have already been broken: */
6568
ret = notify_change(idmap, dentry, &newattrs, NULL);
6669
inode_unlock(dentry->d_inode);

0 commit comments

Comments
 (0)