From 2eac778886c080c6d74868cd75fc20d4ef8c5b07 Mon Sep 17 00:00:00 2001 From: Rachita Kothiyal Date: Thu, 13 Mar 2008 23:36:31 -0400 Subject: [PATCH] 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 --- fs/unionfs/dentry.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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); -- 2.43.0