/* Create new destination for given transaction associated with given network state. Transaction's reference counter is bumped and will be dropped when either reply is received or when async timeout detection task will fail resending and drop transaction.  */
static int netfs_trans_push_dst(struct netfs_trans *t, struct netfs_state *st)
/* Create new destination for given transaction associated with given network state. Transaction's reference counter is bumped and will be dropped when either reply is received or when async timeout detection task will fail resending and drop transaction.  */
static int netfs_trans_push_dst(struct netfs_trans *t, struct netfs_state *st)
{
	struct netfs_trans_dst *dst;
	int err;
	dst = mempool_alloc(netfs_trans_dst_pool, GFP_KERNEL);
	if (!dst)
		return -ENOMEM;
	dst->retries = 0;
	dst->send_time = 0;
	dst->state = st;
	dst->trans = t;
	netfs_trans_get(t);
	mutex_lock(&st->trans_lock);
	err = netfs_trans_insert(dst, st);
	mutex_unlock(&st->trans_lock);
	if (err)
		goto err_out_free;
	spin_lock(&t->dst_lock);
	list_add_tail(&dst->trans_entry, &t->dst_list);
	spin_unlock(&t->dst_lock);
	return 0;
err_out_free:
	t->result = err;
	netfs_trans_put(t);
	mempool_free(dst, netfs_trans_dst_pool);
	return err;
}