goto done;
}
+ // get fsid
+ snprintf(buf, sizeof(buf), "%s/fsid", basedir.c_str());
+ fsid_fd = ::open(buf, O_RDWR, 0644);
+ if (fsid_fd < 0) {
+ ret = -errno;
+ derr << "FileStore::mount: error opening '" << buf << "': "
+ << cpp_strerror(ret) << dendl;
+ goto done;
+ }
+
+ ret = read_fsid(fsid_fd);
+ if (ret < 0) {
+ derr << "FileStore::mount: error reading fsid_fd: " << cpp_strerror(ret)
+ << dendl;
+ goto close_fsid_fd;
+ }
+
+ if (lock_fsid() < 0) {
+ derr << "FileStore::mount: lock_fsid failed" << dendl;
+ ret = -EBUSY;
+ goto close_fsid_fd;
+ }
+
+ dout(10) << "mount fsid is " << fsid << dendl;
+
// test for btrfs, xattrs, etc.
ret = _detect_fs();
if (ret)
- goto done;
+ goto close_fsid_fd;
uint32_t version_stamp;
ret = version_stamp_is_valid(&version_stamp);
if (ret < 0) {
derr << "FileStore::mount : error in version_stamp_is_valid: "
<< cpp_strerror(ret) << dendl;
- goto done;
+ goto close_fsid_fd;
} else if (ret == 0) {
if (m_filestore_update_collections) {
derr << "FileStore::mount : stale version stamp detected: "
<< ". Please run the FileStore update script before starting the "
<< "OSD."
<< dendl;
- goto done;
+ goto close_fsid_fd;
}
}
- // get fsid
- snprintf(buf, sizeof(buf), "%s/fsid", basedir.c_str());
- fsid_fd = ::open(buf, O_RDWR, 0644);
- if (fsid_fd < 0) {
- ret = -errno;
- derr << "FileStore::mount: error opening '" << buf << "': "
- << cpp_strerror(ret) << dendl;
- goto done;
- }
-
- ret = read_fsid(fsid_fd);
- if (ret < 0) {
- derr << "FileStore::mount: error reading fsid_fd: " << cpp_strerror(ret)
- << dendl;
- goto close_fsid_fd;
- }
-
- if (lock_fsid() < 0) {
- derr << "FileStore::mount: lock_fsid failed" << dendl;
- ret = -EBUSY;
- goto close_fsid_fd;
- }
-
- dout(10) << "mount fsid is " << fsid << dendl;
-
// open some dir handles
basedir_fd = ::open(basedir.c_str(), O_RDONLY);
if (basedir_fd < 0) {