| 8403 | } |
| 8404 | |
| 8405 | int 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 |
nothing calls this directly
no test coverage detected