Skip to content

Commit

Permalink
Merge tag 'nfsd-4.3' of git://linux-nfs.org/~bfields/linux
Browse files Browse the repository at this point in the history
Pull nfsd updates from Bruce Fields:
 "Nothing major, but:

   - Add Jeff Layton as an nfsd co-maintainer: no change to existing
     practice, just an acknowledgement of the status quo.

   - Two patches ("nfsd: ensure that...") for a race overlooked by the
     state locking rewrite, causing a crash noticed by multiple users.

   - Lots of smaller bugfixes all over from Kinglong Mee.

   - From Jeff, some cleanup of server rpc code in preparation for
     possible shift of nfsd threads to workqueues"

* tag 'nfsd-4.3' of git://linux-nfs.org/~bfields/linux: (52 commits)
  nfsd: deal with DELEGRETURN racing with CB_RECALL
  nfsd: return CLID_INUSE for unexpected SETCLIENTID_CONFIRM case
  nfsd: ensure that delegation stateid hash references are only put once
  nfsd: ensure that the ol stateid hash reference is only put once
  net: sunrpc: fix tracepoint Warning: unknown op '->'
  nfsd: allow more than one laundry job to run at a time
  nfsd: don't WARN/backtrace for invalid container deployment.
  fs: fix fs/locks.c kernel-doc warning
  nfsd: Add Jeff Layton as co-maintainer
  NFSD: Return word2 bitmask if setting security label in OPEN/CREATE
  NFSD: Set the attributes used to store the verifier for EXCLUSIVE4_1
  nfsd: SUPPATTR_EXCLCREAT must be encoded before SECURITY_LABEL.
  nfsd: Fix an FS_LAYOUT_TYPES/LAYOUT_TYPES encode bug
  NFSD: Store parent's stat in a separate value
  nfsd: Fix two typos in comments
  lockd: NLM grace period shouldn't block NFSv4 opens
  nfsd: include linux/nfs4.h in export.h
  sunrpc: Switch to using hash list instead single list
  sunrpc/nfsd: Remove redundant code by exports seq_operations functions
  sunrpc: Store cache_detail in seq_file's private directly
  ...
  • Loading branch information
torvalds committed Sep 6, 2015
2 parents 2236597 + a457974 commit 1744771
Show file tree
Hide file tree
Showing 35 changed files with 669 additions and 572 deletions.
16 changes: 7 additions & 9 deletions Documentation/filesystems/nfs/nfs-rdma.txt
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,9 @@ Installation
- Build, install, reboot

The NFS/RDMA code will be enabled automatically if NFS and RDMA
are turned on. The NFS/RDMA client and server are configured via the
SUNRPC_XPRT_RDMA_CLIENT and SUNRPC_XPRT_RDMA_SERVER config options that both
depend on SUNRPC and INFINIBAND. The default value of both options will be:
are turned on. The NFS/RDMA client and server are configured via the hidden
SUNRPC_XPRT_RDMA config option that depends on SUNRPC and INFINIBAND. The
value of SUNRPC_XPRT_RDMA will be:

- N if either SUNRPC or INFINIBAND are N, in this case the NFS/RDMA client
and server will not be built
Expand Down Expand Up @@ -238,9 +238,8 @@ NFS/RDMA Setup

- Start the NFS server

If the NFS/RDMA server was built as a module
(CONFIG_SUNRPC_XPRT_RDMA_SERVER=m in kernel config), load the RDMA
transport module:
If the NFS/RDMA server was built as a module (CONFIG_SUNRPC_XPRT_RDMA=m in
kernel config), load the RDMA transport module:

$ modprobe svcrdma

Expand All @@ -259,9 +258,8 @@ NFS/RDMA Setup

- On the client system

If the NFS/RDMA client was built as a module
(CONFIG_SUNRPC_XPRT_RDMA_CLIENT=m in kernel config), load the RDMA client
module:
If the NFS/RDMA client was built as a module (CONFIG_SUNRPC_XPRT_RDMA=m in
kernel config), load the RDMA client module:

$ modprobe xprtrdma.ko

Expand Down
8 changes: 7 additions & 1 deletion fs/lockd/svc.c
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,11 @@ static int lockd_start_svc(struct svc_serv *serv)
return error;
}

static struct svc_serv_ops lockd_sv_ops = {
.svo_shutdown = svc_rpcb_cleanup,
.svo_enqueue_xprt = svc_xprt_do_enqueue,
};

static struct svc_serv *lockd_create_svc(void)
{
struct svc_serv *serv;
Expand Down Expand Up @@ -350,7 +355,7 @@ static struct svc_serv *lockd_create_svc(void)
nlm_timeout = LOCKD_DFLT_TIMEO;
nlmsvc_timeout = nlm_timeout * HZ;

serv = svc_create(&nlmsvc_program, LOCKD_BUFSIZE, svc_rpcb_cleanup);
serv = svc_create(&nlmsvc_program, LOCKD_BUFSIZE, &lockd_sv_ops);
if (!serv) {
printk(KERN_WARNING "lockd_up: create service failed\n");
return ERR_PTR(-ENOMEM);
Expand Down Expand Up @@ -586,6 +591,7 @@ static int lockd_init_net(struct net *net)

INIT_DELAYED_WORK(&ln->grace_period_end, grace_ender);
INIT_LIST_HEAD(&ln->lockd_manager.list);
ln->lockd_manager.block_opens = false;
spin_lock_init(&ln->nsm_clnt_lock);
return 0;
}
Expand Down
1 change: 1 addition & 0 deletions fs/locks.c
Original file line number Diff line number Diff line change
Expand Up @@ -1568,6 +1568,7 @@ int fcntl_getlease(struct file *filp)
* desired lease.
* @dentry: dentry to check
* @arg: type of lease that we're trying to acquire
* @flags: current lock flags
*
* Check to see if there's an existing open fd on this file that would
* conflict with the lease we're trying to set.
Expand Down
6 changes: 5 additions & 1 deletion fs/nfs/callback.c
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,10 @@ static int nfs_callback_up_net(int minorversion, struct svc_serv *serv, struct n
return ret;
}

static struct svc_serv_ops nfs_cb_sv_ops = {
.svo_enqueue_xprt = svc_xprt_do_enqueue,
};

static struct svc_serv *nfs_callback_create_svc(int minorversion)
{
struct nfs_callback_data *cb_info = &nfs_callback_info[minorversion];
Expand All @@ -333,7 +337,7 @@ static struct svc_serv *nfs_callback_create_svc(int minorversion)
printk(KERN_WARNING "nfs_callback_create_svc: no kthread, %d users??\n",
cb_info->users);

serv = svc_create(&nfs4_callback_program, NFS4_CALLBACK_BUFSIZE, NULL);
serv = svc_create(&nfs4_callback_program, NFS4_CALLBACK_BUFSIZE, &nfs_cb_sv_ops);
if (!serv) {
printk(KERN_ERR "nfs_callback_create_svc: create service failed\n");
return ERR_PTR(-ENOMEM);
Expand Down
23 changes: 21 additions & 2 deletions fs/nfs_common/grace.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,33 @@ EXPORT_SYMBOL_GPL(locks_end_grace);
* lock reclaims.
*/
int
locks_in_grace(struct net *net)
__state_in_grace(struct net *net, bool open)
{
struct list_head *grace_list = net_generic(net, grace_net_id);
struct lock_manager *lm;

return !list_empty(grace_list);
if (!open)
return !list_empty(grace_list);

list_for_each_entry(lm, grace_list, list) {
if (lm->block_opens)
return true;
}
return false;
}

int locks_in_grace(struct net *net)
{
return __state_in_grace(net, 0);
}
EXPORT_SYMBOL_GPL(locks_in_grace);

int opens_in_grace(struct net *net)
{
return __state_in_grace(net, 1);
}
EXPORT_SYMBOL_GPL(opens_in_grace);

static int __net_init
grace_init_net(struct net *net)
{
Expand Down
73 changes: 3 additions & 70 deletions fs/nfsd/export.c
Original file line number Diff line number Diff line change
Expand Up @@ -1075,73 +1075,6 @@ exp_pseudoroot(struct svc_rqst *rqstp, struct svc_fh *fhp)
return rv;
}

/* Iterator */

static void *e_start(struct seq_file *m, loff_t *pos)
__acquires(((struct cache_detail *)m->private)->hash_lock)
{
loff_t n = *pos;
unsigned hash, export;
struct cache_head *ch;
struct cache_detail *cd = m->private;
struct cache_head **export_table = cd->hash_table;

read_lock(&cd->hash_lock);
if (!n--)
return SEQ_START_TOKEN;
hash = n >> 32;
export = n & ((1LL<<32) - 1);


for (ch=export_table[hash]; ch; ch=ch->next)
if (!export--)
return ch;
n &= ~((1LL<<32) - 1);
do {
hash++;
n += 1LL<<32;
} while(hash < EXPORT_HASHMAX && export_table[hash]==NULL);
if (hash >= EXPORT_HASHMAX)
return NULL;
*pos = n+1;
return export_table[hash];
}

static void *e_next(struct seq_file *m, void *p, loff_t *pos)
{
struct cache_head *ch = p;
int hash = (*pos >> 32);
struct cache_detail *cd = m->private;
struct cache_head **export_table = cd->hash_table;

if (p == SEQ_START_TOKEN)
hash = 0;
else if (ch->next == NULL) {
hash++;
*pos += 1LL<<32;
} else {
++*pos;
return ch->next;
}
*pos &= ~((1LL<<32) - 1);
while (hash < EXPORT_HASHMAX && export_table[hash] == NULL) {
hash++;
*pos += 1LL<<32;
}
if (hash >= EXPORT_HASHMAX)
return NULL;
++*pos;
return export_table[hash];
}

static void e_stop(struct seq_file *m, void *p)
__releases(((struct cache_detail *)m->private)->hash_lock)
{
struct cache_detail *cd = m->private;

read_unlock(&cd->hash_lock);
}

static struct flags {
int flag;
char *name[2];
Expand Down Expand Up @@ -1270,9 +1203,9 @@ static int e_show(struct seq_file *m, void *p)
}

const struct seq_operations nfs_exports_op = {
.start = e_start,
.next = e_next,
.stop = e_stop,
.start = cache_seq_start,
.next = cache_seq_next,
.stop = cache_seq_stop,
.show = e_show,
};

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

#include <linux/sunrpc/cache.h>
#include <uapi/linux/nfsd/export.h>
#include <linux/nfs4.h>

struct knfsd_fh;
struct svc_fh;
Expand Down
4 changes: 1 addition & 3 deletions fs/nfsd/idmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@

#include <linux/in.h>
#include <linux/sunrpc/svc.h>

/* XXX from linux/nfs_idmap.h */
#define IDMAP_NAMESZ 128
#include <linux/nfs_idmap.h>

#ifdef CONFIG_NFSD_V4
int nfsd_idmap_init(struct net *);
Expand Down
1 change: 1 addition & 0 deletions fs/nfsd/netns.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ struct nfsd_net {
unsigned int max_connections;

u32 clientid_counter;
u32 clverifier_counter;

struct svc_serv *nfsd_serv;
};
Expand Down
10 changes: 4 additions & 6 deletions fs/nfsd/nfs2acl.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ static __be32 nfsacld_proc_getacl(struct svc_rqst * rqstp,

inode = d_inode(fh->fh_dentry);

if (argp->mask & ~(NFS_ACL|NFS_ACLCNT|NFS_DFACL|NFS_DFACLCNT))
if (argp->mask & ~NFS_ACL_MASK)
RETURN_STATUS(nfserr_inval);
resp->mask = argp->mask;

nfserr = fh_getattr(fh, &resp->stat);
if (nfserr)
goto fail;
RETURN_STATUS(nfserr);

if (resp->mask & (NFS_ACL|NFS_ACLCNT)) {
acl = get_acl(inode, ACL_TYPE_ACCESS);
Expand Down Expand Up @@ -202,7 +202,7 @@ static int nfsaclsvc_decode_setaclargs(struct svc_rqst *rqstp, __be32 *p,
if (!p)
return 0;
argp->mask = ntohl(*p++);
if (argp->mask & ~(NFS_ACL|NFS_ACLCNT|NFS_DFACL|NFS_DFACLCNT) ||
if (argp->mask & ~NFS_ACL_MASK ||
!xdr_argsize_check(rqstp, p))
return 0;

Expand Down Expand Up @@ -293,9 +293,7 @@ static int nfsaclsvc_encode_getaclres(struct svc_rqst *rqstp, __be32 *p,
resp->acl_default,
resp->mask & NFS_DFACL,
NFS_ACL_DEFAULT);
if (n <= 0)
return 0;
return 1;
return (n > 0);
}

static int nfsaclsvc_encode_attrstatres(struct svc_rqst *rqstp, __be32 *p,
Expand Down
4 changes: 2 additions & 2 deletions fs/nfsd/nfs3acl.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ static __be32 nfsd3_proc_getacl(struct svc_rqst * rqstp,

inode = d_inode(fh->fh_dentry);

if (argp->mask & ~(NFS_ACL|NFS_ACLCNT|NFS_DFACL|NFS_DFACLCNT))
if (argp->mask & ~NFS_ACL_MASK)
RETURN_STATUS(nfserr_inval);
resp->mask = argp->mask;

Expand Down Expand Up @@ -148,7 +148,7 @@ static int nfs3svc_decode_setaclargs(struct svc_rqst *rqstp, __be32 *p,
if (!p)
return 0;
args->mask = ntohl(*p++);
if (args->mask & ~(NFS_ACL|NFS_ACLCNT|NFS_DFACL|NFS_DFACLCNT) ||
if (args->mask & ~NFS_ACL_MASK ||
!xdr_argsize_check(rqstp, p))
return 0;

Expand Down
8 changes: 5 additions & 3 deletions fs/nfsd/nfs4acl.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#include <linux/fs.h>
#include <linux/slab.h>
#include <linux/nfs_fs.h>
#include <linux/posix_acl.h>

#include "nfsfh.h"
#include "nfsd.h"
#include "acl.h"
Expand Down Expand Up @@ -100,7 +102,7 @@ deny_mask_from_posix(unsigned short perm, u32 flags)
/* We only map from NFSv4 to POSIX ACLs when setting ACLs, when we err on the
* side of being more restrictive, so the mode bit mapping below is
* pessimistic. An optimistic version would be needed to handle DENY's,
* but we espect to coalesce all ALLOWs and DENYs before mapping to mode
* but we expect to coalesce all ALLOWs and DENYs before mapping to mode
* bits. */

static void
Expand Down Expand Up @@ -458,7 +460,7 @@ init_state(struct posix_acl_state *state, int cnt)
state->empty = 1;
/*
* In the worst case, each individual acl could be for a distinct
* named user or group, but we don't no which, so we allocate
* named user or group, but we don't know which, so we allocate
* enough space for either:
*/
alloc = sizeof(struct posix_ace_state_array)
Expand Down
Loading

0 comments on commit 1744771

Please sign in to comment.