Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

client: don't take extra target inode reference in ll_link #11440

Merged
merged 1 commit into from Oct 17, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion src/client/Client.cc
Expand Up @@ -11441,7 +11441,6 @@ int Client::ll_link(Inode *in, Inode *newparent, const char *newname,
if (r == 0) {
assert(target);
fill_stat(target, attr);
_ll_get(target.get());
}
out:
return r;
Expand Down
9 changes: 8 additions & 1 deletion src/client/fuse_ll.cc
Expand Up @@ -522,9 +522,16 @@ static void fuse_ll_link(fuse_req_t req, fuse_ino_t ino, fuse_ino_t newparent,
fuse_reply_entry(req, &fe);
} else {
fuse_reply_err(req, -r);

/*
* Many ll operations in libcephfs return an extra inode reference, but
* ll_link currently does not. Still, FUSE needs one for the new dentry,
* so we commandeer the reference taken earlier when ll_link is successful.
* On error however, we must put that reference.
*/
cfuse->iput(in);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, let's add a comment about what's going on here: namely, that we are only putting the reference in the failure case because we otherwise need the reference for the new parent we created and already have in cache.

}

cfuse->iput(in); // iputs required
cfuse->iput(nin);
}

Expand Down