os/filestore: fix omap fsid fd leak during mount()

Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
This commit is contained in:
xie xingguo 2016-05-19 20:48:06 +08:00
parent b0b8c2a8dc
commit a58c288b8d

View 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;
}
}