scoutfs: add scoutfs_net_response_node()

Today all responses can only be sent down the connection that sent the
response while the request is being processed.  We'll be adding
subsystems that need to send responses asynchronously after initial
request processing.  Give them a call to send a response to a node id
instead of to a node's connection.

Signed-off-by: Zach Brown <zab@versity.com>
This commit is contained in:
Zach Brown
2019-01-09 16:43:45 -08:00
committed by Zach Brown
parent c34dd452a7
commit f472c0bc87
2 changed files with 19 additions and 0 deletions

View File

@@ -1353,6 +1353,21 @@ int scoutfs_net_response(struct super_block *sb,
NULL, NULL, NULL);
}
int scoutfs_net_response_node(struct super_block *sb,
struct scoutfs_net_connection *conn,
u64 node_id, u8 cmd, u64 id, int error,
void *resp, u16 resp_len)
{
if (error) {
resp = NULL;
resp_len = 0;
}
return submit_send(sb, conn, node_id, cmd, SCOUTFS_NET_FLAG_RESPONSE,
id, net_err_from_host(sb, error), resp, resp_len,
NULL, NULL, NULL);
}
/*
* The response function that was submitted with the request is not
* called if the request is canceled here.

View File

@@ -58,6 +58,10 @@ int scoutfs_net_sync_request(struct super_block *sb,
int scoutfs_net_response(struct super_block *sb,
struct scoutfs_net_connection *conn,
u8 cmd, u64 id, int error, void *resp, u16 resp_len);
int scoutfs_net_response_node(struct super_block *sb,
struct scoutfs_net_connection *conn,
u64 node_id, u8 cmd, u64 id, int error,
void *resp, u16 resp_len);
void scoutfs_net_shutdown(struct super_block *sb,
struct scoutfs_net_connection *conn);
void scoutfs_net_free_conn(struct super_block *sb,