Skip to content

Commit

Permalink
Merge tag 'nfsd-4.15' of git://linux-nfs.org/~bfields/linux
Browse files Browse the repository at this point in the history
Pull nfsd updates from Bruce Fields:
 "Lots of good bugfixes, including:

   -  fix a number of races in the NFSv4+ state code

   -  fix some shutdown crashes in multiple-network-namespace cases

   -  relax our 4.1 session limits; if you've an artificially low limit
      to the number of 4.1 clients that can mount simultaneously, try
      upgrading"

* tag 'nfsd-4.15' of git://linux-nfs.org/~bfields/linux: (22 commits)
  SUNRPC: Improve ordering of transport processing
  nfsd: deal with revoked delegations appropriately
  svcrdma: Enqueue after setting XPT_CLOSE in completion handlers
  nfsd: use nfs->ns.inum as net ID
  rpc: remove some BUG()s
  svcrdma: Preserve CB send buffer across retransmits
  nfds: avoid gettimeofday for nfssvc_boot time
  fs, nfsd: convert nfs4_file.fi_ref from atomic_t to refcount_t
  fs, nfsd: convert nfs4_cntl_odstate.co_odcount from atomic_t to refcount_t
  fs, nfsd: convert nfs4_stid.sc_count from atomic_t to refcount_t
  lockd: double unregister of inetaddr notifiers
  nfsd4: catch some false session retries
  nfsd4: fix cached replies to solo SEQUENCE compounds
  sunrcp: make function _svc_create_xprt static
  SUNRPC: Fix tracepoint storage issues with svc_recv and svc_rqst_status
  nfsd: use ARRAY_SIZE
  nfsd: give out fewer session slots as limit approaches
  nfsd: increase DRC cache limit
  nfsd: remove unnecessary nofilehandle checks
  nfs_common: convert int to bool
  ...
  • Loading branch information
Linus Torvalds committed Nov 18, 2017
2 parents 07c455e + 22700f3 commit 4dd3c2e
Show file tree
Hide file tree
Showing 18 changed files with 225 additions and 173 deletions.
20 changes: 9 additions & 11 deletions fs/lockd/svc.c
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,7 @@ static int lockd_start_svc(struct svc_serv *serv)
printk(KERN_WARNING
"lockd_up: svc_rqst allocation failed, error=%d\n",
error);
lockd_unregister_notifiers();
goto out_rqst;
}

Expand Down Expand Up @@ -459,13 +460,16 @@ int lockd_up(struct net *net)
}

error = lockd_up_net(serv, net);
if (error < 0)
goto err_net;
if (error < 0) {
lockd_unregister_notifiers();
goto err_put;
}

error = lockd_start_svc(serv);
if (error < 0)
goto err_start;

if (error < 0) {
lockd_down_net(serv, net);
goto err_put;
}
nlmsvc_users++;
/*
* Note: svc_serv structures have an initial use count of 1,
Expand All @@ -476,12 +480,6 @@ int lockd_up(struct net *net)
err_create:
mutex_unlock(&nlmsvc_mutex);
return error;

err_start:
lockd_down_net(serv, net);
err_net:
lockd_unregister_notifiers();
goto err_put;
}
EXPORT_SYMBOL_GPL(lockd_up);

Expand Down
24 changes: 12 additions & 12 deletions fs/nfs_common/grace.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,7 @@ locks_end_grace(struct lock_manager *lm)
}
EXPORT_SYMBOL_GPL(locks_end_grace);

/**
* locks_in_grace
*
* Lock managers call this function to determine when it is OK for them
* to answer ordinary lock requests, and when they should accept only
* lock reclaims.
*/
int
static bool
__state_in_grace(struct net *net, bool open)
{
struct list_head *grace_list = net_generic(net, grace_net_id);
Expand All @@ -78,15 +71,22 @@ __state_in_grace(struct net *net, bool open)
return false;
}

int locks_in_grace(struct net *net)
/**
* locks_in_grace
*
* Lock managers call this function to determine when it is OK for them
* to answer ordinary lock requests, and when they should accept only
* lock reclaims.
*/
bool locks_in_grace(struct net *net)
{
return __state_in_grace(net, 0);
return __state_in_grace(net, false);
}
EXPORT_SYMBOL_GPL(locks_in_grace);

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

Expand Down
5 changes: 2 additions & 3 deletions fs/nfsd/fault_inject.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <linux/nsproxy.h>
#include <linux/sunrpc/addr.h>
#include <linux/uaccess.h>
#include <linux/kernel.h>

#include "state.h"
#include "netns.h"
Expand Down Expand Up @@ -126,8 +127,6 @@ static struct nfsd_fault_inject_op inject_ops[] = {
},
};

#define NUM_INJECT_OPS (sizeof(inject_ops)/sizeof(struct nfsd_fault_inject_op))

int nfsd_fault_inject_init(void)
{
unsigned int i;
Expand All @@ -138,7 +137,7 @@ int nfsd_fault_inject_init(void)
if (!debug_dir)
goto fail;

for (i = 0; i < NUM_INJECT_OPS; i++) {
for (i = 0; i < ARRAY_SIZE(inject_ops); i++) {
op = &inject_ops[i];
if (!debugfs_create_file(op->file, mode, debug_dir, op, &fops_nfsd))
goto fail;
Expand Down
2 changes: 1 addition & 1 deletion fs/nfsd/netns.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ struct nfsd_net {
bool lockd_up;

/* Time of server startup */
struct timeval nfssvc_boot;
struct timespec64 nfssvc_boot;

/*
* Max number of connections this nfsd container will allow. Defaults
Expand Down
10 changes: 6 additions & 4 deletions fs/nfsd/nfs3xdr.c
Original file line number Diff line number Diff line change
Expand Up @@ -748,8 +748,9 @@ nfs3svc_encode_writeres(struct svc_rqst *rqstp, __be32 *p)
if (resp->status == 0) {
*p++ = htonl(resp->count);
*p++ = htonl(resp->committed);
*p++ = htonl(nn->nfssvc_boot.tv_sec);
*p++ = htonl(nn->nfssvc_boot.tv_usec);
/* unique identifier, y2038 overflow can be ignored */
*p++ = htonl((u32)nn->nfssvc_boot.tv_sec);
*p++ = htonl(nn->nfssvc_boot.tv_nsec);
}
return xdr_ressize_check(rqstp, p);
}
Expand Down Expand Up @@ -1119,8 +1120,9 @@ nfs3svc_encode_commitres(struct svc_rqst *rqstp, __be32 *p)
p = encode_wcc_data(rqstp, p, &resp->fh);
/* Write verifier */
if (resp->status == 0) {
*p++ = htonl(nn->nfssvc_boot.tv_sec);
*p++ = htonl(nn->nfssvc_boot.tv_usec);
/* unique identifier, y2038 overflow can be ignored */
*p++ = htonl((u32)nn->nfssvc_boot.tv_sec);
*p++ = htonl(nn->nfssvc_boot.tv_nsec);
}
return xdr_ressize_check(rqstp, p);
}
Expand Down
4 changes: 2 additions & 2 deletions fs/nfsd/nfs4layouts.c
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ nfsd4_recall_file_layout(struct nfs4_layout_stateid *ls)

trace_layout_recall(&ls->ls_stid.sc_stateid);

atomic_inc(&ls->ls_stid.sc_count);
refcount_inc(&ls->ls_stid.sc_count);
nfsd4_run_cb(&ls->ls_recall);

out_unlock:
Expand Down Expand Up @@ -441,7 +441,7 @@ nfsd4_insert_layout(struct nfsd4_layoutget *lgp, struct nfs4_layout_stateid *ls)
goto done;
}

atomic_inc(&ls->ls_stid.sc_count);
refcount_inc(&ls->ls_stid.sc_count);
list_add_tail(&new->lo_perstate, &ls->ls_layouts);
new = NULL;
done:
Expand Down
19 changes: 5 additions & 14 deletions fs/nfsd/nfs4proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -485,9 +485,6 @@ static __be32
nfsd4_getfh(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
union nfsd4_op_u *u)
{
if (!cstate->current_fh.fh_dentry)
return nfserr_nofilehandle;

u->getfh = &cstate->current_fh;
return nfs_ok;
}
Expand Down Expand Up @@ -535,9 +532,6 @@ static __be32
nfsd4_savefh(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
union nfsd4_op_u *u)
{
if (!cstate->current_fh.fh_dentry)
return nfserr_nofilehandle;

fh_dup2(&cstate->save_fh, &cstate->current_fh);
if (HAS_STATE_ID(cstate, CURRENT_STATE_ID_FLAG)) {
memcpy(&cstate->save_stateid, &cstate->current_stateid, sizeof(stateid_t));
Expand Down Expand Up @@ -570,10 +564,11 @@ static void gen_boot_verifier(nfs4_verifier *verifier, struct net *net)

/*
* This is opaque to client, so no need to byte-swap. Use
* __force to keep sparse happy
* __force to keep sparse happy. y2038 time_t overflow is
* irrelevant in this usage.
*/
verf[0] = (__force __be32)nn->nfssvc_boot.tv_sec;
verf[1] = (__force __be32)nn->nfssvc_boot.tv_usec;
verf[1] = (__force __be32)nn->nfssvc_boot.tv_nsec;
memcpy(verifier->data, verf, sizeof(verifier->data));
}

Expand Down Expand Up @@ -703,10 +698,8 @@ nfsd4_link(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
union nfsd4_op_u *u)
{
struct nfsd4_link *link = &u->link;
__be32 status = nfserr_nofilehandle;
__be32 status;

if (!cstate->save_fh.fh_dentry)
return status;
status = nfsd_link(rqstp, &cstate->current_fh,
link->li_name, link->li_namelen, &cstate->save_fh);
if (!status)
Expand Down Expand Up @@ -850,10 +843,8 @@ nfsd4_rename(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
union nfsd4_op_u *u)
{
struct nfsd4_rename *rename = &u->rename;
__be32 status = nfserr_nofilehandle;
__be32 status;

if (!cstate->save_fh.fh_dentry)
return status;
if (opens_in_grace(SVC_NET(rqstp)) &&
!(cstate->save_fh.fh_export->ex_flags & NFSEXP_NOSUBTREECHECK))
return nfserr_grace;
Expand Down
Loading

0 comments on commit 4dd3c2e

Please sign in to comment.