]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
uclient: Fixes refcounting bug when you chdir to cwd.
authorGreg Farnum <gregf@hq.newdream.net>
Thu, 30 Jul 2009 19:18:15 +0000 (12:18 -0700)
committerGreg Farnum <gregf@hq.newdream.net>
Thu, 30 Jul 2009 21:40:10 +0000 (14:40 -0700)
src/client/Client.cc

index 6b9d5b9d0c597cb510ef58003879229a3deb9287..7fd4ca17e941962d1c07c5ca01b3653518bf9108 100644 (file)
@@ -4229,10 +4229,11 @@ int Client::chdir(const char *relpath)
   int r = path_walk(path, &in);
   if (r < 0)
     return r;
-  if (cwd && cwd != in)
+  if (cwd != in) {
+    in->get();
     put_inode(cwd);
-  cwd = in;
-  in->get();
+    cwd = in;
+  }
   dout(3) << "chdir(" << relpath << ")  cwd now " << cwd->ino << dendl;
   return 0;
 }