linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Max Kellermann <max.kellermann@ionos.com>
To: viro@zeniv.linux.org.uk, brauner@kernel.org, jack@suse.cz,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Max Kellermann <max.kellermann@ionos.com>
Subject: [PATCH v2 3/4] fs/open: make do_truncate() killable
Date: Tue, 13 May 2025 17:03:26 +0200	[thread overview]
Message-ID: <20250513150327.1373061-3-max.kellermann@ionos.com> (raw)
In-Reply-To: <20250513150327.1373061-1-max.kellermann@ionos.com>

Allows killing processes that are waiting for the inode lock.

Signed-off-by: Max Kellermann <max.kellermann@ionos.com>
---
v2: split into separate patches

Review here (though nothing about do_truncate()):
 https://lore.kernel.org/linux-fsdevel/20250512-unrat-kapital-2122d3777c5d@brauner/

Signed-off-by: Max Kellermann <max.kellermann@ionos.com>
---
 fs/open.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/fs/open.c b/fs/open.c
index d2f2df52c458..7828234a7caa 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -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);
-- 
2.47.2


  parent reply	other threads:[~2025-05-13 15:03 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-13 15:03 [PATCH v2 1/4] include/linux/fs.h: add inode_lock_killable() Max Kellermann
2025-05-13 15:03 ` [PATCH v2 2/4] fs/open: make chmod_common() and chown_common() killable Max Kellermann
2025-05-15 11:28   ` Jan Kara
2025-05-13 15:03 ` Max Kellermann [this message]
2025-05-15 11:30   ` [PATCH v2 3/4] fs/open: make do_truncate() killable Jan Kara
2025-05-13 15:03 ` [PATCH v2 4/4] fs/read_write: make default_llseek() killable Max Kellermann
2025-05-15 11:47   ` Jan Kara
2025-05-15 10:04 ` [PATCH v2 1/4] include/linux/fs.h: add inode_lock_killable() Christian Brauner
2025-05-15 11:28 ` Jan Kara

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250513150327.1373061-3-max.kellermann@ionos.com \
    --to=max.kellermann@ionos.com \
    --cc=brauner@kernel.org \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).