Skip to content

Commit

Permalink
Merge tag 'nfsd-6.2' of git://git.kernel.org/pub/scm/linux/kernel/git…
Browse files Browse the repository at this point in the history
…/cel/linux

Pull nfsd updates from Chuck Lever:
 "This release introduces support for the CB_RECALL_ANY operation. NFSD
  can send this operation to request that clients return any delegations
  they choose. The server uses this operation to handle low memory
  scenarios or indicate to a client when that client has reached the
  maximum number of delegations the server supports.

  The NFSv4.2 READ_PLUS operation has been simplified temporarily whilst
  support for sparse files in local filesystems and the VFS is improved.

  Two major data structure fixes appear in this release:

   - The nfs4_file hash table is replaced with a resizable hash table to
     reduce the latency of NFSv4 OPEN operations.

   - Reference counting in the NFSD filecache has been hardened against
     races.

  In furtherance of removing support for NFSv2 in a subsequent kernel
  release, a new Kconfig option enables server-side support for NFSv2 to
  be left out of a kernel build.

  MAINTAINERS has been updated to indicate that changes to fs/exportfs
  should go through the NFSD tree"

* tag 'nfsd-6.2' of git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux: (49 commits)
  NFSD: Avoid clashing function prototypes
  SUNRPC: Fix crasher in unwrap_integ_data()
  SUNRPC: Make the svc_authenticate tracepoint conditional
  NFSD: Use only RQ_DROPME to signal the need to drop a reply
  SUNRPC: Clean up xdr_write_pages()
  SUNRPC: Don't leak netobj memory when gss_read_proxy_verf() fails
  NFSD: add CB_RECALL_ANY tracepoints
  NFSD: add delegation reaper to react to low memory condition
  NFSD: add support for sending CB_RECALL_ANY
  NFSD: refactoring courtesy_client_reaper to a generic low memory shrinker
  trace: Relocate event helper files
  NFSD: pass range end to vfs_fsync_range() instead of count
  lockd: fix file selection in nlmsvc_cancel_blocked
  lockd: ensure we use the correct file descriptor when unlocking
  lockd: set missing fl_flags field when retrieving args
  NFSD: Use struct_size() helper in alloc_session()
  nfsd: return error if nfs4_setacl fails
  lockd: set other missing fields when unlocking files
  NFSD: Add an nfsd_file_fsync tracepoint
  sunrpc: svc: Remove an unused static function svc_ungetu32()
  ...
  • Loading branch information
torvalds committed Dec 13, 2022
2 parents 149c51f + e78e274 commit 7648229
Show file tree
Hide file tree
Showing 49 changed files with 1,300 additions and 806 deletions.
8 changes: 8 additions & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -10082,6 +10082,7 @@ F: drivers/infiniband/
F: include/rdma/
F: include/trace/events/ib_mad.h
F: include/trace/events/ib_umad.h
F: include/trace/misc/rdma.h
F: include/uapi/linux/if_infiniband.h
F: include/uapi/rdma/
F: samples/bpf/ibumad_kern.c
Expand Down Expand Up @@ -11168,11 +11169,18 @@ L: [email protected]
S: Supported
W: http://nfs.sourceforge.net/
T: git git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux.git
F: fs/exportfs/
F: fs/lockd/
F: fs/nfs_common/
F: fs/nfsd/
F: include/linux/lockd/
F: include/linux/sunrpc/
F: include/trace/events/rpcgss.h
F: include/trace/events/rpcrdma.h
F: include/trace/events/sunrpc.h
F: include/trace/misc/fs.h
F: include/trace/misc/nfs.h
F: include/trace/misc/sunrpc.h
F: include/uapi/linux/nfsd/
F: include/uapi/linux/sunrpc/
F: net/sunrpc/
Expand Down
2 changes: 1 addition & 1 deletion drivers/infiniband/core/cm_trace.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

#include <linux/tracepoint.h>
#include <rdma/ib_cm.h>
#include <trace/events/rdma.h>
#include <trace/misc/rdma.h>

