struct svc_rpc_gss_data * authgss_ctx_hash_get(struct rpc_gss_cred *gc) { struct svc_rpc_gss_data gk, *gd = NULL; gss_union_ctx_id_desc *gss_ctx; struct opr_rbtree_node *ngd; struct authgss_x_part *axp; struct rbtree_x_part *t; cond_init_authgss_hash(); gss_ctx = (gss_union_ctx_id_desc *) (gc->gc_ctx.value); gk.hk.k = gss_ctx_hash(gss_ctx); t = rbtx_partition_of_scalar(&authgss_hash_st.xt, gk.hk.k); mutex_lock(&t->mtx); ngd = rbtree_x_cached_lookup(&authgss_hash_st.xt, t, &gk.node_k, gk.hk.k); if (ngd) { gd = opr_containerof(ngd, struct svc_rpc_gss_data, node_k); /* lru adjust */ axp = (struct authgss_x_part *)t->u1; TAILQ_REMOVE(&axp->lru_q, gd, lru_q); TAILQ_INSERT_TAIL(&axp->lru_q, gd, lru_q); ++(axp->gen); (void)atomic_inc_uint32_t(&gd->refcnt); (void)atomic_inc_uint32_t(&gd->gen); } mutex_unlock(&t->mtx); return (gd); }
bool authgss_ctx_hash_set(struct svc_rpc_gss_data *gd) { struct rbtree_x_part *t; struct authgss_x_part *axp; gss_union_ctx_id_desc *gss_ctx; bool rslt; cond_init_authgss_hash(); gss_ctx = (gss_union_ctx_id_desc *) (gd->ctx); gd->hk.k = gss_ctx_hash(gss_ctx); ++(gd->refcnt); /* locked */ t = rbtx_partition_of_scalar(&authgss_hash_st.xt, gd->hk.k); mutex_lock(&t->mtx); rslt = rbtree_x_cached_insert(&authgss_hash_st.xt, t, &gd->node_k, gd->hk.k); /* lru */ axp = (struct authgss_x_part *)t->u1; TAILQ_INSERT_TAIL(&axp->lru_q, gd, lru_q); mutex_unlock(&t->mtx); /* global size */ (void)atomic_inc_uint32_t(&authgss_hash_st.size); return (rslt); }
void DispatchWork9P(request_data_t *req) { switch (req->rtype) { case _9P_REQUEST: switch (req->r_u._9p.pconn->trans_type) { case _9P_TCP: LogDebug(COMPONENT_DISPATCH, "Dispatching 9P/TCP request %p, tcpsock=%lu", req, req->r_u._9p.pconn->trans_data.sockfd); break; case _9P_RDMA: LogDebug(COMPONENT_DISPATCH, "Dispatching 9P/RDMA request %p", req); break; default: LogCrit(COMPONENT_DISPATCH, "/!\\ Implementation error, bad 9P transport type"); return; } break; default: LogCrit(COMPONENT_DISPATCH, "/!\\ Implementation error, 9P Dispatch function is called for non-9P request !!!!"); return; } /* increase connection refcount */ atomic_inc_uint32_t(&req->r_u._9p.pconn->refcount); /* new-style dispatch */ nfs_rpc_enqueue_req(req); }
void free_session_slot(struct session_slot_table *sst, int slotid, uint32_t server_highest, uint32_t target_highest, bool sent) { pthread_mutex_lock(&sst->mutex); assert(!bs_get(sst->free_slots, slotid)); bs_set(sst->free_slots, slotid); if (slotid + 1 == sst->highest_used_slotid_plus1) { int s = slotid - 1; while (s >= 0 && bs_get(sst->free_slots, s)) --s; sst->highest_used_slotid_plus1 = s + 1; } if (sent) { assert(server_highest + 1 >= sst->highest_used_slotid_plus1); sst->server_highest_slotid = server_highest; sst->target_highest_slotid = target_highest; /* increment sequenceid */ atomic_inc_uint32_t(sst->slots + slotid); } if (slotid <= target_highest) { pthread_cond_signal(&sst->slot_cv); } pthread_mutex_unlock(&sst->mutex); }
/** * @brief Build the 12 byte "other" portion of a stateid * * It is built from the ServerEpoch and a 64 bit global counter. * * @param[in] other stateid.other object (a char[OTHERSIZE] string) */ void nfs4_BuildStateId_Other(nfs_client_id_t *clientid, char *other) { uint32_t my_stateid = atomic_inc_uint32_t(&clientid->cid_stateid_counter); /* The first part of the other is the 64 bit clientid, which * consists of the epoch in the high order 32 bits followed by * the clientid counter in the low order 32 bits. */ memcpy(other, &clientid->cid_clientid, sizeof(clientid->cid_clientid)); memcpy(other + sizeof(clientid->cid_clientid), &my_stateid, sizeof(my_stateid)); }