When we are at the point of releasing a unionfs dentry, check the sanity of
the dentry after we have established that UNIONFS_D() is not NULL. This
solves a potential race between two threads trying to release the same
dentry.
Signed-off-by: Rachita Kothiyal <rachita@fsl.cs.sunysb.edu>
/* must lock our branch configuration here */
unionfs_lock_dentry(dentry, UNIONFS_DMUTEX_CHILD);
- unionfs_check_dentry(dentry);
/* this could be a negative dentry, so check first */
if (unlikely(!UNIONFS_D(dentry) || dbstart(dentry) < 0)) {
unionfs_unlock_dentry(dentry);
goto out; /* due to a (normal) failed lookup */
}
+ unionfs_check_dentry(dentry);
+
/* Release all the lower dentries */
bstart = dbstart(dentry);
bend = dbend(dentry);