/*
* enum ib_cm_state, from include/rdma/ib_cm.h
Expand Down
2 changes: 1 addition & 1 deletion drivers/infiniband/core/cma_trace.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#define _TRACE_RDMA_CMA_H

#include <linux/tracepoint.h>
#include <trace/events/rdma.h>
#include <trace/misc/rdma.h>


DECLARE_EVENT_CLASS(cma_fsm_class,
Expand Down
8 changes: 4 additions & 4 deletions fs/exportfs/expfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include <linux/sched.h>
#include <linux/cred.h>

#define dprintk(fmt, args...) do{}while(0)
#define dprintk(fmt, args...) pr_debug(fmt, ##args)


static int get_name(const struct path *path, char *name, struct dentry *child);
Expand Down Expand Up @@ -132,8 +132,8 @@ static struct dentry *reconnect_one(struct vfsmount *mnt,
inode_unlock(dentry->d_inode);

if (IS_ERR(parent)) {
dprintk("%s: get_parent of %ld failed, err %d\n",
__func__, dentry->d_inode->i_ino, PTR_ERR(parent));
dprintk("get_parent of %lu failed, err %ld\n",
dentry->d_inode->i_ino, PTR_ERR(parent));
return parent;
}

Expand All @@ -147,7 +147,7 @@ static struct dentry *reconnect_one(struct vfsmount *mnt,
dprintk("%s: found name: %s\n", __func__, nbuf);
tmp = lookup_one_unlocked(mnt_user_ns(mnt), nbuf, parent, strlen(nbuf));
if (IS_ERR(tmp)) {
dprintk("%s: lookup failed: %d\n", __func__, PTR_ERR(tmp));
dprintk("lookup failed: %ld\n", PTR_ERR(tmp));
err = PTR_ERR(tmp);
goto out_err;
}
Expand Down
1 change: 1 addition & 0 deletions fs/lockd/svc4proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ nlm4svc_retrieve_args(struct svc_rqst *rqstp, struct nlm_args *argp,
*filp = file;

/* Set up the missing parts of the file_lock structure */
lock->fl.fl_flags = FL_POSIX;
lock->fl.fl_file = file->f_file[mode];
lock->fl.fl_pid = current->tgid;
lock->fl.fl_start = (loff_t)lock->lock_start;
Expand Down
17 changes: 10 additions & 7 deletions fs/lockd/svclock.c
Original file line number Diff line number Diff line change
Expand Up @@ -659,11 +659,13 @@ nlmsvc_unlock(struct net *net, struct nlm_file *file, struct nlm_lock *lock)
nlmsvc_cancel_blocked(net, file, lock);

