| 11097 | } |
| 11098 | |
| 11099 | int Client::_renew_caps(Inode *in) |
| 11100 | { |
| 11101 | int wanted = in->caps_file_wanted(); |
| 11102 | if (in->is_any_caps() && |
| 11103 | ((wanted & CEPH_CAP_ANY_WR) == 0 || in->auth_cap)) { |
| 11104 | check_caps(in, CHECK_CAPS_NODELAY); |
| 11105 | return 0; |
| 11106 | } |
| 11107 | |
| 11108 | int flags = 0; |
| 11109 | if ((wanted & CEPH_CAP_FILE_RD) && (wanted & CEPH_CAP_FILE_WR)) |
| 11110 | flags = O_RDWR; |
| 11111 | else if (wanted & CEPH_CAP_FILE_RD) |
| 11112 | flags = O_RDONLY; |
| 11113 | else if (wanted & CEPH_CAP_FILE_WR) |
| 11114 | flags = O_WRONLY; |
| 11115 | |
| 11116 | MetaRequest *req = new MetaRequest(CEPH_MDS_OP_OPEN); |
| 11117 | filepath path; |
| 11118 | in->make_nosnap_relative_path(path); |
| 11119 | req->set_filepath(path); // why not filepath(ino=in->ino) FIXME ?? |
| 11120 | req->head.args.open.flags = flags; |
| 11121 | req->head.args.open.pool = -1; |
| 11122 | if (cct->_conf->client_debug_getattr_caps) |
| 11123 | req->head.args.open.mask = DEBUG_GETATTR_CAPS; |
| 11124 | else |
| 11125 | req->head.args.open.mask = 0; |
| 11126 | req->set_inode(in); |
| 11127 | |
| 11128 | // duplicate in case Cap goes away; not sure if that race is a concern? |
| 11129 | const UserPerm *pperm = in->get_best_perms(); |
| 11130 | UserPerm perms; |
| 11131 | if (pperm != NULL) |
| 11132 | perms = *pperm; |
| 11133 | int ret = make_request(req, perms); |
| 11134 | return ret; |
| 11135 | } |
| 11136 | |
| 11137 | int Client::_close(int fd) |
| 11138 | { |
nothing calls this directly
no test coverage detected