Skip to content

Commit

Permalink
ceph: fix memory leak due to possible dentry init race
Browse files Browse the repository at this point in the history
Free dentry_info in error path.

Signed-off-by: Sage Weil <sage@newdream.net>
  • Loading branch information
Sage Weil committed May 17, 2010
1 parent 559c1e0 commit 8c6efb5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion fs/ceph/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,11 @@ int ceph_init_dentry(struct dentry *dentry)
return -ENOMEM; /* oh well */

spin_lock(&dentry->d_lock);
if (dentry->d_fsdata) /* lost a race */
if (dentry->d_fsdata) {
/* lost a race */
kmem_cache_free(ceph_dentry_cachep, di);
goto out_unlock;
}
di->dentry = dentry;
di->lease_session = NULL;
dentry->d_fsdata = di;
Expand Down

0 comments on commit 8c6efb5

Please sign in to comment.