Skip to content

Commit

Permalink
ceph: fix rare potential cap leak
Browse files Browse the repository at this point in the history
If we grab new_cap, retake the lock, and find we already have a cap now
for the given mds, release new_cap.

Signed-off-by: Sage Weil <sage@newdream.net>
  • Loading branch information
Sage Weil committed May 19, 2011
1 parent 12a2f64 commit 3540303
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fs/ceph/caps.c
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,8 @@ int ceph_add_cap(struct inode *inode,
list_add_tail(&cap->session_caps, &session->s_caps);
session->s_nr_caps++;
spin_unlock(&session->s_cap_lock);
}
} else if (new_cap)
ceph_put_cap(mdsc, new_cap);

if (!ci->i_snap_realm) {
/*
Expand Down

0 comments on commit 3540303

Please sign in to comment.