Commit f90497a1 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'nfsd-6.1' of git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux

Pull nfsd updates from Chuck Lever:
 "This release is mostly bug fixes, clean-ups, and optimizations.

  One notable set of fixes addresses a subtle buffer overflow issue that
  occurs if a small RPC Call message arrives in an oversized RPC record.
  This is only possible on a framed RPC transport such as TCP.

  Because NFSD shares the receive and send buffers in one set of pages,
  an oversized RPC record steals pages from the send buffer that will be
  used to construct the RPC Reply message. NFSD must not assume that a
  full-sized buffer is always available to it; otherwise, it will walk
  off the end of the send buffer while constructing its reply.

  In this release, we also introduce the ability for the server to wait
  a moment for clients to return delegations before it responds with
  NFS4ERR_DELAY. This saves a retransmit and a network round- trip when
  a delegation recall is needed. This work will be built upon in future
  releases.

  The NFS server adds another shrinker to its collection. Because
  courtesy clients can linger for quite some time, they might be
  freeable when the server host comes under memory pressure. A new
  shrinker has been added that releases courtesy client resources during
  low memory scenarios.

  Lastly, of note: the maximum number of operations per NFSv4 COMPOUND
  that NFSD can handle is increased from 16 to 50. There are NFSv4
  client implementations that need more than 16 to successfully perform
  a mount operation that uses a pathname with many components"

* tag 'nfsd-6.1' of git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux: (53 commits)
  nfsd: extra checks when freeing delegation stateids
  nfsd: make nfsd4_run_cb a bool return function
  nfsd: fix comments about spinlock handling with delegations
  nfsd: only fill out return pointer on success in nfsd4_lookup_stateid
  NFSD: fix use-after-free on source server when doing inter-server copy
  NFSD: Cap rsize_bop result based on send buffer size
  NFSD: Rename the fields in copy_stateid_t
  nfsd: use DEFINE_SHOW_ATTRIBUTE to define nfsd_file_cache_stats_fops
  nfsd: use DEFINE_SHOW_ATTRIBUTE to define nfsd_reply_cache_stats_fops
  nfsd: use DEFINE_SHOW_ATTRIBUTE to define client_info_fops
  nfsd: use DEFINE_SHOW_ATTRIBUTE to define export_features_fops and supported_enctypes_fops
  nfsd: use DEFINE_PROC_SHOW_ATTRIBUTE to define nfsd_proc_ops
  NFSD: Pack struct nfsd4_compoundres
  NFSD: Remove unused nfsd4_compoundargs::cachetype field
  NFSD: Remove "inline" directives on op_rsize_bop helpers
  NFSD: Clean up nfs4svc_encode_compoundres()
  SUNRPC: Fix typo in xdr_buf_subsegment's kdoc comment
  NFSD: Clean up WRITE arg decoders
  NFSD: Use xdr_inline_decode() to decode NFSv3 symlinks
  NFSD: Refactor common code out of dirlist helpers
  ...
parents 3497640a 895ddf5e
...@@ -164,7 +164,7 @@ static struct nlm_host *nlm_alloc_host(struct nlm_lookup_host_info *ni, ...@@ -164,7 +164,7 @@ static struct nlm_host *nlm_alloc_host(struct nlm_lookup_host_info *ni,
host->h_addrbuf = nsm->sm_addrbuf; host->h_addrbuf = nsm->sm_addrbuf;
host->net = ni->net; host->net = ni->net;
host->h_cred = get_cred(ni->cred); host->h_cred = get_cred(ni->cred);
strlcpy(host->nodename, utsname()->nodename, sizeof(host->nodename)); strscpy(host->nodename, utsname()->nodename, sizeof(host->nodename));
out: out:
return host; return host;
......
...@@ -521,6 +521,7 @@ const struct svc_procedure nlmsvc_procedures4[24] = { ...@@ -521,6 +521,7 @@ const struct svc_procedure nlmsvc_procedures4[24] = {
.pc_decode = nlm4svc_decode_void, .pc_decode = nlm4svc_decode_void,
.pc_encode = nlm4svc_encode_void, .pc_encode = nlm4svc_encode_void,
.pc_argsize = sizeof(struct nlm_void), .pc_argsize = sizeof(struct nlm_void),
.pc_argzero = sizeof(struct nlm_void),
.pc_ressize = sizeof(struct nlm_void), .pc_ressize = sizeof(struct nlm_void),
.pc_xdrressize = St, .pc_xdrressize = St,
.pc_name = "NULL", .pc_name = "NULL",
...@@ -530,6 +531,7 @@ const struct svc_procedure nlmsvc_procedures4[24] = { ...@@ -530,6 +531,7 @@ const struct svc_procedure nlmsvc_procedures4[24] = {
.pc_decode = nlm4svc_decode_testargs, .pc_decode = nlm4svc_decode_testargs,
.pc_encode = nlm4svc_encode_testres, .pc_encode = nlm4svc_encode_testres,
.pc_argsize = sizeof(struct nlm_args), .pc_argsize = sizeof(struct nlm_args),
.pc_argzero = sizeof(struct nlm_args),
.pc_ressize = sizeof(struct nlm_res), .pc_ressize = sizeof(struct nlm_res),
.pc_xdrressize = Ck+St+2+No+Rg, .pc_xdrressize = Ck+St+2+No+Rg,
.pc_name = "TEST", .pc_name = "TEST",
...@@ -539,6 +541,7 @@ const struct svc_procedure nlmsvc_procedures4[24] = { ...@@ -539,6 +541,7 @@ const struct svc_procedure nlmsvc_procedures4[24] = {
.pc_decode = nlm4svc_decode_lockargs, .pc_decode = nlm4svc_decode_lockargs,
.pc_encode = nlm4svc_encode_res, .pc_encode = nlm4svc_encode_res,
.pc_argsize = sizeof(struct nlm_args), .pc_argsize = sizeof(struct nlm_args),
.pc_argzero = sizeof(struct nlm_args),
.pc_ressize = sizeof(struct nlm_res), .pc_ressize = sizeof(struct nlm_res),
.pc_xdrressize = Ck+St, .pc_xdrressize = Ck+St,
.pc_name = "LOCK", .pc_name = "LOCK",
...@@ -548,6 +551,7 @@ const struct svc_procedure nlmsvc_procedures4[24] = { ...@@ -548,6 +551,7 @@ const struct svc_procedure nlmsvc_procedures4[24] = {
.pc_decode = nlm4svc_decode_cancargs, .pc_decode = nlm4svc_decode_cancargs,
.pc_encode = nlm4svc_encode_res, .pc_encode = nlm4svc_encode_res,
.pc_argsize = sizeof(struct nlm_args), .pc_argsize = sizeof(struct nlm_args),
.pc_argzero = sizeof(struct nlm_args),
.pc_ressize = sizeof(struct nlm_res), .pc_ressize = sizeof(struct nlm_res),
.pc_xdrressize = Ck+St, .pc_xdrressize = Ck+St,
.pc_name = "CANCEL", .pc_name = "CANCEL",
...@@ -557,6 +561,7 @@ const struct svc_procedure nlmsvc_procedures4[24] = { ...@@ -557,6 +561,7 @@ const struct svc_procedure nlmsvc_procedures4[24] = {
.pc_decode = nlm4svc_decode_unlockargs, .pc_decode = nlm4svc_decode_unlockargs,
.pc_encode = nlm4svc_encode_res, .pc_encode = nlm4svc_encode_res,
.pc_argsize = sizeof(struct nlm_args), .pc_argsize = sizeof(struct nlm_args),
.pc_argzero = sizeof(struct nlm_args),
.pc_ressize = sizeof(struct nlm_res), .pc_ressize = sizeof(struct nlm_res),
.pc_xdrressize = Ck+St, .pc_xdrressize = Ck+St,
.pc_name = "UNLOCK", .pc_name = "UNLOCK",
...@@ -566,6 +571,7 @@ const struct svc_procedure nlmsvc_procedures4[24] = { ...@@ -566,6 +571,7 @@ const struct svc_procedure nlmsvc_procedures4[24] = {
.pc_decode = nlm4svc_decode_testargs, .pc_decode = nlm4svc_decode_testargs,
.pc_encode = nlm4svc_encode_res, .pc_encode = nlm4svc_encode_res,
.pc_argsize = sizeof(struct nlm_args), .pc_argsize = sizeof(struct nlm_args),
.pc_argzero = sizeof(struct nlm_args),
.pc_ressize = sizeof(struct nlm_res), .pc_ressize = sizeof(struct nlm_res),
.pc_xdrressize = Ck+St, .pc_xdrressize = Ck+St,
.pc_name = "GRANTED", .pc_name = "GRANTED",
...@@ -575,6 +581,7 @@ const struct svc_procedure nlmsvc_procedures4[24] = { ...@@ -575,6 +581,7 @@ const struct svc_procedure nlmsvc_procedures4[24] = {
.pc_decode = nlm4svc_decode_testargs, .pc_decode = nlm4svc_decode_testargs,
.pc_encode = nlm4svc_encode_void, .pc_encode = nlm4svc_encode_void,
.pc_argsize = sizeof(struct nlm_args), .pc_argsize = sizeof(struct nlm_args),
.pc_argzero = sizeof(struct nlm_args),
.pc_ressize = sizeof(struct nlm_void), .pc_ressize = sizeof(struct nlm_void),
.pc_xdrressize = St, .pc_xdrressize = St,
.pc_name = "TEST_MSG", .pc_name = "TEST_MSG",
...@@ -584,6 +591,7 @@ const struct svc_procedure nlmsvc_procedures4[24] = { ...@@ -584,6 +591,7 @@ const struct svc_procedure nlmsvc_procedures4[24] = {
.pc_decode = nlm4svc_decode_lockargs, .pc_decode = nlm4svc_decode_lockargs,
.pc_encode = nlm4svc_encode_void, .pc_encode = nlm4svc_encode_void,
.pc_argsize = sizeof(struct nlm_args), .pc_argsize = sizeof(struct nlm_args),
.pc_argzero = sizeof(struct nlm_args),
.pc_ressize = sizeof(struct nlm_void), .pc_ressize = sizeof(struct nlm_void),
.pc_xdrressize = St, .pc_xdrressize = St,
.pc_name = "LOCK_MSG", .pc_name = "LOCK_MSG",
...@@ -593,6 +601,7 @@ const struct svc_procedure nlmsvc_procedures4[24] = { ...@@ -593,6 +601,7 @@ const struct svc_procedure nlmsvc_procedures4[24] = {
.pc_decode = nlm4svc_decode_cancargs, .pc_decode = nlm4svc_decode_cancargs,
.pc_encode = nlm4svc_encode_void, .pc_encode = nlm4svc_encode_void,
.pc_argsize = sizeof(struct nlm_args), .pc_argsize = sizeof(struct nlm_args),
.pc_argzero = sizeof(struct nlm_args),
.pc_ressize = sizeof(struct nlm_void), .pc_ressize = sizeof(struct nlm_void),
.pc_xdrressize = St, .pc_xdrressize = St,
.pc_name = "CANCEL_MSG", .pc_name = "CANCEL_MSG",
...@@ -602,6 +611,7 @@ const struct svc_procedure nlmsvc_procedures4[24] = { ...@@ -602,6 +611,7 @@ const struct svc_procedure nlmsvc_procedures4[24] = {
.pc_decode = nlm4svc_decode_unlockargs, .pc_decode = nlm4svc_decode_unlockargs,
.pc_encode = nlm4svc_encode_void, .pc_encode = nlm4svc_encode_void,
.pc_argsize = sizeof(struct nlm_args), .pc_argsize = sizeof(struct nlm_args),
.pc_argzero = sizeof(struct nlm_args),
.pc_ressize = sizeof(struct nlm_void), .pc_ressize = sizeof(struct nlm_void),
.pc_xdrressize = St, .pc_xdrressize = St,
.pc_name = "UNLOCK_MSG", .pc_name = "UNLOCK_MSG",
...@@ -611,6 +621,7 @@ const struct svc_procedure nlmsvc_procedures4[24] = { ...@@ -611,6 +621,7 @@ const struct svc_procedure nlmsvc_procedures4[24] = {
.pc_decode = nlm4svc_decode_testargs, .pc_decode = nlm4svc_decode_testargs,
.pc_encode = nlm4svc_encode_void, .pc_encode = nlm4svc_encode_void,
.pc_argsize = sizeof(struct nlm_args), .pc_argsize = sizeof(struct nlm_args),
.pc_argzero = sizeof(struct nlm_args),
.pc_ressize = sizeof(struct nlm_void), .pc_ressize = sizeof(struct nlm_void),
.pc_xdrressize = St, .pc_xdrressize = St,
.pc_name = "GRANTED_MSG", .pc_name = "GRANTED_MSG",
...@@ -620,6 +631,7 @@ const struct svc_procedure nlmsvc_procedures4[24] = { ...@@ -620,6 +631,7 @@ const struct svc_procedure nlmsvc_procedures4[24] = {
.pc_decode = nlm4svc_decode_void, .pc_decode = nlm4svc_decode_void,
.pc_encode = nlm4svc_encode_void, .pc_encode = nlm4svc_encode_void,
.pc_argsize = sizeof(struct nlm_res), .pc_argsize = sizeof(struct nlm_res),
.pc_argzero = sizeof(struct nlm_res),
.pc_ressize = sizeof(struct nlm_void), .pc_ressize = sizeof(struct nlm_void),
.pc_xdrressize = St, .pc_xdrressize = St,
.pc_name = "TEST_RES", .pc_name = "TEST_RES",
...@@ -629,6 +641,7 @@ const struct svc_procedure nlmsvc_procedures4[24] = { ...@@ -629,6 +641,7 @@ const struct svc_procedure nlmsvc_procedures4[24] = {
.pc_decode = nlm4svc_decode_void, .pc_decode = nlm4svc_decode_void,
.pc_encode = nlm4svc_encode_void, .pc_encode = nlm4svc_encode_void,
.pc_argsize = sizeof(struct nlm_res), .pc_argsize = sizeof(struct nlm_res),
.pc_argzero = sizeof(struct nlm_res),
.pc_ressize = sizeof(struct nlm_void), .pc_ressize = sizeof(struct nlm_void),
.pc_xdrressize = St, .pc_xdrressize = St,
.pc_name = "LOCK_RES", .pc_name = "LOCK_RES",
...@@ -638,6 +651,7 @@ const struct svc_procedure nlmsvc_procedures4[24] = { ...@@ -638,6 +651,7 @@ const struct svc_procedure nlmsvc_procedures4[24] = {
.pc_decode = nlm4svc_decode_void, .pc_decode = nlm4svc_decode_void,
.pc_encode = nlm4svc_encode_void, .pc_encode = nlm4svc_encode_void,
.pc_argsize = sizeof(struct nlm_res), .pc_argsize = sizeof(struct nlm_res),
.pc_argzero = sizeof(struct nlm_res),
.pc_ressize = sizeof(struct nlm_void), .pc_ressize = sizeof(struct nlm_void),
.pc_xdrressize = St, .pc_xdrressize = St,
.pc_name = "CANCEL_RES", .pc_name = "CANCEL_RES",
...@@ -647,6 +661,7 @@ const struct svc_procedure nlmsvc_procedures4[24] = { ...@@ -647,6 +661,7 @@ const struct svc_procedure nlmsvc_procedures4[24] = {
.pc_decode = nlm4svc_decode_void, .pc_decode = nlm4svc_decode_void,
.pc_encode = nlm4svc_encode_void, .pc_encode = nlm4svc_encode_void,
.pc_argsize = sizeof(struct nlm_res), .pc_argsize = sizeof(struct nlm_res),
.pc_argzero = sizeof(struct nlm_res),
.pc_ressize = sizeof(struct nlm_void), .pc_ressize = sizeof(struct nlm_void),
.pc_xdrressize = St, .pc_xdrressize = St,
.pc_name = "UNLOCK_RES", .pc_name = "UNLOCK_RES",
...@@ -656,6 +671,7 @@ const struct svc_procedure nlmsvc_procedures4[24] = { ...@@ -656,6 +671,7 @@ const struct svc_procedure nlmsvc_procedures4[24] = {
.pc_decode = nlm4svc_decode_res, .pc_decode = nlm4svc_decode_res,
.pc_encode = nlm4svc_encode_void, .pc_encode = nlm4svc_encode_void,
.pc_argsize = sizeof(struct nlm_res), .pc_argsize = sizeof(struct nlm_res),
.pc_argzero = sizeof(struct nlm_res),
.pc_ressize = sizeof(struct nlm_void), .pc_ressize = sizeof(struct nlm_void),
.pc_xdrressize = St, .pc_xdrressize = St,
.pc_name = "GRANTED_RES", .pc_name = "GRANTED_RES",
...@@ -665,6 +681,7 @@ const struct svc_procedure nlmsvc_procedures4[24] = { ...@@ -665,6 +681,7 @@ const struct svc_procedure nlmsvc_procedures4[24] = {
.pc_decode = nlm4svc_decode_reboot, .pc_decode = nlm4svc_decode_reboot,
.pc_encode = nlm4svc_encode_void, .pc_encode = nlm4svc_encode_void,
.pc_argsize = sizeof(struct nlm_reboot), .pc_argsize = sizeof(struct nlm_reboot),
.pc_argzero = sizeof(struct nlm_reboot),
.pc_ressize = sizeof(struct nlm_void), .pc_ressize = sizeof(struct nlm_void),
.pc_xdrressize = St, .pc_xdrressize = St,
.pc_name = "SM_NOTIFY", .pc_name = "SM_NOTIFY",
...@@ -674,6 +691,7 @@ const struct svc_procedure nlmsvc_procedures4[24] = { ...@@ -674,6 +691,7 @@ const struct svc_procedure nlmsvc_procedures4[24] = {
.pc_decode = nlm4svc_decode_void, .pc_decode = nlm4svc_decode_void,
.pc_encode = nlm4svc_encode_void, .pc_encode = nlm4svc_encode_void,
.pc_argsize = sizeof(struct nlm_void), .pc_argsize = sizeof(struct nlm_void),
.pc_argzero = sizeof(struct nlm_void),
.pc_ressize = sizeof(struct nlm_void), .pc_ressize = sizeof(struct nlm_void),
.pc_xdrressize = 0, .pc_xdrressize = 0,
.pc_name = "UNUSED", .pc_name = "UNUSED",
...@@ -683,6 +701,7 @@ const struct svc_procedure nlmsvc_procedures4[24] = { ...@@ -683,6 +701,7 @@ const struct svc_procedure nlmsvc_procedures4[24] = {
.pc_decode = nlm4svc_decode_void, .pc_decode = nlm4svc_decode_void,
.pc_encode = nlm4svc_encode_void, .pc_encode = nlm4svc_encode_void,
.pc_argsize = sizeof(struct nlm_void), .pc_argsize = sizeof(struct nlm_void),
.pc_argzero = sizeof(struct nlm_void),
.pc_ressize = sizeof(struct nlm_void), .pc_ressize = sizeof(struct nlm_void),
.pc_xdrressize = 0, .pc_xdrressize = 0,
.pc_name = "UNUSED", .pc_name = "UNUSED",
...@@ -692,6 +711,7 @@ const struct svc_procedure nlmsvc_procedures4[24] = { ...@@ -692,6 +711,7 @@ const struct svc_procedure nlmsvc_procedures4[24] = {
.pc_decode = nlm4svc_decode_void, .pc_decode = nlm4svc_decode_void,
.pc_encode = nlm4svc_encode_void, .pc_encode = nlm4svc_encode_void,
.pc_argsize = sizeof(struct nlm_void), .pc_argsize = sizeof(struct nlm_void),
.pc_argzero = sizeof(struct nlm_void),
.pc_ressize = sizeof(struct nlm_void), .pc_ressize = sizeof(struct nlm_void),
.pc_xdrressize = 0, .pc_xdrressize = 0,
.pc_name = "UNUSED", .pc_name = "UNUSED",
...@@ -701,6 +721,7 @@ const struct svc_procedure nlmsvc_procedures4[24] = { ...@@ -701,6 +721,7 @@ const struct svc_procedure nlmsvc_procedures4[24] = {
.pc_decode = nlm4svc_decode_shareargs, .pc_decode = nlm4svc_decode_shareargs,
.pc_encode = nlm4svc_encode_shareres, .pc_encode = nlm4svc_encode_shareres,
.pc_argsize = sizeof(struct nlm_args), .pc_argsize = sizeof(struct nlm_args),
.pc_argzero = sizeof(struct nlm_args),
.pc_ressize = sizeof(struct nlm_res), .pc_ressize = sizeof(struct nlm_res),
.pc_xdrressize = Ck+St+1, .pc_xdrressize = Ck+St+1,
.pc_name = "SHARE", .pc_name = "SHARE",
...@@ -710,6 +731,7 @@ const struct svc_procedure nlmsvc_procedures4[24] = { ...@@ -710,6 +731,7 @@ const struct svc_procedure nlmsvc_procedures4[24] = {
.pc_decode = nlm4svc_decode_shareargs, .pc_decode = nlm4svc_decode_shareargs,
.pc_encode = nlm4svc_encode_shareres, .pc_encode = nlm4svc_encode_shareres,
.pc_argsize = sizeof(struct nlm_args), .pc_argsize = sizeof(struct nlm_args),
.pc_argzero = sizeof(struct nlm_args),
.pc_ressize = sizeof(struct nlm_res), .pc_ressize = sizeof(struct nlm_res),
.pc_xdrressize = Ck+St+1, .pc_xdrressize = Ck+St+1,
.pc_name = "UNSHARE", .pc_name = "UNSHARE",
...@@ -719,6 +741,7 @@ const struct svc_procedure nlmsvc_procedures4[24] = { ...@@ -719,6 +741,7 @@ const struct svc_procedure nlmsvc_procedures4[24] = {
.pc_decode = nlm4svc_decode_lockargs, .pc_decode = nlm4svc_decode_lockargs,
.pc_encode = nlm4svc_encode_res, .pc_encode = nlm4svc_encode_res,
.pc_argsize = sizeof(struct nlm_args), .pc_argsize = sizeof(struct nlm_args),
.pc_argzero = sizeof(struct nlm_args),
.pc_ressize = sizeof(struct nlm_res), .pc_ressize = sizeof(struct nlm_res),
.pc_xdrressize = Ck+St, .pc_xdrressize = Ck+St,
.pc_name = "NM_LOCK", .pc_name = "NM_LOCK",
...@@ -728,6 +751,7 @@ const struct svc_procedure nlmsvc_procedures4[24] = { ...@@ -728,6 +751,7 @@ const struct svc_procedure nlmsvc_procedures4[24] = {
.pc_decode = nlm4svc_decode_notify, .pc_decode = nlm4svc_decode_notify,
.pc_encode = nlm4svc_encode_void, .pc_encode = nlm4svc_encode_void,
.pc_argsize = sizeof(struct nlm_args), .pc_argsize = sizeof(struct nlm_args),
.pc_argzero = sizeof(struct nlm_args),
.pc_ressize = sizeof(struct nlm_void), .pc_ressize = sizeof(struct nlm_void),
.pc_xdrressize = St, .pc_xdrressize = St,
.pc_name = "FREE_ALL", .pc_name = "FREE_ALL",
......
...@@ -555,6 +555,7 @@ const struct svc_procedure nlmsvc_procedures[24] = { ...@@ -555,6 +555,7 @@ const struct svc_procedure nlmsvc_procedures[24] = {
.pc_decode = nlmsvc_decode_void, .pc_decode = nlmsvc_decode_void,
.pc_encode = nlmsvc_encode_void, .pc_encode = nlmsvc_encode_void,
.pc_argsize = sizeof(struct nlm_void), .pc_argsize = sizeof(struct nlm_void),
.pc_argzero = sizeof(struct nlm_void),
.pc_ressize = sizeof(struct nlm_void), .pc_ressize = sizeof(struct nlm_void),
.pc_xdrressize = St, .pc_xdrressize = St,
.pc_name = "NULL", .pc_name = "NULL",
...@@ -564,6 +565,7 @@ const struct svc_procedure nlmsvc_procedures[24] = { ...@@ -564,6 +565,7 @@ const struct svc_procedure nlmsvc_procedures[24] = {
.pc_decode = nlmsvc_decode_testargs, .pc_decode = nlmsvc_decode_testargs,
.pc_encode = nlmsvc_encode_testres, .pc_encode = nlmsvc_encode_testres,
.pc_argsize = sizeof(struct nlm_args), .pc_argsize = sizeof(struct nlm_args),
.pc_argzero = sizeof(struct nlm_args),
.pc_ressize = sizeof(struct nlm_res), .pc_ressize = sizeof(struct nlm_res),
.pc_xdrressize = Ck+St+2+No+Rg, .pc_xdrressize = Ck+St+2+No+Rg,
.pc_name = "TEST", .pc_name = "TEST",
...@@ -573,6 +575,7 @@ const struct svc_procedure nlmsvc_procedures[24] = { ...@@ -573,6 +575,7 @@ const struct svc_procedure nlmsvc_procedures[24] = {
.pc_decode = nlmsvc_decode_lockargs, .pc_decode = nlmsvc_decode_lockargs,
.pc_encode = nlmsvc_encode_res, .pc_encode = nlmsvc_encode_res,
.pc_argsize = sizeof(struct nlm_args), .pc_argsize = sizeof(struct nlm_args),
.pc_argzero = sizeof(struct nlm_args),
.pc_ressize = sizeof(struct nlm_res), .pc_ressize = sizeof(struct nlm_res),
.pc_xdrressize = Ck+St, .pc_xdrressize = Ck+St,
.pc_name = "LOCK", .pc_name = "LOCK",
...@@ -582,6 +585,7 @@ const struct svc_procedure nlmsvc_procedures[24] = { ...@@ -582,6 +585,7 @@ const struct svc_procedure nlmsvc_procedures[24] = {
.pc_decode = nlmsvc_decode_cancargs, .pc_decode = nlmsvc_decode_cancargs,
.pc_encode = nlmsvc_encode_res, .pc_encode = nlmsvc_encode_res,
.pc_argsize = sizeof(struct nlm_args), .pc_argsize = sizeof(struct nlm_args),
.pc_argzero = sizeof(struct nlm_args),
.pc_ressize = sizeof(struct nlm_res), .pc_ressize = sizeof(struct nlm_res),
.pc_xdrressize = Ck+St, .pc_xdrressize = Ck+St,
.pc_name = "CANCEL", .pc_name = "CANCEL",
...@@ -591,6 +595,7 @@ const struct svc_procedure nlmsvc_procedures[24] = { ...@@ -591,6 +595,7 @@ const struct svc_procedure nlmsvc_procedures[24] = {
.pc_decode = nlmsvc_decode_unlockargs, .pc_decode = nlmsvc_decode_unlockargs,
.pc_encode = nlmsvc_encode_res, .pc_encode = nlmsvc_encode_res,
.pc_argsize = sizeof(struct nlm_args), .pc_argsize = sizeof(struct nlm_args),
.pc_argzero = sizeof(struct nlm_args),
.pc_ressize = sizeof(struct nlm_res), .pc_ressize = sizeof(struct nlm_res),
.pc_xdrressize = Ck+St, .pc_xdrressize = Ck+St,
.pc_name = "UNLOCK", .pc_name = "UNLOCK",
...@@ -600,6 +605,7 @@ const struct svc_procedure nlmsvc_procedures[24] = { ...@@ -600,6 +605,7 @@ const struct svc_procedure nlmsvc_procedures[24] = {
.pc_decode = nlmsvc_decode_testargs, .pc_decode = nlmsvc_decode_testargs,
.pc_encode = nlmsvc_encode_res, .pc_encode = nlmsvc_encode_res,
.pc_argsize = sizeof(struct nlm_args), .pc_argsize = sizeof(struct nlm_args),
.pc_argzero = sizeof(struct nlm_args),
.pc_ressize = sizeof(struct nlm_res), .pc_ressize = sizeof(struct nlm_res),
.pc_xdrressize = Ck+St, .pc_xdrressize = Ck+St,
.pc_name = "GRANTED", .pc_name = "GRANTED",
...@@ -609,6 +615,7 @@ const struct svc_procedure nlmsvc_procedures[24] = { ...@@ -609,6 +615,7 @@ const struct svc_procedure nlmsvc_procedures[24] = {
.pc_decode = nlmsvc_decode_testargs, .pc_decode = nlmsvc_decode_testargs,
.pc_encode = nlmsvc_encode_void, .pc_encode = nlmsvc_encode_void,
.pc_argsize = sizeof(struct nlm_args), .pc_argsize = sizeof(struct nlm_args),
.pc_argzero = sizeof(struct nlm_args),
.pc_ressize = sizeof(struct nlm_void), .pc_ressize = sizeof(struct nlm_void),
.pc_xdrressize = St, .pc_xdrressize = St,
.pc_name = "TEST_MSG", .pc_name = "TEST_MSG",
...@@ -618,6 +625,7 @@ const struct svc_procedure nlmsvc_procedures[24] = { ...@@ -618,6 +625,7 @@ const struct svc_procedure nlmsvc_procedures[24] = {
.pc_decode = nlmsvc_decode_lockargs, .pc_decode = nlmsvc_decode_lockargs,
.pc_encode = nlmsvc_encode_void, .pc_encode = nlmsvc_encode_void,
.pc_argsize = sizeof(struct nlm_args), .pc_argsize = sizeof(struct nlm_args),
.pc_argzero = sizeof(struct nlm_args),
.pc_ressize = sizeof(struct nlm_void), .pc_ressize = sizeof(struct nlm_void),
.pc_xdrressize = St, .pc_xdrressize = St,
.pc_name = "LOCK_MSG", .pc_name = "LOCK_MSG",
...@@ -627,6 +635,7 @@ const struct svc_procedure nlmsvc_procedures[24] = { ...@@ -627,6 +635,7 @@ const struct svc_procedure nlmsvc_procedures[24] = {
.pc_decode = nlmsvc_decode_cancargs, .pc_decode = nlmsvc_decode_cancargs,
.pc_encode = nlmsvc_encode_void, .pc_encode = nlmsvc_encode_void,
.pc_argsize = sizeof(struct nlm_args), .pc_argsize = sizeof(struct nlm_args),
.pc_argzero = sizeof(struct nlm_args),
.pc_ressize = sizeof(struct nlm_void), .pc_ressize = sizeof(struct nlm_void),
.pc_xdrressize = St, .pc_xdrressize = St,
.pc_name = "CANCEL_MSG", .pc_name = "CANCEL_MSG",
...@@ -636,6 +645,7 @@ const struct svc_procedure nlmsvc_procedures[24] = { ...@@ -636,6 +645,7 @@ const struct svc_procedure nlmsvc_procedures[24] = {
.pc_decode = nlmsvc_decode_unlockargs, .pc_decode = nlmsvc_decode_unlockargs,
.pc_encode = nlmsvc_encode_void, .pc_encode = nlmsvc_encode_void,
.pc_argsize = sizeof(struct nlm_args), .pc_argsize = sizeof(struct nlm_args),
.pc_argzero = sizeof(struct nlm_args),
.pc_ressize = sizeof(struct nlm_void), .pc_ressize = sizeof(struct nlm_void),
.pc_xdrressize = St, .pc_xdrressize = St,
.pc_name = "UNLOCK_MSG", .pc_name = "UNLOCK_MSG",
...@@ -645,6 +655,7 @@ const struct svc_procedure nlmsvc_procedures[24] = { ...@@ -645,6 +655,7 @@ const struct svc_procedure nlmsvc_procedures[24] = {
.pc_decode = nlmsvc_decode_testargs, .pc_decode = nlmsvc_decode_testargs,
.pc_encode = nlmsvc_encode_void, .pc_encode = nlmsvc_encode_void,
.pc_argsize = sizeof(struct nlm_args), .pc_argsize = sizeof(struct nlm_args),
.pc_argzero = sizeof(struct nlm_args),
.pc_ressize = sizeof(struct nlm_void), .pc_ressize = sizeof(struct nlm_void),
.pc_xdrressize = St, .pc_xdrressize = St,
.pc_name = "GRANTED_MSG", .pc_name = "GRANTED_MSG",
...@@ -654,6 +665,7 @@ const struct svc_procedure nlmsvc_procedures[24] = { ...@@ -654,6 +665,7 @@ const struct svc_procedure nlmsvc_procedures[24] = {
.pc_decode = nlmsvc_decode_void, .pc_decode = nlmsvc_decode_void,
.pc_encode = nlmsvc_encode_void, .pc_encode = nlmsvc_encode_void,
.pc_argsize = sizeof(struct nlm_res), .pc_argsize = sizeof(struct nlm_res),
.pc_argzero = sizeof(struct nlm_res),
.pc_ressize = sizeof(struct nlm_void), .pc_ressize = sizeof(struct nlm_void),
.pc_xdrressize = St, .pc_xdrressize = St,
.pc_name = "TEST_RES", .pc_name = "TEST_RES",
...@@ -663,6 +675,7 @@ const struct svc_procedure nlmsvc_procedures[24] = { ...@@ -663,6 +675,7 @@ const struct svc_procedure nlmsvc_procedures[24] = {
.pc_decode = nlmsvc_decode_void, .pc_decode = nlmsvc_decode_void,
.pc_encode = nlmsvc_encode_void, .pc_encode = nlmsvc_encode_void,
.pc_argsize = sizeof(struct nlm_res), .pc_argsize = sizeof(struct nlm_res),
.pc_argzero = sizeof(struct nlm_res),
.pc_ressize = sizeof(struct nlm_void), .pc_ressize = sizeof(struct nlm_void),
.pc_xdrressize = St, .pc_xdrressize = St,
.pc_name = "LOCK_RES", .pc_name = "LOCK_RES",
...@@ -672,6 +685,7 @@ const struct svc_procedure nlmsvc_procedures[24] = { ...@@ -672,6 +685,7 @@ const struct svc_procedure nlmsvc_procedures[24] = {
.pc_decode = nlmsvc_decode_void, .pc_decode = nlmsvc_decode_void,
.pc_encode = nlmsvc_encode_void, .pc_encode = nlmsvc_encode_void,
.pc_argsize = sizeof(struct nlm_res), .pc_argsize = sizeof(struct nlm_res),
.pc_argzero = sizeof(struct nlm_res),
.pc_ressize = sizeof(struct nlm_void), .pc_ressize = sizeof(struct nlm_void),
.pc_xdrressize = St, .pc_xdrressize = St,
.pc_name = "CANCEL_RES", .pc_name = "CANCEL_RES",
...@@ -681,6 +695,7 @@ const struct svc_procedure nlmsvc_procedures[24] = { ...@@ -681,6 +695,7 @@ const struct svc_procedure nlmsvc_procedures[24] = {
.pc_decode = nlmsvc_decode_void, .pc_decode = nlmsvc_decode_void,
.pc_encode = nlmsvc_encode_void, .pc_encode = nlmsvc_encode_void,
.pc_argsize = sizeof(struct nlm_res), .pc_argsize = sizeof(struct nlm_res),
.pc_argzero = sizeof(struct nlm_res),
.pc_ressize = sizeof(struct nlm_void), .pc_ressize = sizeof(struct nlm_void),
.pc_xdrressize = St, .pc_xdrressize = St,
.pc_name = "UNLOCK_RES", .pc_name = "UNLOCK_RES",
...@@ -690,6 +705,7 @@ const struct svc_procedure nlmsvc_procedures[24] = { ...@@ -690,6 +705,7 @@ const struct svc_procedure nlmsvc_procedures[24] = {
.pc_decode = nlmsvc_decode_res, .pc_decode = nlmsvc_decode_res,
.pc_encode = nlmsvc_encode_void, .pc_encode = nlmsvc_encode_void,
.pc_argsize = sizeof(struct nlm_res), .pc_argsize = sizeof(struct nlm_res),
.pc_argzero = sizeof(struct nlm_res),
.pc_ressize = sizeof(struct nlm_void), .pc_ressize = sizeof(struct nlm_void),
.pc_xdrressize = St, .pc_xdrressize = St,
.pc_name = "GRANTED_RES", .pc_name = "GRANTED_RES",
...@@ -699,6 +715,7 @@ const struct svc_procedure nlmsvc_procedures[24] = { ...@@ -699,6 +715,7 @@ const struct svc_procedure nlmsvc_procedures[24] = {
.pc_decode = nlmsvc_decode_reboot, .pc_decode = nlmsvc_decode_reboot,
.pc_encode = nlmsvc_encode_void, .pc_encode = nlmsvc_encode_void,
.pc_argsize = sizeof(struct nlm_reboot), .pc_argsize = sizeof(struct nlm_reboot),
.pc_argzero = sizeof(struct nlm_reboot),
.pc_ressize = sizeof(struct nlm_void), .pc_ressize = sizeof(struct nlm_void),
.pc_xdrressize = St, .pc_xdrressize = St,
.pc_name = "SM_NOTIFY", .pc_name = "SM_NOTIFY",
...@@ -708,6 +725,7 @@ const struct svc_procedure nlmsvc_procedures[24] = { ...@@ -708,6 +725,7 @@ const struct svc_procedure nlmsvc_procedures[24] = {
.pc_decode = nlmsvc_decode_void, .pc_decode = nlmsvc_decode_void,
.pc_encode = nlmsvc_encode_void, .pc_encode = nlmsvc_encode_void,
.pc_argsize = sizeof(struct nlm_void), .pc_argsize = sizeof(struct nlm_void),
.pc_argzero = sizeof(struct nlm_void),
.pc_ressize = sizeof(struct nlm_void), .pc_ressize = sizeof(struct nlm_void),
.pc_xdrressize = St, .pc_xdrressize = St,
.pc_name = "UNUSED", .pc_name = "UNUSED",
...@@ -717,6 +735,7 @@ const struct svc_procedure nlmsvc_procedures[24] = { ...@@ -717,6 +735,7 @@ const struct svc_procedure nlmsvc_procedures[24] = {
.pc_decode = nlmsvc_decode_void, .pc_decode = nlmsvc_decode_void,
.pc_encode = nlmsvc_encode_void, .pc_encode = nlmsvc_encode_void,
.pc_argsize = sizeof(struct nlm_void), .pc_argsize = sizeof(struct nlm_void),
.pc_argzero = sizeof(struct nlm_void),
.pc_ressize = sizeof(struct nlm_void), .pc_ressize = sizeof(struct nlm_void),
.pc_xdrressize = St, .pc_xdrressize = St,
.pc_name = "UNUSED", .pc_name = "UNUSED",
...@@ -726,6 +745,7 @@ const struct svc_procedure nlmsvc_procedures[24] = { ...@@ -726,6 +745,7 @@ const struct svc_procedure nlmsvc_procedures[24] = {
.pc_decode = nlmsvc_decode_void, .pc_decode = nlmsvc_decode_void,
.pc_encode = nlmsvc_encode_void, .pc_encode = nlmsvc_encode_void,
.pc_argsize = sizeof(struct nlm_void), .pc_argsize = sizeof(struct nlm_void),
.pc_argzero = sizeof(struct nlm_void),
.pc_ressize = sizeof(struct nlm_void), .pc_ressize = sizeof(struct nlm_void),
.pc_xdrressize = St, .pc_xdrressize = St,
.pc_name = "UNUSED", .pc_name = "UNUSED",
...@@ -735,6 +755,7 @@ const struct svc_procedure nlmsvc_procedures[24] = { ...@@ -735,6 +755,7 @@ const struct svc_procedure nlmsvc_procedures[24] = {
.pc_decode = nlmsvc_decode_shareargs, .pc_decode = nlmsvc_decode_shareargs,
.pc_encode = nlmsvc_encode_shareres, .pc_encode = nlmsvc_encode_shareres,
.pc_argsize = sizeof(struct nlm_args), .pc_argsize = sizeof(struct nlm_args),
.pc_argzero = sizeof(struct nlm_args),
.pc_ressize = sizeof(struct nlm_res), .pc_ressize = sizeof(struct nlm_res),
.pc_xdrressize = Ck+St+1, .pc_xdrressize = Ck+St+1,
.pc_name = "SHARE", .pc_name = "SHARE",
...@@ -744,6 +765,7 @@ const struct svc_procedure nlmsvc_procedures[24] = { ...@@ -744,6 +765,7 @@ const struct svc_procedure nlmsvc_procedures[24] = {
.pc_decode = nlmsvc_decode_shareargs, .pc_decode = nlmsvc_decode_shareargs,
.pc_encode = nlmsvc_encode_shareres, .pc_encode = nlmsvc_encode_shareres,
.pc_argsize = sizeof(struct nlm_args), .pc_argsize = sizeof(struct nlm_args),
.pc_argzero = sizeof(struct nlm_args),
.pc_ressize = sizeof(struct nlm_res), .pc_ressize = sizeof(struct nlm_res),
.pc_xdrressize = Ck+St+1, .pc_xdrressize = Ck+St+1,
.pc_name = "UNSHARE", .pc_name = "UNSHARE",
...@@ -753,6 +775,7 @@ const struct svc_procedure nlmsvc_procedures[24] = { ...@@ -753,6 +775,7 @@ const struct svc_procedure nlmsvc_procedures[24] = {
.pc_decode = nlmsvc_decode_lockargs, .pc_decode = nlmsvc_decode_lockargs,
.pc_encode = nlmsvc_encode_res, .pc_encode = nlmsvc_encode_res,
.pc_argsize = sizeof(struct nlm_args), .pc_argsize = sizeof(struct nlm_args),
.pc_argzero = sizeof(struct nlm_args),
.pc_ressize = sizeof(struct nlm_res), .pc_ressize = sizeof(struct nlm_res),
.pc_xdrressize = Ck+St, .pc_xdrressize = Ck+St,
.pc_name = "NM_LOCK", .pc_name = "NM_LOCK",
...@@ -762,6 +785,7 @@ const struct svc_procedure nlmsvc_procedures[24] = { ...@@ -762,6 +785,7 @@ const struct svc_procedure nlmsvc_procedures[24] = {
.pc_decode = nlmsvc_decode_notify, .pc_decode = nlmsvc_decode_notify,
.pc_encode = nlmsvc_encode_void, .pc_encode = nlmsvc_encode_void,
.pc_argsize = sizeof(struct nlm_args), .pc_argsize = sizeof(struct nlm_args),
.pc_argzero = sizeof(struct nlm_args),
.pc_ressize = sizeof(struct nlm_void), .pc_ressize = sizeof(struct nlm_void),
.pc_xdrressize = 0, .pc_xdrressize = 0,
.pc_name = "FREE_ALL", .pc_name = "FREE_ALL",
......
...@@ -1065,6 +1065,7 @@ static const struct svc_procedure nfs4_callback_procedures1[] = { ...@@ -1065,6 +1065,7 @@ static const struct svc_procedure nfs4_callback_procedures1[] = {
.pc_func = nfs4_callback_compound, .pc_func = nfs4_callback_compound,
.pc_encode = nfs4_encode_void, .pc_encode = nfs4_encode_void,
.pc_argsize = 256, .pc_argsize = 256,
.pc_argzero = 256,
.pc_ressize = 256, .pc_ressize = 256,
.pc_xdrressize = NFS4_CALLBACK_BUFSIZE, .pc_xdrressize = NFS4_CALLBACK_BUFSIZE,
.pc_name = "COMPOUND", .pc_name = "COMPOUND",
......
...@@ -84,6 +84,6 @@ int nfsd_reply_cache_init(struct nfsd_net *); ...@@ -84,6 +84,6 @@ int nfsd_reply_cache_init(struct nfsd_net *);
void nfsd_reply_cache_shutdown(struct nfsd_net *); void nfsd_reply_cache_shutdown(struct nfsd_net *);
int nfsd_cache_lookup(struct svc_rqst *); int nfsd_cache_lookup(struct svc_rqst *);
void nfsd_cache_update(struct svc_rqst *, int, __be32 *); void nfsd_cache_update(struct svc_rqst *, int, __be32 *);
int nfsd_reply_cache_stats_open(struct inode *, struct file *); int nfsd_reply_cache_stats_show(struct seq_file *m, void *v);
#endif /* NFSCACHE_H */ #endif /* NFSCACHE_H */
...@@ -1212,7 +1212,7 @@ nfsd_file_create(struct svc_rqst *rqstp, struct svc_fh *fhp, ...@@ -1212,7 +1212,7 @@ nfsd_file_create(struct svc_rqst *rqstp, struct svc_fh *fhp,
* scraping this file for info should test the labels to ensure they're * scraping this file for info should test the labels to ensure they're
* getting the correct field. * getting the correct field.
*/ */
static int nfsd_file_cache_stats_show(struct seq_file *m, void *v) int nfsd_file_cache_stats_show(struct seq_file *m, void *v)
{ {
unsigned long releases = 0, pages_flushed = 0, evictions = 0; unsigned long releases = 0, pages_flushed = 0, evictions = 0;
unsigned long hits = 0, acquisitions = 0; unsigned long hits = 0, acquisitions = 0;
...@@ -1259,8 +1259,3 @@ static int nfsd_file_cache_stats_show(struct seq_file *m, void *v) ...@@ -1259,8 +1259,3 @@ static int nfsd_file_cache_stats_show(struct seq_file *m, void *v)
seq_printf(m, "pages flushed: %lu\n", pages_flushed); seq_printf(m, "pages flushed: %lu\n", pages_flushed);
return 0; return 0;
} }
int nfsd_file_cache_stats_open(struct inode *inode, struct file *file)
{
return single_open(file, nfsd_file_cache_stats_show, NULL);
}
...@@ -60,5 +60,5 @@ __be32 nfsd_file_acquire(struct svc_rqst *rqstp, struct svc_fh *fhp, ...@@ -60,5 +60,5 @@ __be32 nfsd_file_acquire(struct svc_rqst *rqstp, struct svc_fh *fhp,
unsigned int may_flags, struct nfsd_file **nfp); unsigned int may_flags, struct nfsd_file **nfp);
__be32 nfsd_file_create(struct svc_rqst *rqstp, struct svc_fh *fhp, __be32 nfsd_file_create(struct svc_rqst *rqstp, struct svc_fh *fhp,
unsigned int may_flags, struct nfsd_file **nfp); unsigned int may_flags, struct nfsd_file **nfp);
int nfsd_file_cache_stats_open(struct inode *, struct file *); int nfsd_file_cache_stats_show(struct seq_file *m, void *v);
#endif /* _FS_NFSD_FILECACHE_H */ #endif /* _FS_NFSD_FILECACHE_H */
...@@ -192,6 +192,10 @@ struct nfsd_net { ...@@ -192,6 +192,10 @@ struct nfsd_net {
atomic_t nfs4_client_count; atomic_t nfs4_client_count;
int nfs4_max_clients; int nfs4_max_clients;
atomic_t nfsd_courtesy_clients;
struct shrinker nfsd_client_shrinker;
struct delayed_work nfsd_shrinker_work;
}; };
/* Simple check to find out if a given net was properly initialized */ /* Simple check to find out if a given net was properly initialized */
......
...@@ -331,6 +331,7 @@ static const struct svc_procedure nfsd_acl_procedures2[5] = { ...@@ -331,6 +331,7 @@ static const struct svc_procedure nfsd_acl_procedures2[5] = {
.pc_decode = nfssvc_decode_voidarg, .pc_decode = nfssvc_decode_voidarg,
.pc_encode = nfssvc_encode_voidres, .pc_encode = nfssvc_encode_voidres,
.pc_argsize = sizeof(struct nfsd_voidargs), .pc_argsize = sizeof(struct nfsd_voidargs),
.pc_argzero = sizeof(struct nfsd_voidargs),
.pc_ressize = sizeof(struct nfsd_voidres), .pc_ressize = sizeof(struct nfsd_voidres),
.pc_cachetype = RC_NOCACHE, .pc_cachetype = RC_NOCACHE,
.pc_xdrressize = ST, .pc_xdrressize = ST,
...@@ -342,6 +343,7 @@ static const struct svc_procedure nfsd_acl_procedures2[5] = { ...@@ -342,6 +343,7 @@ static const struct svc_procedure nfsd_acl_procedures2[5] = {
.pc_encode = nfsaclsvc_encode_getaclres, .pc_encode = nfsaclsvc_encode_getaclres,
.pc_release = nfsaclsvc_release_getacl, .pc_release = nfsaclsvc_release_getacl,
.pc_argsize = sizeof(struct nfsd3_getaclargs), .pc_argsize = sizeof(struct nfsd3_getaclargs),
.pc_argzero = sizeof(struct nfsd3_getaclargs),
.pc_ressize = sizeof(struct nfsd3_getaclres), .pc_ressize = sizeof(struct nfsd3_getaclres),
.pc_cachetype = RC_NOCACHE, .pc_cachetype = RC_NOCACHE,
.pc_xdrressize = ST+1+2*(1+ACL), .pc_xdrressize = ST+1+2*(1+ACL),
...@@ -353,6 +355,7 @@ static const struct svc_procedure nfsd_acl_procedures2[5] = { ...@@ -353,6 +355,7 @@ static const struct svc_procedure nfsd_acl_procedures2[5] = {
.pc_encode = nfssvc_encode_attrstatres, .pc_encode = nfssvc_encode_attrstatres,
.pc_release = nfssvc_release_attrstat, .pc_release = nfssvc_release_attrstat,
.pc_argsize = sizeof(struct nfsd3_setaclargs), .pc_argsize = sizeof(struct nfsd3_setaclargs),
.pc_argzero = sizeof(struct nfsd3_setaclargs),
.pc_ressize = sizeof(struct nfsd_attrstat), .pc_ressize = sizeof(struct nfsd_attrstat),
.pc_cachetype = RC_NOCACHE, .pc_cachetype = RC_NOCACHE,
.pc_xdrressize = ST+AT, .pc_xdrressize = ST+AT,
...@@ -364,6 +367,7 @@ static const struct svc_procedure nfsd_acl_procedures2[5] = { ...@@ -364,6 +367,7 @@ static const struct svc_procedure nfsd_acl_procedures2[5] = {
.pc_encode = nfssvc_encode_attrstatres, .pc_encode = nfssvc_encode_attrstatres,
.pc_release = nfssvc_release_attrstat, .pc_release = nfssvc_release_attrstat,
.pc_argsize = sizeof(struct nfsd_fhandle), .pc_argsize = sizeof(struct nfsd_fhandle),
.pc_argzero = sizeof(struct nfsd_fhandle),
.pc_ressize = sizeof(struct nfsd_attrstat), .pc_ressize = sizeof(struct nfsd_attrstat),
.pc_cachetype = RC_NOCACHE, .pc_cachetype = RC_NOCACHE,
.pc_xdrressize = ST+AT, .pc_xdrressize = ST+AT,
...@@ -375,6 +379,7 @@ static const struct svc_procedure nfsd_acl_procedures2[5] = { ...@@ -375,6 +379,7 @@ static const struct svc_procedure nfsd_acl_procedures2[5] = {
.pc_encode = nfsaclsvc_encode_accessres, .pc_encode = nfsaclsvc_encode_accessres,
.pc_release = nfsaclsvc_release_access, .pc_release = nfsaclsvc_release_access,
.pc_argsize = sizeof(struct nfsd3_accessargs), .pc_argsize = sizeof(struct nfsd3_accessargs),
.pc_argzero = sizeof(struct nfsd3_accessargs),
.pc_ressize = sizeof(struct nfsd3_accessres), .pc_ressize = sizeof(struct nfsd3_accessres),
.pc_cachetype = RC_NOCACHE, .pc_cachetype = RC_NOCACHE,
.pc_xdrressize = ST+AT+1, .pc_xdrressize = ST+AT+1,
......
...@@ -252,6 +252,7 @@ static const struct svc_procedure nfsd_acl_procedures3[3] = { ...@@ -252,6 +252,7 @@ static const struct svc_procedure nfsd_acl_procedures3[3] = {
.pc_decode = nfssvc_decode_voidarg, .pc_decode = nfssvc_decode_voidarg,
.pc_encode = nfssvc_encode_voidres, .pc_encode = nfssvc_encode_voidres,
.pc_argsize = sizeof(struct nfsd_voidargs), .pc_argsize = sizeof(struct nfsd_voidargs),
.pc_argzero = sizeof(struct nfsd_voidargs),
.pc_ressize = sizeof(struct nfsd_voidres), .pc_ressize = sizeof(struct nfsd_voidres),
.pc_cachetype = RC_NOCACHE, .pc_cachetype = RC_NOCACHE,
.pc_xdrressize = ST, .pc_xdrressize = ST,
...@@ -263,6 +264,7 @@ static const struct svc_procedure nfsd_acl_procedures3[3] = { ...@@ -263,6 +264,7 @@ static const struct svc_procedure nfsd_acl_procedures3[3] = {
.pc_encode = nfs3svc_encode_getaclres, .pc_encode = nfs3svc_encode_getaclres,
.pc_release = nfs3svc_release_getacl, .pc_release = nfs3svc_release_getacl,
.pc_argsize = sizeof(struct nfsd3_getaclargs), .pc_argsize = sizeof(struct nfsd3_getaclargs),
.pc_argzero = sizeof(struct nfsd3_getaclargs),
.pc_ressize = sizeof(struct nfsd3_getaclres), .pc_ressize = sizeof(struct nfsd3_getaclres),
.pc_cachetype = RC_NOCACHE, .pc_cachetype = RC_NOCACHE,
.pc_xdrressize = ST+1+2*(1+ACL), .pc_xdrressize = ST+1+2*(1+ACL),
...@@ -274,6 +276,7 @@ static const struct svc_procedure nfsd_acl_procedures3[3] = { ...@@ -274,6 +276,7 @@ static const struct svc_procedure nfsd_acl_procedures3[3] = {
.pc_encode = nfs3svc_encode_setaclres, .pc_encode = nfs3svc_encode_setaclres,
.pc_release = nfs3svc_release_fhandle, .pc_release = nfs3svc_release_fhandle,
.pc_argsize = sizeof(struct nfsd3_setaclargs), .pc_argsize = sizeof(struct nfsd3_setaclargs),
.pc_argzero = sizeof(struct nfsd3_setaclargs),
.pc_ressize = sizeof(struct nfsd3_attrstat), .pc_ressize = sizeof(struct nfsd3_attrstat),
.pc_cachetype = RC_NOCACHE, .pc_cachetype = RC_NOCACHE,
.pc_xdrressize = ST+pAT, .pc_xdrressize = ST+pAT,
......
...@@ -150,7 +150,6 @@ nfsd3_proc_read(struct svc_rqst *rqstp) ...@@ -150,7 +150,6 @@ nfsd3_proc_read(struct svc_rqst *rqstp)
{ {
struct nfsd3_readargs *argp = rqstp->rq_argp; struct nfsd3_readargs *argp = rqstp->rq_argp;
struct nfsd3_readres *resp = rqstp->rq_resp; struct nfsd3_readres *resp = rqstp->rq_resp;
u32 max_blocksize = svc_max_payload(rqstp);
unsigned int len; unsigned int len;
int v; int v;
...@@ -159,7 +158,8 @@ nfsd3_proc_read(struct svc_rqst *rqstp) ...@@ -159,7 +158,8 @@ nfsd3_proc_read(struct svc_rqst *rqstp)
(unsigned long) argp->count, (unsigned long) argp->count,
(unsigned long long) argp->offset); (unsigned long long) argp->offset);
argp->count = min_t(u32, argp->count, max_blocksize); argp->count = min_t(u32, argp->count, svc_max_payload(rqstp));
argp->count = min_t(u32, argp->count, rqstp->rq_res.buflen);
if (argp->offset > (u64)OFFSET_MAX) if (argp->offset > (u64)OFFSET_MAX)
argp->offset = (u64)OFFSET_MAX; argp->offset = (u64)OFFSET_MAX;
if (argp->offset + argp->count > (u64)OFFSET_MAX) if (argp->offset + argp->count > (u64)OFFSET_MAX)
...@@ -563,25 +563,18 @@ static void nfsd3_init_dirlist_pages(struct svc_rqst *rqstp, ...@@ -563,25 +563,18 @@ static void nfsd3_init_dirlist_pages(struct svc_rqst *rqstp,
{ {
struct xdr_buf *buf = &resp->dirlist; struct xdr_buf *buf = &resp->dirlist;
struct xdr_stream *xdr = &resp->xdr; struct xdr_stream *xdr = &resp->xdr;
unsigned int sendbuf = min_t(unsigned int, rqstp->rq_res.buflen,
count = clamp(count, (u32)(XDR_UNIT * 2), svc_max_payload(rqstp)); svc_max_payload(rqstp));
memset(buf, 0, sizeof(*buf)); memset(buf, 0, sizeof(*buf));
/* Reserve room for the NULL ptr & eof flag (-2 words) */ /* Reserve room for the NULL ptr & eof flag (-2 words) */
buf->buflen = count - XDR_UNIT * 2; buf->buflen = clamp(count, (u32)(XDR_UNIT * 2), sendbuf);
buf->buflen -= XDR_UNIT * 2;
buf->pages = rqstp->rq_next_page; buf->pages = rqstp->rq_next_page;
rqstp->rq_next_page += (buf->buflen + PAGE_SIZE - 1) >> PAGE_SHIFT; rqstp->rq_next_page += (buf->buflen + PAGE_SIZE - 1) >> PAGE_SHIFT;
/* This is xdr_init_encode(), but it assumes that xdr_init_encode_pages(xdr, buf, buf->pages, NULL);
* the head kvec has already been consumed. */
xdr_set_scratch_buffer(xdr, NULL, 0);
xdr->buf = buf;
xdr->page_ptr = buf->pages;
xdr->iov = NULL;
xdr->p = page_address(*buf->pages);
xdr->end = (void *)xdr->p + min_t(u32, buf->buflen, PAGE_SIZE);
xdr->rqst = NULL;
} }
/* /*
...@@ -808,6 +801,7 @@ static const struct svc_procedure nfsd_procedures3[22] = { ...@@ -808,6 +801,7 @@ static const struct svc_procedure nfsd_procedures3[22] = {
.pc_decode = nfssvc_decode_voidarg, .pc_decode = nfssvc_decode_voidarg,
.pc_encode = nfssvc_encode_voidres, .pc_encode = nfssvc_encode_voidres,
.pc_argsize = sizeof(struct nfsd_voidargs), .pc_argsize = sizeof(struct nfsd_voidargs),
.pc_argzero = sizeof(struct nfsd_voidargs),
.pc_ressize = sizeof(struct nfsd_voidres), .pc_ressize = sizeof(struct nfsd_voidres),
.pc_cachetype = RC_NOCACHE, .pc_cachetype = RC_NOCACHE,
.pc_xdrressize = ST, .pc_xdrressize = ST,
...@@ -819,6 +813,7 @@ static const struct svc_procedure nfsd_procedures3[22] = { ...@@ -819,6 +813,7 @@ static const struct svc_procedure nfsd_procedures3[22] = {
.pc_encode = nfs3svc_encode_getattrres, .pc_encode = nfs3svc_encode_getattrres,
.pc_release = nfs3svc_release_fhandle, .pc_release = nfs3svc_release_fhandle,
.pc_argsize = sizeof(struct nfsd_fhandle), .pc_argsize = sizeof(struct nfsd_fhandle),
.pc_argzero = sizeof(struct nfsd_fhandle),
.pc_ressize = sizeof(struct nfsd3_attrstatres), .pc_ressize = sizeof(struct nfsd3_attrstatres),
.pc_cachetype = RC_NOCACHE, .pc_cachetype = RC_NOCACHE,
.pc_xdrressize = ST+AT, .pc_xdrressize = ST+AT,
...@@ -830,6 +825,7 @@ static const struct svc_procedure nfsd_procedures3[22] = { ...@@ -830,6 +825,7 @@ static const struct svc_procedure nfsd_procedures3[22] = {
.pc_encode = nfs3svc_encode_wccstatres, .pc_encode = nfs3svc_encode_wccstatres,
.pc_release = nfs3svc_release_fhandle, .pc_release = nfs3svc_release_fhandle,
.pc_argsize = sizeof(struct nfsd3_sattrargs), .pc_argsize = sizeof(struct nfsd3_sattrargs),
.pc_argzero = sizeof(struct nfsd3_sattrargs),
.pc_ressize = sizeof(struct nfsd3_wccstatres), .pc_ressize = sizeof(struct nfsd3_wccstatres),
.pc_cachetype = RC_REPLBUFF, .pc_cachetype = RC_REPLBUFF,
.pc_xdrressize = ST+WC, .pc_xdrressize = ST+WC,
...@@ -841,6 +837,7 @@ static const struct svc_procedure nfsd_procedures3[22] = { ...@@ -841,6 +837,7 @@ static const struct svc_procedure nfsd_procedures3[22] = {
.pc_encode = nfs3svc_encode_lookupres, .pc_encode = nfs3svc_encode_lookupres,
.pc_release = nfs3svc_release_fhandle2, .pc_release = nfs3svc_release_fhandle2,
.pc_argsize = sizeof(struct nfsd3_diropargs), .pc_argsize = sizeof(struct nfsd3_diropargs),
.pc_argzero = sizeof(struct nfsd3_diropargs),
.pc_ressize = sizeof(struct nfsd3_diropres), .pc_ressize = sizeof(struct nfsd3_diropres),
.pc_cachetype = RC_NOCACHE, .pc_cachetype = RC_NOCACHE,
.pc_xdrressize = ST+FH+pAT+pAT, .pc_xdrressize = ST+FH+pAT+pAT,
...@@ -852,6 +849,7 @@ static const struct svc_procedure nfsd_procedures3[22] = { ...@@ -852,6 +849,7 @@ static const struct svc_procedure nfsd_procedures3[22] = {
.pc_encode = nfs3svc_encode_accessres, .pc_encode = nfs3svc_encode_accessres,
.pc_release = nfs3svc_release_fhandle, .pc_release = nfs3svc_release_fhandle,
.pc_argsize = sizeof(struct nfsd3_accessargs), .pc_argsize = sizeof(struct nfsd3_accessargs),
.pc_argzero = sizeof(struct nfsd3_accessargs),
.pc_ressize = sizeof(struct nfsd3_accessres), .pc_ressize = sizeof(struct nfsd3_accessres),
.pc_cachetype = RC_NOCACHE, .pc_cachetype = RC_NOCACHE,
.pc_xdrressize = ST+pAT+1, .pc_xdrressize = ST+pAT+1,
...@@ -863,6 +861,7 @@ static const struct svc_procedure nfsd_procedures3[22] = { ...@@ -863,6 +861,7 @@ static const struct svc_procedure nfsd_procedures3[22] = {
.pc_encode = nfs3svc_encode_readlinkres, .pc_encode = nfs3svc_encode_readlinkres,
.pc_release = nfs3svc_release_fhandle, .pc_release = nfs3svc_release_fhandle,
.pc_argsize = sizeof(struct nfsd_fhandle), .pc_argsize = sizeof(struct nfsd_fhandle),
.pc_argzero = sizeof(struct nfsd_fhandle),
.pc_ressize = sizeof(struct nfsd3_readlinkres), .pc_ressize = sizeof(struct nfsd3_readlinkres),
.pc_cachetype = RC_NOCACHE, .pc_cachetype = RC_NOCACHE,
.pc_xdrressize = ST+pAT+1+NFS3_MAXPATHLEN/4, .pc_xdrressize = ST+pAT+1+NFS3_MAXPATHLEN/4,
...@@ -874,6 +873,7 @@ static const struct svc_procedure nfsd_procedures3[22] = { ...@@ -874,6 +873,7 @@ static const struct svc_procedure nfsd_procedures3[22] = {
.pc_encode = nfs3svc_encode_readres, .pc_encode = nfs3svc_encode_readres,
.pc_release = nfs3svc_release_fhandle, .pc_release = nfs3svc_release_fhandle,
.pc_argsize = sizeof(struct nfsd3_readargs), .pc_argsize = sizeof(struct nfsd3_readargs),
.pc_argzero = sizeof(struct nfsd3_readargs),
.pc_ressize = sizeof(struct nfsd3_readres), .pc_ressize = sizeof(struct nfsd3_readres),
.pc_cachetype = RC_NOCACHE, .pc_cachetype = RC_NOCACHE,
.pc_xdrressize = ST+pAT+4+NFSSVC_MAXBLKSIZE/4, .pc_xdrressize = ST+pAT+4+NFSSVC_MAXBLKSIZE/4,
...@@ -885,6 +885,7 @@ static const struct svc_procedure nfsd_procedures3[22] = { ...@@ -885,6 +885,7 @@ static const struct svc_procedure nfsd_procedures3[22] = {
.pc_encode = nfs3svc_encode_writeres, .pc_encode = nfs3svc_encode_writeres,
.pc_release = nfs3svc_release_fhandle, .pc_release = nfs3svc_release_fhandle,
.pc_argsize = sizeof(struct nfsd3_writeargs), .pc_argsize = sizeof(struct nfsd3_writeargs),
.pc_argzero = sizeof(struct nfsd3_writeargs),
.pc_ressize = sizeof(struct nfsd3_writeres), .pc_ressize = sizeof(struct nfsd3_writeres),
.pc_cachetype = RC_REPLBUFF, .pc_cachetype = RC_REPLBUFF,
.pc_xdrressize = ST+WC+4, .pc_xdrressize = ST+WC+4,
...@@ -896,6 +897,7 @@ static const struct svc_procedure nfsd_procedures3[22] = { ...@@ -896,6 +897,7 @@ static const struct svc_procedure nfsd_procedures3[22] = {
.pc_encode = nfs3svc_encode_createres, .pc_encode = nfs3svc_encode_createres,
.pc_release = nfs3svc_release_fhandle2, .pc_release = nfs3svc_release_fhandle2,
.pc_argsize = sizeof(struct nfsd3_createargs), .pc_argsize = sizeof(struct nfsd3_createargs),
.pc_argzero = sizeof(struct nfsd3_createargs),
.pc_ressize = sizeof(struct nfsd3_createres), .pc_ressize = sizeof(struct nfsd3_createres),
.pc_cachetype = RC_REPLBUFF, .pc_cachetype = RC_REPLBUFF,
.pc_xdrressize = ST+(1+FH+pAT)+WC, .pc_xdrressize = ST+(1+FH+pAT)+WC,
...@@ -907,6 +909,7 @@ static const struct svc_procedure nfsd_procedures3[22] = { ...@@ -907,6 +909,7 @@ static const struct svc_procedure nfsd_procedures3[22] = {
.pc_encode = nfs3svc_encode_createres, .pc_encode = nfs3svc_encode_createres,
.pc_release = nfs3svc_release_fhandle2, .pc_release = nfs3svc_release_fhandle2,
.pc_argsize = sizeof(struct nfsd3_mkdirargs), .pc_argsize = sizeof(struct nfsd3_mkdirargs),
.pc_argzero = sizeof(struct nfsd3_mkdirargs),
.pc_ressize = sizeof(struct nfsd3_createres), .pc_ressize = sizeof(struct nfsd3_createres),
.pc_cachetype = RC_REPLBUFF, .pc_cachetype = RC_REPLBUFF,
.pc_xdrressize = ST+(1+FH+pAT)+WC, .pc_xdrressize = ST+(1+FH+pAT)+WC,
...@@ -918,6 +921,7 @@ static const struct svc_procedure nfsd_procedures3[22] = { ...@@ -918,6 +921,7 @@ static const struct svc_procedure nfsd_procedures3[22] = {
.pc_encode = nfs3svc_encode_createres, .pc_encode = nfs3svc_encode_createres,
.pc_release = nfs3svc_release_fhandle2, .pc_release = nfs3svc_release_fhandle2,
.pc_argsize = sizeof(struct nfsd3_symlinkargs), .pc_argsize = sizeof(struct nfsd3_symlinkargs),
.pc_argzero = sizeof(struct nfsd3_symlinkargs),
.pc_ressize = sizeof(struct nfsd3_createres), .pc_ressize = sizeof(struct nfsd3_createres),
.pc_cachetype = RC_REPLBUFF, .pc_cachetype = RC_REPLBUFF,
.pc_xdrressize = ST+(1+FH+pAT)+WC, .pc_xdrressize = ST+(1+FH+pAT)+WC,
...@@ -929,6 +933,7 @@ static const struct svc_procedure nfsd_procedures3[22] = { ...@@ -929,6 +933,7 @@ static const struct svc_procedure nfsd_procedures3[22] = {
.pc_encode = nfs3svc_encode_createres, .pc_encode = nfs3svc_encode_createres,
.pc_release = nfs3svc_release_fhandle2, .pc_release = nfs3svc_release_fhandle2,
.pc_argsize = sizeof(struct nfsd3_mknodargs), .pc_argsize = sizeof(struct nfsd3_mknodargs),
.pc_argzero = sizeof(struct nfsd3_mknodargs),
.pc_ressize = sizeof(struct nfsd3_createres), .pc_ressize = sizeof(struct nfsd3_createres),
.pc_cachetype = RC_REPLBUFF, .pc_cachetype = RC_REPLBUFF,
.pc_xdrressize = ST+(1+FH+pAT)+WC, .pc_xdrressize = ST+(1+FH+pAT)+WC,
...@@ -940,6 +945,7 @@ static const struct svc_procedure nfsd_procedures3[22] = { ...@@ -940,6 +945,7 @@ static const struct svc_procedure nfsd_procedures3[22] = {
.pc_encode = nfs3svc_encode_wccstatres, .pc_encode = nfs3svc_encode_wccstatres,
.pc_release = nfs3svc_release_fhandle, .pc_release = nfs3svc_release_fhandle,
.pc_argsize = sizeof(struct nfsd3_diropargs), .pc_argsize = sizeof(struct nfsd3_diropargs),
.pc_argzero = sizeof(struct nfsd3_diropargs),
.pc_ressize = sizeof(struct nfsd3_wccstatres), .pc_ressize = sizeof(struct nfsd3_wccstatres),
.pc_cachetype = RC_REPLBUFF, .pc_cachetype = RC_REPLBUFF,
.pc_xdrressize = ST+WC, .pc_xdrressize = ST+WC,
...@@ -951,6 +957,7 @@ static const struct svc_procedure nfsd_procedures3[22] = { ...@@ -951,6 +957,7 @@ static const struct svc_procedure nfsd_procedures3[22] = {
.pc_encode = nfs3svc_encode_wccstatres, .pc_encode = nfs3svc_encode_wccstatres,
.pc_release = nfs3svc_release_fhandle, .pc_release = nfs3svc_release_fhandle,
.pc_argsize = sizeof(struct nfsd3_diropargs), .pc_argsize = sizeof(struct nfsd3_diropargs),
.pc_argzero = sizeof(struct nfsd3_diropargs),
.pc_ressize = sizeof(struct nfsd3_wccstatres), .pc_ressize = sizeof(struct nfsd3_wccstatres),
.pc_cachetype = RC_REPLBUFF, .pc_cachetype = RC_REPLBUFF,
.pc_xdrressize = ST+WC, .pc_xdrressize = ST+WC,
...@@ -962,6 +969,7 @@ static const struct svc_procedure nfsd_procedures3[22] = { ...@@ -962,6 +969,7 @@ static const struct svc_procedure nfsd_procedures3[22] = {
.pc_encode = nfs3svc_encode_renameres, .pc_encode = nfs3svc_encode_renameres,
.pc_release = nfs3svc_release_fhandle2, .pc_release = nfs3svc_release_fhandle2,
.pc_argsize = sizeof(struct nfsd3_renameargs), .pc_argsize = sizeof(struct nfsd3_renameargs),
.pc_argzero = sizeof(struct nfsd3_renameargs),
.pc_ressize = sizeof(struct nfsd3_renameres), .pc_ressize = sizeof(struct nfsd3_renameres),
.pc_cachetype = RC_REPLBUFF, .pc_cachetype = RC_REPLBUFF,
.pc_xdrressize = ST+WC+WC, .pc_xdrressize = ST+WC+WC,
...@@ -973,6 +981,7 @@ static const struct svc_procedure nfsd_procedures3[22] = { ...@@ -973,6 +981,7 @@ static const struct svc_procedure nfsd_procedures3[22] = {
.pc_encode = nfs3svc_encode_linkres, .pc_encode = nfs3svc_encode_linkres,
.pc_release = nfs3svc_release_fhandle2, .pc_release = nfs3svc_release_fhandle2,
.pc_argsize = sizeof(struct nfsd3_linkargs), .pc_argsize = sizeof(struct nfsd3_linkargs),
.pc_argzero = sizeof(struct nfsd3_linkargs),
.pc_ressize = sizeof(struct nfsd3_linkres), .pc_ressize = sizeof(struct nfsd3_linkres),
.pc_cachetype = RC_REPLBUFF, .pc_cachetype = RC_REPLBUFF,
.pc_xdrressize = ST+pAT+WC, .pc_xdrressize = ST+pAT+WC,
...@@ -984,6 +993,7 @@ static const struct svc_procedure nfsd_procedures3[22] = { ...@@ -984,6 +993,7 @@ static const struct svc_procedure nfsd_procedures3[22] = {
.pc_encode = nfs3svc_encode_readdirres, .pc_encode = nfs3svc_encode_readdirres,
.pc_release = nfs3svc_release_fhandle, .pc_release = nfs3svc_release_fhandle,
.pc_argsize = sizeof(struct nfsd3_readdirargs), .pc_argsize = sizeof(struct nfsd3_readdirargs),
.pc_argzero = sizeof(struct nfsd3_readdirargs),
.pc_ressize = sizeof(struct nfsd3_readdirres), .pc_ressize = sizeof(struct nfsd3_readdirres),
.pc_cachetype = RC_NOCACHE, .pc_cachetype = RC_NOCACHE,
.pc_name = "READDIR", .pc_name = "READDIR",
...@@ -994,6 +1004,7 @@ static const struct svc_procedure nfsd_procedures3[22] = { ...@@ -994,6 +1004,7 @@ static const struct svc_procedure nfsd_procedures3[22] = {
.pc_encode = nfs3svc_encode_readdirres, .pc_encode = nfs3svc_encode_readdirres,
.pc_release = nfs3svc_release_fhandle, .pc_release = nfs3svc_release_fhandle,
.pc_argsize = sizeof(struct nfsd3_readdirplusargs), .pc_argsize = sizeof(struct nfsd3_readdirplusargs),
.pc_argzero = sizeof(struct nfsd3_readdirplusargs),
.pc_ressize = sizeof(struct nfsd3_readdirres), .pc_ressize = sizeof(struct nfsd3_readdirres),
.pc_cachetype = RC_NOCACHE, .pc_cachetype = RC_NOCACHE,
.pc_name = "READDIRPLUS", .pc_name = "READDIRPLUS",
...@@ -1003,6 +1014,7 @@ static const struct svc_procedure nfsd_procedures3[22] = { ...@@ -1003,6 +1014,7 @@ static const struct svc_procedure nfsd_procedures3[22] = {
.pc_decode = nfs3svc_decode_fhandleargs, .pc_decode = nfs3svc_decode_fhandleargs,
.pc_encode = nfs3svc_encode_fsstatres, .pc_encode = nfs3svc_encode_fsstatres,
.pc_argsize = sizeof(struct nfsd3_fhandleargs), .pc_argsize = sizeof(struct nfsd3_fhandleargs),
.pc_argzero = sizeof(struct nfsd3_fhandleargs),
.pc_ressize = sizeof(struct nfsd3_fsstatres), .pc_ressize = sizeof(struct nfsd3_fsstatres),
.pc_cachetype = RC_NOCACHE, .pc_cachetype = RC_NOCACHE,
.pc_xdrressize = ST+pAT+2*6+1, .pc_xdrressize = ST+pAT+2*6+1,
...@@ -1013,6 +1025,7 @@ static const struct svc_procedure nfsd_procedures3[22] = { ...@@ -1013,6 +1025,7 @@ static const struct svc_procedure nfsd_procedures3[22] = {
.pc_decode = nfs3svc_decode_fhandleargs, .pc_decode = nfs3svc_decode_fhandleargs,
.pc_encode = nfs3svc_encode_fsinfores, .pc_encode = nfs3svc_encode_fsinfores,
.pc_argsize = sizeof(struct nfsd3_fhandleargs), .pc_argsize = sizeof(struct nfsd3_fhandleargs),
.pc_argzero = sizeof(struct nfsd3_fhandleargs),
.pc_ressize = sizeof(struct nfsd3_fsinfores), .pc_ressize = sizeof(struct nfsd3_fsinfores),
.pc_cachetype = RC_NOCACHE, .pc_cachetype = RC_NOCACHE,
.pc_xdrressize = ST+pAT+12, .pc_xdrressize = ST+pAT+12,
...@@ -1023,6 +1036,7 @@ static const struct svc_procedure nfsd_procedures3[22] = { ...@@ -1023,6 +1036,7 @@ static const struct svc_procedure nfsd_procedures3[22] = {
.pc_decode = nfs3svc_decode_fhandleargs, .pc_decode = nfs3svc_decode_fhandleargs,
.pc_encode = nfs3svc_encode_pathconfres, .pc_encode = nfs3svc_encode_pathconfres,
.pc_argsize = sizeof(struct nfsd3_fhandleargs), .pc_argsize = sizeof(struct nfsd3_fhandleargs),
.pc_argzero = sizeof(struct nfsd3_fhandleargs),
.pc_ressize = sizeof(struct nfsd3_pathconfres), .pc_ressize = sizeof(struct nfsd3_pathconfres),
.pc_cachetype = RC_NOCACHE, .pc_cachetype = RC_NOCACHE,
.pc_xdrressize = ST+pAT+6, .pc_xdrressize = ST+pAT+6,
...@@ -1034,6 +1048,7 @@ static const struct svc_procedure nfsd_procedures3[22] = { ...@@ -1034,6 +1048,7 @@ static const struct svc_procedure nfsd_procedures3[22] = {
.pc_encode = nfs3svc_encode_commitres, .pc_encode = nfs3svc_encode_commitres,
.pc_release = nfs3svc_release_fhandle, .pc_release = nfs3svc_release_fhandle,
.pc_argsize = sizeof(struct nfsd3_commitargs), .pc_argsize = sizeof(struct nfsd3_commitargs),
.pc_argzero = sizeof(struct nfsd3_commitargs),
.pc_ressize = sizeof(struct nfsd3_commitres), .pc_ressize = sizeof(struct nfsd3_commitres),
.pc_cachetype = RC_NOCACHE, .pc_cachetype = RC_NOCACHE,
.pc_xdrressize = ST+WC+2, .pc_xdrressize = ST+WC+2,
......
...@@ -571,10 +571,8 @@ nfs3svc_decode_writeargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) ...@@ -571,10 +571,8 @@ nfs3svc_decode_writeargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
args->count = max_blocksize; args->count = max_blocksize;
args->len = max_blocksize; args->len = max_blocksize;
} }
if (!xdr_stream_subsegment(xdr, &args->payload, args->count))
return false;
return true; return xdr_stream_subsegment(xdr, &args->payload, args->count);
} }
bool bool
...@@ -616,8 +614,6 @@ nfs3svc_decode_symlinkargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) ...@@ -616,8 +614,6 @@ nfs3svc_decode_symlinkargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
{ {
struct nfsd3_symlinkargs *args = rqstp->rq_argp; struct nfsd3_symlinkargs *args = rqstp->rq_argp;
struct kvec *head = rqstp->rq_arg.head; struct kvec *head = rqstp->rq_arg.head;
struct kvec *tail = rqstp->rq_arg.tail;
size_t remaining;
if (!svcxdr_decode_diropargs3(xdr, &args->ffh, &args->fname, &args->flen)) if (!svcxdr_decode_diropargs3(xdr, &args->ffh, &args->fname, &args->flen))
return false; return false;
...@@ -626,16 +622,10 @@ nfs3svc_decode_symlinkargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) ...@@ -626,16 +622,10 @@ nfs3svc_decode_symlinkargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
if (xdr_stream_decode_u32(xdr, &args->tlen) < 0) if (xdr_stream_decode_u32(xdr, &args->tlen) < 0)
return false; return false;
/* request sanity */ /* symlink_data */
remaining = head->iov_len + rqstp->rq_arg.page_len + tail->iov_len;
remaining -= xdr_stream_pos(xdr);
if (remaining < xdr_align_size(args->tlen))
return false;
args->first.iov_base = xdr->p;
args->first.iov_len = head->iov_len - xdr_stream_pos(xdr); args->first.iov_len = head->iov_len - xdr_stream_pos(xdr);
args->first.iov_base = xdr_inline_decode(xdr, args->tlen);
return true; return args->first.iov_base != NULL;
} }
bool bool
......
...@@ -1371,11 +1371,21 @@ void nfsd4_init_cb(struct nfsd4_callback *cb, struct nfs4_client *clp, ...@@ -1371,11 +1371,21 @@ void nfsd4_init_cb(struct nfsd4_callback *cb, struct nfs4_client *clp,
cb->cb_holds_slot = false; cb->cb_holds_slot = false;
} }
void nfsd4_run_cb(struct nfsd4_callback *cb) /**
* nfsd4_run_cb - queue up a callback job to run
* @cb: callback to queue
*
* Kick off a callback to do its thing. Returns false if it was already
* on a queue, true otherwise.
*/
bool nfsd4_run_cb(struct nfsd4_callback *cb)
{ {
struct nfs4_client *clp = cb->cb_clp; struct nfs4_client *clp = cb->cb_clp;
bool queued;
nfsd41_cb_inflight_begin(clp); nfsd41_cb_inflight_begin(clp);
if (!nfsd4_queue_cb(cb)) queued = nfsd4_queue_cb(cb);
if (!queued)
nfsd41_cb_inflight_end(clp); nfsd41_cb_inflight_end(clp);
return queued;
} }
...@@ -82,8 +82,8 @@ ent_init(struct cache_head *cnew, struct cache_head *citm) ...@@ -82,8 +82,8 @@ ent_init(struct cache_head *cnew, struct cache_head *citm)
new->id = itm->id; new->id = itm->id;
new->type = itm->type; new->type = itm->type;
strlcpy(new->name, itm->name, sizeof(new->name)); strscpy(new->name, itm->name, sizeof(new->name));
strlcpy(new->authname, itm->authname, sizeof(new->authname)); strscpy(new->authname, itm->authname, sizeof(new->authname));
} }
static void static void
...@@ -548,7 +548,7 @@ idmap_name_to_id(struct svc_rqst *rqstp, int type, const char *name, u32 namelen ...@@ -548,7 +548,7 @@ idmap_name_to_id(struct svc_rqst *rqstp, int type, const char *name, u32 namelen
return nfserr_badowner; return nfserr_badowner;
memcpy(key.name, name, namelen); memcpy(key.name, name, namelen);
key.name[namelen] = '\0'; key.name[namelen] = '\0';
strlcpy(key.authname, rqst_authname(rqstp), sizeof(key.authname)); strscpy(key.authname, rqst_authname(rqstp), sizeof(key.authname));
ret = idmap_lookup(rqstp, nametoid_lookup, &key, nn->nametoid_cache, &item); ret = idmap_lookup(rqstp, nametoid_lookup, &key, nn->nametoid_cache, &item);
if (ret == -ENOENT) if (ret == -ENOENT)
return nfserr_badowner; return nfserr_badowner;
...@@ -584,7 +584,7 @@ static __be32 idmap_id_to_name(struct xdr_stream *xdr, ...@@ -584,7 +584,7 @@ static __be32 idmap_id_to_name(struct xdr_stream *xdr,
int ret; int ret;
struct nfsd_net *nn = net_generic(SVC_NET(rqstp), nfsd_net_id); struct nfsd_net *nn = net_generic(SVC_NET(rqstp), nfsd_net_id);
strlcpy(key.authname, rqst_authname(rqstp), sizeof(key.authname)); strscpy(key.authname, rqst_authname(rqstp), sizeof(key.authname));
ret = idmap_lookup(rqstp, idtoname_lookup, &key, nn->idtoname_cache, &item); ret = idmap_lookup(rqstp, idtoname_lookup, &key, nn->idtoname_cache, &item);
if (ret == -ENOENT) if (ret == -ENOENT)
return encode_ascii_id(xdr, id); return encode_ascii_id(xdr, id);
......
...@@ -658,7 +658,7 @@ nfsd4_cb_layout_done(struct nfsd4_callback *cb, struct rpc_task *task) ...@@ -658,7 +658,7 @@ nfsd4_cb_layout_done(struct nfsd4_callback *cb, struct rpc_task *task)
ktime_t now, cutoff; ktime_t now, cutoff;
const struct nfsd4_layout_ops *ops; const struct nfsd4_layout_ops *ops;
trace_nfsd_cb_layout_done(&ls->ls_stid.sc_stateid, task);
switch (task->tk_status) { switch (task->tk_status) {
case 0: case 0:
case -NFS4ERR_DELAY: case -NFS4ERR_DELAY:
......
This diff is collapsed.
...@@ -807,16 +807,18 @@ __cld_pipe_inprogress_downcall(const struct cld_msg_v2 __user *cmsg, ...@@ -807,16 +807,18 @@ __cld_pipe_inprogress_downcall(const struct cld_msg_v2 __user *cmsg,
if (get_user(namelen, &ci->cc_name.cn_len)) if (get_user(namelen, &ci->cc_name.cn_len))
return -EFAULT; return -EFAULT;
name.data = memdup_user(&ci->cc_name.cn_id, namelen); name.data = memdup_user(&ci->cc_name.cn_id, namelen);
if (IS_ERR_OR_NULL(name.data)) if (IS_ERR(name.data))
return -EFAULT; return PTR_ERR(name.data);
name.len = namelen; name.len = namelen;
get_user(princhashlen, &ci->cc_princhash.cp_len); get_user(princhashlen, &ci->cc_princhash.cp_len);
if (princhashlen > 0) { if (princhashlen > 0) {
princhash.data = memdup_user( princhash.data = memdup_user(
&ci->cc_princhash.cp_data, &ci->cc_princhash.cp_data,
princhashlen); princhashlen);
if (IS_ERR_OR_NULL(princhash.data)) if (IS_ERR(princhash.data)) {
return -EFAULT; kfree(name.data);
return PTR_ERR(princhash.data);
}
princhash.len = princhashlen; princhash.len = princhashlen;
} else } else
princhash.len = 0; princhash.len = 0;
...@@ -827,8 +829,8 @@ __cld_pipe_inprogress_downcall(const struct cld_msg_v2 __user *cmsg, ...@@ -827,8 +829,8 @@ __cld_pipe_inprogress_downcall(const struct cld_msg_v2 __user *cmsg,
if (get_user(namelen, &cnm->cn_len)) if (get_user(namelen, &cnm->cn_len))
return -EFAULT; return -EFAULT;
name.data = memdup_user(&cnm->cn_id, namelen); name.data = memdup_user(&cnm->cn_id, namelen);
if (IS_ERR_OR_NULL(name.data)) if (IS_ERR(name.data))
return -EFAULT; return PTR_ERR(name.data);
name.len = namelen; name.len = namelen;
} }
if (name.len > 5 && memcmp(name.data, "hash:", 5) == 0) { if (name.len > 5 && memcmp(name.data, "hash:", 5) == 0) {
......
This diff is collapsed.
This diff is collapsed.
...@@ -604,9 +604,10 @@ nfsd_cache_append(struct svc_rqst *rqstp, struct kvec *data) ...@@ -604,9 +604,10 @@ nfsd_cache_append(struct svc_rqst *rqstp, struct kvec *data)
* scraping this file for info should test the labels to ensure they're * scraping this file for info should test the labels to ensure they're
* getting the correct field. * getting the correct field.
*/ */
static int nfsd_reply_cache_stats_show(struct seq_file *m, void *v) int nfsd_reply_cache_stats_show(struct seq_file *m, void *v)
{ {
struct nfsd_net *nn = m->private; struct nfsd_net *nn = net_generic(file_inode(m->file)->i_sb->s_fs_info,
nfsd_net_id);
seq_printf(m, "max entries: %u\n", nn->max_drc_entries); seq_printf(m, "max entries: %u\n", nn->max_drc_entries);
seq_printf(m, "num entries: %u\n", seq_printf(m, "num entries: %u\n",
...@@ -626,11 +627,3 @@ static int nfsd_reply_cache_stats_show(struct seq_file *m, void *v) ...@@ -626,11 +627,3 @@ static int nfsd_reply_cache_stats_show(struct seq_file *m, void *v)
seq_printf(m, "cachesize at longest: %u\n", nn->longest_chain_cachesize); seq_printf(m, "cachesize at longest: %u\n", nn->longest_chain_cachesize);
return 0; return 0;
} }
int nfsd_reply_cache_stats_open(struct inode *inode, struct file *file)
{
struct nfsd_net *nn = net_generic(file_inode(file)->i_sb->s_fs_info,
nfsd_net_id);
return single_open(file, nfsd_reply_cache_stats_show, nn);
}
...@@ -185,17 +185,7 @@ static int export_features_show(struct seq_file *m, void *v) ...@@ -185,17 +185,7 @@ static int export_features_show(struct seq_file *m, void *v)
return 0; return 0;
} }
static int export_features_open(struct inode *inode, struct file *file) DEFINE_SHOW_ATTRIBUTE(export_features);
{
return single_open(file, export_features_show, NULL);
}
static const struct file_operations export_features_operations = {
.open = export_features_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
#if defined(CONFIG_SUNRPC_GSS) || defined(CONFIG_SUNRPC_GSS_MODULE) #if defined(CONFIG_SUNRPC_GSS) || defined(CONFIG_SUNRPC_GSS_MODULE)
static int supported_enctypes_show(struct seq_file *m, void *v) static int supported_enctypes_show(struct seq_file *m, void *v)
...@@ -204,17 +194,7 @@ static int supported_enctypes_show(struct seq_file *m, void *v) ...@@ -204,17 +194,7 @@ static int supported_enctypes_show(struct seq_file *m, void *v)
return 0; return 0;
} }
static int supported_enctypes_open(struct inode *inode, struct file *file) DEFINE_SHOW_ATTRIBUTE(supported_enctypes);
{
return single_open(file, supported_enctypes_show, NULL);
}
static const struct file_operations supported_enctypes_ops = {
.open = supported_enctypes_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
#endif /* CONFIG_SUNRPC_GSS or CONFIG_SUNRPC_GSS_MODULE */ #endif /* CONFIG_SUNRPC_GSS or CONFIG_SUNRPC_GSS_MODULE */
static const struct file_operations pool_stats_operations = { static const struct file_operations pool_stats_operations = {
...@@ -224,19 +204,9 @@ static const struct file_operations pool_stats_operations = { ...@@ -224,19 +204,9 @@ static const struct file_operations pool_stats_operations = {
.release = nfsd_pool_stats_release, .release = nfsd_pool_stats_release,
}; };
static const struct file_operations reply_cache_stats_operations = { DEFINE_SHOW_ATTRIBUTE(nfsd_reply_cache_stats);
.open = nfsd_reply_cache_stats_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
static const struct file_operations filecache_ops = { DEFINE_SHOW_ATTRIBUTE(nfsd_file_cache_stats);
.open = nfsd_file_cache_stats_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
/* /*
...@@ -1365,7 +1335,7 @@ static int nfsd_fill_super(struct super_block *sb, struct fs_context *fc) ...@@ -1365,7 +1335,7 @@ static int nfsd_fill_super(struct super_block *sb, struct fs_context *fc)
/* Per-export io stats use same ops as exports file */ /* Per-export io stats use same ops as exports file */
[NFSD_Export_Stats] = {"export_stats", &exports_nfsd_operations, S_IRUGO}, [NFSD_Export_Stats] = {"export_stats", &exports_nfsd_operations, S_IRUGO},
[NFSD_Export_features] = {"export_features", [NFSD_Export_features] = {"export_features",
&export_features_operations, S_IRUGO}, &export_features_fops, S_IRUGO},
[NFSD_FO_UnlockIP] = {"unlock_ip", [NFSD_FO_UnlockIP] = {"unlock_ip",
&transaction_ops, S_IWUSR|S_IRUSR}, &transaction_ops, S_IWUSR|S_IRUSR},
[NFSD_FO_UnlockFS] = {"unlock_filesystem", [NFSD_FO_UnlockFS] = {"unlock_filesystem",
...@@ -1374,14 +1344,16 @@ static int nfsd_fill_super(struct super_block *sb, struct fs_context *fc) ...@@ -1374,14 +1344,16 @@ static int nfsd_fill_super(struct super_block *sb, struct fs_context *fc)
[NFSD_Threads] = {"threads", &transaction_ops, S_IWUSR|S_IRUSR}, [NFSD_Threads] = {"threads", &transaction_ops, S_IWUSR|S_IRUSR},
[NFSD_Pool_Threads] = {"pool_threads", &transaction_ops, S_IWUSR|S_IRUSR}, [NFSD_Pool_Threads] = {"pool_threads", &transaction_ops, S_IWUSR|S_IRUSR},
[NFSD_Pool_Stats] = {"pool_stats", &pool_stats_operations, S_IRUGO}, [NFSD_Pool_Stats] = {"pool_stats", &pool_stats_operations, S_IRUGO},
[NFSD_Reply_Cache_Stats] = {"reply_cache_stats", &reply_cache_stats_operations, S_IRUGO}, [NFSD_Reply_Cache_Stats] = {"reply_cache_stats",
&nfsd_reply_cache_stats_fops, S_IRUGO},
[NFSD_Versions] = {"versions", &transaction_ops, S_IWUSR|S_IRUSR}, [NFSD_Versions] = {"versions", &transaction_ops, S_IWUSR|S_IRUSR},
[NFSD_Ports] = {"portlist", &transaction_ops, S_IWUSR|S_IRUGO}, [NFSD_Ports] = {"portlist", &transaction_ops, S_IWUSR|S_IRUGO},
[NFSD_MaxBlkSize] = {"max_block_size", &transaction_ops, S_IWUSR|S_IRUGO}, [NFSD_MaxBlkSize] = {"max_block_size", &transaction_ops, S_IWUSR|S_IRUGO},
[NFSD_MaxConnections] = {"max_connections", &transaction_ops, S_IWUSR|S_IRUGO}, [NFSD_MaxConnections] = {"max_connections", &transaction_ops, S_IWUSR|S_IRUGO},
[NFSD_Filecache] = {"filecache", &filecache_ops, S_IRUGO}, [NFSD_Filecache] = {"filecache", &nfsd_file_cache_stats_fops, S_IRUGO},
#if defined(CONFIG_SUNRPC_GSS) || defined(CONFIG_SUNRPC_GSS_MODULE) #if defined(CONFIG_SUNRPC_GSS) || defined(CONFIG_SUNRPC_GSS_MODULE)
[NFSD_SupportedEnctypes] = {"supported_krb5_enctypes", &supported_enctypes_ops, S_IRUGO}, [NFSD_SupportedEnctypes] = {"supported_krb5_enctypes",
&supported_enctypes_fops, S_IRUGO},
#endif /* CONFIG_SUNRPC_GSS or CONFIG_SUNRPC_GSS_MODULE */ #endif /* CONFIG_SUNRPC_GSS or CONFIG_SUNRPC_GSS_MODULE */
#ifdef CONFIG_NFSD_V4 #ifdef CONFIG_NFSD_V4
[NFSD_Leasetime] = {"nfsv4leasetime", &transaction_ops, S_IWUSR|S_IRUSR}, [NFSD_Leasetime] = {"nfsv4leasetime", &transaction_ops, S_IWUSR|S_IRUSR},
...@@ -1481,11 +1453,12 @@ static __net_init int nfsd_init_net(struct net *net) ...@@ -1481,11 +1453,12 @@ static __net_init int nfsd_init_net(struct net *net)
goto out_idmap_error; goto out_idmap_error;
nn->nfsd_versions = NULL; nn->nfsd_versions = NULL;
nn->nfsd4_minorversions = NULL; nn->nfsd4_minorversions = NULL;
retval = nfsd4_init_leases_net(nn);
if (retval)
goto out_drc_error;
retval = nfsd_reply_cache_init(nn); retval = nfsd_reply_cache_init(nn);
if (retval) if (retval)
goto out_drc_error; goto out_drc_error;
nfsd4_init_leases_net(nn);
get_random_bytes(&nn->siphash_key, sizeof(nn->siphash_key)); get_random_bytes(&nn->siphash_key, sizeof(nn->siphash_key));
seqlock_init(&nn->writeverf_lock); seqlock_init(&nn->writeverf_lock);
...@@ -1507,6 +1480,7 @@ static __net_exit void nfsd_exit_net(struct net *net) ...@@ -1507,6 +1480,7 @@ static __net_exit void nfsd_exit_net(struct net *net)
nfsd_idmap_shutdown(net); nfsd_idmap_shutdown(net);
nfsd_export_shutdown(net); nfsd_export_shutdown(net);
nfsd_netns_free_versions(net_generic(net, nfsd_net_id)); nfsd_netns_free_versions(net_generic(net, nfsd_net_id));
nfsd4_leases_net_shutdown(nn);
} }
static struct pernet_operations nfsd_net_ops = { static struct pernet_operations nfsd_net_ops = {
......
...@@ -164,6 +164,7 @@ char * nfs4_recoverydir(void); ...@@ -164,6 +164,7 @@ char * nfs4_recoverydir(void);
bool nfsd4_spo_must_allow(struct svc_rqst *rqstp); bool nfsd4_spo_must_allow(struct svc_rqst *rqstp);
int nfsd4_create_laundry_wq(void); int nfsd4_create_laundry_wq(void);
void nfsd4_destroy_laundry_wq(void); void nfsd4_destroy_laundry_wq(void);
bool nfsd_wait_for_delegreturn(struct svc_rqst *rqstp, struct inode *inode);
#else #else
static inline int nfsd4_init_slabs(void) { return 0; } static inline int nfsd4_init_slabs(void) { return 0; }
static inline void nfsd4_free_slabs(void) { } static inline void nfsd4_free_slabs(void) { }
...@@ -179,6 +180,11 @@ static inline bool nfsd4_spo_must_allow(struct svc_rqst *rqstp) ...@@ -179,6 +180,11 @@ static inline bool nfsd4_spo_must_allow(struct svc_rqst *rqstp)
} }
static inline int nfsd4_create_laundry_wq(void) { return 0; }; static inline int nfsd4_create_laundry_wq(void) { return 0; };
static inline void nfsd4_destroy_laundry_wq(void) {}; static inline void nfsd4_destroy_laundry_wq(void) {};
static inline bool nfsd_wait_for_delegreturn(struct svc_rqst *rqstp,
struct inode *inode)
{
return false;
}
#endif #endif
/* /*
...@@ -343,6 +349,7 @@ void nfsd_lockd_shutdown(void); ...@@ -343,6 +349,7 @@ void nfsd_lockd_shutdown(void);
#define NFSD_COURTESY_CLIENT_TIMEOUT (24 * 60 * 60) /* seconds */ #define NFSD_COURTESY_CLIENT_TIMEOUT (24 * 60 * 60) /* seconds */
#define NFSD_CLIENT_MAX_TRIM_PER_RUN 128 #define NFSD_CLIENT_MAX_TRIM_PER_RUN 128
#define NFS4_CLIENTS_PER_GB 1024 #define NFS4_CLIENTS_PER_GB 1024
#define NFSD_DELEGRETURN_TIMEOUT (HZ / 34) /* 30ms */
/* /*
* The following attributes are currently not supported by the NFSv4 server: * The following attributes are currently not supported by the NFSv4 server:
...@@ -498,7 +505,8 @@ extern void unregister_cld_notifier(void); ...@@ -498,7 +505,8 @@ extern void unregister_cld_notifier(void);
extern void nfsd4_ssc_init_umount_work(struct nfsd_net *nn); extern void nfsd4_ssc_init_umount_work(struct nfsd_net *nn);
#endif #endif
extern void nfsd4_init_leases_net(struct nfsd_net *nn); extern int nfsd4_init_leases_net(struct nfsd_net *nn);
extern void nfsd4_leases_net_shutdown(struct nfsd_net *nn);
#else /* CONFIG_NFSD_V4 */ #else /* CONFIG_NFSD_V4 */
static inline int nfsd4_is_junction(struct dentry *dentry) static inline int nfsd4_is_junction(struct dentry *dentry)
...@@ -506,7 +514,8 @@ static inline int nfsd4_is_junction(struct dentry *dentry) ...@@ -506,7 +514,8 @@ static inline int nfsd4_is_junction(struct dentry *dentry)
return 0; return 0;
} }
static inline void nfsd4_init_leases_net(struct nfsd_net *nn) {}; static inline int nfsd4_init_leases_net(struct nfsd_net *nn) { return 0; };
static inline void nfsd4_leases_net_shutdown(struct nfsd_net *nn) {};
#define register_cld_notifier() 0 #define register_cld_notifier() 0
#define unregister_cld_notifier() do { } while(0) #define unregister_cld_notifier() do { } while(0)
......
...@@ -392,13 +392,7 @@ fh_verify(struct svc_rqst *rqstp, struct svc_fh *fhp, umode_t type, int access) ...@@ -392,13 +392,7 @@ fh_verify(struct svc_rqst *rqstp, struct svc_fh *fhp, umode_t type, int access)
skip_pseudoflavor_check: skip_pseudoflavor_check:
/* Finally, check access permissions. */ /* Finally, check access permissions. */
error = nfsd_permission(rqstp, exp, dentry, access); error = nfsd_permission(rqstp, exp, dentry, access);
trace_nfsd_fh_verify_err(rqstp, fhp, type, access, error);
if (error) {
dprintk("fh_verify: %pd2 permission failure, "
"acc=%x, error=%d\n",
dentry,
access, ntohl(error));
}
out: out:
if (error == nfserr_stale) if (error == nfserr_stale)
nfsd_stats_fh_stale_inc(exp); nfsd_stats_fh_stale_inc(exp);
......
...@@ -185,6 +185,7 @@ nfsd_proc_read(struct svc_rqst *rqstp) ...@@ -185,6 +185,7 @@ nfsd_proc_read(struct svc_rqst *rqstp)
argp->count, argp->offset); argp->count, argp->offset);
argp->count = min_t(u32, argp->count, NFSSVC_MAXBLKSIZE_V2); argp->count = min_t(u32, argp->count, NFSSVC_MAXBLKSIZE_V2);
argp->count = min_t(u32, argp->count, rqstp->rq_res.buflen);
v = 0; v = 0;
len = argp->count; len = argp->count;
...@@ -390,9 +391,8 @@ nfsd_proc_create(struct svc_rqst *rqstp) ...@@ -390,9 +391,8 @@ nfsd_proc_create(struct svc_rqst *rqstp)
resp->status = nfs_ok; resp->status = nfs_ok;
if (!inode) { if (!inode) {
/* File doesn't exist. Create it and set attrs */ /* File doesn't exist. Create it and set attrs */
resp->status = nfsd_create_locked(rqstp, dirfhp, argp->name, resp->status = nfsd_create_locked(rqstp, dirfhp, &attrs, type,
argp->len, &attrs, type, rdev, rdev, newfhp);
newfhp);
} else if (type == S_IFREG) { } else if (type == S_IFREG) {
dprintk("nfsd: existing %s, valid=%x, size=%ld\n", dprintk("nfsd: existing %s, valid=%x, size=%ld\n",
argp->name, attr->ia_valid, (long) attr->ia_size); argp->name, attr->ia_valid, (long) attr->ia_size);
...@@ -567,24 +567,15 @@ static void nfsd_init_dirlist_pages(struct svc_rqst *rqstp, ...@@ -567,24 +567,15 @@ static void nfsd_init_dirlist_pages(struct svc_rqst *rqstp,
struct xdr_buf *buf = &resp->dirlist; struct xdr_buf *buf = &resp->dirlist;
struct xdr_stream *xdr = &resp->xdr; struct xdr_stream *xdr = &resp->xdr;
count = clamp(count, (u32)(XDR_UNIT * 2), svc_max_payload(rqstp));
memset(buf, 0, sizeof(*buf)); memset(buf, 0, sizeof(*buf));
/* Reserve room for the NULL ptr & eof flag (-2 words) */ /* Reserve room for the NULL ptr & eof flag (-2 words) */
buf->buflen = count - XDR_UNIT * 2; buf->buflen = clamp(count, (u32)(XDR_UNIT * 2), (u32)PAGE_SIZE);
buf->buflen -= XDR_UNIT * 2;
buf->pages = rqstp->rq_next_page; buf->pages = rqstp->rq_next_page;
rqstp->rq_next_page++; rqstp->rq_next_page++;
/* This is xdr_init_encode(), but it assumes that xdr_init_encode_pages(xdr, buf, buf->pages, NULL);
* the head kvec has already been consumed. */
xdr_set_scratch_buffer(xdr, NULL, 0);
xdr->buf = buf;
xdr->page_ptr = buf->pages;
xdr->iov = NULL;
xdr->p = page_address(*buf->pages);
xdr->end = (void *)xdr->p + min_t(u32, buf->buflen, PAGE_SIZE);
xdr->rqst = NULL;
} }
/* /*
...@@ -646,6 +637,7 @@ static const struct svc_procedure nfsd_procedures2[18] = { ...@@ -646,6 +637,7 @@ static const struct svc_procedure nfsd_procedures2[18] = {
.pc_decode = nfssvc_decode_voidarg, .pc_decode = nfssvc_decode_voidarg,
.pc_encode = nfssvc_encode_voidres, .pc_encode = nfssvc_encode_voidres,
.pc_argsize = sizeof(struct nfsd_voidargs), .pc_argsize = sizeof(struct nfsd_voidargs),
.pc_argzero = sizeof(struct nfsd_voidargs),
.pc_ressize = sizeof(struct nfsd_voidres), .pc_ressize = sizeof(struct nfsd_voidres),
.pc_cachetype = RC_NOCACHE, .pc_cachetype = RC_NOCACHE,
.pc_xdrressize = 0, .pc_xdrressize = 0,
...@@ -657,6 +649,7 @@ static const struct svc_procedure nfsd_procedures2[18] = { ...@@ -657,6 +649,7 @@ static const struct svc_procedure nfsd_procedures2[18] = {
.pc_encode = nfssvc_encode_attrstatres, .pc_encode = nfssvc_encode_attrstatres,
.pc_release = nfssvc_release_attrstat, .pc_release = nfssvc_release_attrstat,
.pc_argsize = sizeof(struct nfsd_fhandle), .pc_argsize = sizeof(struct nfsd_fhandle),
.pc_argzero = sizeof(struct nfsd_fhandle),
.pc_ressize = sizeof(struct nfsd_attrstat), .pc_ressize = sizeof(struct nfsd_attrstat),
.pc_cachetype = RC_NOCACHE, .pc_cachetype = RC_NOCACHE,
.pc_xdrressize = ST+AT, .pc_xdrressize = ST+AT,
...@@ -668,6 +661,7 @@ static const struct svc_procedure nfsd_procedures2[18] = { ...@@ -668,6 +661,7 @@ static const struct svc_procedure nfsd_procedures2[18] = {
.pc_encode = nfssvc_encode_attrstatres, .pc_encode = nfssvc_encode_attrstatres,
.pc_release = nfssvc_release_attrstat, .pc_release = nfssvc_release_attrstat,
.pc_argsize = sizeof(struct nfsd_sattrargs), .pc_argsize = sizeof(struct nfsd_sattrargs),
.pc_argzero = sizeof(struct nfsd_sattrargs),
.pc_ressize = sizeof(struct nfsd_attrstat), .pc_ressize = sizeof(struct nfsd_attrstat),
.pc_cachetype = RC_REPLBUFF, .pc_cachetype = RC_REPLBUFF,
.pc_xdrressize = ST+AT, .pc_xdrressize = ST+AT,
...@@ -678,6 +672,7 @@ static const struct svc_procedure nfsd_procedures2[18] = { ...@@ -678,6 +672,7 @@ static const struct svc_procedure nfsd_procedures2[18] = {
.pc_decode = nfssvc_decode_voidarg, .pc_decode = nfssvc_decode_voidarg,
.pc_encode = nfssvc_encode_voidres, .pc_encode = nfssvc_encode_voidres,
.pc_argsize = sizeof(struct nfsd_voidargs), .pc_argsize = sizeof(struct nfsd_voidargs),
.pc_argzero = sizeof(struct nfsd_voidargs),
.pc_ressize = sizeof(struct nfsd_voidres), .pc_ressize = sizeof(struct nfsd_voidres),
.pc_cachetype = RC_NOCACHE, .pc_cachetype = RC_NOCACHE,
.pc_xdrressize = 0, .pc_xdrressize = 0,
...@@ -689,6 +684,7 @@ static const struct svc_procedure nfsd_procedures2[18] = { ...@@ -689,6 +684,7 @@ static const struct svc_procedure nfsd_procedures2[18] = {
.pc_encode = nfssvc_encode_diropres, .pc_encode = nfssvc_encode_diropres,
.pc_release = nfssvc_release_diropres, .pc_release = nfssvc_release_diropres,
.pc_argsize = sizeof(struct nfsd_diropargs), .pc_argsize = sizeof(struct nfsd_diropargs),
.pc_argzero = sizeof(struct nfsd_diropargs),
.pc_ressize = sizeof(struct nfsd_diropres), .pc_ressize = sizeof(struct nfsd_diropres),
.pc_cachetype = RC_NOCACHE, .pc_cachetype = RC_NOCACHE,
.pc_xdrressize = ST+FH+AT, .pc_xdrressize = ST+FH+AT,
...@@ -699,6 +695,7 @@ static const struct svc_procedure nfsd_procedures2[18] = { ...@@ -699,6 +695,7 @@ static const struct svc_procedure nfsd_procedures2[18] = {
.pc_decode = nfssvc_decode_fhandleargs, .pc_decode = nfssvc_decode_fhandleargs,
.pc_encode = nfssvc_encode_readlinkres, .pc_encode = nfssvc_encode_readlinkres,
.pc_argsize = sizeof(struct nfsd_fhandle), .pc_argsize = sizeof(struct nfsd_fhandle),
.pc_argzero = sizeof(struct nfsd_fhandle),
.pc_ressize = sizeof(struct nfsd_readlinkres), .pc_ressize = sizeof(struct nfsd_readlinkres),
.pc_cachetype = RC_NOCACHE, .pc_cachetype = RC_NOCACHE,
.pc_xdrressize = ST+1+NFS_MAXPATHLEN/4, .pc_xdrressize = ST+1+NFS_MAXPATHLEN/4,
...@@ -710,6 +707,7 @@ static const struct svc_procedure nfsd_procedures2[18] = { ...@@ -710,6 +707,7 @@ static const struct svc_procedure nfsd_procedures2[18] = {
.pc_encode = nfssvc_encode_readres, .pc_encode = nfssvc_encode_readres,
.pc_release = nfssvc_release_readres, .pc_release = nfssvc_release_readres,
.pc_argsize = sizeof(struct nfsd_readargs), .pc_argsize = sizeof(struct nfsd_readargs),
.pc_argzero = sizeof(struct nfsd_readargs),
.pc_ressize = sizeof(struct nfsd_readres), .pc_ressize = sizeof(struct nfsd_readres),
.pc_cachetype = RC_NOCACHE, .pc_cachetype = RC_NOCACHE,
.pc_xdrressize = ST+AT+1+NFSSVC_MAXBLKSIZE_V2/4, .pc_xdrressize = ST+AT+1+NFSSVC_MAXBLKSIZE_V2/4,
...@@ -720,6 +718,7 @@ static const struct svc_procedure nfsd_procedures2[18] = { ...@@ -720,6 +718,7 @@ static const struct svc_procedure nfsd_procedures2[18] = {
.pc_decode = nfssvc_decode_voidarg, .pc_decode = nfssvc_decode_voidarg,
.pc_encode = nfssvc_encode_voidres, .pc_encode = nfssvc_encode_voidres,
.pc_argsize = sizeof(struct nfsd_voidargs), .pc_argsize = sizeof(struct nfsd_voidargs),
.pc_argzero = sizeof(struct nfsd_voidargs),
.pc_ressize = sizeof(struct nfsd_voidres), .pc_ressize = sizeof(struct nfsd_voidres),
.pc_cachetype = RC_NOCACHE, .pc_cachetype = RC_NOCACHE,
.pc_xdrressize = 0, .pc_xdrressize = 0,
...@@ -731,6 +730,7 @@ static const struct svc_procedure nfsd_procedures2[18] = { ...@@ -731,6 +730,7 @@ static const struct svc_procedure nfsd_procedures2[18] = {
.pc_encode = nfssvc_encode_attrstatres, .pc_encode = nfssvc_encode_attrstatres,
.pc_release = nfssvc_release_attrstat, .pc_release = nfssvc_release_attrstat,
.pc_argsize = sizeof(struct nfsd_writeargs), .pc_argsize = sizeof(struct nfsd_writeargs),
.pc_argzero = sizeof(struct nfsd_writeargs),
.pc_ressize = sizeof(struct nfsd_attrstat), .pc_ressize = sizeof(struct nfsd_attrstat),
.pc_cachetype = RC_REPLBUFF, .pc_cachetype = RC_REPLBUFF,
.pc_xdrressize = ST+AT, .pc_xdrressize = ST+AT,
...@@ -742,6 +742,7 @@ static const struct svc_procedure nfsd_procedures2[18] = { ...@@ -742,6 +742,7 @@ static const struct svc_procedure nfsd_procedures2[18] = {
.pc_encode = nfssvc_encode_diropres, .pc_encode = nfssvc_encode_diropres,
.pc_release = nfssvc_release_diropres, .pc_release = nfssvc_release_diropres,
.pc_argsize = sizeof(struct nfsd_createargs), .pc_argsize = sizeof(struct nfsd_createargs),
.pc_argzero = sizeof(struct nfsd_createargs),
.pc_ressize = sizeof(struct nfsd_diropres), .pc_ressize = sizeof(struct nfsd_diropres),
.pc_cachetype = RC_REPLBUFF, .pc_cachetype = RC_REPLBUFF,
.pc_xdrressize = ST+FH+AT, .pc_xdrressize = ST+FH+AT,
...@@ -752,6 +753,7 @@ static const struct svc_procedure nfsd_procedures2[18] = { ...@@ -752,6 +753,7 @@ static const struct svc_procedure nfsd_procedures2[18] = {
.pc_decode = nfssvc_decode_diropargs, .pc_decode = nfssvc_decode_diropargs,
.pc_encode = nfssvc_encode_statres, .pc_encode = nfssvc_encode_statres,
.pc_argsize = sizeof(struct nfsd_diropargs), .pc_argsize = sizeof(struct nfsd_diropargs),
.pc_argzero = sizeof(struct nfsd_diropargs),
.pc_ressize = sizeof(struct nfsd_stat), .pc_ressize = sizeof(struct nfsd_stat),
.pc_cachetype = RC_REPLSTAT, .pc_cachetype = RC_REPLSTAT,
.pc_xdrressize = ST, .pc_xdrressize = ST,
...@@ -762,6 +764,7 @@ static const struct svc_procedure nfsd_procedures2[18] = { ...@@ -762,6 +764,7 @@ static const struct svc_procedure nfsd_procedures2[18] = {
.pc_decode = nfssvc_decode_renameargs, .pc_decode = nfssvc_decode_renameargs,
.pc_encode = nfssvc_encode_statres, .pc_encode = nfssvc_encode_statres,
.pc_argsize = sizeof(struct nfsd_renameargs), .pc_argsize = sizeof(struct nfsd_renameargs),
.pc_argzero = sizeof(struct nfsd_renameargs),
.pc_ressize = sizeof(struct nfsd_stat), .pc_ressize = sizeof(struct nfsd_stat),
.pc_cachetype = RC_REPLSTAT, .pc_cachetype = RC_REPLSTAT,
.pc_xdrressize = ST, .pc_xdrressize = ST,
...@@ -772,6 +775,7 @@ static const struct svc_procedure nfsd_procedures2[18] = { ...@@ -772,6 +775,7 @@ static const struct svc_procedure nfsd_procedures2[18] = {
.pc_decode = nfssvc_decode_linkargs, .pc_decode = nfssvc_decode_linkargs,
.pc_encode = nfssvc_encode_statres, .pc_encode = nfssvc_encode_statres,
.pc_argsize = sizeof(struct nfsd_linkargs), .pc_argsize = sizeof(struct nfsd_linkargs),
.pc_argzero = sizeof(struct nfsd_linkargs),
.pc_ressize = sizeof(struct nfsd_stat), .pc_ressize = sizeof(struct nfsd_stat),
.pc_cachetype = RC_REPLSTAT, .pc_cachetype = RC_REPLSTAT,
.pc_xdrressize = ST, .pc_xdrressize = ST,
...@@ -782,6 +786,7 @@ static const struct svc_procedure nfsd_procedures2[18] = { ...@@ -782,6 +786,7 @@ static const struct svc_procedure nfsd_procedures2[18] = {
.pc_decode = nfssvc_decode_symlinkargs, .pc_decode = nfssvc_decode_symlinkargs,
.pc_encode = nfssvc_encode_statres, .pc_encode = nfssvc_encode_statres,
.pc_argsize = sizeof(struct nfsd_symlinkargs), .pc_argsize = sizeof(struct nfsd_symlinkargs),
.pc_argzero = sizeof(struct nfsd_symlinkargs),
.pc_ressize = sizeof(struct nfsd_stat), .pc_ressize = sizeof(struct nfsd_stat),
.pc_cachetype = RC_REPLSTAT, .pc_cachetype = RC_REPLSTAT,
.pc_xdrressize = ST, .pc_xdrressize = ST,
...@@ -793,6 +798,7 @@ static const struct svc_procedure nfsd_procedures2[18] = { ...@@ -793,6 +798,7 @@ static const struct svc_procedure nfsd_procedures2[18] = {
.pc_encode = nfssvc_encode_diropres, .pc_encode = nfssvc_encode_diropres,
.pc_release = nfssvc_release_diropres, .pc_release = nfssvc_release_diropres,
.pc_argsize = sizeof(struct nfsd_createargs), .pc_argsize = sizeof(struct nfsd_createargs),
.pc_argzero = sizeof(struct nfsd_createargs),
.pc_ressize = sizeof(struct nfsd_diropres), .pc_ressize = sizeof(struct nfsd_diropres),
.pc_cachetype = RC_REPLBUFF, .pc_cachetype = RC_REPLBUFF,
.pc_xdrressize = ST+FH+AT, .pc_xdrressize = ST+FH+AT,
...@@ -803,6 +809,7 @@ static const struct svc_procedure nfsd_procedures2[18] = { ...@@ -803,6 +809,7 @@ static const struct svc_procedure nfsd_procedures2[18] = {
.pc_decode = nfssvc_decode_diropargs, .pc_decode = nfssvc_decode_diropargs,
.pc_encode = nfssvc_encode_statres, .pc_encode = nfssvc_encode_statres,
.pc_argsize = sizeof(struct nfsd_diropargs), .pc_argsize = sizeof(struct nfsd_diropargs),
.pc_argzero = sizeof(struct nfsd_diropargs),
.pc_ressize = sizeof(struct nfsd_stat), .pc_ressize = sizeof(struct nfsd_stat),
.pc_cachetype = RC_REPLSTAT, .pc_cachetype = RC_REPLSTAT,
.pc_xdrressize = ST, .pc_xdrressize = ST,
...@@ -813,6 +820,7 @@ static const struct svc_procedure nfsd_procedures2[18] = { ...@@ -813,6 +820,7 @@ static const struct svc_procedure nfsd_procedures2[18] = {
.pc_decode = nfssvc_decode_readdirargs, .pc_decode = nfssvc_decode_readdirargs,
.pc_encode = nfssvc_encode_readdirres, .pc_encode = nfssvc_encode_readdirres,
.pc_argsize = sizeof(struct nfsd_readdirargs), .pc_argsize = sizeof(struct nfsd_readdirargs),
.pc_argzero = sizeof(struct nfsd_readdirargs),
.pc_ressize = sizeof(struct nfsd_readdirres), .pc_ressize = sizeof(struct nfsd_readdirres),
.pc_cachetype = RC_NOCACHE, .pc_cachetype = RC_NOCACHE,
.pc_name = "READDIR", .pc_name = "READDIR",
...@@ -822,6 +830,7 @@ static const struct svc_procedure nfsd_procedures2[18] = { ...@@ -822,6 +830,7 @@ static const struct svc_procedure nfsd_procedures2[18] = {
.pc_decode = nfssvc_decode_fhandleargs, .pc_decode = nfssvc_decode_fhandleargs,
.pc_encode = nfssvc_encode_statfsres, .pc_encode = nfssvc_encode_statfsres,
.pc_argsize = sizeof(struct nfsd_fhandle), .pc_argsize = sizeof(struct nfsd_fhandle),
.pc_argzero = sizeof(struct nfsd_fhandle),
.pc_ressize = sizeof(struct nfsd_statfsres), .pc_ressize = sizeof(struct nfsd_statfsres),
.pc_cachetype = RC_NOCACHE, .pc_cachetype = RC_NOCACHE,
.pc_xdrressize = ST+5, .pc_xdrressize = ST+5,
......
...@@ -799,7 +799,7 @@ nfsd_svc(int nrservs, struct net *net, const struct cred *cred) ...@@ -799,7 +799,7 @@ nfsd_svc(int nrservs, struct net *net, const struct cred *cred)
if (nrservs == 0 && nn->nfsd_serv == NULL) if (nrservs == 0 && nn->nfsd_serv == NULL)
goto out; goto out;
strlcpy(nn->nfsd_name, utsname()->nodename, strscpy(nn->nfsd_name, utsname()->nodename,
sizeof(nn->nfsd_name)); sizeof(nn->nfsd_name));
error = nfsd_create_serv(net); error = nfsd_create_serv(net);
......
...@@ -338,10 +338,8 @@ nfssvc_decode_writeargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) ...@@ -338,10 +338,8 @@ nfssvc_decode_writeargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
return false; return false;
if (args->len > NFSSVC_MAXBLKSIZE_V2) if (args->len > NFSSVC_MAXBLKSIZE_V2)
return false; return false;
if (!xdr_stream_subsegment(xdr, &args->payload, args->len))
return false;
return true; return xdr_stream_subsegment(xdr, &args->payload, args->len);
} }
bool bool
......
...@@ -57,11 +57,11 @@ typedef struct { ...@@ -57,11 +57,11 @@ typedef struct {
} stateid_t; } stateid_t;
typedef struct { typedef struct {
stateid_t stid; stateid_t cs_stid;
#define NFS4_COPY_STID 1 #define NFS4_COPY_STID 1
#define NFS4_COPYNOTIFY_STID 2 #define NFS4_COPYNOTIFY_STID 2
unsigned char sc_type; unsigned char cs_type;
refcount_t sc_count; refcount_t cs_count;
} copy_stateid_t; } copy_stateid_t;
struct nfsd4_callback { struct nfsd4_callback {
...@@ -175,7 +175,7 @@ static inline struct nfs4_delegation *delegstateid(struct nfs4_stid *s) ...@@ -175,7 +175,7 @@ static inline struct nfs4_delegation *delegstateid(struct nfs4_stid *s)
/* Maximum number of slots per session. 160 is useful for long haul TCP */ /* Maximum number of slots per session. 160 is useful for long haul TCP */
#define NFSD_MAX_SLOTS_PER_SESSION 160 #define NFSD_MAX_SLOTS_PER_SESSION 160
/* Maximum number of operations per session compound */ /* Maximum number of operations per session compound */
#define NFSD_MAX_OPS_PER_COMPOUND 16 #define NFSD_MAX_OPS_PER_COMPOUND 50
/* Maximum session per slot cache size */ /* Maximum session per slot cache size */
#define NFSD_SLOT_CACHE_SIZE 2048 #define NFSD_SLOT_CACHE_SIZE 2048
/* Maximum number of NFSD_SLOT_CACHE_SIZE slots per session */ /* Maximum number of NFSD_SLOT_CACHE_SIZE slots per session */
...@@ -692,12 +692,11 @@ extern void nfsd4_probe_callback_sync(struct nfs4_client *clp); ...@@ -692,12 +692,11 @@ extern void nfsd4_probe_callback_sync(struct nfs4_client *clp);
extern void nfsd4_change_callback(struct nfs4_client *clp, struct nfs4_cb_conn *); extern void nfsd4_change_callback(struct nfs4_client *clp, struct nfs4_cb_conn *);
extern void nfsd4_init_cb(struct nfsd4_callback *cb, struct nfs4_client *clp, extern void nfsd4_init_cb(struct nfsd4_callback *cb, struct nfs4_client *clp,
const struct nfsd4_callback_ops *ops, enum nfsd4_cb_op op); const struct nfsd4_callback_ops *ops, enum nfsd4_cb_op op);
extern void nfsd4_run_cb(struct nfsd4_callback *cb); extern bool nfsd4_run_cb(struct nfsd4_callback *cb);
extern int nfsd4_create_callback_queue(void); extern int nfsd4_create_callback_queue(void);
extern void nfsd4_destroy_callback_queue(void); extern void nfsd4_destroy_callback_queue(void);
extern void nfsd4_shutdown_callback(struct nfs4_client *); extern void nfsd4_shutdown_callback(struct nfs4_client *);
extern void nfsd4_shutdown_copy(struct nfs4_client *clp); extern void nfsd4_shutdown_copy(struct nfs4_client *clp);
extern void nfsd4_prepare_cb_recall(struct nfs4_delegation *dp);
extern struct nfs4_client_reclaim *nfs4_client_to_reclaim(struct xdr_netobj name, extern struct nfs4_client_reclaim *nfs4_client_to_reclaim(struct xdr_netobj name,
struct xdr_netobj princhash, struct nfsd_net *nn); struct xdr_netobj princhash, struct nfsd_net *nn);
extern bool nfs4_has_reclaimed_state(struct xdr_netobj name, struct nfsd_net *nn); extern bool nfs4_has_reclaimed_state(struct xdr_netobj name, struct nfsd_net *nn);
......
...@@ -32,7 +32,7 @@ struct svc_stat nfsd_svcstats = { ...@@ -32,7 +32,7 @@ struct svc_stat nfsd_svcstats = {
.program = &nfsd_program, .program = &nfsd_program,
}; };
static int nfsd_proc_show(struct seq_file *seq, void *v) static int nfsd_show(struct seq_file *seq, void *v)
{ {
int i; int i;
...@@ -72,17 +72,7 @@ static int nfsd_proc_show(struct seq_file *seq, void *v) ...@@ -72,17 +72,7 @@ static int nfsd_proc_show(struct seq_file *seq, void *v)
return 0; return 0;
} }
static int nfsd_proc_open(struct inode *inode, struct file *file) DEFINE_PROC_SHOW_ATTRIBUTE(nfsd);
{
return single_open(file, nfsd_proc_show, NULL);
}
static const struct proc_ops nfsd_proc_ops = {
.proc_open = nfsd_proc_open,
.proc_read = seq_read,
.proc_lseek = seq_lseek,
.proc_release = single_release,
};
int nfsd_percpu_counters_init(struct percpu_counter counters[], int num) int nfsd_percpu_counters_init(struct percpu_counter counters[], int num)
{ {
......
...@@ -84,19 +84,26 @@ DEFINE_NFSD_XDR_ERR_EVENT(cant_encode); ...@@ -84,19 +84,26 @@ DEFINE_NFSD_XDR_ERR_EVENT(cant_encode);
{ NFSD_MAY_64BIT_COOKIE, "64BIT_COOKIE" }) { NFSD_MAY_64BIT_COOKIE, "64BIT_COOKIE" })
TRACE_EVENT(nfsd_compound, TRACE_EVENT(nfsd_compound,
TP_PROTO(const struct svc_rqst *rqst, TP_PROTO(
u32 args_opcnt), const struct svc_rqst *rqst,
TP_ARGS(rqst, args_opcnt), const char *tag,
u32 taglen,
u32 opcnt
),
TP_ARGS(rqst, tag, taglen, opcnt),
TP_STRUCT__entry( TP_STRUCT__entry(
__field(u32, xid) __field(u32, xid)
__field(u32, args_opcnt) __field(u32, opcnt)
__string_len(tag, tag, taglen)
), ),
TP_fast_assign( TP_fast_assign(
__entry->xid = be32_to_cpu(rqst->rq_xid); __entry->xid = be32_to_cpu(rqst->rq_xid);
__entry->args_opcnt = args_opcnt; __entry->opcnt = opcnt;
__assign_str_len(tag, tag, taglen);
), ),
TP_printk("xid=0x%08x opcnt=%u", TP_printk("xid=0x%08x opcnt=%u tag=%s",
__entry->xid, __entry->args_opcnt) __entry->xid, __entry->opcnt, __get_str(tag)
)
) )
TRACE_EVENT(nfsd_compound_status, TRACE_EVENT(nfsd_compound_status,
...@@ -195,7 +202,7 @@ TRACE_EVENT(nfsd_fh_verify, ...@@ -195,7 +202,7 @@ TRACE_EVENT(nfsd_fh_verify,
__sockaddr(client, rqstp->rq_xprt->xpt_remotelen) __sockaddr(client, rqstp->rq_xprt->xpt_remotelen)
__field(u32, xid) __field(u32, xid)
__field(u32, fh_hash) __field(u32, fh_hash)
__field(void *, inode) __field(const void *, inode)
__field(unsigned long, type) __field(unsigned long, type)
__field(unsigned long, access) __field(unsigned long, access)
), ),
...@@ -211,13 +218,55 @@ TRACE_EVENT(nfsd_fh_verify, ...@@ -211,13 +218,55 @@ TRACE_EVENT(nfsd_fh_verify,
__entry->type = type; __entry->type = type;
__entry->access = access; __entry->access = access;
), ),
TP_printk("xid=0x%08x fh_hash=0x%08x inode=%p type=%s access=%s", TP_printk("xid=0x%08x fh_hash=0x%08x type=%s access=%s",
__entry->xid, __entry->fh_hash, __entry->inode, __entry->xid, __entry->fh_hash,
show_fs_file_type(__entry->type), show_fs_file_type(__entry->type),
show_nfsd_may_flags(__entry->access) show_nfsd_may_flags(__entry->access)
) )
); );
TRACE_EVENT_CONDITION(nfsd_fh_verify_err,
TP_PROTO(
const struct svc_rqst *rqstp,
const struct svc_fh *fhp,
umode_t type,
int access,
__be32 error
),
TP_ARGS(rqstp, fhp, type, access, error),
TP_CONDITION(error),
TP_STRUCT__entry(
__field(unsigned int, netns_ino)
__sockaddr(server, rqstp->rq_xprt->xpt_remotelen)
__sockaddr(client, rqstp->rq_xprt->xpt_remotelen)
__field(u32, xid)
__field(u32, fh_hash)
__field(const void *, inode)
__field(unsigned long, type)
__field(unsigned long, access)
__field(int, error)
),
TP_fast_assign(
__entry->netns_ino = SVC_NET(rqstp)->ns.inum;
__assign_sockaddr(server, &rqstp->rq_xprt->xpt_local,
rqstp->rq_xprt->xpt_locallen);
__assign_sockaddr(client, &rqstp->rq_xprt->xpt_remote,
rqstp->rq_xprt->xpt_remotelen);
__entry->xid = be32_to_cpu(rqstp->rq_xid);
__entry->fh_hash = knfsd_fh_hash(&fhp->fh_handle);
__entry->inode = d_inode(fhp->fh_dentry);
__entry->type = type;
__entry->access = access;
__entry->error = be32_to_cpu(error);
),
TP_printk("xid=0x%08x fh_hash=0x%08x type=%s access=%s error=%d",
__entry->xid, __entry->fh_hash,
show_fs_file_type(__entry->type),
show_nfsd_may_flags(__entry->access),
__entry->error
)
);
DECLARE_EVENT_CLASS(nfsd_fh_err_class, DECLARE_EVENT_CLASS(nfsd_fh_err_class,
TP_PROTO(struct svc_rqst *rqstp, TP_PROTO(struct svc_rqst *rqstp,
struct svc_fh *fhp, struct svc_fh *fhp,
...@@ -489,6 +538,29 @@ DEFINE_NFSD_COPY_ERR_EVENT(clone_file_range_err); ...@@ -489,6 +538,29 @@ DEFINE_NFSD_COPY_ERR_EVENT(clone_file_range_err);
#include "filecache.h" #include "filecache.h"
#include "vfs.h" #include "vfs.h"
TRACE_EVENT(nfsd_delegret_wakeup,
TP_PROTO(
const struct svc_rqst *rqstp,
const struct inode *inode,
long timeo
),
TP_ARGS(rqstp, inode, timeo),
TP_STRUCT__entry(
__field(u32, xid)
__field(const void *, inode)
__field(long, timeo)
),
TP_fast_assign(
__entry->xid = be32_to_cpu(rqstp->rq_xid);
__entry->inode = inode;
__entry->timeo = timeo;
),
TP_printk("xid=0x%08x inode=%p%s",
__entry->xid, __entry->inode,
__entry->timeo == 0 ? " (timed out)" : ""
)
);
DECLARE_EVENT_CLASS(nfsd_stateid_class, DECLARE_EVENT_CLASS(nfsd_stateid_class,
TP_PROTO(stateid_t *stp), TP_PROTO(stateid_t *stp),
TP_ARGS(stp), TP_ARGS(stp),
...@@ -1399,6 +1471,45 @@ TRACE_EVENT(nfsd_cb_offload, ...@@ -1399,6 +1471,45 @@ TRACE_EVENT(nfsd_cb_offload,
__entry->fh_hash, __entry->count, __entry->status) __entry->fh_hash, __entry->count, __entry->status)
); );
DECLARE_EVENT_CLASS(nfsd_cb_done_class,
TP_PROTO(
const stateid_t *stp,
const struct rpc_task *task
),
TP_ARGS(stp, task),
TP_STRUCT__entry(
__field(u32, cl_boot)
__field(u32, cl_id)
__field(u32, si_id)
__field(u32, si_generation)
__field(int, status)
),
TP_fast_assign(
__entry->cl_boot = stp->si_opaque.so_clid.cl_boot;
__entry->cl_id = stp->si_opaque.so_clid.cl_id;
__entry->si_id = stp->si_opaque.so_id;
__entry->si_generation = stp->si_generation;
__entry->status = task->tk_status;
),
TP_printk("client %08x:%08x stateid %08x:%08x status=%d",
__entry->cl_boot, __entry->cl_id, __entry->si_id,
__entry->si_generation, __entry->status
)
);
#define DEFINE_NFSD_CB_DONE_EVENT(name) \
DEFINE_EVENT(nfsd_cb_done_class, name, \
TP_PROTO( \
const stateid_t *stp, \
const struct rpc_task *task \
), \
TP_ARGS(stp, task))
DEFINE_NFSD_CB_DONE_EVENT(nfsd_cb_recall_done);
DEFINE_NFSD_CB_DONE_EVENT(nfsd_cb_notify_lock_done);
DEFINE_NFSD_CB_DONE_EVENT(nfsd_cb_layout_done);
DEFINE_NFSD_CB_DONE_EVENT(nfsd_cb_offload_done);
#endif /* _NFSD_TRACE_H */ #endif /* _NFSD_TRACE_H */
#undef TRACE_INCLUDE_PATH #undef TRACE_INCLUDE_PATH
......
...@@ -343,8 +343,61 @@ nfsd_get_write_access(struct svc_rqst *rqstp, struct svc_fh *fhp, ...@@ -343,8 +343,61 @@ nfsd_get_write_access(struct svc_rqst *rqstp, struct svc_fh *fhp,
return nfserrno(get_write_access(inode)); return nfserrno(get_write_access(inode));
} }
/* static int __nfsd_setattr(struct dentry *dentry, struct iattr *iap)
* Set various file attributes. After this call fhp needs an fh_put. {
int host_err;
if (iap->ia_valid & ATTR_SIZE) {
/*
* RFC5661, Section 18.30.4:
* Changing the size of a file with SETATTR indirectly
* changes the time_modify and change attributes.
*
* (and similar for the older RFCs)
*/
struct iattr size_attr = {
.ia_valid = ATTR_SIZE | ATTR_CTIME | ATTR_MTIME,
.ia_size = iap->ia_size,
};
if (iap->ia_size < 0)
return -EFBIG;
host_err = notify_change(&init_user_ns, dentry, &size_attr, NULL);
if (host_err)
return host_err;
iap->ia_valid &= ~ATTR_SIZE;
/*
* Avoid the additional setattr call below if the only other
* attribute that the client sends is the mtime, as we update
* it as part of the size change above.
*/
if ((iap->ia_valid & ~ATTR_MTIME) == 0)
return 0;
}
if (!iap->ia_valid)
return 0;
iap->ia_valid |= ATTR_CTIME;
return notify_change(&init_user_ns, dentry, iap, NULL);
}
/**
* nfsd_setattr - Set various file attributes.
* @rqstp: controlling RPC transaction
* @fhp: filehandle of target
* @attr: attributes to set
* @check_guard: set to 1 if guardtime is a valid timestamp
* @guardtime: do not act if ctime.tv_sec does not match this timestamp
*
* This call may adjust the contents of @attr (in particular, this
* call may change the bits in the na_iattr.ia_valid field).
*
* Returns nfs_ok on success, otherwise an NFS status code is
* returned. Caller must release @fhp by calling fh_put in either
* case.
*/ */
__be32 __be32
nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp,
...@@ -357,9 +410,10 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, ...@@ -357,9 +410,10 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp,
int accmode = NFSD_MAY_SATTR; int accmode = NFSD_MAY_SATTR;
umode_t ftype = 0; umode_t ftype = 0;
__be32 err; __be32 err;
int host_err = 0; int host_err;
bool get_write_count; bool get_write_count;
bool size_change = (iap->ia_valid & ATTR_SIZE); bool size_change = (iap->ia_valid & ATTR_SIZE);
int retries;
if (iap->ia_valid & ATTR_SIZE) { if (iap->ia_valid & ATTR_SIZE) {
accmode |= NFSD_MAY_WRITE|NFSD_MAY_OWNER_OVERRIDE; accmode |= NFSD_MAY_WRITE|NFSD_MAY_OWNER_OVERRIDE;
...@@ -414,43 +468,13 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, ...@@ -414,43 +468,13 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp,
} }
inode_lock(inode); inode_lock(inode);
if (size_change) { for (retries = 1;;) {
/* host_err = __nfsd_setattr(dentry, iap);
* RFC5661, Section 18.30.4: if (host_err != -EAGAIN || !retries--)
* Changing the size of a file with SETATTR indirectly break;
* changes the time_modify and change attributes. if (!nfsd_wait_for_delegreturn(rqstp, inode))
* break;
* (and similar for the older RFCs)
*/
struct iattr size_attr = {
.ia_valid = ATTR_SIZE | ATTR_CTIME | ATTR_MTIME,
.ia_size = iap->ia_size,
};
host_err = -EFBIG;
if (iap->ia_size < 0)
goto out_unlock;
host_err = notify_change(&init_user_ns, dentry, &size_attr, NULL);
if (host_err)
goto out_unlock;
iap->ia_valid &= ~ATTR_SIZE;
/*
* Avoid the additional setattr call below if the only other
* attribute that the client sends is the mtime, as we update
* it as part of the size change above.
*/
if ((iap->ia_valid & ~ATTR_MTIME) == 0)
goto out_unlock;
}
if (iap->ia_valid) {
iap->ia_valid |= ATTR_CTIME;
host_err = notify_change(&init_user_ns, dentry, iap, NULL);
} }
out_unlock:
if (attr->na_seclabel && attr->na_seclabel->len) if (attr->na_seclabel && attr->na_seclabel->len)
attr->na_labelerr = security_inode_setsecctx(dentry, attr->na_labelerr = security_inode_setsecctx(dentry,
attr->na_seclabel->data, attr->na_seclabel->len); attr->na_seclabel->data, attr->na_seclabel->len);
...@@ -1255,7 +1279,7 @@ nfsd_check_ignore_resizing(struct iattr *iap) ...@@ -1255,7 +1279,7 @@ nfsd_check_ignore_resizing(struct iattr *iap)
/* The parent directory should already be locked: */ /* The parent directory should already be locked: */
__be32 __be32
nfsd_create_locked(struct svc_rqst *rqstp, struct svc_fh *fhp, nfsd_create_locked(struct svc_rqst *rqstp, struct svc_fh *fhp,
char *fname, int flen, struct nfsd_attrs *attrs, struct nfsd_attrs *attrs,
int type, dev_t rdev, struct svc_fh *resfhp) int type, dev_t rdev, struct svc_fh *resfhp)
{ {
struct dentry *dentry, *dchild; struct dentry *dentry, *dchild;
...@@ -1382,8 +1406,7 @@ nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp, ...@@ -1382,8 +1406,7 @@ nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp,
if (err) if (err)
goto out_unlock; goto out_unlock;
fh_fill_pre_attrs(fhp); fh_fill_pre_attrs(fhp);
err = nfsd_create_locked(rqstp, fhp, fname, flen, attrs, type, err = nfsd_create_locked(rqstp, fhp, attrs, type, rdev, resfhp);
rdev, resfhp);
fh_fill_post_attrs(fhp); fh_fill_post_attrs(fhp);
out_unlock: out_unlock:
inode_unlock(dentry->d_inode); inode_unlock(dentry->d_inode);
...@@ -1673,7 +1696,15 @@ nfsd_rename(struct svc_rqst *rqstp, struct svc_fh *ffhp, char *fname, int flen, ...@@ -1673,7 +1696,15 @@ nfsd_rename(struct svc_rqst *rqstp, struct svc_fh *ffhp, char *fname, int flen,
.new_dir = tdir, .new_dir = tdir,
.new_dentry = ndentry, .new_dentry = ndentry,
}; };
host_err = vfs_rename(&rd); int retries;
for (retries = 1;;) {
host_err = vfs_rename(&rd);
if (host_err != -EAGAIN || !retries--)
break;
if (!nfsd_wait_for_delegreturn(rqstp, d_inode(odentry)))
break;
}
if (!host_err) { if (!host_err) {
host_err = commit_metadata(tfhp); host_err = commit_metadata(tfhp);
if (!host_err) if (!host_err)
...@@ -1757,9 +1788,18 @@ nfsd_unlink(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, ...@@ -1757,9 +1788,18 @@ nfsd_unlink(struct svc_rqst *rqstp, struct svc_fh *fhp, int type,
fh_fill_pre_attrs(fhp); fh_fill_pre_attrs(fhp);
if (type != S_IFDIR) { if (type != S_IFDIR) {
int retries;
if (rdentry->d_sb->s_export_op->flags & EXPORT_OP_CLOSE_BEFORE_UNLINK) if (rdentry->d_sb->s_export_op->flags & EXPORT_OP_CLOSE_BEFORE_UNLINK)
nfsd_close_cached_files(rdentry); nfsd_close_cached_files(rdentry);
host_err = vfs_unlink(&init_user_ns, dirp, rdentry, NULL);
for (retries = 1;;) {
host_err = vfs_unlink(&init_user_ns, dirp, rdentry, NULL);
if (host_err != -EAGAIN || !retries--)
break;
if (!nfsd_wait_for_delegreturn(rqstp, rinode))
break;
}
} else { } else {
host_err = vfs_rmdir(&init_user_ns, dirp, rdentry); host_err = vfs_rmdir(&init_user_ns, dirp, rdentry);
} }
......
...@@ -79,8 +79,8 @@ __be32 nfsd4_clone_file_range(struct svc_rqst *rqstp, ...@@ -79,8 +79,8 @@ __be32 nfsd4_clone_file_range(struct svc_rqst *rqstp,
u64 count, bool sync); u64 count, bool sync);
#endif /* CONFIG_NFSD_V4 */ #endif /* CONFIG_NFSD_V4 */
__be32 nfsd_create_locked(struct svc_rqst *, struct svc_fh *, __be32 nfsd_create_locked(struct svc_rqst *, struct svc_fh *,
char *name, int len, struct nfsd_attrs *attrs, struct nfsd_attrs *attrs, int type, dev_t rdev,
int type, dev_t rdev, struct svc_fh *res); struct svc_fh *res);
__be32 nfsd_create(struct svc_rqst *, struct svc_fh *, __be32 nfsd_create(struct svc_rqst *, struct svc_fh *,
char *name, int len, struct nfsd_attrs *attrs, char *name, int len, struct nfsd_attrs *attrs,
int type, dev_t rdev, struct svc_fh *res); int type, dev_t rdev, struct svc_fh *res);
......
...@@ -717,13 +717,13 @@ struct nfsd4_compoundargs { ...@@ -717,13 +717,13 @@ struct nfsd4_compoundargs {
struct svcxdr_tmpbuf *to_free; struct svcxdr_tmpbuf *to_free;
struct svc_rqst *rqstp; struct svc_rqst *rqstp;
u32 taglen;
char * tag; char * tag;
u32 taglen;
u32 minorversion; u32 minorversion;
u32 client_opcnt;
u32 opcnt; u32 opcnt;
struct nfsd4_op *ops; struct nfsd4_op *ops;
struct nfsd4_op iops[8]; struct nfsd4_op iops[8];
int cachetype;
}; };
struct nfsd4_compoundres { struct nfsd4_compoundres {
...@@ -732,8 +732,8 @@ struct nfsd4_compoundres { ...@@ -732,8 +732,8 @@ struct nfsd4_compoundres {
struct svc_rqst * rqstp; struct svc_rqst * rqstp;
__be32 *statusp; __be32 *statusp;
u32 taglen;
char * tag; char * tag;
u32 taglen;
u32 opcnt; u32 opcnt;
struct nfsd4_compound_state cstate; struct nfsd4_compound_state cstate;
...@@ -888,7 +888,8 @@ struct nfsd4_operation { ...@@ -888,7 +888,8 @@ struct nfsd4_operation {
u32 op_flags; u32 op_flags;
char *op_name; char *op_name;
/* Try to get response size before operation */ /* Try to get response size before operation */
u32 (*op_rsize_bop)(struct svc_rqst *, struct nfsd4_op *); u32 (*op_rsize_bop)(const struct svc_rqst *rqstp,
const struct nfsd4_op *op);
void (*op_get_currentstateid)(struct nfsd4_compound_state *, void (*op_get_currentstateid)(struct nfsd4_compound_state *,
union nfsd4_op_u *); union nfsd4_op_u *);
void (*op_set_currentstateid)(struct nfsd4_compound_state *, void (*op_set_currentstateid)(struct nfsd4_compound_state *,
......
...@@ -472,6 +472,7 @@ struct svc_procedure { ...@@ -472,6 +472,7 @@ struct svc_procedure {
/* XDR free result: */ /* XDR free result: */
void (*pc_release)(struct svc_rqst *); void (*pc_release)(struct svc_rqst *);
unsigned int pc_argsize; /* argument struct size */ unsigned int pc_argsize; /* argument struct size */
unsigned int pc_argzero; /* how much of argument to clear */
unsigned int pc_ressize; /* result struct size */ unsigned int pc_ressize; /* result struct size */
unsigned int pc_cachetype; /* cache info (NFS) */ unsigned int pc_cachetype; /* cache info (NFS) */
unsigned int pc_xdrressize; /* maximum size of XDR reply */ unsigned int pc_xdrressize; /* maximum size of XDR reply */
...@@ -544,16 +545,27 @@ static inline void svc_reserve_auth(struct svc_rqst *rqstp, int space) ...@@ -544,16 +545,27 @@ static inline void svc_reserve_auth(struct svc_rqst *rqstp, int space)
} }
/** /**
* svcxdr_init_decode - Prepare an xdr_stream for svc Call decoding * svcxdr_init_decode - Prepare an xdr_stream for Call decoding
* @rqstp: controlling server RPC transaction context * @rqstp: controlling server RPC transaction context
* *
* This function currently assumes the RPC header in rq_arg has
* already been decoded. Upon return, xdr->p points to the
* location of the upper layer header.
*/ */
static inline void svcxdr_init_decode(struct svc_rqst *rqstp) static inline void svcxdr_init_decode(struct svc_rqst *rqstp)
{ {
struct xdr_stream *xdr = &rqstp->rq_arg_stream; struct xdr_stream *xdr = &rqstp->rq_arg_stream;
struct kvec *argv = rqstp->rq_arg.head; struct xdr_buf *buf = &rqstp->rq_arg;
struct kvec *argv = buf->head;
xdr_init_decode(xdr, &rqstp->rq_arg, argv->iov_base, NULL); /*
* svc_getnl() and friends do not keep the xdr_buf's ::len
* field up to date. Refresh that field before initializing
* the argument decoding stream.
*/
buf->len = buf->head->iov_len + buf->page_len + buf->tail->iov_len;
xdr_init_decode(xdr, buf, argv->iov_base, NULL);
xdr_set_scratch_page(xdr, rqstp->rq_scratch_page); xdr_set_scratch_page(xdr, rqstp->rq_scratch_page);
} }
...@@ -576,7 +588,7 @@ static inline void svcxdr_init_encode(struct svc_rqst *rqstp) ...@@ -576,7 +588,7 @@ static inline void svcxdr_init_encode(struct svc_rqst *rqstp)
xdr->end = resv->iov_base + PAGE_SIZE - rqstp->rq_auth_slack; xdr->end = resv->iov_base + PAGE_SIZE - rqstp->rq_auth_slack;
buf->len = resv->iov_len; buf->len = resv->iov_len;
xdr->page_ptr = buf->pages - 1; xdr->page_ptr = buf->pages - 1;
buf->buflen = PAGE_SIZE * (1 + rqstp->rq_page_end - buf->pages); buf->buflen = PAGE_SIZE * (rqstp->rq_page_end - buf->pages);
buf->buflen -= rqstp->rq_auth_slack; buf->buflen -= rqstp->rq_auth_slack;
xdr->rqst = NULL; xdr->rqst = NULL;
} }
......
...@@ -240,6 +240,8 @@ typedef int (*kxdrdproc_t)(struct rpc_rqst *rqstp, struct xdr_stream *xdr, ...@@ -240,6 +240,8 @@ typedef int (*kxdrdproc_t)(struct rpc_rqst *rqstp, struct xdr_stream *xdr,
extern void xdr_init_encode(struct xdr_stream *xdr, struct xdr_buf *buf, extern void xdr_init_encode(struct xdr_stream *xdr, struct xdr_buf *buf,
__be32 *p, struct rpc_rqst *rqst); __be32 *p, struct rpc_rqst *rqst);
extern void xdr_init_encode_pages(struct xdr_stream *xdr, struct xdr_buf *buf,
struct page **pages, struct rpc_rqst *rqst);
extern __be32 *xdr_reserve_space(struct xdr_stream *xdr, size_t nbytes); extern __be32 *xdr_reserve_space(struct xdr_stream *xdr, size_t nbytes);
extern int xdr_reserve_space_vec(struct xdr_stream *xdr, struct kvec *vec, extern int xdr_reserve_space_vec(struct xdr_stream *xdr, struct kvec *vec,
size_t nbytes); size_t nbytes);
......
...@@ -1205,7 +1205,7 @@ svc_generic_init_request(struct svc_rqst *rqstp, ...@@ -1205,7 +1205,7 @@ svc_generic_init_request(struct svc_rqst *rqstp,
goto err_bad_proc; goto err_bad_proc;
/* Initialize storage for argp and resp */ /* Initialize storage for argp and resp */
memset(rqstp->rq_argp, 0, procp->pc_argsize); memset(rqstp->rq_argp, 0, procp->pc_argzero);
memset(rqstp->rq_resp, 0, procp->pc_ressize); memset(rqstp->rq_resp, 0, procp->pc_ressize);
/* Bump per-procedure stats counter */ /* Bump per-procedure stats counter */
...@@ -1434,8 +1434,7 @@ svc_process(struct svc_rqst *rqstp) ...@@ -1434,8 +1434,7 @@ svc_process(struct svc_rqst *rqstp)
{ {
struct kvec *argv = &rqstp->rq_arg.head[0]; struct kvec *argv = &rqstp->rq_arg.head[0];
struct kvec *resv = &rqstp->rq_res.head[0]; struct kvec *resv = &rqstp->rq_res.head[0];
struct svc_serv *serv = rqstp->rq_server; __be32 dir;
u32 dir;
#if IS_ENABLED(CONFIG_FAIL_SUNRPC) #if IS_ENABLED(CONFIG_FAIL_SUNRPC)
if (!fail_sunrpc.ignore_server_disconnect && if (!fail_sunrpc.ignore_server_disconnect &&
...@@ -1450,7 +1449,7 @@ svc_process(struct svc_rqst *rqstp) ...@@ -1450,7 +1449,7 @@ svc_process(struct svc_rqst *rqstp)
rqstp->rq_next_page = &rqstp->rq_respages[1]; rqstp->rq_next_page = &rqstp->rq_respages[1];
resv->iov_base = page_address(rqstp->rq_respages[0]); resv->iov_base = page_address(rqstp->rq_respages[0]);
resv->iov_len = 0; resv->iov_len = 0;
rqstp->rq_res.pages = rqstp->rq_respages + 1; rqstp->rq_res.pages = rqstp->rq_next_page;
rqstp->rq_res.len = 0; rqstp->rq_res.len = 0;
rqstp->rq_res.page_base = 0; rqstp->rq_res.page_base = 0;
rqstp->rq_res.page_len = 0; rqstp->rq_res.page_len = 0;
...@@ -1458,18 +1457,17 @@ svc_process(struct svc_rqst *rqstp) ...@@ -1458,18 +1457,17 @@ svc_process(struct svc_rqst *rqstp)
rqstp->rq_res.tail[0].iov_base = NULL; rqstp->rq_res.tail[0].iov_base = NULL;
rqstp->rq_res.tail[0].iov_len = 0; rqstp->rq_res.tail[0].iov_len = 0;
dir = svc_getnl(argv); dir = svc_getu32(argv);
if (dir != 0) { if (dir != rpc_call)
/* direction != CALL */ goto out_baddir;
svc_printk(rqstp, "bad direction %d, dropping request\n", dir); if (!svc_process_common(rqstp, argv, resv))
serv->sv_stats->rpcbadfmt++;
goto out_drop; goto out_drop;
} return svc_send(rqstp);
/* Returns 1 for send, 0 for drop */
if (likely(svc_process_common(rqstp, argv, resv)))
return svc_send(rqstp);
out_baddir:
svc_printk(rqstp, "bad direction 0x%08x, dropping request\n",
be32_to_cpu(dir));
rqstp->rq_server->sv_stats->rpcbadfmt++;
out_drop: out_drop:
svc_drop(rqstp); svc_drop(rqstp);
return 0; return 0;
...@@ -1556,8 +1554,12 @@ bc_svc_process(struct svc_serv *serv, struct rpc_rqst *req, ...@@ -1556,8 +1554,12 @@ bc_svc_process(struct svc_serv *serv, struct rpc_rqst *req,
EXPORT_SYMBOL_GPL(bc_svc_process); EXPORT_SYMBOL_GPL(bc_svc_process);
#endif /* CONFIG_SUNRPC_BACKCHANNEL */ #endif /* CONFIG_SUNRPC_BACKCHANNEL */
/* /**
* Return (transport-specific) limit on the rpc payload. * svc_max_payload - Return transport-specific limit on the RPC payload
* @rqstp: RPC transaction context
*
* Returns the maximum number of payload bytes the current transport
* allows.
*/ */
u32 svc_max_payload(const struct svc_rqst *rqstp) u32 svc_max_payload(const struct svc_rqst *rqstp)
{ {
......
...@@ -946,6 +946,28 @@ void xdr_init_encode(struct xdr_stream *xdr, struct xdr_buf *buf, __be32 *p, ...@@ -946,6 +946,28 @@ void xdr_init_encode(struct xdr_stream *xdr, struct xdr_buf *buf, __be32 *p,
} }
EXPORT_SYMBOL_GPL(xdr_init_encode); EXPORT_SYMBOL_GPL(xdr_init_encode);
/**
* xdr_init_encode_pages - Initialize an xdr_stream for encoding into pages
* @xdr: pointer to xdr_stream struct
* @buf: pointer to XDR buffer into which to encode data
* @pages: list of pages to decode into
* @rqst: pointer to controlling rpc_rqst, for debugging
*
*/
void xdr_init_encode_pages(struct xdr_stream *xdr, struct xdr_buf *buf,
struct page **pages, struct rpc_rqst *rqst)
{
xdr_reset_scratch_buffer(xdr);
xdr->buf = buf;
xdr->page_ptr = pages;
xdr->iov = NULL;
xdr->p = page_address(*pages);
xdr->end = (void *)xdr->p + min_t(u32, buf->buflen, PAGE_SIZE);
xdr->rqst = rqst;
}
EXPORT_SYMBOL_GPL(xdr_init_encode_pages);
/** /**
* __xdr_commit_encode - Ensure all data is written to buffer * __xdr_commit_encode - Ensure all data is written to buffer
* @xdr: pointer to xdr_stream * @xdr: pointer to xdr_stream
...@@ -1575,7 +1597,7 @@ EXPORT_SYMBOL_GPL(xdr_buf_from_iov); ...@@ -1575,7 +1597,7 @@ EXPORT_SYMBOL_GPL(xdr_buf_from_iov);
* *
* @buf and @subbuf may be pointers to the same struct xdr_buf. * @buf and @subbuf may be pointers to the same struct xdr_buf.
* *
* Returns -1 if base of length are out of bounds. * Returns -1 if base or length are out of bounds.
*/ */
int xdr_buf_subsegment(const struct xdr_buf *buf, struct xdr_buf *subbuf, int xdr_buf_subsegment(const struct xdr_buf *buf, struct xdr_buf *subbuf,
unsigned int base, unsigned int len) unsigned int base, unsigned int len)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment