--- a/fs/inode.c +++ b/fs/inode.c @@ -2518,14 +2518,18 @@ static void __wait_on_freeing_inode(struct inode *inode, bool is_inode_hash_lock wq_head = inode_bit_waitqueue(&wqe, inode, __I_NEW); prepare_to_wait_event(wq_head, &wqe.wq_entry, TASK_UNINTERRUPTIBLE); spin_unlock(&inode->i_lock); - rcu_read_unlock(); + if (rcu_read_lock_any_held()) + rcu_read_unlock(); + if (is_inode_hash_locked) spin_unlock(&inode_hash_lock); schedule(); finish_wait(wq_head, &wqe.wq_entry); if (is_inode_hash_locked) spin_lock(&inode_hash_lock); - rcu_read_lock(); + + if (rcu_read_lock_any_held()) + rcu_read_lock(); } static __initdata unsigned long ihash_entries;