lock->fl.fl_type = F_UNLCK;
if (file->f_file[O_RDONLY])
error = vfs_lock_file(file->f_file[O_RDONLY], F_SETLK,
lock->fl.fl_file = file->f_file[O_RDONLY];
if (lock->fl.fl_file)
error = vfs_lock_file(lock->fl.fl_file, F_SETLK,
&lock->fl, NULL);
if (file->f_file[O_WRONLY])
error = vfs_lock_file(file->f_file[O_WRONLY], F_SETLK,
lock->fl.fl_file = file->f_file[O_WRONLY];
if (lock->fl.fl_file)
error |= vfs_lock_file(lock->fl.fl_file, F_SETLK,
&lock->fl, NULL);

return (error < 0)? nlm_lck_denied_nolocks : nlm_granted;
Expand Down Expand Up @@ -697,9 +699,10 @@ nlmsvc_cancel_blocked(struct net *net, struct nlm_file *file, struct nlm_lock *l
block = nlmsvc_lookup_block(file, lock);
mutex_unlock(&file->f_mutex);
if (block != NULL) {
mode = lock_to_openmode(&lock->fl);
vfs_cancel_lock(block->b_file->f_file[mode],
&block->b_call->a_args.lock.fl);
struct file_lock *fl = &block->b_call->a_args.lock.fl;

mode = lock_to_openmode(fl);
vfs_cancel_lock(block->b_file->f_file[mode], fl);
status = nlmsvc_unlink_block(block);
nlmsvc_release_block(block);
}
Expand Down
1 change: 1 addition & 0 deletions fs/lockd/svcproc.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ nlmsvc_retrieve_args(struct svc_rqst *rqstp, struct nlm_args *argp,

/* Set up the missing parts of the file_lock structure */
mode = lock_to_openmode(&lock->fl);
lock->fl.fl_flags = FL_POSIX;
lock->fl.fl_file = file->f_file[mode];
lock->fl.fl_pid = current->tgid;
lock->fl.fl_lmops = &nlmsvc_lock_operations;
Expand Down
17 changes: 10 additions & 7 deletions fs/lockd/svcsubs.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,20 +176,23 @@ nlm_delete_file(struct nlm_file *file)
}
}

static int nlm_unlock_files(struct nlm_file *file, fl_owner_t owner)
static int nlm_unlock_files(struct nlm_file *file, const struct file_lock *fl)
{
struct file_lock lock;

locks_init_lock(&lock);
lock.fl_type = F_UNLCK;
lock.fl_start = 0;
lock.fl_end = OFFSET_MAX;
lock.fl_owner = owner;
if (file->f_file[O_RDONLY] &&
vfs_lock_file(file->f_file[O_RDONLY], F_SETLK, &lock, NULL))
lock.fl_owner = fl->fl_owner;
lock.fl_pid = fl->fl_pid;
lock.fl_flags = FL_POSIX;

lock.fl_file = file->f_file[O_RDONLY];
if (lock.fl_file && vfs_lock_file(lock.fl_file, F_SETLK, &lock, NULL))
goto out_err;
if (file->f_file[O_WRONLY] &&
vfs_lock_file(file->f_file[O_WRONLY], F_SETLK, &lock, NULL))
lock.fl_file = file->f_file[O_WRONLY];
if (lock.fl_file && vfs_lock_file(lock.fl_file, F_SETLK, &lock, NULL))
goto out_err;
return 0;
out_err:
Expand Down Expand Up @@ -226,7 +229,7 @@ nlm_traverse_locks(struct nlm_host *host, struct nlm_file *file,
if (match(lockhost, host)) {

spin_unlock(&flctx->flc_lock);
if (nlm_unlock_files(file, fl->fl_owner))
if (nlm_unlock_files(file, fl))
return 1;
goto again;
}
Expand Down
6 changes: 3 additions & 3 deletions fs/nfs/nfs4trace.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
#define _TRACE_NFS4_H

#include <linux/tracepoint.h>
#include <trace/events/sunrpc_base.h>
#include <trace/misc/sunrpc.h>

#include <trace/events/fs.h>
#include <trace/events/nfs.h>
#include <trace/misc/fs.h>
#include <trace/misc/nfs.h>

#define show_nfs_fattr_flags(valid) \
__print_flags((unsigned long)valid, "|", \
Expand Down
6 changes: 3 additions & 3 deletions fs/nfs/nfstrace.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
#include <linux/tracepoint.h>
#include <linux/iversion.h>

#include <trace/events/fs.h>
#include <trace/events/nfs.h>
#include <trace/events/sunrpc_base.h>
#include <trace/misc/fs.h>
#include <trace/misc/nfs.h>
#include <trace/misc/sunrpc.h>

#define nfs_show_cache_validity(v) \
__print_flags(v, "|", \
Expand Down
19 changes: 15 additions & 4 deletions fs/nfsd/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ config NFSD
select SUNRPC
select EXPORTFS
select NFS_ACL_SUPPORT if NFSD_V2_ACL
select NFS_ACL_SUPPORT if NFSD_V3_ACL
depends on MULTIUSER
help
Choose Y here if you want to allow other computers to access
Expand All @@ -26,19 +27,29 @@ config NFSD

Below you can choose which versions of the NFS protocol are
available to clients mounting the NFS server on this system.
Support for NFS version 2 (RFC 1094) is always available when
Support for NFS version 3 (RFC 1813) is always available when
CONFIG_NFSD is selected.

If unsure, say N.

config NFSD_V2_ACL
bool
config NFSD_V2
bool "NFS server support for NFS version 2 (DEPRECATED)"
depends on NFSD
default n
help
NFSv2 (RFC 1094) was the first publicly-released version of NFS.
Unless you are hosting ancient (1990's era) NFS clients, you don't
need this.

If unsure, say N.

config NFSD_V2_ACL
bool "NFS server support for the NFSv2 ACL protocol extension"
depends on NFSD_V2

config NFSD_V3_ACL
bool "NFS server support for the NFSv3 ACL protocol extension"
depends on NFSD
select NFSD_V2_ACL
help
Solaris NFS servers support an auxiliary NFSv3 ACL protocol that
never became an official part of the NFS version 3 protocol.
Expand Down
5 changes: 3 additions & 2 deletions fs/nfsd/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ obj-$(CONFIG_NFSD) += nfsd.o
# this one should be compiled first, as the tracing macros can easily blow up
nfsd-y += trace.o

nfsd-y += nfssvc.o nfsctl.o nfsproc.o nfsfh.o vfs.o \
export.o auth.o lockd.o nfscache.o nfsxdr.o \
nfsd-y += nfssvc.o nfsctl.o nfsfh.o vfs.o \
export.o auth.o lockd.o nfscache.o \
stats.o filecache.o nfs3proc.o nfs3xdr.o
nfsd-$(CONFIG_NFSD_V2) += nfsproc.o nfsxdr.o
nfsd-$(CONFIG_NFSD_V2_ACL) += nfs2acl.o
nfsd-$(CONFIG_NFSD_V3_ACL) += nfs3acl.o
nfsd-$(CONFIG_NFSD_V4) += nfs4proc.o nfs4xdr.o nfs4state.o nfs4idmap.o \
Expand Down
1 change: 1 addition & 0 deletions fs/nfsd/blocklayout.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "blocklayoutxdr.h"
#include "pnfs.h"
#include "filecache.h"
#include "vfs.h"

#define NFSDDBG_FACILITY NFSDDBG_PNFS

Expand Down
1 change: 1 addition & 0 deletions fs/nfsd/blocklayoutxdr.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

#include "nfsd.h"
#include "blocklayoutxdr.h"
#include "vfs.h"

#define NFSDDBG_FACILITY NFSDDBG_PNFS

Expand Down
1 change: 0 additions & 1 deletion fs/nfsd/export.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ struct svc_export * rqst_find_fsidzero_export(struct svc_rqst *);
int exp_rootfh(struct net *, struct auth_domain *,
char *path, struct knfsd_fh *, int maxsize);
__be32 exp_pseudoroot(struct svc_rqst *, struct svc_fh *);
__be32 nfserrno(int errno);

static inline void exp_put(struct svc_export *exp)
{
Expand Down
Loading

0 comments on commit 7648229

Please sign in to comment.