Commit 3540303f authored by Sage Weil's avatar Sage Weil

ceph: fix rare potential cap leak

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: default avatarSage Weil <sage@newdream.net>
parent 12a2f643
...@@ -569,7 +569,8 @@ int ceph_add_cap(struct inode *inode, ...@@ -569,7 +569,8 @@ int ceph_add_cap(struct inode *inode,
list_add_tail(&cap->session_caps, &session->s_caps); list_add_tail(&cap->session_caps, &session->s_caps);
session->s_nr_caps++; session->s_nr_caps++;
spin_unlock(&session->s_cap_lock); spin_unlock(&session->s_cap_lock);
} } else if (new_cap)
ceph_put_cap(mdsc, new_cap);
if (!ci->i_snap_realm) { if (!ci->i_snap_realm) {
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment