]> git.ipfire.org Git - thirdparty/kernel/stable.git/log
thirdparty/kernel/stable.git
17 months agoinotify: Increase default inotify.max_user_watches limit to 1048576
Waiman Long [Mon, 9 Nov 2020 03:59:31 +0000 (22:59 -0500)] 
inotify: Increase default inotify.max_user_watches limit to 1048576

[ Upstream commit 92890123749bafc317bbfacbe0a62ce08d78efb7 ]

The default value of inotify.max_user_watches sysctl parameter was set
to 8192 since the introduction of the inotify feature in 2005 by
commit 0eeca28300df ("[PATCH] inotify"). Today this value is just too
small for many modern usage. As a result, users have to explicitly set
it to a larger value to make it work.

After some searching around the web, these are the
inotify.max_user_watches values used by some projects:
 - vscode:  524288
 - dropbox support: 100000
 - users on stackexchange: 12228
 - lsyncd user: 2000000
 - code42 support: 1048576
 - monodevelop: 16384
 - tectonic: 524288
 - openshift origin: 65536

Each watch point adds an inotify_inode_mark structure to an inode to
be watched. It also pins the watched inode.

Modeled after the epoll.max_user_watches behavior to adjust the default
value according to the amount of addressable memory available, make
inotify.max_user_watches behave in a similar way to make it use no more
than 1% of addressable memory within the range [8192, 1048576].

We estimate the amount of memory used by inotify mark to size of
inotify_inode_mark plus two times the size of struct inode (we double
the inode size to cover the additional filesystem private inode part).
That means that a 64-bit system with 128GB or more memory will likely
have the maximum value of 1048576 for inotify.max_user_watches. This
default should be big enough for most use cases.

Link: https://lore.kernel.org/r/20201109035931.4740-1-longman@redhat.com
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Waiman Long <longman@redhat.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agofile: Replace ksys_close with close_fd
Eric W. Biederman [Fri, 20 Nov 2020 23:14:39 +0000 (17:14 -0600)] 
file: Replace ksys_close with close_fd

[ Upstream commit 1572bfdf21d4d50e51941498ffe0b56c2289f783 ]

Now that ksys_close is exactly identical to close_fd replace
the one caller of ksys_close with close_fd.

[1] https://lkml.kernel.org/r/20200818112020.GA17080@infradead.org
Suggested-by: Christoph Hellwig <hch@infradead.org>
Link: https://lkml.kernel.org/r/20201120231441.29911-22-ebiederm@xmission.com
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agofile: Rename __close_fd to close_fd and remove the files parameter
Eric W. Biederman [Fri, 20 Nov 2020 23:14:38 +0000 (17:14 -0600)] 
file: Rename __close_fd to close_fd and remove the files parameter

[ Upstream commit 8760c909f54a82aaa6e76da19afe798a0c77c3c3 ]

The function __close_fd was added to support binder[1].  Now that
binder has been fixed to no longer need __close_fd[2] all calls
to __close_fd pass current->files.

Therefore transform the files parameter into a local variable
initialized to current->files, and rename __close_fd to close_fd to
reflect this change, and keep it in sync with the similar changes to
__alloc_fd, and __fd_install.

This removes the need for callers to care about the extra care that
needs to be take if anything except current->files is passed, by
limiting the callers to only operation on current->files.

[1] 483ce1d4b8c3 ("take descriptor-related part of close() to file.c")
[2] 44d8047f1d87 ("binder: use standard functions to allocate fds")
Acked-by: Christian Brauner <christian.brauner@ubuntu.com>
v1: https://lkml.kernel.org/r/20200817220425.9389-17-ebiederm@xmission.com
Link: https://lkml.kernel.org/r/20201120231441.29911-21-ebiederm@xmission.com
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agofile: Merge __alloc_fd into alloc_fd
Eric W. Biederman [Fri, 20 Nov 2020 23:14:37 +0000 (17:14 -0600)] 
file: Merge __alloc_fd into alloc_fd

[ Upstream commit aa384d10f3d06d4b85597ff5df41551262220e16 ]

The function __alloc_fd was added to support binder[1].  With binder
fixed[2] there are no more users.

As alloc_fd just calls __alloc_fd with "files=current->files",
merge them together by transforming the files parameter into a
local variable initialized to current->files.

[1] dcfadfa4ec5a ("new helper: __alloc_fd()")
[2] 44d8047f1d87 ("binder: use standard functions to allocate fds")
Acked-by: Christian Brauner <christian.brauner@ubuntu.com>
v1: https://lkml.kernel.org/r/20200817220425.9389-16-ebiederm@xmission.com
Link: https://lkml.kernel.org/r/20201120231441.29911-20-ebiederm@xmission.com
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agofile: In f_dupfd read RLIMIT_NOFILE once.
Eric W. Biederman [Fri, 20 Nov 2020 23:14:36 +0000 (17:14 -0600)] 
file: In f_dupfd read RLIMIT_NOFILE once.

Simplify the code, and remove the chance of races by reading
RLIMIT_NOFILE only once in f_dupfd.

Pass the read value of RLIMIT_NOFILE into alloc_fd which is the other
location the rlimit was read in f_dupfd.  As f_dupfd is the only
caller of alloc_fd this changing alloc_fd is trivially safe.

Further this causes alloc_fd to take all of the same arguments as
__alloc_fd except for the files_struct argument.

Acked-by: Christian Brauner <christian.brauner@ubuntu.com>
v1: https://lkml.kernel.org/r/20200817220425.9389-15-ebiederm@xmission.com
Link: https://lkml.kernel.org/r/20201120231441.29911-19-ebiederm@xmission.com
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agofile: Merge __fd_install into fd_install
Eric W. Biederman [Fri, 20 Nov 2020 23:14:35 +0000 (17:14 -0600)] 
file: Merge __fd_install into fd_install

[ Upstream commit d74ba04d919ebe30bf47406819c18c6b50003d92 ]

The function __fd_install was added to support binder[1].  With binder
fixed[2] there are no more users.

As fd_install just calls __fd_install with "files=current->files",
merge them together by transforming the files parameter into a
local variable initialized to current->files.

[1] f869e8a7f753 ("expose a low-level variant of fd_install() for binder")
[2] 44d8047f1d87 ("binder: use standard functions to allocate fds")
Acked-by: Christian Brauner <christian.brauner@ubuntu.com>
v1: https://lkml.kernel.org/r/20200817220425.9389-14-ebiederm@xmission.com
Link: https://lkml.kernel.org/r/20201120231441.29911-18-ebiederm@xmission.com
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agoproc/fd: In fdinfo seq_show don't use get_files_struct
Eric W. Biederman [Fri, 20 Nov 2020 23:14:34 +0000 (17:14 -0600)] 
proc/fd: In fdinfo seq_show don't use get_files_struct

[ Upstream commit 775e0656b27210ae668e33af00bece858f44576f ]

When discussing[1] exec and posix file locks it was realized that none
of the callers of get_files_struct fundamentally needed to call
get_files_struct, and that by switching them to helper functions
instead it will both simplify their code and remove unnecessary
increments of files_struct.count.  Those unnecessary increments can
result in exec unnecessarily unsharing files_struct which breaking
posix locks, and it can result in fget_light having to fallback to
fget reducing system performance.

Instead hold task_lock for the duration that task->files needs to be
stable in seq_show.  The task_lock was already taken in
get_files_struct, and so skipping get_files_struct performs less work
overall, and avoids the problems with the files_struct reference
count.

[1] https://lkml.kernel.org/r/20180915160423.GA31461@redhat.com
Suggested-by: Oleg Nesterov <oleg@redhat.com>
Acked-by: Christian Brauner <christian.brauner@ubuntu.com>
v1: https://lkml.kernel.org/r/20200817220425.9389-12-ebiederm@xmission.com
Link: https://lkml.kernel.org/r/20201120231441.29911-17-ebiederm@xmission.com
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agoproc/fd: In proc_readfd_common use task_lookup_next_fd_rcu
Eric W. Biederman [Fri, 20 Nov 2020 23:14:32 +0000 (17:14 -0600)] 
proc/fd: In proc_readfd_common use task_lookup_next_fd_rcu

[ Upstream commit 5b17b61870e2f4b0a4fdc5c6039fbdb4ffb796df ]

When discussing[1] exec and posix file locks it was realized that none
of the callers of get_files_struct fundamentally needed to call
get_files_struct, and that by switching them to helper functions
instead it will both simplify their code and remove unnecessary
increments of files_struct.count.  Those unnecessary increments can
result in exec unnecessarily unsharing files_struct which breaking
posix locks, and it can result in fget_light having to fallback to
fget reducing system performance.

Using task_lookup_next_fd_rcu simplifies proc_readfd_common, by moving
the checking for the maximum file descritor into the generic code, and
by remvoing the need for capturing and releasing a reference on
files_struct.

As task_lookup_fd_rcu may update the fd ctx->pos has been changed
to be the fd +2 after task_lookup_fd_rcu returns.

[1] https://lkml.kernel.org/r/20180915160423.GA31461@redhat.com
Suggested-by: Oleg Nesterov <oleg@redhat.com>
Tested-by: Andy Lavr <andy.lavr@gmail.com>
v1: https://lkml.kernel.org/r/20200817220425.9389-10-ebiederm@xmission.com
Link: https://lkml.kernel.org/r/20201120231441.29911-15-ebiederm@xmission.com
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agofile: Implement task_lookup_next_fd_rcu
Eric W. Biederman [Fri, 20 Nov 2020 23:14:31 +0000 (17:14 -0600)] 
file: Implement task_lookup_next_fd_rcu

[ Upstream commit e9a53aeb5e0a838f10fcea74235664e7ad5e6e1a ]

As a companion to fget_task and task_lookup_fd_rcu implement
task_lookup_next_fd_rcu that will return the struct file for the first
file descriptor number that is equal or greater than the fd argument
value, or NULL if there is no such struct file.

This allows file descriptors of foreign processes to be iterated
through safely, without needed to increment the count on files_struct.

Some concern[1] has been expressed that this function takes the task_lock
for each iteration and thus for each file descriptor.  This place
where this function will be called in a commonly used code path is for
listing /proc/<pid>/fd.  I did some small benchmarks and did not see
any measurable performance differences.  For ordinary users ls is
likely to stat each of the directory entries and tid_fd_mode called
from tid_fd_revalidae has always taken the task lock for each file
descriptor.  So this does not look like it will be a big change in
practice.

At some point is will probably be worth changing put_files_struct to
free files_struct after an rcu grace period so that task_lock won't be
needed at all.

[1] https://lkml.kernel.org/r/20200817220425.9389-10-ebiederm@xmission.com
v1: https://lkml.kernel.org/r/20200817220425.9389-9-ebiederm@xmission.com
Link: https://lkml.kernel.org/r/20201120231441.29911-14-ebiederm@xmission.com
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agokcmp: In get_file_raw_ptr use task_lookup_fd_rcu
Eric W. Biederman [Fri, 20 Nov 2020 23:14:30 +0000 (17:14 -0600)] 
kcmp: In get_file_raw_ptr use task_lookup_fd_rcu

[ Upstream commit ed77e80e14a3cd55c73848b9e8043020e717ce12 ]

Modify get_file_raw_ptr to use task_lookup_fd_rcu.  The helper
task_lookup_fd_rcu does the work of taking the task lock and verifying
that task->files != NULL and then calls files_lookup_fd_rcu.  So let
use the helper to make a simpler implementation of get_file_raw_ptr.

Acked-by: Cyrill Gorcunov <gorcunov@gmail.com>
Link: https://lkml.kernel.org/r/20201120231441.29911-13-ebiederm@xmission.com
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agoproc/fd: In tid_fd_mode use task_lookup_fd_rcu
Eric W. Biederman [Fri, 20 Nov 2020 23:14:29 +0000 (17:14 -0600)] 
proc/fd: In tid_fd_mode use task_lookup_fd_rcu

[ Upstream commit 64eb661fda0269276b4c46965832938e3f268268 ]

When discussing[1] exec and posix file locks it was realized that none
of the callers of get_files_struct fundamentally needed to call
get_files_struct, and that by switching them to helper functions
instead it will both simplify their code and remove unnecessary
increments of files_struct.count.  Those unnecessary increments can
result in exec unnecessarily unsharing files_struct which breaking
posix locks, and it can result in fget_light having to fallback to
fget reducing system performance.

Instead of manually coding finding the files struct for a task and
then calling files_lookup_fd_rcu, use the helper task_lookup_fd_rcu
that combines those to steps.   Making the code simpler and removing
the need to get a reference on a files_struct.

[1] https://lkml.kernel.org/r/20180915160423.GA31461@redhat.com
Suggested-by: Oleg Nesterov <oleg@redhat.com>
Acked-by: Christian Brauner <christian.brauner@ubuntu.com>
v1: https://lkml.kernel.org/r/20200817220425.9389-7-ebiederm@xmission.com
Link: https://lkml.kernel.org/r/20201120231441.29911-12-ebiederm@xmission.com
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agofile: Implement task_lookup_fd_rcu
Eric W. Biederman [Fri, 20 Nov 2020 23:14:28 +0000 (17:14 -0600)] 
file: Implement task_lookup_fd_rcu

[ Upstream commit 3a879fb38082125cc0d8aa89b70c7f3a7cdf584b ]

As a companion to lookup_fd_rcu implement task_lookup_fd_rcu for
querying an arbitrary process about a specific file.

Acked-by: Christian Brauner <christian.brauner@ubuntu.com>
v1: https://lkml.kernel.org/r/20200818103713.aw46m7vprsy4vlve@wittgenstein
Link: https://lkml.kernel.org/r/20201120231441.29911-11-ebiederm@xmission.com
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agofile: Rename fcheck lookup_fd_rcu
Eric W. Biederman [Fri, 20 Nov 2020 23:14:27 +0000 (17:14 -0600)] 
file: Rename fcheck lookup_fd_rcu

[ Upstream commit 460b4f812a9d473d4b39d87d37844f9fc30a9eb3 ]

Also remove the confusing comment about checking if a fd exists.  I
could not find one instance in the entire kernel that still matches
the description or the reason for the name fcheck.

The need for better names became apparent in the last round of
discussion of this set of changes[1].

[1] https://lkml.kernel.org/r/CAHk-=wj8BQbgJFLa+J0e=iT-1qpmCRTbPAJ8gd6MJQ=kbRPqyQ@mail.gmail.com
Link: https://lkml.kernel.org/r/20201120231441.29911-10-ebiederm@xmission.com
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agofile: Replace fcheck_files with files_lookup_fd_rcu
Eric W. Biederman [Fri, 20 Nov 2020 23:14:26 +0000 (17:14 -0600)] 
file: Replace fcheck_files with files_lookup_fd_rcu

[ Upstream commit f36c2943274199cb8aef32ac96531ffb7c4b43d0 ]

This change renames fcheck_files to files_lookup_fd_rcu.  All of the
remaining callers take the rcu_read_lock before calling this function
so the _rcu suffix is appropriate.  This change also tightens up the
debug check to verify that all callers hold the rcu_read_lock.

All callers that used to call files_check with the files->file_lock
held have now been changed to call files_lookup_fd_locked.

This change of name has helped remind me of which locks and which
guarantees are in place helping me to catch bugs later in the
patchset.

The need for better names became apparent in the last round of
discussion of this set of changes[1].

[1] https://lkml.kernel.org/r/CAHk-=wj8BQbgJFLa+J0e=iT-1qpmCRTbPAJ8gd6MJQ=kbRPqyQ@mail.gmail.com
Link: https://lkml.kernel.org/r/20201120231441.29911-9-ebiederm@xmission.com
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agofile: Factor files_lookup_fd_locked out of fcheck_files
Eric W. Biederman [Fri, 20 Nov 2020 23:14:25 +0000 (17:14 -0600)] 
file: Factor files_lookup_fd_locked out of fcheck_files

[ Upstream commit 120ce2b0cd52abe73e8b16c23461eb14df5a87d8 ]

To make it easy to tell where files->file_lock protection is being
used when looking up a file create files_lookup_fd_locked.  Only allow
this function to be called with the file_lock held.

Update the callers of fcheck and fcheck_files that are called with the
files->file_lock held to call files_lookup_fd_locked instead.

Hopefully this makes it easier to quickly understand what is going on.

The need for better names became apparent in the last round of
discussion of this set of changes[1].

[1] https://lkml.kernel.org/r/CAHk-=wj8BQbgJFLa+J0e=iT-1qpmCRTbPAJ8gd6MJQ=kbRPqyQ@mail.gmail.com
Link: https://lkml.kernel.org/r/20201120231441.29911-8-ebiederm@xmission.com
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agofile: Rename __fcheck_files to files_lookup_fd_raw
Eric W. Biederman [Thu, 10 Dec 2020 18:39:54 +0000 (12:39 -0600)] 
file: Rename __fcheck_files to files_lookup_fd_raw

[ Upstream commit bebf684bf330915e6c96313ad7db89a5480fc9c2 ]

The function fcheck despite it's comment is poorly named
as it has no callers that only check it's return value.
All of fcheck's callers use the returned file descriptor.
The same is true for fcheck_files and __fcheck_files.

A new less confusing name is needed.  In addition the names
of these functions are confusing as they do not report
the kind of locks that are needed to be held when these
functions are called making error prone to use them.

To remedy this I am making the base functio name lookup_fd
and will and prefixes and sufficies to indicate the rest
of the context.

Name the function (previously called __fcheck_files) that proceeds
from a struct files_struct, looks up the struct file of a file
descriptor, and requires it's callers to verify all of the appropriate
locks are held files_lookup_fd_raw.

The need for better names became apparent in the last round of
discussion of this set of changes[1].

[1] https://lkml.kernel.org/r/CAHk-=wj8BQbgJFLa+J0e=iT-1qpmCRTbPAJ8gd6MJQ=kbRPqyQ@mail.gmail.com
Link: https://lkml.kernel.org/r/20201120231441.29911-7-ebiederm@xmission.com
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
[ cel: adjusted to apply to v5.10.y ]
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agoRevert "fget: clarify and improve __fget_files() implementation"
Chuck Lever [Thu, 29 Feb 2024 23:19:36 +0000 (18:19 -0500)] 
Revert "fget: clarify and improve __fget_files() implementation"

Temporarily revert commit 0849f83e4782 ("fget: clarify and improve
__fget_files() implementation") to enable subsequent upstream
commits to apply and build cleanly.

Stable-dep-of: bebf684bf330 ("file: Rename __fcheck_files to files_lookup_fd_raw")
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agoproc/fd: In proc_fd_link use fget_task
Eric W. Biederman [Fri, 20 Nov 2020 23:14:23 +0000 (17:14 -0600)] 
proc/fd: In proc_fd_link use fget_task

[ Upstream commit 439be32656035d3239fd56f9b83353ec06cb3b45 ]

When discussing[1] exec and posix file locks it was realized that none
of the callers of get_files_struct fundamentally needed to call
get_files_struct, and that by switching them to helper functions
instead it will both simplify their code and remove unnecessary
increments of files_struct.count.  Those unnecessary increments can
result in exec unnecessarily unsharing files_struct which breaking
posix locks, and it can result in fget_light having to fallback to
fget reducing system performance.

Simplifying proc_fd_link is a little bit tricky.  It is necessary to
know that there is a reference to fd_f  ile while path_get is running.
This reference can either be guaranteed to exist either by locking the
fdtable as the code currently does or by taking a reference on the
file in question.

Use fget_task to remove the need for get_files_struct and
to take a reference to file in question.

[1] https://lkml.kernel.org/r/20180915160423.GA31461@redhat.com
Suggested-by: Oleg Nesterov <oleg@redhat.com>
v1: https://lkml.kernel.org/r/20200817220425.9389-8-ebiederm@xmission.com
Link: https://lkml.kernel.org/r/20201120231441.29911-6-ebiederm@xmission.com
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agobpf: In bpf_task_fd_query use fget_task
Eric W. Biederman [Fri, 20 Nov 2020 23:14:22 +0000 (17:14 -0600)] 
bpf: In bpf_task_fd_query use fget_task

[ Upstream commit b48845af0152d790a54b8ab78cc2b7c07485fc98 ]

Use the helper fget_task to simplify bpf_task_fd_query.

As well as simplifying the code this removes one unnecessary increment of
struct files_struct.  This unnecessary increment of files_struct.count can
result in exec unnecessarily unsharing files_struct and breaking posix
locks, and it can result in fget_light having to fallback to fget reducing
performance.

This simplification comes from the observation that none of the
callers of get_files_struct actually need to call get_files_struct
that was made when discussing[1] exec and posix file locks.

[1] https://lkml.kernel.org/r/20180915160423.GA31461@redhat.com
Suggested-by: Oleg Nesterov <oleg@redhat.com>
v1: https://lkml.kernel.org/r/20200817220425.9389-5-ebiederm@xmission.com
Link: https://lkml.kernel.org/r/20201120231441.29911-5-ebiederm@xmission.com
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agokcmp: In kcmp_epoll_target use fget_task
Eric W. Biederman [Fri, 20 Nov 2020 23:14:21 +0000 (17:14 -0600)] 
kcmp: In kcmp_epoll_target use fget_task

[ Upstream commit f43c283a89a7dc531a47d4b1e001503cf3dc3234 ]

Use the helper fget_task and simplify the code.

As well as simplifying the code this removes one unnecessary increment of
struct files_struct.  This unnecessary increment of files_struct.count can
result in exec unnecessarily unsharing files_struct and breaking posix
locks, and it can result in fget_light having to fallback to fget reducing
performance.

Suggested-by: Oleg Nesterov <oleg@redhat.com>
Reviewed-by: Cyrill Gorcunov <gorcunov@gmail.com>
v1: https://lkml.kernel.org/r/20200817220425.9389-4-ebiederm@xmission.com
Link: https://lkml.kernel.org/r/20201120231441.29911-4-ebiederm@xmission.com
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agoexec: Remove reset_files_struct
Eric W. Biederman [Fri, 20 Nov 2020 23:14:20 +0000 (17:14 -0600)] 
exec: Remove reset_files_struct

[ Upstream commit 950db38ff2c01b7aabbd7ab4a50b7992750fa63d ]

Now that exec no longer needs to restore the previous value of current->files
on error there are no more callers of reset_files_struct so remove it.

Acked-by: Christian Brauner <christian.brauner@ubuntu.com>
v1: https://lkml.kernel.org/r/20200817220425.9389-3-ebiederm@xmission.com
Link: https://lkml.kernel.org/r/20201120231441.29911-3-ebiederm@xmission.com
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agoexec: Simplify unshare_files
Eric W. Biederman [Fri, 20 Nov 2020 23:14:19 +0000 (17:14 -0600)] 
exec: Simplify unshare_files

[ Upstream commit 1f702603e7125a390b5cdf5ce00539781cfcc86a ]

Now that exec no longer needs to return the unshared files to their
previous value there is no reason to return displaced.

Instead when unshare_fd creates a copy of the file table, call
put_files_struct before returning from unshare_files.

Acked-by: Christian Brauner <christian.brauner@ubuntu.com>
v1: https://lkml.kernel.org/r/20200817220425.9389-2-ebiederm@xmission.com
Link: https://lkml.kernel.org/r/20201120231441.29911-2-ebiederm@xmission.com
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agoexec: Move unshare_files to fix posix file locking during exec
Eric W. Biederman [Fri, 20 Nov 2020 23:14:18 +0000 (17:14 -0600)] 
exec: Move unshare_files to fix posix file locking during exec

[ Upstream commit b6043501289ebf169ae19b810a882d517377302f ]

Many moons ago the binfmts were doing some very questionable things
with file descriptors and an unsharing of the file descriptor table
was added to make things better[1][2].  The helper steal_lockss was
added to avoid breaking the userspace programs[3][4][6].

Unfortunately it turned out that steal_locks did not work for network
file systems[5], so it was removed to see if anyone would
complain[7][8].  It was thought at the time that NPTL would not be
affected as the unshare_files happened after the other threads were
killed[8].  Unfortunately because there was an unshare_files in
binfmt_elf.c before the threads were killed this analysis was
incorrect.

This unshare_files in binfmt_elf.c resulted in the unshares_files
happening whenever threads were present.  Which led to unshare_files
being moved to the start of do_execve[9].

Later the problems were rediscovered and the suggested approach was to
readd steal_locks under a different name[10].  I happened to be
reviewing patches and I noticed that this approach was a step
backwards[11].

I proposed simply moving unshare_files[12] and it was pointed
out that moving unshare_files without auditing the code was
also unsafe[13].

There were then several attempts to solve this[14][15][16] and I even
posted this set of changes[17].  Unfortunately because auditing all of
execve is time consuming this change did not make it in at the time.

Well now that I am cleaning up exec I have made the time to read
through all of the binfmts and the only playing with file descriptors
is either the security modules closing them in
security_bprm_committing_creds or is in the generic code in fs/exec.c.
None of it happens before begin_new_exec is called.

So move unshare_files into begin_new_exec, after the point of no
return.  If memory is very very very low and the application calling
exec is sharing file descriptor tables between processes we might fail
past the point of no return.  Which is unfortunate but no different
than any of the other places where we allocate memory after the point
of no return.

This movement allows another process that shares the file table, or
another thread of the same process and that closes files or changes
their close on exec behavior and races with execve to cause some
unexpected things to happen.  There is only one time of check to time
of use race and it is just there so that execve fails instead of
an interpreter failing when it tries to open the file it is supposed
to be interpreting.   Failing later if userspace is being silly is
not a problem.

With this change it the following discription from the removal
of steal_locks[8] finally becomes true.

    Apps using NPTL are not affected, since all other threads are killed before
    execve.

    Apps using LinuxThreads are only affected if they

      - have multiple threads during exec (LinuxThreads doesn't kill other
        threads, the app may do it with pthread_kill_other_threads_np())
      - rely on POSIX locks being inherited across exec

    Both conditions are documented, but not their interaction.

    Apps using clone() natively are affected if they

      - use clone(CLONE_FILES)
      - rely on POSIX locks being inherited across exec

I have investigated some paths to make it possible to solve this
without moving unshare_files but they all look more complicated[18].

Reported-by: Daniel P. Berrangé <berrange@redhat.com>
Reported-by: Jeff Layton <jlayton@redhat.com>
History-tree: git://git.kernel.org/pub/scm/linux/kernel/git/tglx/history.git
[1] 02cda956de0b ("[PATCH] unshare_files"
[2] 04e9bcb4d106 ("[PATCH] use new unshare_files helper")
[3] 088f5d7244de ("[PATCH] add steal_locks helper")
[4] 02c541ec8ffa ("[PATCH] use new steal_locks helper")
[5] https://lkml.kernel.org/r/E1FLIlF-0007zR-00@dorka.pomaz.szeredi.hu
[6] https://lkml.kernel.org/r/0060321191605.GB15997@sorel.sous-sol.org
[7] https://lkml.kernel.org/r/E1FLwjC-0000kJ-00@dorka.pomaz.szeredi.hu
[8] c89681ed7d0e ("[PATCH] remove steal_locks()")
[9] fd8328be874f ("[PATCH] sanitize handling of shared descriptor tables in failing execve()")
[10] https://lkml.kernel.org/r/20180317142520.30520-1-jlayton@kernel.org
[11] https://lkml.kernel.org/r/87r2nwqk73.fsf@xmission.com
[12] https://lkml.kernel.org/r/87bmfgvg8w.fsf@xmission.com
[13] https://lkml.kernel.org/r/20180322111424.GE30522@ZenIV.linux.org.uk
[14] https://lkml.kernel.org/r/20180827174722.3723-1-jlayton@kernel.org
[15] https://lkml.kernel.org/r/20180830172423.21964-1-jlayton@kernel.org
[16] https://lkml.kernel.org/r/20180914105310.6454-1-jlayton@kernel.org
[17] https://lkml.kernel.org/r/87a7ohs5ow.fsf@xmission.com
[18] https://lkml.kernel.org/r/87pn8c1uj6.fsf_-_@x220.int.ebiederm.org
Acked-by: Christian Brauner <christian.brauner@ubuntu.com>
v1: https://lkml.kernel.org/r/20200817220425.9389-1-ebiederm@xmission.com
Link: https://lkml.kernel.org/r/20201120231441.29911-1-ebiederm@xmission.com
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agoexec: Don't open code get_close_on_exec
Eric W. Biederman [Wed, 9 Dec 2020 21:42:57 +0000 (15:42 -0600)] 
exec: Don't open code get_close_on_exec

[ Upstream commit 878f12dbb8f514799d126544d59be4d2675caac3 ]

Al Viro pointed out that using the phrase "close_on_exec(fd,
rcu_dereference_raw(current->files->fdt))" instead of wrapping it in
rcu_read_lock(), rcu_read_unlock() is a very questionable
optimization[1].

Once wrapped with rcu_read_lock()/rcu_read_unlock() that phrase
becomes equivalent the helper function get_close_on_exec so
simplify the code and make it more robust by simply using
get_close_on_exec.

[1] https://lkml.kernel.org/r/20201207222214.GA4115853@ZenIV.linux.org.uk
Suggested-by: Al Viro <viro@ftp.linux.org.uk>
Link: https://lkml.kernel.org/r/87k0tqr6zi.fsf_-_@x220.int.ebiederm.org
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agonfsd: Record NFSv4 pre/post-op attributes as non-atomic
Trond Myklebust [Tue, 1 Dec 2020 04:14:27 +0000 (23:14 -0500)] 
nfsd: Record NFSv4 pre/post-op attributes as non-atomic

[ Upstream commit 716a8bc7f706eeef80ab42c99d9f210eda845c81 ]

For the case of NFSv4, specify to the client that the pre/post-op
attributes were not recorded atomically with the main operation.

Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agonfsd: Set PF_LOCAL_THROTTLE on local filesystems only
Trond Myklebust [Mon, 30 Nov 2020 22:03:19 +0000 (17:03 -0500)] 
nfsd: Set PF_LOCAL_THROTTLE on local filesystems only

[ Upstream commit 01cbf3853959feec40ec9b9a399e12a021cd4d81 ]

Don't set PF_LOCAL_THROTTLE on remote filesystems like NFS, since they
aren't expected to ever be subject to double buffering.

Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agonfsd: Fix up nfsd to ensure that timeout errors don't result in ESTALE
Trond Myklebust [Mon, 30 Nov 2020 22:03:18 +0000 (17:03 -0500)] 
nfsd: Fix up nfsd to ensure that timeout errors don't result in ESTALE

[ Upstream commit 2e19d10c1438241de32467637a2a411971547991 ]

If the underlying filesystem times out, then we want knfsd to return
NFSERR_JUKEBOX/DELAY rather than NFSERR_STALE.

Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agoexportfs: Add a function to return the raw output from fh_to_dentry()
Trond Myklebust [Mon, 30 Nov 2020 22:03:17 +0000 (17:03 -0500)] 
exportfs: Add a function to return the raw output from fh_to_dentry()

[ Upstream commit d045465fc6cbfa4acfb5a7d817a7c1a57a078109 ]

In order to allow nfsd to accept return values that are not
acceptable to overlayfs and others, add a new function.

Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agonfsd: close cached files prior to a REMOVE or RENAME that would replace target
Jeff Layton [Mon, 30 Nov 2020 22:03:16 +0000 (17:03 -0500)] 
nfsd: close cached files prior to a REMOVE or RENAME that would replace target

[ Upstream commit 7f84b488f9add1d5cca3e6197c95914c7bd3c1cf ]

It's not uncommon for some workloads to do a bunch of I/O to a file and
delete it just afterward. If knfsd has a cached open file however, then
the file may still be open when the dentry is unlinked. If the
underlying filesystem is nfs, then that could trigger it to do a
sillyrename.

On a REMOVE or RENAME scan the nfsd_file cache for open files that
correspond to the inode, and proactively unhash and put their
references. This should prevent any delete-on-last-close activity from
occurring, solely due to knfsd's open file cache.

This must be done synchronously though so we use the variants that call
flush_delayed_fput. There are deadlock possibilities if you call
flush_delayed_fput while holding locks, however. In the case of
nfsd_rename, we don't even do the lookups of the dentries to be renamed
until we've locked for rename.

Once we've figured out what the target dentry is for a rename, check to
see whether there are cached open files associated with it. If there
are, then unwind all of the locking, close them all, and then reattempt
the rename.

None of this is really necessary for "typical" filesystems though. It's
mostly of use for NFS, so declare a new export op flag and use that to
determine whether to close the files beforehand.

Signed-off-by: Jeff Layton <jeff.layton@primarydata.com>
Signed-off-by: Lance Shelton <lance.shelton@hammerspace.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
[ cel: adjusted to apply to 5.10.y ]
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agonfsd: allow filesystems to opt out of subtree checking
Jeff Layton [Mon, 30 Nov 2020 22:03:15 +0000 (17:03 -0500)] 
nfsd: allow filesystems to opt out of subtree checking

[ Upstream commit ba5e8187c55555519ae0b63c0fb681391bc42af9 ]

When we start allowing NFS to be reexported, then we have some problems
when it comes to subtree checking. In principle, we could allow it, but
it would mean encoding parent info in the filehandles and there may not
be enough space for that in a NFSv3 filehandle.

To enforce this at export upcall time, we add a new export_ops flag
that declares the filesystem ineligible for subtree checking.

Signed-off-by: Jeff Layton <jeff.layton@primarydata.com>
Signed-off-by: Lance Shelton <lance.shelton@hammerspace.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agonfsd: add a new EXPORT_OP_NOWCC flag to struct export_operations
Jeff Layton [Mon, 30 Nov 2020 22:03:14 +0000 (17:03 -0500)] 
nfsd: add a new EXPORT_OP_NOWCC flag to struct export_operations

[ Upstream commit daab110e47f8d7aa6da66923e3ac1a8dbd2b2a72 ]

With NFSv3 nfsd will always attempt to send along WCC data to the
client. This generally involves saving off the in-core inode information
prior to doing the operation on the given filehandle, and then issuing a
vfs_getattr to it after the op.

Some filesystems (particularly clustered or networked ones) have an
expensive ->getattr inode operation. Atomicity is also often difficult
or impossible to guarantee on such filesystems. For those, we're best
off not trying to provide WCC information to the client at all, and to
simply allow it to poll for that information as needed with a GETATTR
RPC.

This patch adds a new flags field to struct export_operations, and
defines a new EXPORT_OP_NOWCC flag that filesystems can use to indicate
that nfsd should not attempt to provide WCC info in NFSv3 replies. It
also adds a blurb about the new flags field and flag to the exporting
documentation.

The server will also now skip collecting this information for NFSv2 as
well, since that info is never used there anyway.

Note that this patch does not add this flag to any filesystem
export_operations structures. This was originally developed to allow
reexporting nfs via nfsd.

Other filesystems may want to consider enabling this flag too. It's hard
to tell however which ones have export operations to enable export via
knfsd and which ones mostly rely on them for open-by-filehandle support,
so I'm leaving that up to the individual maintainers to decide. I am
cc'ing the relevant lists for those filesystems that I think may want to
consider adding this though.

Cc: HPDD-discuss@lists.01.org
Cc: ceph-devel@vger.kernel.org
Cc: cluster-devel@redhat.com
Cc: fuse-devel@lists.sourceforge.net
Cc: ocfs2-devel@oss.oracle.com
Signed-off-by: Jeff Layton <jeff.layton@primarydata.com>
Signed-off-by: Lance Shelton <lance.shelton@hammerspace.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agoRevert "nfsd4: support change_attr_type attribute"
J. Bruce Fields [Mon, 30 Nov 2020 22:46:18 +0000 (17:46 -0500)] 
Revert "nfsd4: support change_attr_type attribute"

This reverts commit a85857633b04d57f4524cca0a2bfaf87b2543f9f.

We're still factoring ctime into our change attribute even in the
IS_I_VERSION case.  If someone sets the system time backwards, a client
could see the change attribute go backwards.  Maybe we can just say
"well, don't do that", but there's some question whether that's good
enough, or whether we need a better guarantee.

Also, the client still isn't actually using the attribute.

While we're still figuring this out, let's just stop returning this
attribute.

Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agonfsd4: don't query change attribute in v2/v3 case
J. Bruce Fields [Mon, 30 Nov 2020 22:46:17 +0000 (17:46 -0500)] 
nfsd4: don't query change attribute in v2/v3 case

[ Upstream commit 942b20dc245590327ee0187c15c78174cd96dd52 ]

inode_query_iversion() has side effects, and there's no point calling it
when we're not even going to use it.

We check whether we're currently processing a v4 request by checking
fh_maxsize, which is arguably a little hacky; we could add a flag to
svc_fh instead.

Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agonfsd: minor nfsd4_change_attribute cleanup
J. Bruce Fields [Mon, 30 Nov 2020 22:46:16 +0000 (17:46 -0500)] 
nfsd: minor nfsd4_change_attribute cleanup

[ Upstream commit 4b03d99794eeed27650597a886247c6427ce1055 ]

Minor cleanup, no change in behavior.

Also pull out a common helper that'll be useful elsewhere.

Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agonfsd: simplify nfsd4_change_info
J. Bruce Fields [Mon, 30 Nov 2020 22:46:15 +0000 (17:46 -0500)] 
nfsd: simplify nfsd4_change_info

[ Upstream commit b2140338d8dca827ad9e83f3e026e9d51748b265 ]

It doesn't make sense to carry all these extra fields around.  Just
make everything into change attribute from the start.

This is just cleanup, there should be no change in behavior.

Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agonfsd: only call inode_query_iversion in the I_VERSION case
J. Bruce Fields [Mon, 30 Nov 2020 22:46:14 +0000 (17:46 -0500)] 
nfsd: only call inode_query_iversion in the I_VERSION case

[ Upstream commit 70b87f77294d16d3e567056ba4c9ee2b091a5b50 ]

inode_query_iversion() can modify i_version.  Depending on the exported
filesystem, that may not be safe.  For example, if you're re-exporting
NFS, NFS stores the server's change attribute in i_version and does not
expect it to be modified locally.  This has been observed causing
unnecessary cache invalidations.

The way a filesystem indicates that it's OK to call
inode_query_iverson() is by setting SB_I_VERSION.

So, move the I_VERSION check out of encode_change(), where it's used
only in GETATTR responses, to nfsd4_change_attribute(), which is
also called for pre- and post- operation attributes.

(Note we could also pull the NFSEXP_V4ROOT case into
nfsd4_change_attribute() as well.  That would actually be a no-op,
since pre/post attrs are only used for metadata-modifying operations,
and V4ROOT exports are read-only.  But we might make the change in
the future just for simplicity.)

Reported-by: Daire Byrne <daire@dneg.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agoNFSD: Remove macros that are no longer used
Chuck Lever [Wed, 4 Nov 2020 16:12:18 +0000 (11:12 -0500)] 
NFSD: Remove macros that are no longer used

[ Upstream commit 5cfc822f3e77b0477e6602d399116130317f537a ]

Now that all the NFSv4 decoder functions have been converted to
make direct calls to the xdr helpers, remove the unused C macros.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agoNFSD: Replace READ* macros in nfsd4_decode_compound()
Chuck Lever [Wed, 4 Nov 2020 16:07:06 +0000 (11:07 -0500)] 
NFSD: Replace READ* macros in nfsd4_decode_compound()

[ Upstream commit d9b74bdac6f24afc3101b6a5b6f59842610c9c94 ]

And clean-up: Now that we have removed the DECODE_TAIL macro from
nfsd4_decode_compound(), we observe that there's no benefit for
nfsd4_decode_compound() to return nfs_ok or nfserr_bad_xdr only to
have its sole caller convert those values to one or zero,
respectively. Have nfsd4_decode_compound() return 1/0 instead.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agoNFSD: Make nfsd4_ops::opnum a u32
Chuck Lever [Sun, 22 Nov 2020 17:49:52 +0000 (12:49 -0500)] 
NFSD: Make nfsd4_ops::opnum a u32

[ Upstream commit 3a237b4af5b7b0e77588e120554077cab3341943 ]

Avoid passing a "pointer to int" argument to xdr_stream_decode_u32.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agoNFSD: Replace READ* macros in nfsd4_decode_listxattrs()
Chuck Lever [Wed, 4 Nov 2020 16:04:02 +0000 (11:04 -0500)] 
NFSD: Replace READ* macros in nfsd4_decode_listxattrs()

[ Upstream commit 2212036cadf4da3c4b0e4bd2a9a8c3d78617ab4f ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agoNFSD: Replace READ* macros in nfsd4_decode_setxattr()
Chuck Lever [Wed, 4 Nov 2020 15:59:57 +0000 (10:59 -0500)] 
NFSD: Replace READ* macros in nfsd4_decode_setxattr()

[ Upstream commit 403366a7e8e2930002157525cd44add7fa01bca9 ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agoNFSD: Replace READ* macros in nfsd4_decode_xattr_name()
Chuck Lever [Wed, 4 Nov 2020 15:56:52 +0000 (10:56 -0500)] 
NFSD: Replace READ* macros in nfsd4_decode_xattr_name()

[ Upstream commit 830c71502ae0ae1677ac6c08ffbcf85a6e7b2937 ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agoNFSD: Replace READ* macros in nfsd4_decode_clone()
Chuck Lever [Wed, 4 Nov 2020 15:46:46 +0000 (10:46 -0500)] 
NFSD: Replace READ* macros in nfsd4_decode_clone()

[ Upstream commit 3dfd0b0e15671e2b4047ccb9222432f0b2d930be ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agoNFSD: Replace READ* macros in nfsd4_decode_seek()
Chuck Lever [Wed, 4 Nov 2020 15:54:47 +0000 (10:54 -0500)] 
NFSD: Replace READ* macros in nfsd4_decode_seek()

[ Upstream commit 9d32b412fe0a6186cc57789d218e8f8299454ae2 ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agoNFSD: Replace READ* macros in nfsd4_decode_offload_status()
Chuck Lever [Sat, 21 Nov 2020 19:21:25 +0000 (14:21 -0500)] 
NFSD: Replace READ* macros in nfsd4_decode_offload_status()

[ Upstream commit 2846bb0525a73e00b3566fda535ea6a5879e2971 ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agoNFSD: Replace READ* macros in nfsd4_decode_copy_notify()
Chuck Lever [Sat, 21 Nov 2020 19:19:24 +0000 (14:19 -0500)] 
NFSD: Replace READ* macros in nfsd4_decode_copy_notify()

[ Upstream commit f9a953fb369bbd2135ccead3393ec1ef66544471 ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agoNFSD: Replace READ* macros in nfsd4_decode_copy()
Chuck Lever [Wed, 4 Nov 2020 15:49:37 +0000 (10:49 -0500)] 
NFSD: Replace READ* macros in nfsd4_decode_copy()

[ Upstream commit e8febea7190bcbd1e608093acb67f2a5009556aa ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agoNFSD: Replace READ* macros in nfsd4_decode_nl4_server()
Chuck Lever [Mon, 16 Nov 2020 23:05:06 +0000 (18:05 -0500)] 
NFSD: Replace READ* macros in nfsd4_decode_nl4_server()

[ Upstream commit f49e4b4d58cc835d8bd0cc9663f7b9c5497e0e7e ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agoNFSD: Replace READ* macros in nfsd4_decode_fallocate()
Chuck Lever [Wed, 4 Nov 2020 15:44:05 +0000 (10:44 -0500)] 
NFSD: Replace READ* macros in nfsd4_decode_fallocate()

[ Upstream commit 6aef27aaeae7611f98af08205acc79f5a8f3aa59 ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agoNFSD: Replace READ* macros in nfsd4_decode_reclaim_complete()
Chuck Lever [Tue, 3 Nov 2020 20:02:11 +0000 (15:02 -0500)] 
NFSD: Replace READ* macros in nfsd4_decode_reclaim_complete()

[ Upstream commit 0d6467844d437e07db1e76d96176b1a55401018c ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agoNFSD: Replace READ* macros in nfsd4_decode_destroy_clientid()
Chuck Lever [Wed, 4 Nov 2020 20:15:09 +0000 (15:15 -0500)] 
NFSD: Replace READ* macros in nfsd4_decode_destroy_clientid()

[ Upstream commit c95f2ec3490586cbb33badc8f4c82d6aa4955078 ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agoNFSD: Replace READ* macros in nfsd4_decode_test_stateid()
Chuck Lever [Tue, 3 Nov 2020 19:57:44 +0000 (14:57 -0500)] 
NFSD: Replace READ* macros in nfsd4_decode_test_stateid()

[ Upstream commit b7a0c8f6e741bf9dee0d24e69d3ce51fa4ccce78 ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agoNFSD: Replace READ* macros in nfsd4_decode_sequence()
Chuck Lever [Tue, 3 Nov 2020 19:55:19 +0000 (14:55 -0500)] 
NFSD: Replace READ* macros in nfsd4_decode_sequence()

[ Upstream commit cf907b11326d9360877d6c6ea8f75e1b29f39f2f ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agoNFSD: Replace READ* macros in nfsd4_decode_secinfo_no_name()
Chuck Lever [Tue, 3 Nov 2020 19:33:12 +0000 (14:33 -0500)] 
NFSD: Replace READ* macros in nfsd4_decode_secinfo_no_name()

[ Upstream commit 53d70873e37c09a582167ed73d1858e3a2af0157 ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agoNFSD: Replace READ* macros in nfsd4_decode_layoutreturn()
Chuck Lever [Wed, 4 Nov 2020 15:42:25 +0000 (10:42 -0500)] 
NFSD: Replace READ* macros in nfsd4_decode_layoutreturn()

[ Upstream commit 645fcad371420913c30e9aca80fc0a38f3acf432 ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agoNFSD: Replace READ* macros in nfsd4_decode_layoutget()
Chuck Lever [Tue, 3 Nov 2020 20:06:04 +0000 (15:06 -0500)] 
NFSD: Replace READ* macros in nfsd4_decode_layoutget()

[ Upstream commit c8e88e3aa73889421461f878cd569ef84f231ceb ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agoNFSD: Replace READ* macros in nfsd4_decode_layoutcommit()
Chuck Lever [Wed, 4 Nov 2020 15:40:07 +0000 (10:40 -0500)] 
NFSD: Replace READ* macros in nfsd4_decode_layoutcommit()

[ Upstream commit 5185980d8a23001c2317c290129ab7ab20067e20 ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agoNFSD: Replace READ* macros in nfsd4_decode_getdeviceinfo()
Chuck Lever [Tue, 3 Nov 2020 20:03:50 +0000 (15:03 -0500)] 
NFSD: Replace READ* macros in nfsd4_decode_getdeviceinfo()

[ Upstream commit 044959715f370b24870c95df3940add8710c5a29 ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agoNFSD: Replace READ* macros in nfsd4_decode_free_stateid()
Chuck Lever [Sun, 1 Nov 2020 18:38:27 +0000 (13:38 -0500)] 
NFSD: Replace READ* macros in nfsd4_decode_free_stateid()

[ Upstream commit aec387d5909304810d899f7d90ae57df33f3a75c ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agoNFSD: Replace READ* macros in nfsd4_decode_destroy_session()
Chuck Lever [Wed, 4 Nov 2020 18:50:55 +0000 (13:50 -0500)] 
NFSD: Replace READ* macros in nfsd4_decode_destroy_session()

[ Upstream commit 94e254af1f873b4b551db4c4549294f2c4d385ef ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agoNFSD: Replace READ* macros in nfsd4_decode_create_session()
Chuck Lever [Tue, 3 Nov 2020 19:52:44 +0000 (14:52 -0500)] 
NFSD: Replace READ* macros in nfsd4_decode_create_session()

[ Upstream commit 81243e3fe37ed547fc4ed8aab1cec2865540bb18 ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agoNFSD: Add a helper to decode channel_attrs4
Chuck Lever [Mon, 16 Nov 2020 20:35:05 +0000 (15:35 -0500)] 
NFSD: Add a helper to decode channel_attrs4

[ Upstream commit 3a3f1fbacb0960b628e5a9f07c78287312f7a99d ]

De-duplicate some code.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agoNFSD: Add a helper to decode nfs_impl_id4
Chuck Lever [Mon, 16 Nov 2020 20:21:55 +0000 (15:21 -0500)] 
NFSD: Add a helper to decode nfs_impl_id4

[ Upstream commit 10ff84228197f47401833495ba19a50131323b4a ]

Refactor for clarity.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agoNFSD: Add a helper to decode state_protect4_a
Chuck Lever [Mon, 2 Nov 2020 20:19:12 +0000 (15:19 -0500)] 
NFSD: Add a helper to decode state_protect4_a

[ Upstream commit 523ec6ed6fb80fd1537d748a06bffd060a8b3235 ]

Refactor for clarity.

Also, remove a stale comment. Commit ed94164398c9 ("nfsd: implement
machine credential support for some operations") added support for
SP4_MACH_CRED, so state_protect_a is no longer completely ignored.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agoNFSD: Add a separate decoder for ssv_sp_parms
Chuck Lever [Tue, 3 Nov 2020 16:17:50 +0000 (11:17 -0500)] 
NFSD: Add a separate decoder for ssv_sp_parms

[ Upstream commit 547bfeb4cd8d491aabbd656d5a6f410cb4249b4e ]

Refactor for clarity.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agoNFSD: Add a separate decoder to handle state_protect_ops
Chuck Lever [Tue, 3 Nov 2020 16:13:00 +0000 (11:13 -0500)] 
NFSD: Add a separate decoder to handle state_protect_ops

[ Upstream commit 2548aa784d760567c2a77cbd8b7c55b211167c37 ]

Refactor for clarity and de-duplication of code.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agoNFSD: Replace READ* macros in nfsd4_decode_bind_conn_to_session()
Chuck Lever [Tue, 3 Nov 2020 18:16:23 +0000 (13:16 -0500)] 
NFSD: Replace READ* macros in nfsd4_decode_bind_conn_to_session()

[ Upstream commit 571e0451c4de0a545960ffaea16d969931afc563 ]

A dedicated sessionid4 decoder is introduced that will be used by
other operation decoders in subsequent patches.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agoNFSD: Replace READ* macros in nfsd4_decode_backchannel_ctl()
Chuck Lever [Tue, 3 Nov 2020 18:14:35 +0000 (13:14 -0500)] 
NFSD: Replace READ* macros in nfsd4_decode_backchannel_ctl()

[ Upstream commit 0f81d96098f8eb707afe2f8d5c3fe0f9316ef5ce ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agoNFSD: Replace READ* macros in nfsd4_decode_cb_sec()
Chuck Lever [Tue, 3 Nov 2020 18:09:34 +0000 (13:09 -0500)] 
NFSD: Replace READ* macros in nfsd4_decode_cb_sec()

[ Upstream commit 1a99440807bfc66597aaa2e0f0213c319b023e34 ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agoNFSD: Replace READ* macros in nfsd4_decode_release_lockowner()
Chuck Lever [Wed, 4 Nov 2020 18:42:25 +0000 (13:42 -0500)] 
NFSD: Replace READ* macros in nfsd4_decode_release_lockowner()

[ Upstream commit a4a80c15ca4dd998ab5cbe87bd856c626a318a80 ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agoNFSD: Replace READ* macros in nfsd4_decode_write()
Chuck Lever [Tue, 3 Nov 2020 19:44:28 +0000 (14:44 -0500)] 
NFSD: Replace READ* macros in nfsd4_decode_write()

[ Upstream commit 244e2befcba80f42c65293b6c56282bb78f9f417 ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agoNFSD: Replace READ* macros in nfsd4_decode_verify()
Chuck Lever [Tue, 3 Nov 2020 19:40:32 +0000 (14:40 -0500)] 
NFSD: Replace READ* macros in nfsd4_decode_verify()

[ Upstream commit 67cd453eeda86be90f83a0f4798f33832cf2d98c ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agoNFSD: Replace READ* macros in nfsd4_decode_setclientid_confirm()
Chuck Lever [Wed, 4 Nov 2020 20:12:33 +0000 (15:12 -0500)] 
NFSD: Replace READ* macros in nfsd4_decode_setclientid_confirm()

[ Upstream commit d1ca55149d67e5896f89a30053f5d83c002ac10e ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agoNFSD: Replace READ* macros in nfsd4_decode_setclientid()
Chuck Lever [Tue, 3 Nov 2020 19:35:02 +0000 (14:35 -0500)] 
NFSD: Replace READ* macros in nfsd4_decode_setclientid()

[ Upstream commit 92fa6c08c251d52d0d7b46066ecf87b96a0c4b8f ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agoNFSD: Replace READ* macros in nfsd4_decode_setattr()
Chuck Lever [Sat, 21 Nov 2020 19:14:59 +0000 (14:14 -0500)] 
NFSD: Replace READ* macros in nfsd4_decode_setattr()

[ Upstream commit 44592fe9479d8d4b88594365ab825f7b07afdf7c ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agoNFSD: Replace READ* macros in nfsd4_decode_secinfo()
Chuck Lever [Wed, 4 Nov 2020 20:09:42 +0000 (15:09 -0500)] 
NFSD: Replace READ* macros in nfsd4_decode_secinfo()

[ Upstream commit d0abdae5191a916d767164f6fc6c0e2e814a20a7 ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agoNFSD: Replace READ* macros in nfsd4_decode_renew()
Chuck Lever [Wed, 4 Nov 2020 20:08:50 +0000 (15:08 -0500)] 
NFSD: Replace READ* macros in nfsd4_decode_renew()

[ Upstream commit d12f90458dc8c11734ba44ec88f109bf8de86ff0 ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agoNFSD: Replace READ* macros in nfsd4_decode_rename()
Chuck Lever [Wed, 4 Nov 2020 20:05:58 +0000 (15:05 -0500)] 
NFSD: Replace READ* macros in nfsd4_decode_rename()

[ Upstream commit ba881a0a5342b3aaf83958901ebe3fe752eaab46 ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agoNFSD: Replace READ* macros in nfsd4_decode_remove()
Chuck Lever [Wed, 4 Nov 2020 20:04:36 +0000 (15:04 -0500)] 
NFSD: Replace READ* macros in nfsd4_decode_remove()

[ Upstream commit b7f5fbf219aecda98e32de305551e445f9438899 ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agoNFSD: Replace READ* macros in nfsd4_decode_readdir()
Chuck Lever [Tue, 3 Nov 2020 19:30:59 +0000 (14:30 -0500)] 
NFSD: Replace READ* macros in nfsd4_decode_readdir()

[ Upstream commit 0dfaf2a371436860ace6af889e6cd8410ee63164 ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agoNFSD: Replace READ* macros in nfsd4_decode_read()
Chuck Lever [Tue, 3 Nov 2020 19:28:24 +0000 (14:28 -0500)] 
NFSD: Replace READ* macros in nfsd4_decode_read()

[ Upstream commit 3909c3bc604688503e31ddceb429dc156c4720c1 ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agoNFSD: Replace READ* macros in nfsd4_decode_putfh()
Chuck Lever [Tue, 3 Nov 2020 19:23:02 +0000 (14:23 -0500)] 
NFSD: Replace READ* macros in nfsd4_decode_putfh()

[ Upstream commit a73bed98413b1d9eb4466f776a56d2fde8b3b2c9 ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agoNFSD: Replace READ* macros in nfsd4_decode_open_downgrade()
Chuck Lever [Tue, 3 Nov 2020 19:21:01 +0000 (14:21 -0500)] 
NFSD: Replace READ* macros in nfsd4_decode_open_downgrade()

[ Upstream commit dca71651f097ea608945d7a66bf62761a630de9a ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agoNFSD: Replace READ* macros in nfsd4_decode_open_confirm()
Chuck Lever [Tue, 3 Nov 2020 19:18:57 +0000 (14:18 -0500)] 
NFSD: Replace READ* macros in nfsd4_decode_open_confirm()

[ Upstream commit 06bee693a1f1cb774b91000f05a6e183c257d8e9 ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agoNFSD: Replace READ* macros in nfsd4_decode_open()
Chuck Lever [Sun, 1 Nov 2020 17:04:06 +0000 (12:04 -0500)] 
NFSD: Replace READ* macros in nfsd4_decode_open()

[ Upstream commit 61e5e0b3ec713d1365008c8af3fe5fdd262e2a60 ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agoNFSD: Add helper to decode OPEN's open_claim4 argument
Chuck Lever [Mon, 16 Nov 2020 22:45:04 +0000 (17:45 -0500)] 
NFSD: Add helper to decode OPEN's open_claim4 argument

[ Upstream commit 1708e50b0145f393acbec9e319bdf0e33f765d25 ]

Refactor for clarity.

Note that op_fname is the only instance of an NFSv4 filename stored
in a struct xdr_netobj. Convert it to a u32/char * pair so that the
new nfsd4_decode_filename() helper can be used.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agoNFSD: Replace READ* macros in nfsd4_decode_share_deny()
Chuck Lever [Mon, 16 Nov 2020 22:56:17 +0000 (17:56 -0500)] 
NFSD: Replace READ* macros in nfsd4_decode_share_deny()

[ Upstream commit b07bebd9eb9842e2d0dea87efeb92884556e55b0 ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agoNFSD: Replace READ* macros in nfsd4_decode_share_access()
Chuck Lever [Mon, 16 Nov 2020 22:54:48 +0000 (17:54 -0500)] 
NFSD: Replace READ* macros in nfsd4_decode_share_access()

[ Upstream commit 9aa62f5199749b274454b6d7d914c9b2a5e77031 ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agoNFSD: Add helper to decode OPEN's openflag4 argument
Chuck Lever [Mon, 16 Nov 2020 22:41:21 +0000 (17:41 -0500)] 
NFSD: Add helper to decode OPEN's openflag4 argument

[ Upstream commit e6ec04b27bfb4869c0e35fbcf24333d379f101d5 ]

Refactor for clarity.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agoNFSD: Add helper to decode OPEN's createhow4 argument
Chuck Lever [Mon, 16 Nov 2020 22:37:42 +0000 (17:37 -0500)] 
NFSD: Add helper to decode OPEN's createhow4 argument

[ Upstream commit bf33bab3c4182cdd795983f14de5606e82fab377 ]

Refactor for clarity.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agoNFSD: Add helper to decode NFSv4 verifiers
Chuck Lever [Mon, 16 Nov 2020 22:34:01 +0000 (17:34 -0500)] 
NFSD: Add helper to decode NFSv4 verifiers

[ Upstream commit 796dd1c6b680959ac968b52aa507911b288b1749 ]

This helper will be used to simplify decoders in subsequent
patches.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agoNFSD: Replace READ* macros in nfsd4_decode_lookup()
Chuck Lever [Wed, 4 Nov 2020 20:02:40 +0000 (15:02 -0500)] 
NFSD: Replace READ* macros in nfsd4_decode_lookup()

[ Upstream commit 3d5877e8e03f60d7cc804d7b230ff9c00c9c07bd ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agoNFSD: Replace READ* macros in nfsd4_decode_locku()
Chuck Lever [Tue, 3 Nov 2020 18:33:28 +0000 (13:33 -0500)] 
NFSD: Replace READ* macros in nfsd4_decode_locku()

[ Upstream commit ca9cf9fc27f8f722e9eb2763173ba01f6ac3dad1 ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agoNFSD: Replace READ* macros in nfsd4_decode_lockt()
Chuck Lever [Tue, 3 Nov 2020 18:31:44 +0000 (13:31 -0500)] 
NFSD: Replace READ* macros in nfsd4_decode_lockt()

[ Upstream commit 0a146f04aa0fa7a57aaed3913d1c2732b3853f31 ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agoNFSD: Replace READ* macros in nfsd4_decode_lock()
Chuck Lever [Tue, 3 Nov 2020 18:29:27 +0000 (13:29 -0500)] 
NFSD: Replace READ* macros in nfsd4_decode_lock()

[ Upstream commit 7c59deed5cd2e1cfc6cbecf06f4584ac53755f53 ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agoNFSD: Add helper for decoding locker4
Chuck Lever [Mon, 16 Nov 2020 22:16:52 +0000 (17:16 -0500)] 
NFSD: Add helper for decoding locker4

[ Upstream commit 8918cc0d2b72db9997390626010b182c4500d749 ]

Refactor for clarity.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agoNFSD: Add helpers to decode a clientid4 and an NFSv4 state owner
Chuck Lever [Mon, 16 Nov 2020 22:25:02 +0000 (17:25 -0500)] 
NFSD: Add helpers to decode a clientid4 and an NFSv4 state owner

[ Upstream commit 144e82694092ff80b5e64749d6822cd8947587f2 ]

These helpers will also be used to simplify decoders in subsequent
patches.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agoNFSD: Relocate nfsd4_decode_opaque()
Chuck Lever [Wed, 4 Nov 2020 16:41:55 +0000 (11:41 -0500)] 
NFSD: Relocate nfsd4_decode_opaque()

[ Upstream commit 5dcbfabb676b2b6d97767209cf707eb463ca232a ]

Enable nfsd4_decode_opaque() to be used in more decoders, and
replace the READ* macros in nfsd4_decode_opaque().

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agoNFSD: Replace READ* macros in nfsd4_decode_link()
Chuck Lever [Wed, 4 Nov 2020 20:01:24 +0000 (15:01 -0500)] 
NFSD: Replace READ* macros in nfsd4_decode_link()

[ Upstream commit 5c505d128691c70991b766dd6a3faf49fa59ecfb ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
17 months agoNFSD: Replace READ* macros in nfsd4_decode_getattr()
Chuck Lever [Thu, 19 Nov 2020 19:40:20 +0000 (14:40 -0500)] 
NFSD: Replace READ* macros in nfsd4_decode_getattr()

[ Upstream commit f759eff260f1f0b0f56531517762f27ee3233506 ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>