Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
6e5b70e9
Commit
6e5b70e9
authored
Jun 12, 2007
by
Trond Myklebust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SUNRPC: clean up rpc_call_async/rpc_call_sync/rpc_run_task
Signed-off-by:
Trond Myklebust
<
Trond.Myklebust@netapp.com
>
parent
188fef11
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
69 additions
and
69 deletions
+69
-69
net/sunrpc/clnt.c
net/sunrpc/clnt.c
+69
-46
net/sunrpc/sched.c
net/sunrpc/sched.c
+0
-23
No files found.
net/sunrpc/clnt.c
View file @
6e5b70e9
...
...
@@ -474,73 +474,96 @@ void rpc_clnt_sigunmask(struct rpc_clnt *clnt, sigset_t *oldset)
rpc_restore_sigmask
(
oldset
);
}
/*
* New rpc_call implementation
*/
int
rpc_call_sync
(
struct
rpc_clnt
*
clnt
,
struct
rpc_message
*
msg
,
int
flags
)
static
struct
rpc_task
*
rpc_do_run_task
(
struct
rpc_clnt
*
clnt
,
struct
rpc_message
*
msg
,
int
flags
,
const
struct
rpc_call_ops
*
ops
,
void
*
data
)
{
struct
rpc_task
*
task
;
struct
rpc_task
*
task
,
*
ret
;
sigset_t
oldset
;
int
status
;
BUG_ON
(
flags
&
RPC_TASK_ASYNC
);
task
=
rpc_new_task
(
clnt
,
flags
,
&
rpc_default_ops
,
NULL
);
if
(
task
==
NULL
)
return
-
ENOMEM
;
task
=
rpc_new_task
(
clnt
,
flags
,
ops
,
data
);
if
(
task
==
NULL
)
{
rpc_release_calldata
(
ops
,
data
);
return
ERR_PTR
(
-
ENOMEM
);
}
/* Mask signals on
RPC calls _and_ GSS_AUTH
upcalls */
/* Mask signals on
synchronous RPC calls and RPCSEC_GSS
upcalls */
rpc_task_sigmask
(
task
,
&
oldset
);
/* Set up the call info struct and execute the task */
if
(
msg
!=
NULL
)
{
rpc_call_setup
(
task
,
msg
,
0
);
if
(
task
->
tk_status
==
0
)
{
if
(
task
->
tk_status
!=
0
)
{
ret
=
ERR_PTR
(
task
->
tk_status
);
rpc_put_task
(
task
);
goto
out
;
}
}
atomic_inc
(
&
task
->
tk_count
);
rpc_execute
(
task
);
}
ret
=
task
;
out:
rpc_restore_sigmask
(
&
oldset
);
return
ret
;
}
/**
* rpc_call_sync - Perform a synchronous RPC call
* @clnt: pointer to RPC client
* @msg: RPC call parameters
* @flags: RPC call flags
*/
int
rpc_call_sync
(
struct
rpc_clnt
*
clnt
,
struct
rpc_message
*
msg
,
int
flags
)
{
struct
rpc_task
*
task
;
int
status
;
BUG_ON
(
flags
&
RPC_TASK_ASYNC
);
task
=
rpc_do_run_task
(
clnt
,
msg
,
flags
,
&
rpc_default_ops
,
NULL
);
if
(
IS_ERR
(
task
))
return
PTR_ERR
(
task
);
status
=
task
->
tk_status
;
rpc_put_task
(
task
);
rpc_restore_sigmask
(
&
oldset
);
return
status
;
}
/*
* New rpc_call implementation
/**
* rpc_call_async - Perform an asynchronous RPC call
* @clnt: pointer to RPC client
* @msg: RPC call parameters
* @flags: RPC call flags
* @ops: RPC call ops
* @data: user call data
*/
int
rpc_call_async
(
struct
rpc_clnt
*
clnt
,
struct
rpc_message
*
msg
,
int
flags
,
const
struct
rpc_call_ops
*
tk_ops
,
void
*
data
)
{
struct
rpc_task
*
task
;
sigset_t
oldset
;
int
status
;
flags
|=
RPC_TASK_ASYNC
;
/* Create/initialize a new RPC task */
status
=
-
ENOMEM
;
if
(
!
(
task
=
rpc_new_task
(
clnt
,
flags
,
tk_ops
,
data
)))
goto
out_release
;
/* Mask signals on GSS_AUTH upcalls */
rpc_task_sigmask
(
task
,
&
oldset
);
rpc_call_setup
(
task
,
msg
,
0
);
/* Set up the call info struct and execute the task */
status
=
task
->
tk_status
;
if
(
status
==
0
)
rpc_execute
(
task
);
else
task
=
rpc_do_run_task
(
clnt
,
msg
,
flags
|
RPC_TASK_ASYNC
,
tk_ops
,
data
);
if
(
IS_ERR
(
task
))
return
PTR_ERR
(
task
);
rpc_put_task
(
task
);
rpc_restore_sigmask
(
&
oldset
);
return
status
;
out_release:
rpc_release_calldata
(
tk_ops
,
data
);
return
status
;
return
0
;
}
/**
* rpc_run_task - Allocate a new RPC task, then run rpc_execute against it
* @clnt: pointer to RPC client
* @flags: RPC flags
* @ops: RPC call ops
* @data: user call data
*/
struct
rpc_task
*
rpc_run_task
(
struct
rpc_clnt
*
clnt
,
int
flags
,
const
struct
rpc_call_ops
*
tk_ops
,
void
*
data
)
{
return
rpc_do_run_task
(
clnt
,
NULL
,
flags
,
tk_ops
,
data
);
}
EXPORT_SYMBOL
(
rpc_run_task
);
void
rpc_call_setup
(
struct
rpc_task
*
task
,
struct
rpc_message
*
msg
,
int
flags
)
...
...
net/sunrpc/sched.c
View file @
6e5b70e9
...
...
@@ -933,29 +933,6 @@ static void rpc_release_task(struct rpc_task *task)
rpc_put_task
(
task
);
}
/**
* rpc_run_task - Allocate a new RPC task, then run rpc_execute against it
* @clnt: pointer to RPC client
* @flags: RPC flags
* @ops: RPC call ops
* @data: user call data
*/
struct
rpc_task
*
rpc_run_task
(
struct
rpc_clnt
*
clnt
,
int
flags
,
const
struct
rpc_call_ops
*
ops
,
void
*
data
)
{
struct
rpc_task
*
task
;
task
=
rpc_new_task
(
clnt
,
flags
,
ops
,
data
);
if
(
task
==
NULL
)
{
rpc_release_calldata
(
ops
,
data
);
return
ERR_PTR
(
-
ENOMEM
);
}
atomic_inc
(
&
task
->
tk_count
);
rpc_execute
(
task
);
return
task
;
}
EXPORT_SYMBOL
(
rpc_run_task
);
/*
* Kill all tasks for the given client.
* XXX: kill their descendants as well?
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment