From a58c288b8d4cd59d12567d45cff53ec76ebc115b Mon Sep 17 00:00:00 2001 From: xie xingguo Date: Thu, 19 May 2016 20:48:06 +0800 Subject: [PATCH] os/filestore: fix omap fsid fd leak during mount() Signed-off-by: xie xingguo --- src/os/filestore/FileStore.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/os/filestore/FileStore.cc b/src/os/filestore/FileStore.cc index 39e58021c13..78dab861a35 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; } }