return lfn_open(cid, oid, flags, 0);
}
+void FileStore::lfn_close(int fd)
+{
+ TEMP_FAILURE_RETRY(::close(fd));
+}
+
int FileStore::lfn_link(coll_t c, coll_t cid, const hobject_t& o)
{
Index index_new, index_old;
return 1; // if file does not exist, there is no guard, and we can replay.
}
int ret = _check_replay_guard(fd, spos);
- TEMP_FAILURE_RETRY(::close(fd));
+ lfn_close(fd);
return ret;
}
got = safe_pread(fd, bptr.c_str(), len, offset);
if (got < 0) {
dout(10) << "FileStore::read(" << cid << "/" << oid << ") pread error: " << cpp_strerror(got) << dendl;
- TEMP_FAILURE_RETRY(::close(fd));
+ lfn_close(fd);
assert(!m_filestore_fail_eio || got != -EIO);
return got;
}
bptr.set_length(got); // properly size the buffer
bl.push_back(bptr); // put it in the target bufferlist
- TEMP_FAILURE_RETRY(::close(fd));
+ lfn_close(fd);
dout(10) << "FileStore::read " << cid << "/" << oid << " " << offset << "~"
<< got << "/" << len << dendl;
done:
if (fd >= 0)
- TEMP_FAILURE_RETRY(::close(fd));
+ lfn_close(fd);
if (r >= 0)
::encode(exomap, bl);
int fd = lfn_open(cid, oid, flags, 0644);
int r;
if (fd >= 0) {
- TEMP_FAILURE_RETRY(::close(fd));
+ lfn_close(fd);
r = 0;
} else
r = fd;
if (actual < 0) {
r = -errno;
dout(0) << "write lseek64 to " << offset << " failed: " << cpp_strerror(r) << dendl;
- TEMP_FAILURE_RETRY(::close(fd));
+ lfn_close(fd);
goto out;
}
if (actual != (int64_t)offset) {
dout(0) << "write lseek64 to " << offset << " gave bad offset " << actual << dendl;
r = -EIO;
- TEMP_FAILURE_RETRY(::close(fd));
+ lfn_close(fd);
goto out;
}
) {
if (m_filestore_sync_flush)
::sync_file_range(fd, offset, len, SYNC_FILE_RANGE_WRITE);
- TEMP_FAILURE_RETRY(::close(fd));
+ lfn_close(fd);
}
out:
ret = fallocate(fd, FALLOC_FL_PUNCH_HOLE, offset, len);
if (ret < 0)
ret = -errno;
- TEMP_FAILURE_RETRY(::close(fd));
+ lfn_close(fd);
if (ret == 0)
goto out; // yay!
_set_replay_guard(n, spos, &newoid);
out3:
- TEMP_FAILURE_RETRY(::close(n));
+ lfn_close(n);
out:
- TEMP_FAILURE_RETRY(::close(o));
+ lfn_close(o);
out2:
dout(10) << "clone " << cid << "/" << oldoid << " -> " << cid << "/" << newoid << " = " << r << dendl;
assert(!m_filestore_fail_eio || r != -EIO);
// clone is non-idempotent; record our work.
_set_replay_guard(n, spos, &newoid);
- TEMP_FAILURE_RETRY(::close(n));
+ lfn_close(n);
out:
- TEMP_FAILURE_RETRY(::close(o));
+ lfn_close(o);
out2:
dout(10) << "clone_range " << cid << "/" << oldoid << " -> " << cid << "/" << newoid << " "
<< srcoff << "~" << len << " to " << dstoff << " = " << r << dendl;
char n[CHAIN_XATTR_MAX_NAME_LEN];
get_attrname(name, n, CHAIN_XATTR_MAX_NAME_LEN);
r = _fgetattr(fd, n, bp);
- TEMP_FAILURE_RETRY(::close(fd));
+ lfn_close(fd);
if (r == -ENODATA && g_conf->filestore_xattr_use_omap) {
map<string, bufferlist> got;
set<string> to_get;
goto out;
}
r = _fgetattrs(fd, aset, user_only);
- TEMP_FAILURE_RETRY(::close(fd));
+ lfn_close(fd);
if (g_conf->filestore_xattr_use_omap) {
set<string> omap_attrs;
map<string, bufferlist> omap_aset;
return r;
}
}
- TEMP_FAILURE_RETRY(::close(fd));
+ lfn_close(fd);
out:
dout(10) << "setattrs " << cid << "/" << oid << " = " << r << dendl;
return r;
return r;
}
}
- TEMP_FAILURE_RETRY(::close(fd));
+ lfn_close(fd);
out:
dout(10) << "rmattr " << cid << "/" << oid << " '" << name << "' = " << r << dendl;
return r;
break;
}
}
- TEMP_FAILURE_RETRY(::close(fd));
+ lfn_close(fd);
if (g_conf->filestore_xattr_use_omap) {
set<string> omap_attrs;
if (r == 0) {
_close_replay_guard(fd, spos);
}
- TEMP_FAILURE_RETRY(::close(fd));
+ lfn_close(fd);
dout(10) << "collection_add " << c << "/" << o << " from " << oldcid << "/" << o << " = " << r << dendl;
return r;