linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/4] include/linux/fs.h: add inode_lock_killable()
@ 2025-05-13 15:03 Max Kellermann
  2025-05-13 15:03 ` [PATCH v2 2/4] fs/open: make chmod_common() and chown_common() killable Max Kellermann
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Max Kellermann @ 2025-05-13 15:03 UTC (permalink / raw)
  To: viro, brauner, jack, linux-fsdevel, linux-kernel; +Cc: Max Kellermann

Prepare for making inode operations killable while they're waiting for
the lock.

Signed-off-by: Max Kellermann <max.kellermann@ionos.com>
---
 include/linux/fs.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/include/linux/fs.h b/include/linux/fs.h
index 016b0fe1536e..5e4ac873228d 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -867,6 +867,11 @@ static inline void inode_lock(struct inode *inode)
 	down_write(&inode->i_rwsem);
 }
 
+static inline __must_check int inode_lock_killable(struct inode *inode)
+{
+	return down_write_killable(&inode->i_rwsem);
+}
+
 static inline void inode_unlock(struct inode *inode)
 {
 	up_write(&inode->i_rwsem);
@@ -877,6 +882,11 @@ static inline void inode_lock_shared(struct inode *inode)
 	down_read(&inode->i_rwsem);
 }
 
+static inline __must_check int inode_lock_shared_killable(struct inode *inode)
+{
+	return down_read_killable(&inode->i_rwsem);
+}
+
 static inline void inode_unlock_shared(struct inode *inode)
 {
 	up_read(&inode->i_rwsem);
-- 
2.47.2


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2025-05-15 11:47 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [PATCH v2 3/4] fs/open: make do_truncate() killable Max Kellermann
2025-05-15 11:30   ` 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

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).