From: xie xingguo Date: Thu, 19 May 2016 12:48:06 +0000 (+0800) Subject: os/filestore: fix omap fsid fd leak during mount() X-Git-Tag: v11.0.0~410^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a58c288b8d4cd59d12567d45cff53ec76ebc115b;p=ceph.git os/filestore: fix omap fsid fd leak during mount() Signed-off-by: xie xingguo --- diff --git a/src/os/filestore/FileStore.cc b/src/os/filestore/FileStore.cc index 39e58021c135..78dab861a351 100644 --- a/src/os/filestore/FileStore.cc +++ b/src/os/filestore/FileStore.cc @@ -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; } }