From: Rachita Kothiyal Date: Sun, 18 May 2008 07:28:34 +0000 (-0400) Subject: Unionfs ODF: Check UNIONFS_D before grabbing dentry lock X-Git-Url: https://git.fsl.cs.stonybrook.edu/?a=commitdiff_plain;h=2ceed14fabbfddac8fabd0a7baa0d90912088ba5;p=unionfs-odf.git Unionfs ODF: Check UNIONFS_D before grabbing dentry lock First check if the UNIONFS_D() is non NULL, and only then grab a lock on the dentry. Since trying to grab a lock, which is a member of UNIONFS_D(), doesn't make sense if it is itself NULL Signed-off-by: Rachita Kothiyal --- diff --git a/fs/unionfs/dentry.c b/fs/unionfs/dentry.c index 3faae792cb..d034708880 100644 --- a/fs/unionfs/dentry.c +++ b/fs/unionfs/dentry.c @@ -499,16 +499,14 @@ static void unionfs_d_release(struct dentry *dentry) { int bindex, bstart, bend; + /* this could be a negative dentry, so check first */ + if (unlikely(!UNIONFS_D(dentry) || dbstart(dentry) < 0)) + goto out; /* due to a (normal) failed lookup */ + unionfs_read_lock(dentry->d_sb, UNIONFS_SMUTEX_CHILD); /* must lock our branch configuration here */ unionfs_lock_dentry(dentry, UNIONFS_DMUTEX_CHILD); - /* 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 */ @@ -529,9 +527,10 @@ static void unionfs_d_release(struct dentry *dentry) unionfs_unlock_dentry(dentry); + + unionfs_read_unlock(dentry->d_sb); out: free_dentry_private_data(dentry); - unionfs_read_unlock(dentry->d_sb); return; }