As Zheng points out, declaring an InodeRef before you take the mutex
means that its destructor gets called after the mutex has already been
released. Handling the refcount however, requires that you hold the
mutex so this could cause refcount leaks if two threads do a
load/decrement/store at the same time. Reverse the order.
Adding a fixes line here for the currently reported bug, but it's
not yet clear whether this will fix it.
Fixes: http://tracker.ceph.com/issues/17982
Signed-off-by: Jeff Layton <jlayton@redhat.com>
int flags, struct stat *attr, Inode **outp, Fh **fhp,
const UserPerm& perms)
{
- InodeRef in;
Mutex::Locker lock(client_lock);
+ InodeRef in;
int r = _ll_create(parent, name, mode, flags, &in, CEPH_STAT_CAP_INODE_ALL,
fhp, perms);
const UserPerm& perms)
{
unsigned caps = statx_to_mask(lflags, want);
- InodeRef in;
Mutex::Locker lock(client_lock);
+ InodeRef in;
int r = _ll_create(parent, name, mode, oflags, &in, caps, fhp, perms);
if (r >= 0) {