]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
fuse: fix for missing ll_ref on create
authorCasey Bodley <casey@linuxbox.com>
Fri, 7 Feb 2014 20:17:04 +0000 (15:17 -0500)
committerCasey Bodley <casey@linuxbox.com>
Fri, 7 Feb 2014 22:04:28 +0000 (17:04 -0500)
when the 'Inode **outp' argument was added to ll_create(), it was
changed to only take the ll_ref if outp was not NULL. fuse_ll_create()
was calling ll_create() with outp=NULL, and subsequently calling
fuse_reply_create() (which causes fuse to increment the lookup count)
without registering the initial ll_ref

this patch adds a dummy inode pointer i2 to the ll_create() call to
claim our initial reference

Signed-off-by: Casey Bodley <casey@linuxbox.com>
src/client/fuse_ll.cc

index 61b72d22252c0b46104db9c808199328448618fa..d9f6a8d5249a48d9e5400bc86f620bcc784fbba0 100644 (file)
@@ -596,13 +596,14 @@ static void fuse_ll_create(fuse_req_t req, fuse_ino_t parent, const char *name,
 {
   CephFuse::Handle *cfuse = (CephFuse::Handle *)fuse_req_userdata(req);
   const struct fuse_ctx *ctx = fuse_req_ctx(req);
-  Inode *i1 = cfuse->iget(parent);
+  Inode *i1 = cfuse->iget(parent), *i2;
   struct fuse_entry_param fe;
   Fh *fh = NULL;
 
   memset(&fe, 0, sizeof(fe));
 
-  int r = cfuse->client->ll_create(i1, name, mode, fi->flags, &fe.attr, NULL,
+  // pass &i2 for the created inode so that ll_create takes an initial ll_ref
+  int r = cfuse->client->ll_create(i1, name, mode, fi->flags, &fe.attr, &i2,
                                   &fh, ctx->uid, ctx->gid);
   if (r == 0) {
     fi->fh = (long)fh;