From: Rachita Kothiyal Date: Fri, 14 Mar 2008 03:36:31 +0000 (-0400) Subject: Unionfs: check UNIONFS_D() before unionfs_check_dentry during release X-Git-Url: https://git.fsl.cs.stonybrook.edu/?a=commitdiff_plain;h=2eac778886c080c6d74868cd75fc20d4ef8c5b07;p=unionfs-odf.git Unionfs: check UNIONFS_D() before unionfs_check_dentry during release 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 --- diff --git a/fs/unionfs/dentry.c b/fs/unionfs/dentry.c index 8f9ea7da63..3faae792cb 100644 --- a/fs/unionfs/dentry.c +++ b/fs/unionfs/dentry.c @@ -503,13 +503,14 @@ static void unionfs_d_release(struct dentry *dentry) /* 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);