echo "Unknown parameter $1"
exit 1
;;
-esac
\ No newline at end of file
+esac
(new_issued & (CEPH_CAP_ANY_FILE_RD | CEPH_CAP_ANY_FILE_WR))) {
in->layout = st->layout;
uint64_t size = st->size;
- if (in->fscrypt_ctx) {
+ if (in->fscrypt_auth.size()) {
if (st->fscrypt_file.size() >= sizeof(uint64_t)) {
size = *(ceph_le64 *)st->fscrypt_file.data();
}
if (mask & CEPH_SETATTR_SIZE) {
auto stx_size = stx->stx_size;
+ if (paux && !(mask & CEPH_SETATTR_FSCRYPT_FILE)) {
+ mask |= CEPH_SETATTR_FSCRYPT_FILE;
+ }
+
if (in->fscrypt_ctx &&
- (!(mask & CEPH_SETATTR_FSCRYPT_FILE))) {
+ (!(mask & CEPH_SETATTR_FSCRYPT_FILE))) {
ldout(cct,10) << "fscrypt: set file size: orig stx_size=" << stx->stx_size <<" new stx_size=" << stx_size << dendl;
alt_aux.resize(sizeof(stx->stx_size));
struct ceph_statx stx = { 0 };
std::vector<uint8_t> aux;
- aux.resize(size);
+ aux.resize(sizeof(uint64_t));
memcpy(aux.data(), val, size);
- return _do_setattr(in, &stx, CEPH_SETATTR_FSCRYPT_FILE, perms, nullptr, &aux);
+ return _do_setattr(in, &stx, CEPH_SETATTR_SIZE, perms, nullptr, &aux);
}
bool Client::_vxattrcb_quota_exists(Inode *in)
int fd = ceph_open(cmount, test_xattr_file, O_RDWR|O_CREAT, 0666);
ASSERT_GT(fd, 0);
+ uint64_t size = 64;
ASSERT_EQ(0, ceph_fsetxattr(cmount, fd, "ceph.fscrypt.auth", "foo", 3, CEPH_XATTR_CREATE));
- ASSERT_EQ(0, ceph_fsetxattr(cmount, fd, "ceph.fscrypt.file", "foo", 3, CEPH_XATTR_CREATE));
+ ASSERT_EQ(0, ceph_fsetxattr(cmount, fd, "ceph.fscrypt.file", &size, sizeof(size), CEPH_XATTR_CREATE));
char buf[64];
ASSERT_EQ(3, ceph_fgetxattr(cmount, fd, "ceph.fscrypt.auth", buf, sizeof(buf)));
- ASSERT_EQ(3, ceph_fgetxattr(cmount, fd, "ceph.fscrypt.file", buf, sizeof(buf)));
+ ASSERT_EQ(sizeof(size), ceph_fgetxattr(cmount, fd, "ceph.fscrypt.file", buf, sizeof(buf)));
ASSERT_EQ(0, ceph_close(cmount, fd));
ASSERT_EQ(0, ceph_unmount(cmount));
fd = ceph_open(cmount, test_xattr_file, O_RDWR, 0666);
ASSERT_GT(fd, 0);
ASSERT_EQ(3, ceph_fgetxattr(cmount, fd, "ceph.fscrypt.auth", buf, sizeof(buf)));
- ASSERT_EQ(3, ceph_fgetxattr(cmount, fd, "ceph.fscrypt.file", buf, sizeof(buf)));
+ ASSERT_EQ(sizeof(size), ceph_fgetxattr(cmount, fd, "ceph.fscrypt.file", buf, sizeof(buf)));
ASSERT_EQ(0, ceph_close(cmount, fd));
ASSERT_EQ(0, ceph_unmount(cmount));
int fd = ceph_open(cmount, test_xattr_file, O_RDWR|O_CREAT, 0666);
ASSERT_GT(fd, 0);
+ uint64_t size = 64;
ASSERT_EQ(0, ceph_fsetxattr(cmount, fd, "ceph.fscrypt.auth", "foo", 3, XATTR_CREATE));
- ASSERT_EQ(0, ceph_fsetxattr(cmount, fd, "ceph.fscrypt.file", "foo", 3, XATTR_CREATE));
+ ASSERT_EQ(0, ceph_fsetxattr(cmount, fd, "ceph.fscrypt.file", &size, sizeof(size), XATTR_CREATE));
char buf[64];
ASSERT_EQ(3, ceph_fgetxattr(cmount, fd, "ceph.fscrypt.auth", buf, sizeof(buf)));
- ASSERT_EQ(3, ceph_fgetxattr(cmount, fd, "ceph.fscrypt.file", buf, sizeof(buf)));
+ ASSERT_EQ(sizeof(size), ceph_fgetxattr(cmount, fd, "ceph.fscrypt.file", buf, sizeof(buf)));
ASSERT_EQ(0, ceph_close(cmount, fd));
ASSERT_EQ(0, ceph_unmount(cmount));
fd = ceph_open(cmount, test_xattr_file, O_RDWR, 0666);
ASSERT_GT(fd, 0);
ASSERT_EQ(3, ceph_fgetxattr(cmount, fd, "ceph.fscrypt.auth", buf, sizeof(buf)));
- ASSERT_EQ(3, ceph_fgetxattr(cmount, fd, "ceph.fscrypt.file", buf, sizeof(buf)));
+ ASSERT_EQ(sizeof(size), ceph_fgetxattr(cmount, fd, "ceph.fscrypt.file", buf, sizeof(buf)));
ASSERT_EQ(0, ceph_close(cmount, fd));
ASSERT_EQ(0, ceph_unmount(cmount));