* [PATCH] vfs: potential deadlock in insert_inode_locked()
@ 2018-08-03 19:31 ` Dan Carpenter
0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2018-08-03 19:31 UTC (permalink / raw)
To: Alexander Viro; +Cc: linux-fsdevel, kernel-janitors
We added a new error path to insert_inode_locked() but we need to drop
the inode_hash_lock spin_lock before we return.
Fixes: 397127e49ff5 ("new primitive: discard_new_inode()")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/fs/inode.c b/fs/inode.c
index 593d0cfce27c..ed7c18495cd9 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -1462,6 +1462,7 @@ int insert_inode_locked(struct inode *inode)
}
if (unlikely(old->i_state & I_CREATING)) {
spin_unlock(&old->i_lock);
+ spin_unlock(&inode_hash_lock);
return -EBUSY;
}
__iget(old);
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] vfs: potential deadlock in insert_inode_locked()
@ 2018-08-03 19:31 ` Dan Carpenter
0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2018-08-03 19:31 UTC (permalink / raw)
To: Alexander Viro; +Cc: linux-fsdevel, kernel-janitors
We added a new error path to insert_inode_locked() but we need to drop
the inode_hash_lock spin_lock before we return.
Fixes: 397127e49ff5 ("new primitive: discard_new_inode()")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/fs/inode.c b/fs/inode.c
index 593d0cfce27c..ed7c18495cd9 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -1462,6 +1462,7 @@ int insert_inode_locked(struct inode *inode)
}
if (unlikely(old->i_state & I_CREATING)) {
spin_unlock(&old->i_lock);
+ spin_unlock(&inode_hash_lock);
return -EBUSY;
}
__iget(old);
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] vfs: potential deadlock in insert_inode_locked()
2018-08-03 19:31 ` Dan Carpenter
@ 2018-08-03 20:05 ` Al Viro
-1 siblings, 0 replies; 4+ messages in thread
From: Al Viro @ 2018-08-03 20:05 UTC (permalink / raw)
To: Dan Carpenter; +Cc: linux-fsdevel, kernel-janitors
On Fri, Aug 03, 2018 at 10:31:01PM +0300, Dan Carpenter wrote:
> We added a new error path to insert_inode_locked() but we need to drop
> the inode_hash_lock spin_lock before we return.
Folded, with credits.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-08-03 22:03 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-03 19:31 [PATCH] vfs: potential deadlock in insert_inode_locked() Dan Carpenter
2018-08-03 19:31 ` Dan Carpenter
2018-08-03 20:05 ` Al Viro
2018-08-03 20:05 ` Al Viro
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.