]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/filestore: fix omap fsid fd leak during mount()
authorxie xingguo <xie.xingguo@zte.com.cn>
Thu, 19 May 2016 12:48:06 +0000 (20:48 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Thu, 19 May 2016 13:19:08 +0000 (21:19 +0800)
Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
src/os/filestore/FileStore.cc

index 39e58021c13500e8ce28aaf2316ba903b0a16d0a..78dab861a351c1792caeb9aa520d30c151d27144 100644 (file)
@@ -1585,15 +1585,17 @@ int FileStore::mount()
         goto close_current_fd;
     }
     ret = read_fsid(omap_fsid_fd, &omap_fsid);
+    VOID_TEMP_FAILURE_RETRY(::close(omap_fsid_fd));
+    omap_fsid_fd = -1; // defensive 
     if (ret < 0) {
       derr << "FileStore::mount: error reading omap_fsid_fd" << ", omap_fsid = " << omap_fsid
       << cpp_strerror(ret) << dendl;
-      goto close_fsid_fd;
+      goto close_current_fd;
     }
     if (fsid != omap_fsid) {
       derr << "FileStore::mount: " << omap_fsid_buf << " has existed omap fsid " << omap_fsid << " != expected osd fsid " << fsid << dendl;
       ret = -EINVAL;
-      goto close_fsid_fd;
+      goto close_current_fd;
     }
   }