Skip to content

Commit d8c5507

Browse files
MaxKellermannbrauner
authored andcommitted
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 <[email protected]> Link: https://lore.kernel.org/[email protected] Signed-off-by: Christian Brauner <[email protected]>
1 parent e0410e9 commit d8c5507

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

include/linux/fs.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -867,6 +867,11 @@ static inline void inode_lock(struct inode *inode)
867867
down_write(&inode->i_rwsem);
868868
}
869869

870+
static inline __must_check int inode_lock_killable(struct inode *inode)
871+
{
872+
return down_write_killable(&inode->i_rwsem);
873+
}
874+
870875
static inline void inode_unlock(struct inode *inode)
871876
{
872877
up_write(&inode->i_rwsem);
@@ -877,6 +882,11 @@ static inline void inode_lock_shared(struct inode *inode)
877882
down_read(&inode->i_rwsem);
878883
}
879884

885+
static inline __must_check int inode_lock_shared_killable(struct inode *inode)
886+
{
887+
return down_read_killable(&inode->i_rwsem);
888+
}
889+
880890
static inline void inode_unlock_shared(struct inode *inode)
881891
{
882892
up_read(&inode->i_rwsem);

0 commit comments

Comments
 (0)