]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
FlatIndex: lfn_get needs to set *exist for short filenames
authorSamuel Just <samuel.just@dreamhost.com>
Wed, 31 Aug 2011 21:47:18 +0000 (14:47 -0700)
committerSamuel Just <samuel.just@dreamhost.com>
Wed, 31 Aug 2011 21:59:07 +0000 (14:59 -0700)
Signed-off-by: Samuel Just <samuel.just@dreamhost.com>
src/os/FlatIndex.cc

index 10dd48f1e587ae16d896f9809c82b1aba381e621..f3b0cb3d2a57e576821aab8c603f71594f620354 100644 (file)
@@ -220,6 +220,18 @@ static int lfn_get(const char *coll_path, const hobject_t& oid, char *pathname,
     /* not a long file name, just build it as it is */
     strncpy(filename, lfn, len - path_len);
     *is_lfn = 0;
+    struct stat buf;
+    int r = ::stat(pathname, &buf);
+    if (r < 0) {
+      if (errno == ENOENT) {
+       *exist = 0;
+      } else {
+       return -errno;
+      }
+    } else {
+      *exist = 1;
+    }
+
     return 0;
   }
 
@@ -290,7 +302,6 @@ int FlatIndex::unlink(const hobject_t &o) {
   if (!is_lfn) {
     r = ::unlink(short_fn);
     if (r < 0) {
-      cerr << "failed to unlink: " << short_fn << std::endl;
       return -errno;
     }
     return 0;