goto fail;
}
r = chain_fsetxattr(fd, XATTR_SPILL_OUT_NAME,
- XATTR_NO_SPILL_OUT, sizeof(XATTR_NO_SPILL_OUT));
+ XATTR_NO_SPILL_OUT, sizeof(XATTR_NO_SPILL_OUT), true);
if (r < 0) {
VOID_TEMP_FAILURE_RETRY(::close(fd));
derr << "error setting spillout xattr for oid " << oid << " (" << (*path)->path()
// then record that we did it
bufferlist v;
::encode(spos, v);
- int r = chain_fsetxattr(fd, GLOBAL_REPLAY_GUARD_XATTR, v.c_str(), v.length());
+ int r = chain_fsetxattr(fd, GLOBAL_REPLAY_GUARD_XATTR, v.c_str(), v.length(), true);
if (r < 0) {
derr << __func__ << ": fsetxattr " << GLOBAL_REPLAY_GUARD_XATTR
<< " got " << cpp_strerror(r) << dendl;
bufferlist v(40);
::encode(spos, v);
::encode(in_progress, v);
- int r = chain_fsetxattr(fd, REPLAY_GUARD_XATTR, v.c_str(), v.length());
+ int r = chain_fsetxattr(fd, REPLAY_GUARD_XATTR, v.c_str(), v.length(), true);
if (r < 0) {
derr << "fsetxattr " << REPLAY_GUARD_XATTR << " got " << cpp_strerror(r) << dendl;
assert(0 == "fsetxattr failed");
::encode(spos, v);
bool in_progress = false;
::encode(in_progress, v);
- int r = chain_fsetxattr(fd, REPLAY_GUARD_XATTR, v.c_str(), v.length());
+ int r = chain_fsetxattr(fd, REPLAY_GUARD_XATTR, v.c_str(), v.length(), true);
if (r < 0) {
derr << "fsetxattr " << REPLAY_GUARD_XATTR << " got " << cpp_strerror(r) << dendl;
assert(0 == "fsetxattr failed");
r = chain_fgetxattr(**o, XATTR_SPILL_OUT_NAME, buf, sizeof(buf));
if (r >= 0 && !strncmp(buf, XATTR_NO_SPILL_OUT, sizeof(XATTR_NO_SPILL_OUT))) {
r = chain_fsetxattr(**n, XATTR_SPILL_OUT_NAME, XATTR_NO_SPILL_OUT,
- sizeof(XATTR_NO_SPILL_OUT));
+ sizeof(XATTR_NO_SPILL_OUT), true);
} else {
r = chain_fsetxattr(**n, XATTR_SPILL_OUT_NAME, XATTR_SPILL_OUT,
- sizeof(XATTR_SPILL_OUT));
+ sizeof(XATTR_SPILL_OUT), true);
}
if (r < 0)
goto out3;
return CHAIN_XATTR_MAX_BLOCK_LEN;
}
-int chain_setxattr(const char *fn, const char *name, const void *val, size_t size)
+int chain_setxattr(const char *fn, const char *name, const void *val, size_t size, bool onechunk)
{
int i = 0, pos = 0;
char raw_name[CHAIN_XATTR_MAX_NAME_LEN * 2 + 16];
i++;
} while (size);
- if (ret >= 0 ) {
+ if (ret >= 0 && !onechunk) {
int r;
do {
get_raw_xattr_name(name, i, raw_name, sizeof(raw_name));
return ret;
}
-int chain_fsetxattr(int fd, const char *name, const void *val, size_t size)
+int chain_fsetxattr(int fd, const char *name, const void *val, size_t size, bool onechunk)
{
int i = 0, pos = 0;
char raw_name[CHAIN_XATTR_MAX_NAME_LEN * 2 + 16];
i++;
} while (size);
- if (ret >= 0) {
+ if (ret >= 0 && !onechunk) {
int r;
do {
get_raw_xattr_name(name, i, raw_name, sizeof(raw_name));
int chain_getxattr(const char *fn, const char *name, void *val, size_t size);
int chain_fgetxattr(int fd, const char *name, void *val, size_t size);
-int chain_setxattr(const char *fn, const char *name, const void *val, size_t size);
-int chain_fsetxattr(int fd, const char *name, const void *val, size_t size);
+int chain_setxattr(const char *fn, const char *name, const void *val, size_t size, bool onechunk=false);
+int chain_fsetxattr(int fd, const char *name, const void *val, size_t size, bool onechunk=false);
int chain_listxattr(const char *fn, char *names, size_t len);
int chain_flistxattr(int fd, char *names, size_t len);
int chain_removexattr(const char *fn, const char *name);