eCryptfs: Fix new inode race condition
Only unlock and d_add() new inodes after the plaintext inode size has been read from the lower filesystem. This fixes a race condition that was sometimes seen during a multi-job kernel build in an eCryptfs mount. https://bugzilla.kernel.org/show_bug.cgi?id=36002 Signed-off-by: Tyler Hicks <tyhicks@linux.vnet.ibm.com> Reported-by: David <david@unsolicited.net> Tested-by: David <david@unsolicited.net>
This commit is contained in:
@@ -135,12 +135,12 @@ static int ecryptfs_init_lower_file(struct dentry *dentry,
|
||||
return rc;
|
||||
}
|
||||
|
||||
int ecryptfs_get_lower_file(struct dentry *dentry)
|
||||
int ecryptfs_get_lower_file(struct dentry *dentry, struct inode *inode)
|
||||
{
|
||||
struct ecryptfs_inode_info *inode_info =
|
||||
ecryptfs_inode_to_private(dentry->d_inode);
|
||||
struct ecryptfs_inode_info *inode_info;
|
||||
int count, rc = 0;
|
||||
|
||||
inode_info = ecryptfs_inode_to_private(inode);
|
||||
mutex_lock(&inode_info->lower_file_mutex);
|
||||
count = atomic_inc_return(&inode_info->lower_file_count);
|
||||
if (WARN_ON_ONCE(count < 1))
|
||||
|
Reference in New Issue
Block a user