[lkml]   [2020]   [May]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH] fs: Add an explicit might_sleep() to iput
From: KP Singh <>

It is currently mentioned in the comments to the function that iput
might sleep when the inode is destroyed. Have it call might_sleep, as
dput already does.

Adding an explicity might_sleep() would help in quickly realizing that
iput is called from a place where sleeping is not allowed when
CONFIG_DEBUG_ATOMIC_SLEEP is enabled as noticed in the dicussion:

Signed-off-by: KP Singh <>
Reviewed-by: Brendan Jackman <>
fs/inode.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/fs/inode.c b/fs/inode.c
index cc6e701b7e5d..f55e72e76266 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -1583,6 +1583,7 @@ static void iput_final(struct inode *inode)
void iput(struct inode *inode)
+ might_sleep();
if (!inode)
BUG_ON(inode->i_state & I_CLEAR);
 \ /
  Last update: 2020-05-27 16:18    [W:0.141 / U:16.472 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site