MCPcopy Create free account
hub / github.com/ceph/ceph / _do_setattr

Method _do_setattr

src/client/Client.cc:8405–8830  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8403}
8404
8405int Client::_do_setattr(Inode *in, struct ceph_statx *stx, int mask,
8406 const UserPerm& perms, InodeRef *inp,
8407 std::vector<uint8_t>* aux)
8408{
8409 int issued = in->caps_issued();
8410 union ceph_mds_request_args args;
8411 bool kill_sguid = false;
8412 int inode_drop = 0;
8413 size_t auxsize = 0;
8414 filepath path;
8415 MetaRequest *req;
8416 std::vector<uint8_t> alt_aux;
8417 std::vector<uint8_t> *paux = aux;
8418 int setting_smaller = 0;
8419 bufferlist lastblockbl;
8420
8421 if (aux)
8422 auxsize = aux->size();
8423
8424 ldout(cct, 10) << __func__ << " mask " << mask << " issued " <<
8425 ccap_string(issued) << " aux size " << auxsize << " perms " << perms << dendl;
8426
8427 if (in->snapid != CEPH_NOSNAP) {
8428 return -EROFS;
8429 }
8430 if ((mask & CEPH_SETATTR_SIZE) &&
8431 (uint64_t)stx->stx_size > in->effective_size() &&
8432 is_quota_bytes_exceeded(in, (uint64_t)stx->stx_size - in->effective_size(),
8433 perms)) {
8434 return -EDQUOT;
8435 }
8436
8437 // Can't set fscrypt_auth and file at the same time!
8438 if ((mask & (CEPH_SETATTR_FSCRYPT_AUTH|CEPH_SETATTR_FSCRYPT_FILE)) ==
8439 (CEPH_SETATTR_FSCRYPT_AUTH|CEPH_SETATTR_FSCRYPT_FILE))
8440 return -EINVAL;
8441
8442 if (!aux && (mask & (CEPH_SETATTR_FSCRYPT_AUTH|CEPH_SETATTR_FSCRYPT_FILE)))
8443 return -EINVAL;
8444
8445 memset(&args, 0, sizeof(args));
8446
8447 bool do_sync = true;
8448 int res;
8449 {
8450 std::string path;
8451 if (make_absolute_path_string(in, path)) {
8452 ldout(cct, 20) << " absolute path: " << path << dendl;
8453 res = mds_check_access(path, perms, MAY_WRITE);
8454 if (res) {
8455 goto out;
8456 }
8457 do_sync = false;
8458 }
8459 }
8460
8461 if (!mask) {
8462 // caller just needs us to bump the ctime

Callers

nothing calls this directly

Calls 15

ccap_stringFunction · 0.85
ceph_clock_nowFunction · 0.85
fscrypt_block_startFunction · 0.85
fscrypt_next_block_startFunction · 0.85
caps_issuedMethod · 0.80
mark_caps_dirtyMethod · 0.80
caps_issued_maskMethod · 0.80
init_fscrypt_ctxMethod · 0.80
get_max_filesizeMethod · 0.80
prepare_data_readMethod · 0.80
file_read_exMethod · 0.80
decrypt_blMethod · 0.80

Tested by

no test coverage detected