License cleanup: add SPDX GPL-2.0 license identifier to files with no license
Many source files in the tree are missing licensing information, which
makes it harder for compliance tools to determine the correct license.
By default all files without license information are under the default
license of the kernel, which is GPL version 2.
Update the files which contain no license information with the 'GPL-2.0'
SPDX license identifier. The SPDX identifier is a legally binding
shorthand, which can be used instead of the full boiler plate text.
This patch is based on work done by Thomas Gleixner and Kate Stewart and
Philippe Ombredanne.
How this work was done:
Patches were generated and checked against linux-4.14-rc6 for a subset of
the use cases:
- file had no licensing information it it.
- file was a */uapi/* one with no licensing information in it,
- file was a */uapi/* one with existing licensing information,
Further patches will be generated in subsequent months to fix up cases
where non-standard license headers were used, and references to license
had to be inferred by heuristics based on keywords.
The analysis to determine which SPDX License Identifier to be applied to
a file was done in a spreadsheet of side by side results from of the
output of two independent scanners (ScanCode & Windriver) producing SPDX
tag:value files created by Philippe Ombredanne. Philippe prepared the
base worksheet, and did an initial spot review of a few 1000 files.
The 4.13 kernel was the starting point of the analysis with 60,537 files
assessed. Kate Stewart did a file by file comparison of the scanner
results in the spreadsheet to determine which SPDX license identifier(s)
to be applied to the file. She confirmed any determination that was not
immediately clear with lawyers working with the Linux Foundation.
Criteria used to select files for SPDX license identifier tagging was:
- Files considered eligible had to be source code files.
- Make and config files were included as candidates if they contained >5
lines of source
- File already had some variant of a license header in it (even if <5
lines).
All documentation files were explicitly excluded.
The following heuristics were used to determine which SPDX license
identifiers to apply.
- when both scanners couldn't find any license traces, file was
considered to have no license information in it, and the top level
COPYING file license applied.
For non */uapi/* files that summary was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 11139
and resulted in the first patch in this series.
If that file was a */uapi/* path one, it was "GPL-2.0 WITH
Linux-syscall-note" otherwise it was "GPL-2.0". Results of that was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 WITH Linux-syscall-note 930
and resulted in the second patch in this series.
- if a file had some form of licensing information in it, and was one
of the */uapi/* ones, it was denoted with the Linux-syscall-note if
any GPL family license was found in the file or had no licensing in
it (per prior point). Results summary:
SPDX license identifier # files
---------------------------------------------------|------
GPL-2.0 WITH Linux-syscall-note 270
GPL-2.0+ WITH Linux-syscall-note 169
((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) 21
((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) 17
LGPL-2.1+ WITH Linux-syscall-note 15
GPL-1.0+ WITH Linux-syscall-note 14
((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) 5
LGPL-2.0+ WITH Linux-syscall-note 4
LGPL-2.1 WITH Linux-syscall-note 3
((GPL-2.0 WITH Linux-syscall-note) OR MIT) 3
((GPL-2.0 WITH Linux-syscall-note) AND MIT) 1
and that resulted in the third patch in this series.
- when the two scanners agreed on the detected license(s), that became
the concluded license(s).
- when there was disagreement between the two scanners (one detected a
license but the other didn't, or they both detected different
licenses) a manual inspection of the file occurred.
- In most cases a manual inspection of the information in the file
resulted in a clear resolution of the license that should apply (and
which scanner probably needed to revisit its heuristics).
- When it was not immediately clear, the license identifier was
confirmed with lawyers working with the Linux Foundation.
- If there was any question as to the appropriate license identifier,
the file was flagged for further research and to be revisited later
in time.
In total, over 70 hours of logged manual review was done on the
spreadsheet to determine the SPDX license identifiers to apply to the
source files by Kate, Philippe, Thomas and, in some cases, confirmation
by lawyers working with the Linux Foundation.
Kate also obtained a third independent scan of the 4.13 code base from
FOSSology, and compared selected files where the other two scanners
disagreed against that SPDX file, to see if there was new insights. The
Windriver scanner is based on an older version of FOSSology in part, so
they are related.
Thomas did random spot checks in about 500 files from the spreadsheets
for the uapi headers and agreed with SPDX license identifier in the
files he inspected. For the non-uapi files Thomas did random spot checks
in about 15000 files.
In initial set of patches against 4.14-rc6, 3 files were found to have
copy/paste license identifier errors, and have been fixed to reflect the
correct identifier.
Additionally Philippe spent 10 hours this week doing a detailed manual
inspection and review of the 12,461 patched files from the initial patch
version early this week with:
- a full scancode scan run, collecting the matched texts, detected
license ids and scores
- reviewing anything where there was a license detected (about 500+
files) to ensure that the applied SPDX license was correct
- reviewing anything where there was no detection but the patch license
was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
SPDX license was correct
This produced a worksheet with 20 files needing minor correction. This
worksheet was then exported into 3 different .csv files for the
different types of files to be modified.
These .csv files were then reviewed by Greg. Thomas wrote a script to
parse the csv files and add the proper SPDX tag to the file, in the
format that the file expected. This script was further refined by Greg
based on the output to detect more types of files automatically and to
distinguish between header and source .c files (which need different
comment types.) Finally Greg ran the script using the .csv files to
generate the patches.
Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-01 22:07:57 +08:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
2005-04-17 06:20:36 +08:00
|
|
|
/*
|
|
|
|
* linux/include/linux/sunrpc/sched.h
|
|
|
|
*
|
|
|
|
* Scheduling primitives for kernel Sun RPC.
|
|
|
|
*
|
|
|
|
* Copyright (C) 1996, Olaf Kirch <okir@monad.swb.de>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _LINUX_SUNRPC_SCHED_H_
|
|
|
|
#define _LINUX_SUNRPC_SCHED_H_
|
|
|
|
|
|
|
|
#include <linux/timer.h>
|
2010-05-08 01:34:47 +08:00
|
|
|
#include <linux/ktime.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
#include <linux/sunrpc/types.h>
|
|
|
|
#include <linux/spinlock.h>
|
2017-06-20 18:19:09 +08:00
|
|
|
#include <linux/wait_bit.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
#include <linux/workqueue.h>
|
|
|
|
#include <linux/sunrpc/xdr.h>
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This is the actual RPC procedure call info.
|
|
|
|
*/
|
|
|
|
struct rpc_procinfo;
|
|
|
|
struct rpc_message {
|
2017-05-12 21:36:49 +08:00
|
|
|
const struct rpc_procinfo *rpc_proc; /* Procedure information */
|
2005-04-17 06:20:36 +08:00
|
|
|
void * rpc_argp; /* Arguments */
|
|
|
|
void * rpc_resp; /* Result */
|
2018-12-03 08:30:31 +08:00
|
|
|
const struct cred * rpc_cred; /* Credentials */
|
2005-04-17 06:20:36 +08:00
|
|
|
};
|
|
|
|
|
2006-01-03 16:55:04 +08:00
|
|
|
struct rpc_call_ops;
|
2005-04-17 06:20:36 +08:00
|
|
|
struct rpc_wait_queue;
|
|
|
|
struct rpc_wait {
|
|
|
|
struct list_head list; /* wait queue links */
|
|
|
|
struct list_head links; /* Links to related tasks */
|
2007-07-19 04:18:52 +08:00
|
|
|
struct list_head timer_list; /* Timer list */
|
2005-04-17 06:20:36 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This is the RPC task struct
|
|
|
|
*/
|
|
|
|
struct rpc_task {
|
2006-01-03 16:55:06 +08:00
|
|
|
atomic_t tk_count; /* Reference count */
|
2015-02-26 03:49:16 +08:00
|
|
|
int tk_status; /* result of last operation */
|
2005-04-17 06:20:36 +08:00
|
|
|
struct list_head tk_task; /* global list of tasks */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* callback to be executed after waking up
|
|
|
|
* action next procedure for async tasks
|
|
|
|
*/
|
|
|
|
void (*tk_callback)(struct rpc_task *);
|
|
|
|
void (*tk_action)(struct rpc_task *);
|
|
|
|
|
|
|
|
unsigned long tk_timeout; /* timeout for rpc_sleep() */
|
|
|
|
unsigned long tk_runstate; /* Task run status */
|
2015-02-26 03:49:16 +08:00
|
|
|
|
2008-02-23 04:46:41 +08:00
|
|
|
struct rpc_wait_queue *tk_waitqueue; /* RPC wait queue we're on */
|
2005-04-17 06:20:36 +08:00
|
|
|
union {
|
|
|
|
struct work_struct tk_work; /* Async task work queue */
|
|
|
|
struct rpc_wait tk_wait; /* RPC wait */
|
|
|
|
} u;
|
2006-03-21 02:44:17 +08:00
|
|
|
|
2019-04-08 01:58:54 +08:00
|
|
|
int tk_rpc_status; /* Result of last RPC operation */
|
|
|
|
|
2015-02-26 03:49:16 +08:00
|
|
|
/*
|
|
|
|
* RPC call state
|
|
|
|
*/
|
|
|
|
struct rpc_message tk_msg; /* RPC call info */
|
|
|
|
void * tk_calldata; /* Caller private data */
|
|
|
|
const struct rpc_call_ops *tk_ops; /* Caller callbacks */
|
|
|
|
|
|
|
|
struct rpc_clnt * tk_client; /* RPC client */
|
2016-01-31 05:39:26 +08:00
|
|
|
struct rpc_xprt * tk_xprt; /* Transport */
|
2018-12-03 08:30:30 +08:00
|
|
|
struct rpc_cred * tk_op_cred; /* cred being operated on */
|
2016-01-31 05:39:26 +08:00
|
|
|
|
2015-02-26 03:49:16 +08:00
|
|
|
struct rpc_rqst * tk_rqstp; /* RPC request */
|
|
|
|
|
|
|
|
struct workqueue_struct *tk_workqueue; /* Normally rpciod, but could
|
|
|
|
* be any workqueue
|
|
|
|
*/
|
2010-05-14 00:51:49 +08:00
|
|
|
ktime_t tk_start; /* RPC task init timestamp */
|
2006-03-21 02:44:17 +08:00
|
|
|
|
2007-07-15 03:40:00 +08:00
|
|
|
pid_t tk_owner; /* Process id for batching tasks */
|
2010-05-14 00:51:50 +08:00
|
|
|
unsigned short tk_flags; /* misc flags */
|
|
|
|
unsigned short tk_timeouts; /* maj timeouts */
|
2007-07-15 03:40:00 +08:00
|
|
|
|
2014-11-18 05:58:05 +08:00
|
|
|
#if IS_ENABLED(CONFIG_SUNRPC_DEBUG) || IS_ENABLED(CONFIG_TRACEPOINTS)
|
2005-04-17 06:20:36 +08:00
|
|
|
unsigned short tk_pid; /* debugging aid */
|
|
|
|
#endif
|
2010-05-14 00:51:50 +08:00
|
|
|
unsigned char tk_priority : 2,/* Task priority */
|
|
|
|
tk_garb_retry : 2,
|
2011-06-01 03:15:34 +08:00
|
|
|
tk_cred_retry : 2,
|
|
|
|
tk_rebind_retry : 2;
|
2005-04-17 06:20:36 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef void (*rpc_action)(struct rpc_task *);
|
|
|
|
|
2006-01-03 16:55:04 +08:00
|
|
|
struct rpc_call_ops {
|
2006-01-03 16:55:05 +08:00
|
|
|
void (*rpc_call_prepare)(struct rpc_task *, void *);
|
2006-01-03 16:55:04 +08:00
|
|
|
void (*rpc_call_done)(struct rpc_task *, void *);
|
2012-02-18 02:15:24 +08:00
|
|
|
void (*rpc_count_stats)(struct rpc_task *, void *);
|
2006-01-03 16:55:04 +08:00
|
|
|
void (*rpc_release)(void *);
|
|
|
|
};
|
|
|
|
|
2007-07-15 03:39:59 +08:00
|
|
|
struct rpc_task_setup {
|
2007-10-26 06:42:53 +08:00
|
|
|
struct rpc_task *task;
|
2007-07-15 03:39:59 +08:00
|
|
|
struct rpc_clnt *rpc_client;
|
2016-01-31 07:13:05 +08:00
|
|
|
struct rpc_xprt *rpc_xprt;
|
2018-12-03 08:30:30 +08:00
|
|
|
struct rpc_cred *rpc_op_cred; /* credential being operated on */
|
2007-07-15 03:39:59 +08:00
|
|
|
const struct rpc_message *rpc_message;
|
|
|
|
const struct rpc_call_ops *callback_ops;
|
|
|
|
void *callback_data;
|
2008-02-20 09:04:21 +08:00
|
|
|
struct workqueue_struct *workqueue;
|
2007-07-15 03:39:59 +08:00
|
|
|
unsigned short flags;
|
2007-07-15 03:40:00 +08:00
|
|
|
signed char priority;
|
2007-07-15 03:39:59 +08:00
|
|
|
};
|
2006-01-03 16:55:04 +08:00
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/*
|
|
|
|
* RPC task flags
|
|
|
|
*/
|
|
|
|
#define RPC_TASK_ASYNC 0x0001 /* is an async task */
|
|
|
|
#define RPC_TASK_SWAPPER 0x0002 /* is swapping in/out */
|
2021-06-24 11:28:51 +08:00
|
|
|
#define RPC_TASK_MOVEABLE 0x0004 /* nfs4.1+ rpc tasks */
|
2018-12-03 08:30:30 +08:00
|
|
|
#define RPC_TASK_NULLCREDS 0x0010 /* Use AUTH_NULL credential */
|
2005-04-17 06:20:36 +08:00
|
|
|
#define RPC_CALL_MAJORSEEN 0x0020 /* major timeout seen */
|
|
|
|
#define RPC_TASK_ROOTCREDS 0x0040 /* force root creds */
|
|
|
|
#define RPC_TASK_DYNAMIC 0x0080 /* task was kmalloc'ed */
|
2019-05-30 08:41:28 +08:00
|
|
|
#define RPC_TASK_NO_ROUND_ROBIN 0x0100 /* send requests on "main" xprt */
|
2005-04-17 06:20:36 +08:00
|
|
|
#define RPC_TASK_SOFT 0x0200 /* Use soft timeouts */
|
SUNRPC: Allow RPCs to fail quickly if the server is unreachable
The kernel sometimes makes RPC calls to services that aren't running.
Because the kernel's RPC client always assumes the hard retry semantic
when reconnecting a connection-oriented RPC transport, the underlying
reconnect logic takes a long while to time out, even though the remote
may have responded immediately with ECONNREFUSED.
In certain cases, like upcalls to our local rpcbind daemon, or for NFS
mount requests, we'd like the kernel to fail immediately if the remote
service isn't reachable. This allows another transport to be tried
immediately, or the pending request can be abandoned quickly.
Introduce a per-request flag which controls how call_transmit_status()
behaves when request transmission fails because the server cannot be
reached.
We don't want soft connection semantics to apply to other errors. The
default case of the switch statement in call_transmit_status() no
longer falls through; the fall through code is copied to the default
case, and a "break;" is added.
The transport's connection re-establishment timeout is also ignored for
such requests. We want the request to fail immediately, so the
reconnect delay is skipped. Additionally, we don't want a connect
failure here to further increase the reconnect timeout value, since
this request will not be retried.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
2009-12-04 04:58:56 +08:00
|
|
|
#define RPC_TASK_SOFTCONN 0x0400 /* Fail if can't connect */
|
2011-04-19 03:57:32 +08:00
|
|
|
#define RPC_TASK_SENT 0x0800 /* message was sent */
|
2011-04-25 02:28:45 +08:00
|
|
|
#define RPC_TASK_TIMEOUT 0x1000 /* fail with ETIMEDOUT on timeout */
|
2013-08-06 04:04:47 +08:00
|
|
|
#define RPC_TASK_NOCONNECT 0x2000 /* return ENOTCONN if not connected */
|
2013-09-25 00:00:27 +08:00
|
|
|
#define RPC_TASK_NO_RETRANS_TIMEOUT 0x4000 /* wait forever for a reply */
|
2020-02-08 08:11:12 +08:00
|
|
|
#define RPC_TASK_CRED_NOREF 0x8000 /* No refcount on the credential */
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
#define RPC_IS_ASYNC(t) ((t)->tk_flags & RPC_TASK_ASYNC)
|
|
|
|
#define RPC_IS_SWAPPER(t) ((t)->tk_flags & RPC_TASK_SWAPPER)
|
2011-04-25 02:28:45 +08:00
|
|
|
#define RPC_IS_SOFT(t) ((t)->tk_flags & (RPC_TASK_SOFT|RPC_TASK_TIMEOUT))
|
SUNRPC: Allow RPCs to fail quickly if the server is unreachable
The kernel sometimes makes RPC calls to services that aren't running.
Because the kernel's RPC client always assumes the hard retry semantic
when reconnecting a connection-oriented RPC transport, the underlying
reconnect logic takes a long while to time out, even though the remote
may have responded immediately with ECONNREFUSED.
In certain cases, like upcalls to our local rpcbind daemon, or for NFS
mount requests, we'd like the kernel to fail immediately if the remote
service isn't reachable. This allows another transport to be tried
immediately, or the pending request can be abandoned quickly.
Introduce a per-request flag which controls how call_transmit_status()
behaves when request transmission fails because the server cannot be
reached.
We don't want soft connection semantics to apply to other errors. The
default case of the switch statement in call_transmit_status() no
longer falls through; the fall through code is copied to the default
case, and a "break;" is added.
The transport's connection re-establishment timeout is also ignored for
such requests. We want the request to fail immediately, so the
reconnect delay is skipped. Additionally, we don't want a connect
failure here to further increase the reconnect timeout value, since
this request will not be retried.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
2009-12-04 04:58:56 +08:00
|
|
|
#define RPC_IS_SOFTCONN(t) ((t)->tk_flags & RPC_TASK_SOFTCONN)
|
2011-04-19 03:57:32 +08:00
|
|
|
#define RPC_WAS_SENT(t) ((t)->tk_flags & RPC_TASK_SENT)
|
2021-06-24 11:28:51 +08:00
|
|
|
#define RPC_IS_MOVEABLE(t) ((t)->tk_flags & RPC_TASK_MOVEABLE)
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
#define RPC_TASK_RUNNING 0
|
|
|
|
#define RPC_TASK_QUEUED 1
|
2008-02-26 13:40:50 +08:00
|
|
|
#define RPC_TASK_ACTIVE 2
|
2018-08-28 21:00:27 +08:00
|
|
|
#define RPC_TASK_NEED_XMIT 3
|
|
|
|
#define RPC_TASK_NEED_RECV 4
|
2018-08-07 00:55:34 +08:00
|
|
|
#define RPC_TASK_MSG_PIN_WAIT 5
|
2019-04-08 01:58:44 +08:00
|
|
|
#define RPC_TASK_SIGNALLED 6
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2007-02-21 05:57:45 +08:00
|
|
|
#define RPC_IS_RUNNING(t) test_bit(RPC_TASK_RUNNING, &(t)->tk_runstate)
|
|
|
|
#define rpc_set_running(t) set_bit(RPC_TASK_RUNNING, &(t)->tk_runstate)
|
2005-04-17 06:20:36 +08:00
|
|
|
#define rpc_test_and_set_running(t) \
|
2007-02-21 05:57:45 +08:00
|
|
|
test_and_set_bit(RPC_TASK_RUNNING, &(t)->tk_runstate)
|
2005-04-17 06:20:36 +08:00
|
|
|
#define rpc_clear_running(t) \
|
|
|
|
do { \
|
2014-03-18 01:06:10 +08:00
|
|
|
smp_mb__before_atomic(); \
|
2005-04-17 06:20:36 +08:00
|
|
|
clear_bit(RPC_TASK_RUNNING, &(t)->tk_runstate); \
|
2014-03-18 01:06:10 +08:00
|
|
|
smp_mb__after_atomic(); \
|
2005-04-17 06:20:36 +08:00
|
|
|
} while (0)
|
|
|
|
|
2007-02-21 05:57:45 +08:00
|
|
|
#define RPC_IS_QUEUED(t) test_bit(RPC_TASK_QUEUED, &(t)->tk_runstate)
|
|
|
|
#define rpc_set_queued(t) set_bit(RPC_TASK_QUEUED, &(t)->tk_runstate)
|
2005-04-17 06:20:36 +08:00
|
|
|
#define rpc_clear_queued(t) \
|
|
|
|
do { \
|
2014-03-18 01:06:10 +08:00
|
|
|
smp_mb__before_atomic(); \
|
2005-04-17 06:20:36 +08:00
|
|
|
clear_bit(RPC_TASK_QUEUED, &(t)->tk_runstate); \
|
2014-03-18 01:06:10 +08:00
|
|
|
smp_mb__after_atomic(); \
|
2005-04-17 06:20:36 +08:00
|
|
|
} while (0)
|
|
|
|
|
2007-02-21 05:57:45 +08:00
|
|
|
#define RPC_IS_ACTIVATED(t) test_bit(RPC_TASK_ACTIVE, &(t)->tk_runstate)
|
2006-01-03 16:55:06 +08:00
|
|
|
|
2019-04-08 01:58:44 +08:00
|
|
|
#define RPC_SIGNALLED(t) test_bit(RPC_TASK_SIGNALLED, &(t)->tk_runstate)
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/*
|
|
|
|
* Task priorities.
|
|
|
|
* Note: if you change these, you must also change
|
|
|
|
* the task initialization definitions below.
|
|
|
|
*/
|
2007-07-15 03:40:00 +08:00
|
|
|
#define RPC_PRIORITY_LOW (-1)
|
|
|
|
#define RPC_PRIORITY_NORMAL (0)
|
|
|
|
#define RPC_PRIORITY_HIGH (1)
|
2009-12-15 13:27:55 +08:00
|
|
|
#define RPC_PRIORITY_PRIVILEGED (2)
|
|
|
|
#define RPC_NR_PRIORITY (1 + RPC_PRIORITY_PRIVILEGED - RPC_PRIORITY_LOW)
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2007-07-19 04:18:52 +08:00
|
|
|
struct rpc_timer {
|
|
|
|
struct list_head list;
|
2019-05-01 22:49:27 +08:00
|
|
|
unsigned long expires;
|
|
|
|
struct delayed_work dwork;
|
2007-07-19 04:18:52 +08:00
|
|
|
};
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/*
|
|
|
|
* RPC synchronization objects
|
|
|
|
*/
|
|
|
|
struct rpc_wait_queue {
|
|
|
|
spinlock_t lock;
|
|
|
|
struct list_head tasks[RPC_NR_PRIORITY]; /* task queue for each priority level */
|
|
|
|
unsigned char maxpriority; /* maximum priority (0 if queue is not a priority queue) */
|
|
|
|
unsigned char priority; /* current priority */
|
|
|
|
unsigned char nr; /* # tasks remaining for cookie */
|
2006-03-21 02:44:15 +08:00
|
|
|
unsigned short qlen; /* total # tasks waiting in queue */
|
2007-07-19 04:18:52 +08:00
|
|
|
struct rpc_timer timer_list;
|
2014-11-18 05:58:05 +08:00
|
|
|
#if IS_ENABLED(CONFIG_SUNRPC_DEBUG) || IS_ENABLED(CONFIG_TRACEPOINTS)
|
2005-04-17 06:20:36 +08:00
|
|
|
const char * name;
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This is the # requests to send consecutively
|
|
|
|
* from a single cookie. The aim is to improve
|
|
|
|
* performance of NFS operations such as read/write.
|
|
|
|
*/
|
|
|
|
#define RPC_IS_PRIORITY(q) ((q)->maxpriority > 0)
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Function prototypes
|
|
|
|
*/
|
2007-07-15 03:39:59 +08:00
|
|
|
struct rpc_task *rpc_new_task(const struct rpc_task_setup *);
|
2007-07-15 03:39:59 +08:00
|
|
|
struct rpc_task *rpc_run_task(const struct rpc_task_setup *);
|
2015-06-02 10:59:08 +08:00
|
|
|
struct rpc_task *rpc_run_bc_task(struct rpc_rqst *req);
|
2006-11-12 11:18:03 +08:00
|
|
|
void rpc_put_task(struct rpc_task *);
|
2011-02-22 03:05:41 +08:00
|
|
|
void rpc_put_task_async(struct rpc_task *);
|
2019-04-08 01:58:44 +08:00
|
|
|
void rpc_signal_task(struct rpc_task *);
|
2006-01-03 16:55:03 +08:00
|
|
|
void rpc_exit_task(struct rpc_task *);
|
2010-08-01 02:29:08 +08:00
|
|
|
void rpc_exit(struct rpc_task *, int);
|
2006-10-19 04:01:05 +08:00
|
|
|
void rpc_release_calldata(const struct rpc_call_ops *, void *);
|
2005-04-17 06:20:36 +08:00
|
|
|
void rpc_killall_tasks(struct rpc_clnt *);
|
2007-02-04 05:38:41 +08:00
|
|
|
void rpc_execute(struct rpc_task *);
|
2005-04-17 06:20:36 +08:00
|
|
|
void rpc_init_priority_wait_queue(struct rpc_wait_queue *, const char *);
|
|
|
|
void rpc_init_wait_queue(struct rpc_wait_queue *, const char *);
|
2008-02-23 06:06:55 +08:00
|
|
|
void rpc_destroy_wait_queue(struct rpc_wait_queue *);
|
2019-04-08 01:58:50 +08:00
|
|
|
unsigned long rpc_task_timeout(const struct rpc_task *task);
|
2019-04-08 01:58:49 +08:00
|
|
|
void rpc_sleep_on_timeout(struct rpc_wait_queue *queue,
|
|
|
|
struct rpc_task *task,
|
|
|
|
rpc_action action,
|
|
|
|
unsigned long timeout);
|
2005-04-17 06:20:36 +08:00
|
|
|
void rpc_sleep_on(struct rpc_wait_queue *, struct rpc_task *,
|
2008-02-23 05:34:17 +08:00
|
|
|
rpc_action action);
|
2019-04-08 01:58:49 +08:00
|
|
|
void rpc_sleep_on_priority_timeout(struct rpc_wait_queue *queue,
|
|
|
|
struct rpc_task *task,
|
|
|
|
unsigned long timeout,
|
|
|
|
int priority);
|
2011-07-18 06:11:34 +08:00
|
|
|
void rpc_sleep_on_priority(struct rpc_wait_queue *,
|
|
|
|
struct rpc_task *,
|
|
|
|
int priority);
|
2008-02-23 04:46:41 +08:00
|
|
|
void rpc_wake_up_queued_task(struct rpc_wait_queue *,
|
|
|
|
struct rpc_task *);
|
2018-08-29 21:22:28 +08:00
|
|
|
void rpc_wake_up_queued_task_set_status(struct rpc_wait_queue *,
|
|
|
|
struct rpc_task *,
|
|
|
|
int);
|
2005-04-17 06:20:36 +08:00
|
|
|
void rpc_wake_up(struct rpc_wait_queue *);
|
|
|
|
struct rpc_task *rpc_wake_up_next(struct rpc_wait_queue *);
|
2016-05-28 00:59:33 +08:00
|
|
|
struct rpc_task *rpc_wake_up_first_on_wq(struct workqueue_struct *wq,
|
|
|
|
struct rpc_wait_queue *,
|
|
|
|
bool (*)(struct rpc_task *, void *),
|
|
|
|
void *);
|
2012-01-18 11:57:37 +08:00
|
|
|
struct rpc_task *rpc_wake_up_first(struct rpc_wait_queue *,
|
|
|
|
bool (*)(struct rpc_task *, void *),
|
|
|
|
void *);
|
2005-04-17 06:20:36 +08:00
|
|
|
void rpc_wake_up_status(struct rpc_wait_queue *, int);
|
|
|
|
void rpc_delay(struct rpc_task *, unsigned long);
|
2016-09-15 22:55:20 +08:00
|
|
|
int rpc_malloc(struct rpc_task *);
|
2016-09-15 22:55:29 +08:00
|
|
|
void rpc_free(struct rpc_task *);
|
2005-04-17 06:20:36 +08:00
|
|
|
int rpciod_up(void);
|
|
|
|
void rpciod_down(void);
|
2014-07-07 13:16:04 +08:00
|
|
|
int __rpc_wait_for_completion_task(struct rpc_task *task, wait_bit_action_f *);
|
2014-11-18 05:58:04 +08:00
|
|
|
#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
|
2012-01-13 02:07:51 +08:00
|
|
|
struct net;
|
|
|
|
void rpc_show_tasks(struct net *);
|
2005-04-17 06:20:36 +08:00
|
|
|
#endif
|
|
|
|
int rpc_init_mempool(void);
|
|
|
|
void rpc_destroy_mempool(void);
|
2006-03-21 02:44:08 +08:00
|
|
|
extern struct workqueue_struct *rpciod_workqueue;
|
2016-05-27 22:39:50 +08:00
|
|
|
extern struct workqueue_struct *xprtiod_workqueue;
|
2009-04-01 21:22:40 +08:00
|
|
|
void rpc_prepare_task(struct rpc_task *task);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2006-01-03 16:55:06 +08:00
|
|
|
static inline int rpc_wait_for_completion_task(struct rpc_task *task)
|
|
|
|
{
|
|
|
|
return __rpc_wait_for_completion_task(task, NULL);
|
|
|
|
}
|
|
|
|
|
2014-11-18 05:58:05 +08:00
|
|
|
#if IS_ENABLED(CONFIG_SUNRPC_DEBUG) || IS_ENABLED(CONFIG_TRACEPOINTS)
|
2012-01-21 03:52:23 +08:00
|
|
|
static inline const char * rpc_qname(const struct rpc_wait_queue *q)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
|
|
|
return ((q && q->name) ? q->name : "unknown");
|
|
|
|
}
|
2012-02-09 11:01:15 +08:00
|
|
|
|
|
|
|
static inline void rpc_assign_waitqueue_name(struct rpc_wait_queue *q,
|
|
|
|
const char *name)
|
|
|
|
{
|
|
|
|
q->name = name;
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
static inline void rpc_assign_waitqueue_name(struct rpc_wait_queue *q,
|
|
|
|
const char *name)
|
|
|
|
{
|
|
|
|
}
|
2005-04-17 06:20:36 +08:00
|
|
|
#endif
|
|
|
|
|
2015-06-04 04:14:25 +08:00
|
|
|
#if IS_ENABLED(CONFIG_SUNRPC_SWAP)
|
|
|
|
int rpc_clnt_swap_activate(struct rpc_clnt *clnt);
|
|
|
|
void rpc_clnt_swap_deactivate(struct rpc_clnt *clnt);
|
|
|
|
#else
|
|
|
|
static inline int
|
|
|
|
rpc_clnt_swap_activate(struct rpc_clnt *clnt)
|
|
|
|
{
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
rpc_clnt_swap_deactivate(struct rpc_clnt *clnt)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
#endif /* CONFIG_SUNRPC_SWAP */
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
#endif /* _LINUX_SUNRPC_SCHED_H_ */
|