Commit 298fb76a authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'nfsd-5.4' of git://linux-nfs.org/~bfields/linux

Pull nfsd updates from Bruce Fields:
 "Highlights:

   - Add a new knfsd file cache, so that we don't have to open and close
     on each (NFSv2/v3) READ or WRITE. This can speed up read and write
     in some cases. It also replaces our readahead cache.

   - Prevent silent data loss on write errors, by treating write errors
     like server reboots for the purposes of write caching, thus forcing
     clients to resend their writes.

   - Tweak the code that allocates sessions to be more forgiving, so
     that NFSv4.1 mounts are less likely to hang when a server already
     has a lot of clients.

   - Eliminate an arbitrary limit on NFSv4 ACL sizes; they should now be
     limited only by the backend filesystem and the maximum RPC size.

   - Allow the server to enforce use of the correct kerberos credentials
     when a client reclaims state after a reboot.

  And some miscellaneous smaller bugfixes and cleanup"

* tag 'nfsd-5.4' of git://linux-nfs.org/~bfields/linux: (34 commits)
  sunrpc: clean up indentation issue
  nfsd: fix nfs read eof detection
  nfsd: Make nfsd_reset_boot_verifier_locked static
  nfsd: degraded slot-count more gracefully as allocation nears exhaustion.
  nfsd: handle drc over-allocation gracefully.
  nfsd: add support for upcall version 2
  nfsd: add a "GetVersion" upcall for nfsdcld
  nfsd: Reset the boot verifier on all write I/O errors
  nfsd: Don't garbage collect files that might contain write errors
  nfsd: Support the server resetting the boot verifier
  nfsd: nfsd_file cache entries should be per net namespace
  nfsd: eliminate an unnecessary acl size limit
  Deprecate nfsd fault injection
  nfsd: remove duplicated include from filecache.c
  nfsd: Fix the documentation for svcxdr_tmpalloc()
  nfsd: Fix up some unused variable warnings
  nfsd: close cached files prior to a REMOVE or RENAME that would replace target
  nfsd: rip out the raparms cache
  nfsd: have nfsd_test_lock use the nfsd_file cache
  nfsd: hook up nfs4_preprocess_stateid_op to the nfsd_file cache
  ...
parents 8f744bde e41f9efb
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -327,6 +327,7 @@ void flush_delayed_fput(void)
{
{
	delayed_fput(NULL);
	delayed_fput(NULL);
}
}
EXPORT_SYMBOL_GPL(flush_delayed_fput);


static DECLARE_DELAYED_WORK(delayed_fput_work, delayed_fput);
static DECLARE_DELAYED_WORK(delayed_fput_work, delayed_fput);


+62 −0
Original line number Original line Diff line number Diff line
@@ -212,6 +212,7 @@ struct file_lock_list_struct {
static DEFINE_PER_CPU(struct file_lock_list_struct, file_lock_list);
static DEFINE_PER_CPU(struct file_lock_list_struct, file_lock_list);
DEFINE_STATIC_PERCPU_RWSEM(file_rwsem);
DEFINE_STATIC_PERCPU_RWSEM(file_rwsem);



/*
/*
 * The blocked_hash is used to find POSIX lock loops for deadlock detection.
 * The blocked_hash is used to find POSIX lock loops for deadlock detection.
 * It is protected by blocked_lock_lock.
 * It is protected by blocked_lock_lock.
@@ -1991,6 +1992,64 @@ int generic_setlease(struct file *filp, long arg, struct file_lock **flp,
}
}
EXPORT_SYMBOL(generic_setlease);
EXPORT_SYMBOL(generic_setlease);


#if IS_ENABLED(CONFIG_SRCU)
/*
 * Kernel subsystems can register to be notified on any attempt to set
 * a new lease with the lease_notifier_chain. This is used by (e.g.) nfsd
 * to close files that it may have cached when there is an attempt to set a
 * conflicting lease.
 */
static struct srcu_notifier_head lease_notifier_chain;

static inline void
lease_notifier_chain_init(void)
{
	srcu_init_notifier_head(&lease_notifier_chain);
}

static inline void
setlease_notifier(long arg, struct file_lock *lease)
{
	if (arg != F_UNLCK)
		srcu_notifier_call_chain(&lease_notifier_chain, arg, lease);
}

int lease_register_notifier(struct notifier_block *nb)
{
	return srcu_notifier_chain_register(&lease_notifier_chain, nb);
}
EXPORT_SYMBOL_GPL(lease_register_notifier);

void lease_unregister_notifier(struct notifier_block *nb)
{
	srcu_notifier_chain_unregister(&lease_notifier_chain, nb);
}
EXPORT_SYMBOL_GPL(lease_unregister_notifier);

#else /* !IS_ENABLED(CONFIG_SRCU) */
static inline void
lease_notifier_chain_init(void)
{
}

static inline void
setlease_notifier(long arg, struct file_lock *lease)
{
}

int lease_register_notifier(struct notifier_block *nb)
{
	return 0;
}
EXPORT_SYMBOL_GPL(lease_register_notifier);

void lease_unregister_notifier(struct notifier_block *nb)
{
}
EXPORT_SYMBOL_GPL(lease_unregister_notifier);

#endif /* IS_ENABLED(CONFIG_SRCU) */

/**
/**
 * vfs_setlease        -       sets a lease on an open file
 * vfs_setlease        -       sets a lease on an open file
 * @filp:	file pointer
 * @filp:	file pointer
@@ -2011,6 +2070,8 @@ EXPORT_SYMBOL(generic_setlease);
int
int
vfs_setlease(struct file *filp, long arg, struct file_lock **lease, void **priv)
vfs_setlease(struct file *filp, long arg, struct file_lock **lease, void **priv)
{
{
	if (lease)
		setlease_notifier(arg, *lease);
	if (filp->f_op->setlease)
	if (filp->f_op->setlease)
		return filp->f_op->setlease(filp, arg, lease, priv);
		return filp->f_op->setlease(filp, arg, lease, priv);
	else
	else
@@ -2924,6 +2985,7 @@ static int __init filelock_init(void)
		INIT_HLIST_HEAD(&fll->hlist);
		INIT_HLIST_HEAD(&fll->hlist);
	}
	}


	lease_notifier_chain_init();
	return 0;
	return 0;
}
}
core_initcall(filelock_init);
core_initcall(filelock_init);
+2 −1
Original line number Original line Diff line number Diff line
@@ -3,6 +3,7 @@ config NFSD
	tristate "NFS server support"
	tristate "NFS server support"
	depends on INET
	depends on INET
	depends on FILE_LOCKING
	depends on FILE_LOCKING
	depends on FSNOTIFY
	select LOCKD
	select LOCKD
	select SUNRPC
	select SUNRPC
	select EXPORTFS
	select EXPORTFS
@@ -147,7 +148,7 @@ config NFSD_V4_SECURITY_LABEL


config NFSD_FAULT_INJECTION
config NFSD_FAULT_INJECTION
	bool "NFS server manual fault injection"
	bool "NFS server manual fault injection"
	depends on NFSD_V4 && DEBUG_KERNEL && DEBUG_FS
	depends on NFSD_V4 && DEBUG_KERNEL && DEBUG_FS && BROKEN
	help
	help
	  This option enables support for manually injecting faults
	  This option enables support for manually injecting faults
	  into the NFS server.  This is intended to be used for
	  into the NFS server.  This is intended to be used for
+2 −1
Original line number Original line Diff line number Diff line
@@ -11,7 +11,8 @@ obj-$(CONFIG_NFSD) += nfsd.o
nfsd-y			+= trace.o
nfsd-y			+= trace.o


nfsd-y 			+= nfssvc.o nfsctl.o nfsproc.o nfsfh.o vfs.o \
nfsd-y 			+= nfssvc.o nfsctl.o nfsproc.o nfsfh.o vfs.o \
			   export.o auth.o lockd.o nfscache.o nfsxdr.o stats.o
			   export.o auth.o lockd.o nfscache.o nfsxdr.o \
			   stats.o filecache.o
nfsd-$(CONFIG_NFSD_FAULT_INJECTION) += fault_inject.o
nfsd-$(CONFIG_NFSD_FAULT_INJECTION) += fault_inject.o
nfsd-$(CONFIG_NFSD_V2_ACL) += nfs2acl.o
nfsd-$(CONFIG_NFSD_V2_ACL) += nfs2acl.o
nfsd-$(CONFIG_NFSD_V3)	+= nfs3proc.o nfs3xdr.o
nfsd-$(CONFIG_NFSD_V3)	+= nfs3proc.o nfs3xdr.o
+0 −8
Original line number Original line Diff line number Diff line
@@ -39,14 +39,6 @@ struct nfs4_acl;
struct svc_fh;
struct svc_fh;
struct svc_rqst;
struct svc_rqst;


/*
 * Maximum ACL we'll accept from a client; chosen (somewhat
 * arbitrarily) so that kmalloc'ing the ACL shouldn't require a
 * high-order allocation.  This allows 204 ACEs on x86_64:
 */
#define NFS4_ACL_MAX ((PAGE_SIZE - sizeof(struct nfs4_acl)) \
			/ sizeof(struct nfs4_ace))

int nfs4_acl_bytes(int entries);
int nfs4_acl_bytes(int entries);
int nfs4_acl_get_whotype(char *, u32);
int nfs4_acl_get_whotype(char *, u32);
__be32 nfs4_acl_write_who(struct xdr_stream *xdr, int who);
__be32 nfs4_acl_write_who(struct xdr_stream *xdr, int who);
Loading