/** * Routines that retrieve and/or set ACLs for PVFS2 files. */ static struct posix_acl * pvfs2_get_acl(struct inode *inode, int type) { struct posix_acl *acl; int ret; char *key = NULL, *value = NULL; /* Won't work if you don't mount with the right set of options */ if (get_acl_flag(inode) == 0) { gossip_debug(GOSSIP_ACL_DEBUG, "pvfs2_get_acl: ACL options disabled on " "this FS!\n"); return NULL; } switch (type) { case ACL_TYPE_ACCESS: key = PVFS2_XATTR_NAME_ACL_ACCESS; break; case ACL_TYPE_DEFAULT: key = PVFS2_XATTR_NAME_ACL_DEFAULT; break; default: gossip_err("pvfs2_get_acl: bogus value of type %d\n", type); return ERR_PTR(-EINVAL); } /* * Rather than incurring a network call just to determine the exact length of * the attribute, I just allocate a max length to save on the network call * Conceivably, we could pass NULL to pvfs2_inode_getxattr() to probe the length * of the value, but I don't do that for now. */ value = (char *) kmalloc(PVFS_MAX_XATTR_VALUELEN, GFP_KERNEL); if (value == NULL) { gossip_err("pvfs2_get_acl: Could not allocate value ptr\n"); return ERR_PTR(-ENOMEM); } gossip_debug(GOSSIP_ACL_DEBUG, "inode %llu, key %s, type %d\n", llu(get_handle_from_ino(inode)), key, type); ret = pvfs2_inode_getxattr(inode, "", key, value, PVFS_MAX_XATTR_VALUELEN); /* if the key exists, convert it to an in-memory rep */ if (ret > 0) { acl = pvfs2_acl_decode(value, ret); } else if (ret == -ENODATA || ret == -ENOSYS) { acl = NULL; } else { gossip_err("inode %llu retrieving acl's failed with error %d\n", llu(get_handle_from_ino(inode)), ret); acl = ERR_PTR(ret); } if (value) { kfree(value); } return acl; }
/* * get one attribute value. * * -EINVAL: invalid arg, ignore used_len * -ENOENT: error, attribute not found * OSD_ERROR: some other error * OSD_OK: success, used_outlen modified */ int attr_get_val(struct db_context *dbc, uint64_t pid, uint64_t oid, uint32_t page, uint32_t number, uint64_t outlen, void *outdata, uint32_t *used_outlen) { int ret = 0; sqlite3_stmt *stmt = NULL; assert(dbc && dbc->db && dbc->attr && dbc->attr->getval); repeat: ret = 0; stmt = dbc->attr->getval; ret |= sqlite3_bind_int64(stmt, 1, pid); ret |= sqlite3_bind_int64(stmt, 2, oid); ret |= sqlite3_bind_int(stmt, 3, page); ret |= sqlite3_bind_int(stmt, 4, number); ret = exec_attr_rtrvl_stmt(dbc, stmt, ret, __func__, oid, 0, GATHER_VAL, outlen, outdata, 0, used_outlen); if (ret == OSD_REPEAT) { goto repeat; } else if (ret == -ENOENT) { osd_debug("%s: attr (%llu %llu %u %u) not found!", __func__, llu(pid), llu(oid), page, number); } return ret; }
int create_dirent(PVFS_object_ref dir_ref, char *name, PVFS_handle handle, PVFS_credentials *creds) { int ret; printf("* %s creating new reference to %s (%llu) in %llu.\n", fsck_opts->destructive ? "" : "not", name, llu(handle), llu(dir_ref.handle)); if (fsck_opts->destructive) { ret = PVFS_mgmt_create_dirent(dir_ref, name, handle, creds, NULL); if (ret != 0) { PVFS_perror("PVFS_mgmt_create_dirent", ret); } } else { ret = 0; } return ret; }
int match_dirdata(struct handlelist *hl, struct handlelist *alt_hl, PVFS_object_ref dir_ref, PVFS_credentials *creds) { int ret, idx; PVFS_handle dirdata_handle; printf("# looking for dirdata match to %llu.\n", llu(dir_ref.handle)); ret = PVFS_mgmt_get_dirdata_handle(dir_ref, &dirdata_handle, creds, NULL); if (ret != 0) { PVFS_perror("match_dirdata", ret); return -1; } printf("# mgmt_get_dirdata returned %llu.\n", llu(dirdata_handle)); if (handlelist_find_handle(hl, dirdata_handle, &idx) == 0) { handlelist_remove_handle(hl, dirdata_handle, idx); return 0; } if (alt_hl && handlelist_find_handle(alt_hl, dirdata_handle, &idx) == 0) { handlelist_remove_handle(alt_hl, dirdata_handle, idx); return 0; } return -1; }
static uint64_t cephwrap_disk_free(struct vfs_handle_struct *handle, const struct smb_filename *smb_fname, uint64_t *bsize, uint64_t *dfree, uint64_t *dsize) { struct statvfs statvfs_buf; int ret; if (!(ret = ceph_statfs(handle->data, smb_fname->base_name, &statvfs_buf))) { /* * Provide all the correct values. */ *bsize = statvfs_buf.f_bsize; *dfree = statvfs_buf.f_bavail; *dsize = statvfs_buf.f_blocks; DBG_DEBUG("[CEPH] bsize: %llu, dfree: %llu, dsize: %llu\n", llu(*bsize), llu(*dfree), llu(*dsize)); return *dfree; } else { DBG_DEBUG("[CEPH] ceph_statfs returned %d\n", ret); WRAP_RETURN(ret); } }
int remove_directory_entry(PVFS_object_ref dir_ref, PVFS_object_ref entry_ref, char *name, PVFS_credentials *creds) { int ret; printf("* %s deleting directory entry for missing object %s (%llu) from dir %llu.\n", fsck_opts->destructive ? "" : "not", name, llu(entry_ref.handle), llu(dir_ref.handle)); if( (fsck_opts->safety_check) && (++global_removals >= fsck_opts->safety_count) ) { get_user_action_to_continue( ); } if (fsck_opts->destructive) { ret = PVFS_mgmt_remove_dirent(dir_ref, name, creds, NULL); if (ret != 0) { PVFS_perror("PVFS_mgmt_remove_dirent", ret); } } else { ret = 0; } assert(ret == 0); return 0; }
/* * return the type of the object * * returns: * -EINVAL: invalid arg, ignore value of obj_type * OSD_ERROR: any other error, ignore value of obj_type * OSD_OK: success in determining the type, either valid or invalid. * obj_types set to the determined type. */ int obj_get_type(void *ohandle, uint64_t pid, uint64_t oid, uint8_t *obj_type) { struct db_context *dbc = ((struct handle*)ohandle)->dbc; int ret = 0; int bound = 0; *obj_type = ILLEGAL_OBJ; assert(dbc && dbc->db && dbc->obj && dbc->obj->gettype); repeat: ret = 0; ret |= sqlite3_bind_int64(dbc->obj->gettype, 1, pid); ret |= sqlite3_bind_int64(dbc->obj->gettype, 2, oid); bound = (ret == SQLITE_OK); if (!bound) { error_sql(dbc->db, "%s: bind failed", __func__); goto out_reset; } while ((ret = sqlite3_step(dbc->obj->gettype)) == SQLITE_BUSY); if (ret == SQLITE_ROW) { *obj_type = sqlite3_column_int(dbc->obj->gettype, 0); } else if (ret == SQLITE_DONE) { osd_debug("%s: object (%llu %llu) doesn't exist", __func__, llu(pid), llu(oid)); } out_reset: ret = db_reset_stmt(dbc, dbc->obj->gettype, bound, __func__); if (ret == OSD_REPEAT) goto repeat; out: return ret; }
static int pvfs2_check_acl(struct inode *inode, int mask) { struct posix_acl *acl = NULL; gossip_debug(GOSSIP_ACL_DEBUG, "pvfs2_check_acl: called on inode %llu\n", llu(get_handle_from_ino(inode))); acl = pvfs2_get_acl(inode, ACL_TYPE_ACCESS); if (IS_ERR(acl)) { int error = PTR_ERR(acl); gossip_debug(GOSSIP_ACL_DEBUG, "pvfs2_check_acl: pvfs2_get_acl returned error %d\n", error); return error; } if (acl) { int error = posix_acl_permission(inode, acl, mask); posix_acl_release(acl); gossip_debug(GOSSIP_ACL_DEBUG, "pvfs2_check_acl: posix_acl_permission " " (inode %llu, acl %p, mask %x) returned %d\n", llu(get_handle_from_ino(inode)), acl, mask, error); return error; } gossip_debug(GOSSIP_ACL_DEBUG, "pvfs2_check_acl returning EAGAIN\n"); return -EAGAIN; }
/* * get all attributes for an object in a list format * * XXX:SD If the page is defined and we don't have name for the page (attr * num == 0), then we don't return its name. That is a bug * * returns: * -EINVAL: invalid arg, ignore used_len * -ENOENT: error, attribute not found * OSD_ERROR: some other error * OSD_OK: success, used_outlen modified */ int attr_get_all_attrs(struct db_context *dbc, uint64_t pid, uint64_t oid, uint64_t outlen, void *outdata, uint8_t listfmt, uint32_t *used_outlen) { int ret = 0; sqlite3_stmt *stmt = NULL; assert(dbc && dbc->db && dbc->attr && dbc->attr->getall); repeat: ret = 0; stmt = dbc->attr->getall; ret |= sqlite3_bind_int64(stmt, 1, pid); ret |= sqlite3_bind_int64(stmt, 2, oid); ret = exec_attr_rtrvl_stmt(dbc, stmt, ret, __func__, oid, 0, GATHER_ATTR, outlen, outdata, listfmt, used_outlen); if (ret == OSD_REPEAT) { goto repeat; } else if (ret == -ENOENT) { osd_debug("%s: attr (%llu %llu * *) not found!", __func__, llu(pid), llu(oid)); } return ret; }
int pvfs2_mmap_ra_cache_flush(PVFS_object_ref refn) { int ret = -1; struct qlist_head *hash_link = NULL; mmap_ra_cache_elem_t *cache_elem = NULL; if (MMAP_RA_CACHE_INITIALIZED()) { gen_mutex_lock(&s_mmap_ra_cache_mutex); hash_link = qhash_search_and_remove(s_key_to_data_table, &refn); if (hash_link) { cache_elem = qhash_entry( hash_link, mmap_ra_cache_elem_t, hash_link); assert(cache_elem); assert(cache_elem->data); gossip_debug(GOSSIP_MMAP_RCACHE_DEBUG, "Flushed mmap ra cache " "element %llu, %d of size %llu\n", llu(cache_elem->refn.handle), cache_elem->refn.fs_id, llu(cache_elem->data_sz)); free(cache_elem->data); free(cache_elem); ret = 0; } gen_mutex_unlock(&s_mmap_ra_cache_mutex); } return ret; }
void print_entry( char *entry_name, PVFS_handle handle, PVFS_fs_id fs_id, PVFS_sys_attr *attr, int attr_error, struct options *opts) { int ret = -1; PVFS_object_ref ref; PVFS_credentials credentials; PVFS_sysresp_getattr getattr_response; if (!opts->list_long) { if (opts->list_inode) { printf("%llu %s\n", llu(handle), entry_name); } else { printf("%s\n", entry_name); } return; } if (attr_error == 0) { if(!attr) { /* missing attributes (possibly for . or .. entries); get them * the old fashioned way */ ref.handle = handle; ref.fs_id = fs_id; memset(&getattr_response,0, sizeof(PVFS_sysresp_getattr)); PVFS_util_gen_credentials(&credentials); ret = PVFS_sys_getattr(ref, PVFS_ATTR_SYS_ALL_NOHINT, &credentials, &getattr_response, NULL); if (ret) { fprintf(stderr,"Failed to get attributes on handle %llu,%d\n", llu(handle),fs_id); PVFS_perror("Getattr failure", ret); return; } print_entry_attr(handle, entry_name, &getattr_response.attr, opts); } else { print_entry_attr(handle, entry_name, attr, opts); } } }
static PINT_sm_action readdir_msg_setup_msgpair( struct PINT_smcb *smcb, job_status_s *js_p) { struct PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_FRAME_CURRENT); int ret = -PVFS_EINVAL; PINT_sm_msgpair_state *msg_p = NULL; gossip_debug(GOSSIP_CLIENT_DEBUG, "readdir state: " "readdir_msg_setup_msgpair\n"); if (js_p->error_code) { return SM_ACTION_COMPLETE; } js_p->error_code = 0; gossip_debug(GOSSIP_READDIR_DEBUG," readdir: posting readdir req\n"); gossip_debug( GOSSIP_READDIR_DEBUG, "%llu|%d | token is %llu | limit is %d\n", llu(sm_p->object_ref.handle), sm_p->object_ref.fs_id, llu(sm_p->readdir.pos_token), sm_p->readdir.dirent_limit); PINT_msgpair_init(&sm_p->msgarray_op); msg_p = &sm_p->msgarray_op.msgpair; PINT_SERVREQ_READDIR_FILL( msg_p->req, *sm_p->cred_p, sm_p->object_ref.fs_id, sm_p->object_ref.handle, sm_p->u.readdir.pos_token, sm_p->u.readdir.dirent_limit, sm_p->hints); msg_p->fs_id = sm_p->object_ref.fs_id; msg_p->handle = sm_p->object_ref.handle; msg_p->retry_flag = PVFS_MSGPAIR_RETRY; msg_p->comp_fn = readdir_msg_comp_fn; ret = PINT_cached_config_map_to_server( &msg_p->svr_addr, sm_p->object_ref.handle, sm_p->object_ref.fs_id); if (ret) { gossip_err("Failed to map meta server address\n"); js_p->error_code = ret; } PINT_sm_push_frame(smcb, 0, &sm_p->msgarray_op); return SM_ACTION_COMPLETE; }
static ssize_t cephwrap_pread(struct vfs_handle_struct *handle, files_struct *fsp, void *data, size_t n, off_t offset) { ssize_t result; DBG_DEBUG("[CEPH] pread(%p, %p, %p, %llu, %llu)\n", handle, fsp, data, llu(n), llu(offset)); result = ceph_read(handle->data, fsp->fh->fd, data, n, offset); DBG_DEBUG("[CEPH] pread(...) = %llu\n", llu(result)); WRAP_RETURN(result); }
/* PINT_serv_msgpair_array_resolve_addrs() * * fills in BMI address of server for each entry in the msgpair array, * based on the handle and fsid * * returns 0 on success, -PVFS_error on failure */ int PINT_serv_msgpairarray_resolve_addrs( PINT_sm_msgarray_op *mop) { int i = 0; int ret = -PVFS_EINVAL; if ((mop->count > 0) && mop->msgarray) { for(i = 0; i < mop->count; i++) { PINT_sm_msgpair_state *msg_p = &mop->msgarray[i]; assert(msg_p); ret = PINT_cached_config_map_to_server( &msg_p->svr_addr, msg_p->handle, msg_p->fs_id); if (ret != 0) { gossip_err("Failed to map server address to handle\n"); break; } gossip_debug(GOSSIP_MSGPAIR_DEBUG, " mapped handle %llu to server %lld\n", llu(msg_p->handle), lld(msg_p->svr_addr)); } } return ret; }
static void handlelist_remove_handle(struct handlelist *hl, PVFS_handle handle, int server_idx) { unsigned long i; assert(server_idx < hl->server_ct); for (i = 0; i < hl->used_array[server_idx]; i++) { if (hl->list_array[server_idx][i] == handle) { if (i < (hl->used_array[server_idx] - 1)) { /* move last entry to this position before decrement */ hl->list_array[server_idx][i] = hl->list_array[server_idx][hl->used_array[server_idx]-1]; } hl->used_array[server_idx]--; break; } } if (i > hl->used_array[server_idx]) { printf("! problem removing %llu/%d.\n", llu(handle), server_idx); } assert(i <= hl->used_array[server_idx]); /* <= because of decrement! */ }
/* TODO: we could speed this up by resolving which server the handle * belongs to using the cached_config api */ static void handlelist_remove_handle_no_idx(struct handlelist *hl, PVFS_handle handle) { unsigned long i; int server_idx = 0; int found = 0; for(server_idx = 0; server_idx<hl->server_ct; server_idx++) { for (i = 0; i < hl->used_array[server_idx]; i++) { if (hl->list_array[server_idx][i] == handle) { if (i < (hl->used_array[server_idx] - 1)) { /* move last entry to this position before decrement */ hl->list_array[server_idx][i] = hl->list_array[server_idx][hl->used_array[server_idx]-1]; } hl->used_array[server_idx]--; found = 1; break; } } if(found) { break; } } if (!found) { printf("! problem removing %llu.\n", llu(handle)); } }
void util_meminfo() { struct memblock_t *info; if (!opts.memchk) return; for (info = mem_start; info; info = info->next) { util_debug("MEM", "lost: % 8u (bytes) at %s:%u\n", info->byte, info->file, info->line); } util_debug("MEM", "Memory information:\n\ Total allocations: %llu\n\ Total deallocations: %llu\n\ Total allocated: %llu (bytes)\n\ Total deallocated: %llu (bytes)\n\ Leaks found: lost %llu (bytes) in %d allocations\n", mem_at, mem_dt, mem_ab, mem_db, (mem_ab - mem_db), (mem_at - mem_dt) ); }
int test_util_get_io_perfs( PVFS_fs_id cur_fs, PVFS_credentials creds, int count) { int ret, i, j; ret = PVFS_mgmt_perf_mon_list( cur_fs, &creds, perf_matrix, end_time_ms_array, addr_array, next_id_array, count, HISTORY, NULL, NULL); if(ret < 0) { PVFS_perror("PVFS_mgmt_perf_mon_list", ret); return -1; } for(i = 0; i < count; i++) { for(j = 0; j < HISTORY; ++j) { if(!perf_matrix[i][j].valid_flag) { break; } printf("%d\t%llu\t%lld\t%lld\n", count, llu(perf_matrix[i][j].start_time_ms), lld(perf_matrix[i][j].write), lld(perf_matrix[i][j].read)); } } return 0; }
/* * This routine checks keys to confirm that the name spaces are valid. * It also prints debugging information. */ static int seteattr_verify_eattribs( struct PINT_smcb *smcb, job_status_s *js_p) { struct PINT_server_op *s_op = PINT_sm_frame(smcb, PINT_FRAME_CURRENT); int i; PVFS_object_attr *a_p = NULL; a_p = &s_op->attr; js_p->error_code = 0; gossip_debug(GOSSIP_SETEATTR_DEBUG, " ext attr list write to handle %llu refers to a %s\n\t" "[owner = %d, group = %d, perms = %o, type = %d]\n", llu(s_op->req->u.seteattr.handle), PINT_util_get_object_type(a_p->objtype), a_p->owner, a_p->group, a_p->perms, a_p->objtype); /* iterate through the keys that are being written */ for (i = 0; i < s_op->req->u.seteattr.nkey; i++) { js_p->error_code = PINT_eattr_namespace_verify( &s_op->req->u.seteattr.key[i], &s_op->req->u.seteattr.val[i]); if(!js_p->error_code) { return SM_ACTION_COMPLETE; } } return SM_ACTION_COMPLETE; }
int remove_object(PVFS_object_ref obj_ref, PVFS_ds_type obj_type, PVFS_credentials *creds) { int ret; printf("* %s removing %s %llu.\n", fsck_opts->destructive ? "" : "not", get_type_str(obj_type), llu(obj_ref.handle)); if( (fsck_opts->safety_check) && (++global_removals >= fsck_opts->safety_count) ) { get_user_action_to_continue( ); } if (fsck_opts->destructive) { ret = PVFS_mgmt_remove_object(obj_ref, creds, NULL); if (ret != 0) { PVFS_perror("PVFS_mgmt_remove_object", ret); } } else { ret = 0; } assert(ret == 0); return 0; }
/* * Used by both encode functions, request and response, to set * up the one buffer which will hold the encoded message. */ static int encode_common(struct PINT_encoded_msg *target_msg, int maxsize) { int ret = 0; void *buf = NULL; gossip_debug(GOSSIP_ENDECODE_DEBUG,"encode_common\n"); /* this encoder always uses just one buffer */ BF_ENCODE_TARGET_MSG_INIT(target_msg); /* allocate the max size buffer to avoid the work of calculating it */ buf = (initializing_sizes ? malloc(maxsize) : BMI_memalloc(target_msg->dest, maxsize, BMI_SEND)); if (!buf) { gossip_err("Error: failed to BMI_malloc memory for response.\n"); gossip_err("Error: is BMI address %llu still valid?\n", llu(target_msg->dest)); ret = -PVFS_ENOMEM; goto out; } target_msg->buffer_list[0] = buf; target_msg->alloc_size_list[0] = maxsize; target_msg->ptr_current = buf; /* generic header */ memcpy(target_msg->ptr_current, le_bytefield_table.generic_header, PINT_ENC_GENERIC_HEADER_SIZE); target_msg->ptr_current += PINT_ENC_GENERIC_HEADER_SIZE; out: return ret; }
static PINT_sm_action chdirent_read_directory_entry( struct PINT_smcb *smcb, job_status_s *js_p) { struct PINT_server_op *s_op = PINT_sm_frame(smcb, PINT_FRAME_CURRENT); int ret = -PVFS_EINVAL; job_id_t j_id; gossip_debug(GOSSIP_SERVER_DEBUG, " reading from dirent handle = %llu, name = %s\n", llu(s_op->u.chdirent.dirdata_handle), s_op->req->u.chdirent.entry); s_op->key.buffer = s_op->req->u.chdirent.entry; s_op->key.buffer_sz = strlen(s_op->req->u.chdirent.entry) + 1; s_op->val.buffer = &s_op->u.chdirent.old_dirent_handle; s_op->val.buffer_sz = sizeof(PVFS_handle); ret = job_trove_keyval_read( s_op->req->u.chdirent.fs_id, s_op->u.chdirent.dirdata_handle, &s_op->key, &s_op->val, 0, NULL, smcb, 0, js_p, &j_id, server_job_context, s_op->req->hints); return ret; }
static void print_datafile_handles(PVFS_handle *h_p, int count) { int i; for (i = 0; i < count && i < 10; i++) fprintf(stdout, "0x%08llx ", llu(h_p[i])); if (i == 10) fprintf(stdout, "...\n"); else fprintf(stdout, "\n"); }
int pvfs2_mmap_ra_cache_register(PVFS_object_ref refn, void *data, int data_len) { int ret = -1; mmap_ra_cache_elem_t *cache_elem = NULL; if (MMAP_RA_CACHE_INITIALIZED()) { pvfs2_mmap_ra_cache_flush(refn); cache_elem = (mmap_ra_cache_elem_t *) malloc(sizeof(mmap_ra_cache_elem_t)); if (!cache_elem) { goto return_exit; } memset(cache_elem, 0, sizeof(mmap_ra_cache_elem_t)); cache_elem->refn = refn; cache_elem->data = malloc(data_len); if (!cache_elem->data) { goto return_exit; } memcpy(cache_elem->data, data, data_len); cache_elem->data_sz = data_len; gen_mutex_lock(&s_mmap_ra_cache_mutex); qhash_add(s_key_to_data_table, &refn, &cache_elem->hash_link); gen_mutex_unlock(&s_mmap_ra_cache_mutex); gossip_debug(GOSSIP_MMAP_RCACHE_DEBUG, "Inserted mmap ra cache " "element %llu, %d of size %llu\n", llu(cache_elem->refn.handle), cache_elem->refn.fs_id, llu(cache_elem->data_sz)); ret = 0; } return_exit: return ret; }
static void handlelist_print(struct handlelist *hl) { unsigned long i; /* NOTE: REALLY ONLY PRINTS FOR ONE SERVER RIGHT NOW */ for (i=0; i < hl->used_array[0]; i++) { printf("%llu ", llu(hl->list_array[0][i])); } printf("\n"); }
static PINT_sm_action chdirent_change_directory_entry( struct PINT_smcb *smcb, job_status_s *js_p) { struct PINT_server_op *s_op = PINT_sm_frame(smcb, PINT_FRAME_CURRENT); int ret = -PVFS_EINVAL; job_id_t j_id; js_p->error_code = 0; s_op->u.chdirent.new_dirent_handle = s_op->req->u.chdirent.new_dirent_handle; if (s_op->u.chdirent.old_dirent_handle == s_op->u.chdirent.new_dirent_handle) { /* FIXME: return an error since a dirent is being changed to itself (?) */ } s_op->key.buffer = s_op->req->u.chdirent.entry; s_op->key.buffer_sz = strlen(s_op->req->u.chdirent.entry) + 1; s_op->val.buffer = &s_op->u.chdirent.new_dirent_handle; s_op->val.buffer_sz = sizeof(PVFS_handle); gossip_debug(GOSSIP_SERVER_DEBUG, " changing dir entry for %s from handle value " "%llu to %llu\n", s_op->req->u.chdirent.entry, llu(s_op->u.chdirent.old_dirent_handle), llu(s_op->u.chdirent.new_dirent_handle)); ret = job_trove_keyval_write( s_op->req->u.chdirent.fs_id, s_op->u.chdirent.dirdata_handle, &s_op->key, &s_op->val, TROVE_SYNC | 0, NULL, smcb, 0, js_p, &j_id, server_job_context, s_op->req->hints); s_op->u.chdirent.dir_attr_update_required = 1; return ret; }
void op_release(struct orangefs_kernel_op_s *orangefs_op) { if (orangefs_op) { gossip_debug(GOSSIP_CACHE_DEBUG, "Releasing OP (%p: %llu)\n", orangefs_op, llu(orangefs_op->tag)); kmem_cache_free(op_cache, orangefs_op); } else { gossip_err("NULL pointer in op_release\n"); } }
static PINT_sm_action setattr_write_metafile_datafile_handles_if_required( struct PINT_smcb *smcb, job_status_s *js_p) { struct PINT_server_op *s_op = PINT_sm_frame(smcb, PINT_FRAME_CURRENT); int ret = 0, dfile_count = 0; job_id_t j_id; /* reset from jump to here with STATE_METAFILE */ js_p->error_code = 0; gossip_debug(GOSSIP_SETATTR_DEBUG, " request has dfile_count of %d | dspace has %d\n", s_op->req->u.setattr.attr.u.meta.dfile_count, s_op->attr.u.meta.dfile_count); /* verify that the requested dfile count is sane */ dfile_count = s_op->req->u.setattr.attr.u.meta.dfile_count; if ((dfile_count < 1) || (dfile_count > PVFS_REQ_LIMIT_DFILE_COUNT)) { gossip_err("The requested dfile count of %d is invalid; " "aborting operation.\n", dfile_count); js_p->error_code = -PVFS_EOVERFLOW; return SM_ACTION_COMPLETE; } /* set up key and value structure for keyval write */ s_op->key.buffer = Trove_Common_Keys[METAFILE_HANDLES_KEY].key; s_op->key.buffer_sz = Trove_Common_Keys[METAFILE_HANDLES_KEY].size; gossip_debug(GOSSIP_SETATTR_DEBUG, " metafile has %d datafiles associated with it\n", s_op->req->u.setattr.attr.u.meta.dfile_count); s_op->val.buffer = s_op->req->u.setattr.attr.u.meta.dfile_array; s_op->val.buffer_sz = dfile_count * sizeof(PVFS_handle); gossip_debug( GOSSIP_SETATTR_DEBUG, " writing %s [%llu,%d," "len %d]\n", (char *)s_op->key.buffer, llu(s_op->req->u.setattr.handle), s_op->req->u.setattr.fs_id, s_op->val.buffer_sz); /* we don't sync here since we're going to do it anyway in * write_metafile_distribution */ ret = job_trove_keyval_write( s_op->req->u.setattr.fs_id, s_op->req->u.setattr.handle, &(s_op->key), &(s_op->val), 0, NULL, smcb, 0, js_p, &j_id, server_job_context, s_op->req->hints); return ret; }
static PINT_sm_action prelude_check_acls_if_needed( struct PINT_smcb *smcb, job_status_s *js_p) { struct PINT_server_op *s_op = PINT_sm_frame(smcb, PINT_FRAME_CURRENT); int ret = -PVFS_EINVAL; job_id_t i; gossip_debug(GOSSIP_SERVER_DEBUG, "(%p) %s (prelude sm) state: prelude_check_acls_if_needed\n", s_op, PINT_map_server_op_to_string(s_op->req->op)); /* If we get here with an invalid fsid and handle, we have to * return -PVFS_EACCESS */ if (s_op->target_fs_id == PVFS_FS_ID_NULL || s_op->target_handle == PVFS_HANDLE_NULL) { js_p->error_code = -PVFS_EACCES; return SM_ACTION_COMPLETE; } js_p->error_code = 0; memset(&s_op->key, 0, sizeof(PVFS_ds_keyval)); memset(&s_op->val, 0, sizeof(PVFS_ds_keyval)); s_op->key.buffer = "system.posix_acl_access"; s_op->key.buffer_sz = strlen(s_op->key.buffer) + 1; s_op->val.buffer = (char *) malloc(PVFS_REQ_LIMIT_VAL_LEN); if (!s_op->val.buffer) { js_p->error_code = -PVFS_ENOMEM; return SM_ACTION_COMPLETE; } s_op->val.buffer_sz = PVFS_REQ_LIMIT_VAL_LEN; gossip_debug(GOSSIP_PERMISSIONS_DEBUG, "About to retrieve acl keyvals " "for handle %llu\n", llu(s_op->target_handle)); /* Read acl keys */ ret = job_trove_keyval_read( s_op->target_fs_id, s_op->target_handle, &s_op->key, &s_op->val, 0, NULL, smcb, 0, js_p, &i, server_job_context, s_op->req->hints); return ret; }
static PINT_sm_action flush_check_error( struct PINT_smcb *smcb, job_status_s *js_p) { struct PINT_server_op *s_op = PINT_sm_frame(smcb, PINT_FRAME_CURRENT); char buf[64] = {0}; if (js_p->error_code != 0) { PVFS_strerror_r(js_p->error_code, buf, 64); gossip_err("failed to flush handle %llu: %s\n", llu(s_op->req->u.flush.handle), buf); } return SM_ACTION_COMPLETE; }