diff options
author | 2025-05-13 17:03:24 +0200 | |
---|---|---|
committer | 2025-05-15 12:03:11 +0200 | |
commit | d8c5507cd140d9471472ece673e70250b957c595 (patch) | |
tree | d921ee258e50c9ce76ea55aa9b89e2d7ecbdbbfa | |
parent | readdir: supply dir_context.count as readdir buffer size hint (diff) | |
download | wireguard-linux-d8c5507cd140d9471472ece673e70250b957c595.tar.xz wireguard-linux-d8c5507cd140d9471472ece673e70250b957c595.zip |
include/linux/fs.h: add inode_lock_killable()
Prepare for making inode operations killable while they're waiting for
the lock.
Signed-off-by: Max Kellermann <max.kellermann@ionos.com>
Link: https://lore.kernel.org/20250513150327.1373061-1-max.kellermann@ionos.com
Signed-off-by: Christian Brauner <brauner@kernel.org>
-rw-r--r-- | include/linux/fs.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h index ddd54a664916..82c6093b8582 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); |