Skip to content
Commit b0d5d10f authored by Chris Mason's avatar Chris Mason
Browse files

Btrfs: use insert_inode_locked4 for inode creation



Btrfs was inserting inodes into the hash table before we had fully
set the inode up on disk.  This leaves us open to rare races that allow
two different inodes in memory for the same [root, inode] pair.

This patch fixes things by using insert_inode_locked4 to insert an I_NEW
inode and unlock_new_inode when we're ready for the rest of the kernel
to use the inode.

It also makes sure to init the operations pointers on the inode before
going into the error handling paths.

Signed-off-by: default avatarChris Mason <clm@fb.com>
Reported-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 49dae1bc
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment