mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-28 14:44:10 +08:00
NFSD 6.1 Release Notes
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. -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEKLLlsBKG3yQ88j7+M2qzM29mf5cFAmM66P4ACgkQM2qzM29m f5fhMg//afS2mp4fgPz4MjoFIqD/Icep8qFEPA8Gy6I1dDGRxd9wNgjoN4JALFdr NKX1oRVISBvDrOG/C84GbYnXEDlzY8q1HmyPoJA8VAR57hnJXfPZN6CBN//Bx4mU nISPJeNGY9SMNVhS8916V/yzd41uWDQuD+H+i5mluBTJHONgSzwzc80sQ+eq+yZQ PV6mlJN6hcm14LCaDOTXF7oY2Wm6dQc2rV87YChJWnc+vdXKnme/LWTMY1ABkePD g88mSL6w3YDKEuKciWda5/QU1ETp/Q7XTjFGDKEQSnnNsvCLmUKogJTKVa2QqyLY P1qlrj6XwukqAe414W4amlLL3q4NUFmJZPNWDxdf+qtTrQrBBEFrsKy/bSt27XoD cTvBWcorMG2riSlYPViVeh8RpyC6qwhttPbvGAmflVF2KEyXpfgc5Pnn0/Xm1Ac9 XKzaCTJlUyRb/2wdqVtQbIpyh3sbhzp8zhv7sWKXgQOEXxKOO3ZAIrQXeL6oFN/b HlXDty7wKhFRj8IbkZfQ9SvN1saTONwB3clYHbCXTetkw/nnrUgLYcu8NIDBK9ou wkBcz1++XgVTqjRFwUwagb62cPJnRM6UiROYCVbQp7qcUe4/U+WP9t6dnZlnGZVZ dtipKlH/LTGKW+d7ysZOqb4hsRza5Kaduz5a7lML7UIGQXmxjM0= =hE6t -----END PGP SIGNATURE----- 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 ...
This commit is contained in:
commit
f90497a16e
@ -164,7 +164,7 @@ static struct nlm_host *nlm_alloc_host(struct nlm_lookup_host_info *ni,
|
||||
host->h_addrbuf = nsm->sm_addrbuf;
|
||||
host->net = ni->net;
|
||||
host->h_cred = get_cred(ni->cred);
|
||||
strlcpy(host->nodename, utsname()->nodename, sizeof(host->nodename));
|
||||
strscpy(host->nodename, utsname()->nodename, sizeof(host->nodename));
|
||||
|
||||
out:
|
||||
return host;
|
||||
|
@ -521,6 +521,7 @@ const struct svc_procedure nlmsvc_procedures4[24] = {
|
||||
.pc_decode = nlm4svc_decode_void,
|
||||
.pc_encode = nlm4svc_encode_void,
|
||||
.pc_argsize = sizeof(struct nlm_void),
|
||||
.pc_argzero = sizeof(struct nlm_void),
|
||||
.pc_ressize = sizeof(struct nlm_void),
|
||||
.pc_xdrressize = St,
|
||||
.pc_name = "NULL",
|
||||
@ -530,6 +531,7 @@ const struct svc_procedure nlmsvc_procedures4[24] = {
|
||||
.pc_decode = nlm4svc_decode_testargs,
|
||||
.pc_encode = nlm4svc_encode_testres,
|
||||
.pc_argsize = sizeof(struct nlm_args),
|
||||
.pc_argzero = sizeof(struct nlm_args),
|
||||
.pc_ressize = sizeof(struct nlm_res),
|
||||
.pc_xdrressize = Ck+St+2+No+Rg,
|
||||
.pc_name = "TEST",
|
||||
@ -539,6 +541,7 @@ const struct svc_procedure nlmsvc_procedures4[24] = {
|
||||
.pc_decode = nlm4svc_decode_lockargs,
|
||||
.pc_encode = nlm4svc_encode_res,
|
||||
.pc_argsize = sizeof(struct nlm_args),
|
||||
.pc_argzero = sizeof(struct nlm_args),
|
||||
.pc_ressize = sizeof(struct nlm_res),
|
||||
.pc_xdrressize = Ck+St,
|
||||
.pc_name = "LOCK",
|
||||
@ -548,6 +551,7 @@ const struct svc_procedure nlmsvc_procedures4[24] = {
|
||||
.pc_decode = nlm4svc_decode_cancargs,
|
||||
.pc_encode = nlm4svc_encode_res,
|
||||
.pc_argsize = sizeof(struct nlm_args),
|
||||
.pc_argzero = sizeof(struct nlm_args),
|
||||
.pc_ressize = sizeof(struct nlm_res),
|
||||
.pc_xdrressize = Ck+St,
|
||||
.pc_name = "CANCEL",
|
||||
@ -557,6 +561,7 @@ const struct svc_procedure nlmsvc_procedures4[24] = {
|
||||
.pc_decode = nlm4svc_decode_unlockargs,
|
||||
.pc_encode = nlm4svc_encode_res,
|
||||
.pc_argsize = sizeof(struct nlm_args),
|
||||
.pc_argzero = sizeof(struct nlm_args),
|
||||
.pc_ressize = sizeof(struct nlm_res),
|
||||
.pc_xdrressize = Ck+St,
|
||||
.pc_name = "UNLOCK",
|
||||
@ -566,6 +571,7 @@ const struct svc_procedure nlmsvc_procedures4[24] = {
|
||||
.pc_decode = nlm4svc_decode_testargs,
|
||||
.pc_encode = nlm4svc_encode_res,
|
||||
.pc_argsize = sizeof(struct nlm_args),
|
||||
.pc_argzero = sizeof(struct nlm_args),
|
||||
.pc_ressize = sizeof(struct nlm_res),
|
||||
.pc_xdrressize = Ck+St,
|
||||
.pc_name = "GRANTED",
|
||||
@ -575,6 +581,7 @@ const struct svc_procedure nlmsvc_procedures4[24] = {
|
||||
.pc_decode = nlm4svc_decode_testargs,
|
||||
.pc_encode = nlm4svc_encode_void,
|
||||
.pc_argsize = sizeof(struct nlm_args),
|
||||
.pc_argzero = sizeof(struct nlm_args),
|
||||
.pc_ressize = sizeof(struct nlm_void),
|
||||
.pc_xdrressize = St,
|
||||
.pc_name = "TEST_MSG",
|
||||
@ -584,6 +591,7 @@ const struct svc_procedure nlmsvc_procedures4[24] = {
|
||||
.pc_decode = nlm4svc_decode_lockargs,
|
||||
.pc_encode = nlm4svc_encode_void,
|
||||
.pc_argsize = sizeof(struct nlm_args),
|
||||
.pc_argzero = sizeof(struct nlm_args),
|
||||
.pc_ressize = sizeof(struct nlm_void),
|
||||
.pc_xdrressize = St,
|
||||
.pc_name = "LOCK_MSG",
|
||||
@ -593,6 +601,7 @@ const struct svc_procedure nlmsvc_procedures4[24] = {
|
||||
.pc_decode = nlm4svc_decode_cancargs,
|
||||
.pc_encode = nlm4svc_encode_void,
|
||||
.pc_argsize = sizeof(struct nlm_args),
|
||||
.pc_argzero = sizeof(struct nlm_args),
|
||||
.pc_ressize = sizeof(struct nlm_void),
|
||||
.pc_xdrressize = St,
|
||||
.pc_name = "CANCEL_MSG",
|
||||
@ -602,6 +611,7 @@ const struct svc_procedure nlmsvc_procedures4[24] = {
|
||||
.pc_decode = nlm4svc_decode_unlockargs,
|
||||
.pc_encode = nlm4svc_encode_void,
|
||||
.pc_argsize = sizeof(struct nlm_args),
|
||||
.pc_argzero = sizeof(struct nlm_args),
|
||||
.pc_ressize = sizeof(struct nlm_void),
|
||||
.pc_xdrressize = St,
|
||||
.pc_name = "UNLOCK_MSG",
|
||||
@ -611,6 +621,7 @@ const struct svc_procedure nlmsvc_procedures4[24] = {
|
||||
.pc_decode = nlm4svc_decode_testargs,
|
||||
.pc_encode = nlm4svc_encode_void,
|
||||
.pc_argsize = sizeof(struct nlm_args),
|
||||
.pc_argzero = sizeof(struct nlm_args),
|
||||
.pc_ressize = sizeof(struct nlm_void),
|
||||
.pc_xdrressize = St,
|
||||
.pc_name = "GRANTED_MSG",
|
||||
@ -620,6 +631,7 @@ const struct svc_procedure nlmsvc_procedures4[24] = {
|
||||
.pc_decode = nlm4svc_decode_void,
|
||||
.pc_encode = nlm4svc_encode_void,
|
||||
.pc_argsize = sizeof(struct nlm_res),
|
||||
.pc_argzero = sizeof(struct nlm_res),
|
||||
.pc_ressize = sizeof(struct nlm_void),
|
||||
.pc_xdrressize = St,
|
||||
.pc_name = "TEST_RES",
|
||||
@ -629,6 +641,7 @@ const struct svc_procedure nlmsvc_procedures4[24] = {
|
||||
.pc_decode = nlm4svc_decode_void,
|
||||
.pc_encode = nlm4svc_encode_void,
|
||||
.pc_argsize = sizeof(struct nlm_res),
|
||||
.pc_argzero = sizeof(struct nlm_res),
|
||||
.pc_ressize = sizeof(struct nlm_void),
|
||||
.pc_xdrressize = St,
|
||||
.pc_name = "LOCK_RES",
|
||||
@ -638,6 +651,7 @@ const struct svc_procedure nlmsvc_procedures4[24] = {
|
||||
.pc_decode = nlm4svc_decode_void,
|
||||
.pc_encode = nlm4svc_encode_void,
|
||||
.pc_argsize = sizeof(struct nlm_res),
|
||||
.pc_argzero = sizeof(struct nlm_res),
|
||||
.pc_ressize = sizeof(struct nlm_void),
|
||||
.pc_xdrressize = St,
|
||||
.pc_name = "CANCEL_RES",
|
||||
@ -647,6 +661,7 @@ const struct svc_procedure nlmsvc_procedures4[24] = {
|
||||
.pc_decode = nlm4svc_decode_void,
|
||||
.pc_encode = nlm4svc_encode_void,
|
||||
.pc_argsize = sizeof(struct nlm_res),
|
||||
.pc_argzero = sizeof(struct nlm_res),
|
||||
.pc_ressize = sizeof(struct nlm_void),
|
||||
.pc_xdrressize = St,
|
||||
.pc_name = "UNLOCK_RES",
|
||||
@ -656,6 +671,7 @@ const struct svc_procedure nlmsvc_procedures4[24] = {
|
||||
.pc_decode = nlm4svc_decode_res,
|
||||
.pc_encode = nlm4svc_encode_void,
|
||||
.pc_argsize = sizeof(struct nlm_res),
|
||||
.pc_argzero = sizeof(struct nlm_res),
|
||||
.pc_ressize = sizeof(struct nlm_void),
|
||||
.pc_xdrressize = St,
|
||||
.pc_name = "GRANTED_RES",
|
||||
@ -665,6 +681,7 @@ const struct svc_procedure nlmsvc_procedures4[24] = {
|
||||
.pc_decode = nlm4svc_decode_reboot,
|
||||
.pc_encode = nlm4svc_encode_void,
|
||||
.pc_argsize = sizeof(struct nlm_reboot),
|
||||
.pc_argzero = sizeof(struct nlm_reboot),
|
||||
.pc_ressize = sizeof(struct nlm_void),
|
||||
.pc_xdrressize = St,
|
||||
.pc_name = "SM_NOTIFY",
|
||||
@ -674,6 +691,7 @@ const struct svc_procedure nlmsvc_procedures4[24] = {
|
||||
.pc_decode = nlm4svc_decode_void,
|
||||
.pc_encode = nlm4svc_encode_void,
|
||||
.pc_argsize = sizeof(struct nlm_void),
|
||||
.pc_argzero = sizeof(struct nlm_void),
|
||||
.pc_ressize = sizeof(struct nlm_void),
|
||||
.pc_xdrressize = 0,
|
||||
.pc_name = "UNUSED",
|
||||
@ -683,6 +701,7 @@ const struct svc_procedure nlmsvc_procedures4[24] = {
|
||||
.pc_decode = nlm4svc_decode_void,
|
||||
.pc_encode = nlm4svc_encode_void,
|
||||
.pc_argsize = sizeof(struct nlm_void),
|
||||
.pc_argzero = sizeof(struct nlm_void),
|
||||
.pc_ressize = sizeof(struct nlm_void),
|
||||
.pc_xdrressize = 0,
|
||||
.pc_name = "UNUSED",
|
||||
@ -692,6 +711,7 @@ const struct svc_procedure nlmsvc_procedures4[24] = {
|
||||
.pc_decode = nlm4svc_decode_void,
|
||||
.pc_encode = nlm4svc_encode_void,
|
||||
.pc_argsize = sizeof(struct nlm_void),
|
||||
.pc_argzero = sizeof(struct nlm_void),
|
||||
.pc_ressize = sizeof(struct nlm_void),
|
||||
.pc_xdrressize = 0,
|
||||
.pc_name = "UNUSED",
|
||||
@ -701,6 +721,7 @@ const struct svc_procedure nlmsvc_procedures4[24] = {
|
||||
.pc_decode = nlm4svc_decode_shareargs,
|
||||
.pc_encode = nlm4svc_encode_shareres,
|
||||
.pc_argsize = sizeof(struct nlm_args),
|
||||
.pc_argzero = sizeof(struct nlm_args),
|
||||
.pc_ressize = sizeof(struct nlm_res),
|
||||
.pc_xdrressize = Ck+St+1,
|
||||
.pc_name = "SHARE",
|
||||
@ -710,6 +731,7 @@ const struct svc_procedure nlmsvc_procedures4[24] = {
|
||||
.pc_decode = nlm4svc_decode_shareargs,
|
||||
.pc_encode = nlm4svc_encode_shareres,
|
||||
.pc_argsize = sizeof(struct nlm_args),
|
||||
.pc_argzero = sizeof(struct nlm_args),
|
||||
.pc_ressize = sizeof(struct nlm_res),
|
||||
.pc_xdrressize = Ck+St+1,
|
||||
.pc_name = "UNSHARE",
|
||||
@ -719,6 +741,7 @@ const struct svc_procedure nlmsvc_procedures4[24] = {
|
||||
.pc_decode = nlm4svc_decode_lockargs,
|
||||
.pc_encode = nlm4svc_encode_res,
|
||||
.pc_argsize = sizeof(struct nlm_args),
|
||||
.pc_argzero = sizeof(struct nlm_args),
|
||||
.pc_ressize = sizeof(struct nlm_res),
|
||||
.pc_xdrressize = Ck+St,
|
||||
.pc_name = "NM_LOCK",
|
||||
@ -728,6 +751,7 @@ const struct svc_procedure nlmsvc_procedures4[24] = {
|
||||
.pc_decode = nlm4svc_decode_notify,
|
||||
.pc_encode = nlm4svc_encode_void,
|
||||
.pc_argsize = sizeof(struct nlm_args),
|
||||
.pc_argzero = sizeof(struct nlm_args),
|
||||
.pc_ressize = sizeof(struct nlm_void),
|
||||
.pc_xdrressize = St,
|
||||
.pc_name = "FREE_ALL",
|
||||
|
@ -555,6 +555,7 @@ const struct svc_procedure nlmsvc_procedures[24] = {
|
||||
.pc_decode = nlmsvc_decode_void,
|
||||
.pc_encode = nlmsvc_encode_void,
|
||||
.pc_argsize = sizeof(struct nlm_void),
|
||||
.pc_argzero = sizeof(struct nlm_void),
|
||||
.pc_ressize = sizeof(struct nlm_void),
|
||||
.pc_xdrressize = St,
|
||||
.pc_name = "NULL",
|
||||
@ -564,6 +565,7 @@ const struct svc_procedure nlmsvc_procedures[24] = {
|
||||
.pc_decode = nlmsvc_decode_testargs,
|
||||
.pc_encode = nlmsvc_encode_testres,
|
||||
.pc_argsize = sizeof(struct nlm_args),
|
||||
.pc_argzero = sizeof(struct nlm_args),
|
||||
.pc_ressize = sizeof(struct nlm_res),
|
||||
.pc_xdrressize = Ck+St+2+No+Rg,
|
||||
.pc_name = "TEST",
|
||||
@ -573,6 +575,7 @@ const struct svc_procedure nlmsvc_procedures[24] = {
|
||||
.pc_decode = nlmsvc_decode_lockargs,
|
||||
.pc_encode = nlmsvc_encode_res,
|
||||
.pc_argsize = sizeof(struct nlm_args),
|
||||
.pc_argzero = sizeof(struct nlm_args),
|
||||
.pc_ressize = sizeof(struct nlm_res),
|
||||
.pc_xdrressize = Ck+St,
|
||||
.pc_name = "LOCK",
|
||||
@ -582,6 +585,7 @@ const struct svc_procedure nlmsvc_procedures[24] = {
|
||||
.pc_decode = nlmsvc_decode_cancargs,
|
||||
.pc_encode = nlmsvc_encode_res,
|
||||
.pc_argsize = sizeof(struct nlm_args),
|
||||
.pc_argzero = sizeof(struct nlm_args),
|
||||
.pc_ressize = sizeof(struct nlm_res),
|
||||
.pc_xdrressize = Ck+St,
|
||||
.pc_name = "CANCEL",
|
||||
@ -591,6 +595,7 @@ const struct svc_procedure nlmsvc_procedures[24] = {
|
||||
.pc_decode = nlmsvc_decode_unlockargs,
|
||||
.pc_encode = nlmsvc_encode_res,
|
||||
.pc_argsize = sizeof(struct nlm_args),
|
||||
.pc_argzero = sizeof(struct nlm_args),
|
||||
.pc_ressize = sizeof(struct nlm_res),
|
||||
.pc_xdrressize = Ck+St,
|
||||
.pc_name = "UNLOCK",
|
||||
@ -600,6 +605,7 @@ const struct svc_procedure nlmsvc_procedures[24] = {
|
||||
.pc_decode = nlmsvc_decode_testargs,
|
||||
.pc_encode = nlmsvc_encode_res,
|
||||
.pc_argsize = sizeof(struct nlm_args),
|
||||
.pc_argzero = sizeof(struct nlm_args),
|
||||
.pc_ressize = sizeof(struct nlm_res),
|
||||
.pc_xdrressize = Ck+St,
|
||||
.pc_name = "GRANTED",
|
||||
@ -609,6 +615,7 @@ const struct svc_procedure nlmsvc_procedures[24] = {
|
||||
.pc_decode = nlmsvc_decode_testargs,
|
||||
.pc_encode = nlmsvc_encode_void,
|
||||
.pc_argsize = sizeof(struct nlm_args),
|
||||
.pc_argzero = sizeof(struct nlm_args),
|
||||
.pc_ressize = sizeof(struct nlm_void),
|
||||
.pc_xdrressize = St,
|
||||
.pc_name = "TEST_MSG",
|
||||
@ -618,6 +625,7 @@ const struct svc_procedure nlmsvc_procedures[24] = {
|
||||
.pc_decode = nlmsvc_decode_lockargs,
|
||||
.pc_encode = nlmsvc_encode_void,
|
||||
.pc_argsize = sizeof(struct nlm_args),
|
||||
.pc_argzero = sizeof(struct nlm_args),
|
||||
.pc_ressize = sizeof(struct nlm_void),
|
||||
.pc_xdrressize = St,
|
||||
.pc_name = "LOCK_MSG",
|
||||
@ -627,6 +635,7 @@ const struct svc_procedure nlmsvc_procedures[24] = {
|
||||
.pc_decode = nlmsvc_decode_cancargs,
|
||||
.pc_encode = nlmsvc_encode_void,
|
||||
.pc_argsize = sizeof(struct nlm_args),
|
||||
.pc_argzero = sizeof(struct nlm_args),
|
||||
.pc_ressize = sizeof(struct nlm_void),
|
||||
.pc_xdrressize = St,
|
||||
.pc_name = "CANCEL_MSG",
|
||||
@ -636,6 +645,7 @@ const struct svc_procedure nlmsvc_procedures[24] = {
|
||||
.pc_decode = nlmsvc_decode_unlockargs,
|
||||
.pc_encode = nlmsvc_encode_void,
|
||||
.pc_argsize = sizeof(struct nlm_args),
|
||||
.pc_argzero = sizeof(struct nlm_args),
|
||||
.pc_ressize = sizeof(struct nlm_void),
|
||||
.pc_xdrressize = St,
|
||||
.pc_name = "UNLOCK_MSG",
|
||||
@ -645,6 +655,7 @@ const struct svc_procedure nlmsvc_procedures[24] = {
|
||||
.pc_decode = nlmsvc_decode_testargs,
|
||||
.pc_encode = nlmsvc_encode_void,
|
||||
.pc_argsize = sizeof(struct nlm_args),
|
||||
.pc_argzero = sizeof(struct nlm_args),
|
||||
.pc_ressize = sizeof(struct nlm_void),
|
||||
.pc_xdrressize = St,
|
||||
.pc_name = "GRANTED_MSG",
|
||||
@ -654,6 +665,7 @@ const struct svc_procedure nlmsvc_procedures[24] = {
|
||||
.pc_decode = nlmsvc_decode_void,
|
||||
.pc_encode = nlmsvc_encode_void,
|
||||
.pc_argsize = sizeof(struct nlm_res),
|
||||
.pc_argzero = sizeof(struct nlm_res),
|
||||
.pc_ressize = sizeof(struct nlm_void),
|
||||
.pc_xdrressize = St,
|
||||
.pc_name = "TEST_RES",
|
||||
@ -663,6 +675,7 @@ const struct svc_procedure nlmsvc_procedures[24] = {
|
||||
.pc_decode = nlmsvc_decode_void,
|
||||
.pc_encode = nlmsvc_encode_void,
|
||||
.pc_argsize = sizeof(struct nlm_res),
|
||||
.pc_argzero = sizeof(struct nlm_res),
|
||||
.pc_ressize = sizeof(struct nlm_void),
|
||||
.pc_xdrressize = St,
|
||||
.pc_name = "LOCK_RES",
|
||||
@ -672,6 +685,7 @@ const struct svc_procedure nlmsvc_procedures[24] = {
|
||||
.pc_decode = nlmsvc_decode_void,
|
||||
.pc_encode = nlmsvc_encode_void,
|
||||
.pc_argsize = sizeof(struct nlm_res),
|
||||
.pc_argzero = sizeof(struct nlm_res),
|
||||
.pc_ressize = sizeof(struct nlm_void),
|
||||
.pc_xdrressize = St,
|
||||
.pc_name = "CANCEL_RES",
|
||||
@ -681,6 +695,7 @@ const struct svc_procedure nlmsvc_procedures[24] = {
|
||||
.pc_decode = nlmsvc_decode_void,
|
||||
.pc_encode = nlmsvc_encode_void,
|
||||
.pc_argsize = sizeof(struct nlm_res),
|
||||
.pc_argzero = sizeof(struct nlm_res),
|
||||
.pc_ressize = sizeof(struct nlm_void),
|
||||
.pc_xdrressize = St,
|
||||
.pc_name = "UNLOCK_RES",
|
||||
@ -690,6 +705,7 @@ const struct svc_procedure nlmsvc_procedures[24] = {
|
||||
.pc_decode = nlmsvc_decode_res,
|
||||
.pc_encode = nlmsvc_encode_void,
|
||||
.pc_argsize = sizeof(struct nlm_res),
|
||||
.pc_argzero = sizeof(struct nlm_res),
|
||||
.pc_ressize = sizeof(struct nlm_void),
|
||||
.pc_xdrressize = St,
|
||||
.pc_name = "GRANTED_RES",
|
||||
@ -699,6 +715,7 @@ const struct svc_procedure nlmsvc_procedures[24] = {
|
||||
.pc_decode = nlmsvc_decode_reboot,
|
||||
.pc_encode = nlmsvc_encode_void,
|
||||
.pc_argsize = sizeof(struct nlm_reboot),
|
||||
.pc_argzero = sizeof(struct nlm_reboot),
|
||||
.pc_ressize = sizeof(struct nlm_void),
|
||||
.pc_xdrressize = St,
|
||||
.pc_name = "SM_NOTIFY",
|
||||
@ -708,6 +725,7 @@ const struct svc_procedure nlmsvc_procedures[24] = {
|
||||
.pc_decode = nlmsvc_decode_void,
|
||||
.pc_encode = nlmsvc_encode_void,
|
||||
.pc_argsize = sizeof(struct nlm_void),
|
||||
.pc_argzero = sizeof(struct nlm_void),
|
||||
.pc_ressize = sizeof(struct nlm_void),
|
||||
.pc_xdrressize = St,
|
||||
.pc_name = "UNUSED",
|
||||
@ -717,6 +735,7 @@ const struct svc_procedure nlmsvc_procedures[24] = {
|
||||
.pc_decode = nlmsvc_decode_void,
|
||||
.pc_encode = nlmsvc_encode_void,
|
||||
.pc_argsize = sizeof(struct nlm_void),
|
||||
.pc_argzero = sizeof(struct nlm_void),
|
||||
.pc_ressize = sizeof(struct nlm_void),
|
||||
.pc_xdrressize = St,
|
||||
.pc_name = "UNUSED",
|
||||
@ -726,6 +745,7 @@ const struct svc_procedure nlmsvc_procedures[24] = {
|
||||
.pc_decode = nlmsvc_decode_void,
|
||||
.pc_encode = nlmsvc_encode_void,
|
||||
.pc_argsize = sizeof(struct nlm_void),
|
||||
.pc_argzero = sizeof(struct nlm_void),
|
||||
.pc_ressize = sizeof(struct nlm_void),
|
||||
.pc_xdrressize = St,
|
||||
.pc_name = "UNUSED",
|
||||
@ -735,6 +755,7 @@ const struct svc_procedure nlmsvc_procedures[24] = {
|
||||
.pc_decode = nlmsvc_decode_shareargs,
|
||||
.pc_encode = nlmsvc_encode_shareres,
|
||||
.pc_argsize = sizeof(struct nlm_args),
|
||||
.pc_argzero = sizeof(struct nlm_args),
|
||||
.pc_ressize = sizeof(struct nlm_res),
|
||||
.pc_xdrressize = Ck+St+1,
|
||||
.pc_name = "SHARE",
|
||||
@ -744,6 +765,7 @@ const struct svc_procedure nlmsvc_procedures[24] = {
|
||||
.pc_decode = nlmsvc_decode_shareargs,
|
||||
.pc_encode = nlmsvc_encode_shareres,
|
||||
.pc_argsize = sizeof(struct nlm_args),
|
||||
.pc_argzero = sizeof(struct nlm_args),
|
||||
.pc_ressize = sizeof(struct nlm_res),
|
||||
.pc_xdrressize = Ck+St+1,
|
||||
.pc_name = "UNSHARE",
|
||||
@ -753,6 +775,7 @@ const struct svc_procedure nlmsvc_procedures[24] = {
|
||||
.pc_decode = nlmsvc_decode_lockargs,
|
||||
.pc_encode = nlmsvc_encode_res,
|
||||
.pc_argsize = sizeof(struct nlm_args),
|
||||
.pc_argzero = sizeof(struct nlm_args),
|
||||
.pc_ressize = sizeof(struct nlm_res),
|
||||
.pc_xdrressize = Ck+St,
|
||||
.pc_name = "NM_LOCK",
|
||||
@ -762,6 +785,7 @@ const struct svc_procedure nlmsvc_procedures[24] = {
|
||||
.pc_decode = nlmsvc_decode_notify,
|
||||
.pc_encode = nlmsvc_encode_void,
|
||||
.pc_argsize = sizeof(struct nlm_args),
|
||||
.pc_argzero = sizeof(struct nlm_args),
|
||||
.pc_ressize = sizeof(struct nlm_void),
|
||||
.pc_xdrressize = 0,
|
||||
.pc_name = "FREE_ALL",
|
||||
|
@ -1065,6 +1065,7 @@ static const struct svc_procedure nfs4_callback_procedures1[] = {
|
||||
.pc_func = nfs4_callback_compound,
|
||||
.pc_encode = nfs4_encode_void,
|
||||
.pc_argsize = 256,
|
||||
.pc_argzero = 256,
|
||||
.pc_ressize = 256,
|
||||
.pc_xdrressize = NFS4_CALLBACK_BUFSIZE,
|
||||
.pc_name = "COMPOUND",
|
||||
|
@ -84,6 +84,6 @@ int nfsd_reply_cache_init(struct nfsd_net *);
|
||||
void nfsd_reply_cache_shutdown(struct nfsd_net *);
|
||||
int nfsd_cache_lookup(struct svc_rqst *);
|
||||
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 */
|
||||
|
@ -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
|
||||
* 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 hits = 0, acquisitions = 0;
|
||||
@ -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);
|
||||
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,
|
||||
unsigned int may_flags, struct nfsd_file **nfp);
|
||||
__be32 nfsd_file_create(struct svc_rqst *rqstp, struct svc_fh *fhp,
|
||||
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 */
|
||||
|
@ -192,6 +192,10 @@ struct nfsd_net {
|
||||
|
||||
atomic_t nfs4_client_count;
|
||||
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 */
|
||||
|
@ -331,6 +331,7 @@ static const struct svc_procedure nfsd_acl_procedures2[5] = {
|
||||
.pc_decode = nfssvc_decode_voidarg,
|
||||
.pc_encode = nfssvc_encode_voidres,
|
||||
.pc_argsize = sizeof(struct nfsd_voidargs),
|
||||
.pc_argzero = sizeof(struct nfsd_voidargs),
|
||||
.pc_ressize = sizeof(struct nfsd_voidres),
|
||||
.pc_cachetype = RC_NOCACHE,
|
||||
.pc_xdrressize = ST,
|
||||
@ -342,6 +343,7 @@ static const struct svc_procedure nfsd_acl_procedures2[5] = {
|
||||
.pc_encode = nfsaclsvc_encode_getaclres,
|
||||
.pc_release = nfsaclsvc_release_getacl,
|
||||
.pc_argsize = sizeof(struct nfsd3_getaclargs),
|
||||
.pc_argzero = sizeof(struct nfsd3_getaclargs),
|
||||
.pc_ressize = sizeof(struct nfsd3_getaclres),
|
||||
.pc_cachetype = RC_NOCACHE,
|
||||
.pc_xdrressize = ST+1+2*(1+ACL),
|
||||
@ -353,6 +355,7 @@ static const struct svc_procedure nfsd_acl_procedures2[5] = {
|
||||
.pc_encode = nfssvc_encode_attrstatres,
|
||||
.pc_release = nfssvc_release_attrstat,
|
||||
.pc_argsize = sizeof(struct nfsd3_setaclargs),
|
||||
.pc_argzero = sizeof(struct nfsd3_setaclargs),
|
||||
.pc_ressize = sizeof(struct nfsd_attrstat),
|
||||
.pc_cachetype = RC_NOCACHE,
|
||||
.pc_xdrressize = ST+AT,
|
||||
@ -364,6 +367,7 @@ static const struct svc_procedure nfsd_acl_procedures2[5] = {
|
||||
.pc_encode = nfssvc_encode_attrstatres,
|
||||
.pc_release = nfssvc_release_attrstat,
|
||||
.pc_argsize = sizeof(struct nfsd_fhandle),
|
||||
.pc_argzero = sizeof(struct nfsd_fhandle),
|
||||
.pc_ressize = sizeof(struct nfsd_attrstat),
|
||||
.pc_cachetype = RC_NOCACHE,
|
||||
.pc_xdrressize = ST+AT,
|
||||
@ -375,6 +379,7 @@ static const struct svc_procedure nfsd_acl_procedures2[5] = {
|
||||
.pc_encode = nfsaclsvc_encode_accessres,
|
||||
.pc_release = nfsaclsvc_release_access,
|
||||
.pc_argsize = sizeof(struct nfsd3_accessargs),
|
||||
.pc_argzero = sizeof(struct nfsd3_accessargs),
|
||||
.pc_ressize = sizeof(struct nfsd3_accessres),
|
||||
.pc_cachetype = RC_NOCACHE,
|
||||
.pc_xdrressize = ST+AT+1,
|
||||
|
@ -252,6 +252,7 @@ static const struct svc_procedure nfsd_acl_procedures3[3] = {
|
||||
.pc_decode = nfssvc_decode_voidarg,
|
||||
.pc_encode = nfssvc_encode_voidres,
|
||||
.pc_argsize = sizeof(struct nfsd_voidargs),
|
||||
.pc_argzero = sizeof(struct nfsd_voidargs),
|
||||
.pc_ressize = sizeof(struct nfsd_voidres),
|
||||
.pc_cachetype = RC_NOCACHE,
|
||||
.pc_xdrressize = ST,
|
||||
@ -263,6 +264,7 @@ static const struct svc_procedure nfsd_acl_procedures3[3] = {
|
||||
.pc_encode = nfs3svc_encode_getaclres,
|
||||
.pc_release = nfs3svc_release_getacl,
|
||||
.pc_argsize = sizeof(struct nfsd3_getaclargs),
|
||||
.pc_argzero = sizeof(struct nfsd3_getaclargs),
|
||||
.pc_ressize = sizeof(struct nfsd3_getaclres),
|
||||
.pc_cachetype = RC_NOCACHE,
|
||||
.pc_xdrressize = ST+1+2*(1+ACL),
|
||||
@ -274,6 +276,7 @@ static const struct svc_procedure nfsd_acl_procedures3[3] = {
|
||||
.pc_encode = nfs3svc_encode_setaclres,
|
||||
.pc_release = nfs3svc_release_fhandle,
|
||||
.pc_argsize = sizeof(struct nfsd3_setaclargs),
|
||||
.pc_argzero = sizeof(struct nfsd3_setaclargs),
|
||||
.pc_ressize = sizeof(struct nfsd3_attrstat),
|
||||
.pc_cachetype = RC_NOCACHE,
|
||||
.pc_xdrressize = ST+pAT,
|
||||
|
@ -150,7 +150,6 @@ nfsd3_proc_read(struct svc_rqst *rqstp)
|
||||
{
|
||||
struct nfsd3_readargs *argp = rqstp->rq_argp;
|
||||
struct nfsd3_readres *resp = rqstp->rq_resp;
|
||||
u32 max_blocksize = svc_max_payload(rqstp);
|
||||
unsigned int len;
|
||||
int v;
|
||||
|
||||
@ -159,7 +158,8 @@ nfsd3_proc_read(struct svc_rqst *rqstp)
|
||||
(unsigned long) argp->count,
|
||||
(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)
|
||||
argp->offset = (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,
|
||||
{
|
||||
struct xdr_buf *buf = &resp->dirlist;
|
||||
struct xdr_stream *xdr = &resp->xdr;
|
||||
|
||||
count = clamp(count, (u32)(XDR_UNIT * 2), svc_max_payload(rqstp));
|
||||
unsigned int sendbuf = min_t(unsigned int, rqstp->rq_res.buflen,
|
||||
svc_max_payload(rqstp));
|
||||
|
||||
memset(buf, 0, sizeof(*buf));
|
||||
|
||||
/* 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;
|
||||
rqstp->rq_next_page += (buf->buflen + PAGE_SIZE - 1) >> PAGE_SHIFT;
|
||||
|
||||
/* This is xdr_init_encode(), but it assumes that
|
||||
* 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;
|
||||
xdr_init_encode_pages(xdr, buf, buf->pages, NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -808,6 +801,7 @@ static const struct svc_procedure nfsd_procedures3[22] = {
|
||||
.pc_decode = nfssvc_decode_voidarg,
|
||||
.pc_encode = nfssvc_encode_voidres,
|
||||
.pc_argsize = sizeof(struct nfsd_voidargs),
|
||||
.pc_argzero = sizeof(struct nfsd_voidargs),
|
||||
.pc_ressize = sizeof(struct nfsd_voidres),
|
||||
.pc_cachetype = RC_NOCACHE,
|
||||
.pc_xdrressize = ST,
|
||||
@ -819,6 +813,7 @@ static const struct svc_procedure nfsd_procedures3[22] = {
|
||||
.pc_encode = nfs3svc_encode_getattrres,
|
||||
.pc_release = nfs3svc_release_fhandle,
|
||||
.pc_argsize = sizeof(struct nfsd_fhandle),
|
||||
.pc_argzero = sizeof(struct nfsd_fhandle),
|
||||
.pc_ressize = sizeof(struct nfsd3_attrstatres),
|
||||
.pc_cachetype = RC_NOCACHE,
|
||||
.pc_xdrressize = ST+AT,
|
||||
@ -830,6 +825,7 @@ static const struct svc_procedure nfsd_procedures3[22] = {
|
||||
.pc_encode = nfs3svc_encode_wccstatres,
|
||||
.pc_release = nfs3svc_release_fhandle,
|
||||
.pc_argsize = sizeof(struct nfsd3_sattrargs),
|
||||
.pc_argzero = sizeof(struct nfsd3_sattrargs),
|
||||
.pc_ressize = sizeof(struct nfsd3_wccstatres),
|
||||
.pc_cachetype = RC_REPLBUFF,
|
||||
.pc_xdrressize = ST+WC,
|
||||
@ -841,6 +837,7 @@ static const struct svc_procedure nfsd_procedures3[22] = {
|
||||
.pc_encode = nfs3svc_encode_lookupres,
|
||||
.pc_release = nfs3svc_release_fhandle2,
|
||||
.pc_argsize = sizeof(struct nfsd3_diropargs),
|
||||
.pc_argzero = sizeof(struct nfsd3_diropargs),
|
||||
.pc_ressize = sizeof(struct nfsd3_diropres),
|
||||
.pc_cachetype = RC_NOCACHE,
|
||||
.pc_xdrressize = ST+FH+pAT+pAT,
|
||||
@ -852,6 +849,7 @@ static const struct svc_procedure nfsd_procedures3[22] = {
|
||||
.pc_encode = nfs3svc_encode_accessres,
|
||||
.pc_release = nfs3svc_release_fhandle,
|
||||
.pc_argsize = sizeof(struct nfsd3_accessargs),
|
||||
.pc_argzero = sizeof(struct nfsd3_accessargs),
|
||||
.pc_ressize = sizeof(struct nfsd3_accessres),
|
||||
.pc_cachetype = RC_NOCACHE,
|
||||
.pc_xdrressize = ST+pAT+1,
|
||||
@ -863,6 +861,7 @@ static const struct svc_procedure nfsd_procedures3[22] = {
|
||||
.pc_encode = nfs3svc_encode_readlinkres,
|
||||
.pc_release = nfs3svc_release_fhandle,
|
||||
.pc_argsize = sizeof(struct nfsd_fhandle),
|
||||
.pc_argzero = sizeof(struct nfsd_fhandle),
|
||||
.pc_ressize = sizeof(struct nfsd3_readlinkres),
|
||||
.pc_cachetype = RC_NOCACHE,
|
||||
.pc_xdrressize = ST+pAT+1+NFS3_MAXPATHLEN/4,
|
||||
@ -874,6 +873,7 @@ static const struct svc_procedure nfsd_procedures3[22] = {
|
||||
.pc_encode = nfs3svc_encode_readres,
|
||||
.pc_release = nfs3svc_release_fhandle,
|
||||
.pc_argsize = sizeof(struct nfsd3_readargs),
|
||||
.pc_argzero = sizeof(struct nfsd3_readargs),
|
||||
.pc_ressize = sizeof(struct nfsd3_readres),
|
||||
.pc_cachetype = RC_NOCACHE,
|
||||
.pc_xdrressize = ST+pAT+4+NFSSVC_MAXBLKSIZE/4,
|
||||
@ -885,6 +885,7 @@ static const struct svc_procedure nfsd_procedures3[22] = {
|
||||
.pc_encode = nfs3svc_encode_writeres,
|
||||
.pc_release = nfs3svc_release_fhandle,
|
||||
.pc_argsize = sizeof(struct nfsd3_writeargs),
|
||||
.pc_argzero = sizeof(struct nfsd3_writeargs),
|
||||
.pc_ressize = sizeof(struct nfsd3_writeres),
|
||||
.pc_cachetype = RC_REPLBUFF,
|
||||
.pc_xdrressize = ST+WC+4,
|
||||
@ -896,6 +897,7 @@ static const struct svc_procedure nfsd_procedures3[22] = {
|
||||
.pc_encode = nfs3svc_encode_createres,
|
||||
.pc_release = nfs3svc_release_fhandle2,
|
||||
.pc_argsize = sizeof(struct nfsd3_createargs),
|
||||
.pc_argzero = sizeof(struct nfsd3_createargs),
|
||||
.pc_ressize = sizeof(struct nfsd3_createres),
|
||||
.pc_cachetype = RC_REPLBUFF,
|
||||
.pc_xdrressize = ST+(1+FH+pAT)+WC,
|
||||
@ -907,6 +909,7 @@ static const struct svc_procedure nfsd_procedures3[22] = {
|
||||
.pc_encode = nfs3svc_encode_createres,
|
||||
.pc_release = nfs3svc_release_fhandle2,
|
||||
.pc_argsize = sizeof(struct nfsd3_mkdirargs),
|
||||
.pc_argzero = sizeof(struct nfsd3_mkdirargs),
|
||||
.pc_ressize = sizeof(struct nfsd3_createres),
|
||||
.pc_cachetype = RC_REPLBUFF,
|
||||
.pc_xdrressize = ST+(1+FH+pAT)+WC,
|
||||
@ -918,6 +921,7 @@ static const struct svc_procedure nfsd_procedures3[22] = {
|
||||
.pc_encode = nfs3svc_encode_createres,
|
||||
.pc_release = nfs3svc_release_fhandle2,
|
||||
.pc_argsize = sizeof(struct nfsd3_symlinkargs),
|
||||
.pc_argzero = sizeof(struct nfsd3_symlinkargs),
|
||||
.pc_ressize = sizeof(struct nfsd3_createres),
|
||||
.pc_cachetype = RC_REPLBUFF,
|
||||
.pc_xdrressize = ST+(1+FH+pAT)+WC,
|
||||
@ -929,6 +933,7 @@ static const struct svc_procedure nfsd_procedures3[22] = {
|
||||
.pc_encode = nfs3svc_encode_createres,
|
||||
.pc_release = nfs3svc_release_fhandle2,
|
||||
.pc_argsize = sizeof(struct nfsd3_mknodargs),
|
||||
.pc_argzero = sizeof(struct nfsd3_mknodargs),
|
||||
.pc_ressize = sizeof(struct nfsd3_createres),
|
||||
.pc_cachetype = RC_REPLBUFF,
|
||||
.pc_xdrressize = ST+(1+FH+pAT)+WC,
|
||||
@ -940,6 +945,7 @@ static const struct svc_procedure nfsd_procedures3[22] = {
|
||||
.pc_encode = nfs3svc_encode_wccstatres,
|
||||
.pc_release = nfs3svc_release_fhandle,
|
||||
.pc_argsize = sizeof(struct nfsd3_diropargs),
|
||||
.pc_argzero = sizeof(struct nfsd3_diropargs),
|
||||
.pc_ressize = sizeof(struct nfsd3_wccstatres),
|
||||
.pc_cachetype = RC_REPLBUFF,
|
||||
.pc_xdrressize = ST+WC,
|
||||
@ -951,6 +957,7 @@ static const struct svc_procedure nfsd_procedures3[22] = {
|
||||
.pc_encode = nfs3svc_encode_wccstatres,
|
||||
.pc_release = nfs3svc_release_fhandle,
|
||||
.pc_argsize = sizeof(struct nfsd3_diropargs),
|
||||
.pc_argzero = sizeof(struct nfsd3_diropargs),
|
||||
.pc_ressize = sizeof(struct nfsd3_wccstatres),
|
||||
.pc_cachetype = RC_REPLBUFF,
|
||||
.pc_xdrressize = ST+WC,
|
||||
@ -962,6 +969,7 @@ static const struct svc_procedure nfsd_procedures3[22] = {
|
||||
.pc_encode = nfs3svc_encode_renameres,
|
||||
.pc_release = nfs3svc_release_fhandle2,
|
||||
.pc_argsize = sizeof(struct nfsd3_renameargs),
|
||||
.pc_argzero = sizeof(struct nfsd3_renameargs),
|
||||
.pc_ressize = sizeof(struct nfsd3_renameres),
|
||||
.pc_cachetype = RC_REPLBUFF,
|
||||
.pc_xdrressize = ST+WC+WC,
|
||||
@ -973,6 +981,7 @@ static const struct svc_procedure nfsd_procedures3[22] = {
|
||||
.pc_encode = nfs3svc_encode_linkres,
|
||||
.pc_release = nfs3svc_release_fhandle2,
|
||||
.pc_argsize = sizeof(struct nfsd3_linkargs),
|
||||
.pc_argzero = sizeof(struct nfsd3_linkargs),
|
||||
.pc_ressize = sizeof(struct nfsd3_linkres),
|
||||
.pc_cachetype = RC_REPLBUFF,
|
||||
.pc_xdrressize = ST+pAT+WC,
|
||||
@ -984,6 +993,7 @@ static const struct svc_procedure nfsd_procedures3[22] = {
|
||||
.pc_encode = nfs3svc_encode_readdirres,
|
||||
.pc_release = nfs3svc_release_fhandle,
|
||||
.pc_argsize = sizeof(struct nfsd3_readdirargs),
|
||||
.pc_argzero = sizeof(struct nfsd3_readdirargs),
|
||||
.pc_ressize = sizeof(struct nfsd3_readdirres),
|
||||
.pc_cachetype = RC_NOCACHE,
|
||||
.pc_name = "READDIR",
|
||||
@ -994,6 +1004,7 @@ static const struct svc_procedure nfsd_procedures3[22] = {
|
||||
.pc_encode = nfs3svc_encode_readdirres,
|
||||
.pc_release = nfs3svc_release_fhandle,
|
||||
.pc_argsize = sizeof(struct nfsd3_readdirplusargs),
|
||||
.pc_argzero = sizeof(struct nfsd3_readdirplusargs),
|
||||
.pc_ressize = sizeof(struct nfsd3_readdirres),
|
||||
.pc_cachetype = RC_NOCACHE,
|
||||
.pc_name = "READDIRPLUS",
|
||||
@ -1003,6 +1014,7 @@ static const struct svc_procedure nfsd_procedures3[22] = {
|
||||
.pc_decode = nfs3svc_decode_fhandleargs,
|
||||
.pc_encode = nfs3svc_encode_fsstatres,
|
||||
.pc_argsize = sizeof(struct nfsd3_fhandleargs),
|
||||
.pc_argzero = sizeof(struct nfsd3_fhandleargs),
|
||||
.pc_ressize = sizeof(struct nfsd3_fsstatres),
|
||||
.pc_cachetype = RC_NOCACHE,
|
||||
.pc_xdrressize = ST+pAT+2*6+1,
|
||||
@ -1013,6 +1025,7 @@ static const struct svc_procedure nfsd_procedures3[22] = {
|
||||
.pc_decode = nfs3svc_decode_fhandleargs,
|
||||
.pc_encode = nfs3svc_encode_fsinfores,
|
||||
.pc_argsize = sizeof(struct nfsd3_fhandleargs),
|
||||
.pc_argzero = sizeof(struct nfsd3_fhandleargs),
|
||||
.pc_ressize = sizeof(struct nfsd3_fsinfores),
|
||||
.pc_cachetype = RC_NOCACHE,
|
||||
.pc_xdrressize = ST+pAT+12,
|
||||
@ -1023,6 +1036,7 @@ static const struct svc_procedure nfsd_procedures3[22] = {
|
||||
.pc_decode = nfs3svc_decode_fhandleargs,
|
||||
.pc_encode = nfs3svc_encode_pathconfres,
|
||||
.pc_argsize = sizeof(struct nfsd3_fhandleargs),
|
||||
.pc_argzero = sizeof(struct nfsd3_fhandleargs),
|
||||
.pc_ressize = sizeof(struct nfsd3_pathconfres),
|
||||
.pc_cachetype = RC_NOCACHE,
|
||||
.pc_xdrressize = ST+pAT+6,
|
||||
@ -1034,6 +1048,7 @@ static const struct svc_procedure nfsd_procedures3[22] = {
|
||||
.pc_encode = nfs3svc_encode_commitres,
|
||||
.pc_release = nfs3svc_release_fhandle,
|
||||
.pc_argsize = sizeof(struct nfsd3_commitargs),
|
||||
.pc_argzero = sizeof(struct nfsd3_commitargs),
|
||||
.pc_ressize = sizeof(struct nfsd3_commitres),
|
||||
.pc_cachetype = RC_NOCACHE,
|
||||
.pc_xdrressize = ST+WC+2,
|
||||
|
@ -571,10 +571,8 @@ nfs3svc_decode_writeargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
||||
args->count = 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
|
||||
@ -616,8 +614,6 @@ nfs3svc_decode_symlinkargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
||||
{
|
||||
struct nfsd3_symlinkargs *args = rqstp->rq_argp;
|
||||
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))
|
||||
return false;
|
||||
@ -626,16 +622,10 @@ nfs3svc_decode_symlinkargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
||||
if (xdr_stream_decode_u32(xdr, &args->tlen) < 0)
|
||||
return false;
|
||||
|
||||
/* request sanity */
|
||||
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;
|
||||
/* symlink_data */
|
||||
args->first.iov_len = head->iov_len - xdr_stream_pos(xdr);
|
||||
|
||||
return true;
|
||||
args->first.iov_base = xdr_inline_decode(xdr, args->tlen);
|
||||
return args->first.iov_base != NULL;
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -1371,11 +1371,21 @@ void nfsd4_init_cb(struct nfsd4_callback *cb, struct nfs4_client *clp,
|
||||
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;
|
||||
bool queued;
|
||||
|
||||
nfsd41_cb_inflight_begin(clp);
|
||||
if (!nfsd4_queue_cb(cb))
|
||||
queued = nfsd4_queue_cb(cb);
|
||||
if (!queued)
|
||||
nfsd41_cb_inflight_end(clp);
|
||||
return queued;
|
||||
}
|
||||
|
@ -82,8 +82,8 @@ ent_init(struct cache_head *cnew, struct cache_head *citm)
|
||||
new->id = itm->id;
|
||||
new->type = itm->type;
|
||||
|
||||
strlcpy(new->name, itm->name, sizeof(new->name));
|
||||
strlcpy(new->authname, itm->authname, sizeof(new->authname));
|
||||
strscpy(new->name, itm->name, sizeof(new->name));
|
||||
strscpy(new->authname, itm->authname, sizeof(new->authname));
|
||||
}
|
||||
|
||||
static void
|
||||
@ -548,7 +548,7 @@ idmap_name_to_id(struct svc_rqst *rqstp, int type, const char *name, u32 namelen
|
||||
return nfserr_badowner;
|
||||
memcpy(key.name, name, namelen);
|
||||
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);
|
||||
if (ret == -ENOENT)
|
||||
return nfserr_badowner;
|
||||
@ -584,7 +584,7 @@ static __be32 idmap_id_to_name(struct xdr_stream *xdr,
|
||||
int ret;
|
||||
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);
|
||||
if (ret == -ENOENT)
|
||||
return encode_ascii_id(xdr, id);
|
||||
|
@ -658,7 +658,7 @@ nfsd4_cb_layout_done(struct nfsd4_callback *cb, struct rpc_task *task)
|
||||
ktime_t now, cutoff;
|
||||
const struct nfsd4_layout_ops *ops;
|
||||
|
||||
|
||||
trace_nfsd_cb_layout_done(&ls->ls_stid.sc_stateid, task);
|
||||
switch (task->tk_status) {
|
||||
case 0:
|
||||
case -NFS4ERR_DELAY:
|
||||
|
@ -141,7 +141,6 @@ fh_dup2(struct svc_fh *dst, struct svc_fh *src)
|
||||
static __be32
|
||||
do_open_permission(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open *open, int accmode)
|
||||
{
|
||||
__be32 status;
|
||||
|
||||
if (open->op_truncate &&
|
||||
!(open->op_share_access & NFS4_SHARE_ACCESS_WRITE))
|
||||
@ -156,9 +155,7 @@ do_open_permission(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfs
|
||||
if (open->op_share_deny & NFS4_SHARE_DENY_READ)
|
||||
accmode |= NFSD_MAY_WRITE;
|
||||
|
||||
status = fh_verify(rqstp, current_fh, S_IFREG, accmode);
|
||||
|
||||
return status;
|
||||
return fh_verify(rqstp, current_fh, S_IFREG, accmode);
|
||||
}
|
||||
|
||||
static __be32 nfsd_check_obj_isreg(struct svc_fh *fh)
|
||||
@ -454,7 +451,6 @@ static __be32
|
||||
do_open_fhandle(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, struct nfsd4_open *open)
|
||||
{
|
||||
struct svc_fh *current_fh = &cstate->current_fh;
|
||||
__be32 status;
|
||||
int accmode = 0;
|
||||
|
||||
/* We don't know the target directory, and therefore can not
|
||||
@ -479,9 +475,7 @@ do_open_fhandle(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, str
|
||||
if (open->op_claim_type == NFS4_OPEN_CLAIM_DELEG_CUR_FH)
|
||||
accmode = NFSD_MAY_OWNER_OVERRIDE;
|
||||
|
||||
status = do_open_permission(rqstp, current_fh, open, accmode);
|
||||
|
||||
return status;
|
||||
return do_open_permission(rqstp, current_fh, open, accmode);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -668,11 +662,9 @@ static __be32
|
||||
nfsd4_putrootfh(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
|
||||
union nfsd4_op_u *u)
|
||||
{
|
||||
__be32 status;
|
||||
|
||||
fh_put(&cstate->current_fh);
|
||||
status = exp_pseudoroot(rqstp, &cstate->current_fh);
|
||||
return status;
|
||||
|
||||
return exp_pseudoroot(rqstp, &cstate->current_fh);
|
||||
}
|
||||
|
||||
static __be32
|
||||
@ -1343,7 +1335,7 @@ try_again:
|
||||
return 0;
|
||||
}
|
||||
if (work) {
|
||||
strlcpy(work->nsui_ipaddr, ipaddr, sizeof(work->nsui_ipaddr) - 1);
|
||||
strscpy(work->nsui_ipaddr, ipaddr, sizeof(work->nsui_ipaddr) - 1);
|
||||
refcount_set(&work->nsui_refcnt, 2);
|
||||
work->nsui_busy = true;
|
||||
list_add_tail(&work->nsui_list, &nn->nfsd_ssc_mount_list);
|
||||
@ -1621,6 +1613,10 @@ static void nfsd4_cb_offload_release(struct nfsd4_callback *cb)
|
||||
static int nfsd4_cb_offload_done(struct nfsd4_callback *cb,
|
||||
struct rpc_task *task)
|
||||
{
|
||||
struct nfsd4_cb_offload *cbo =
|
||||
container_of(cb, struct nfsd4_cb_offload, co_cb);
|
||||
|
||||
trace_nfsd_cb_offload_done(&cbo->co_res.cb_stateid, task);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -1768,7 +1764,13 @@ static int nfsd4_do_async_copy(void *data)
|
||||
filp = nfs42_ssc_open(copy->ss_mnt, ©->c_fh,
|
||||
©->stateid);
|
||||
if (IS_ERR(filp)) {
|
||||
nfserr = nfserr_offload_denied;
|
||||
switch (PTR_ERR(filp)) {
|
||||
case -EBADF:
|
||||
nfserr = nfserr_wrong_type;
|
||||
break;
|
||||
default:
|
||||
nfserr = nfserr_offload_denied;
|
||||
}
|
||||
nfsd4_interssc_disconnect(copy->ss_mnt);
|
||||
goto do_callback;
|
||||
}
|
||||
@ -1826,7 +1828,7 @@ nfsd4_copy(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
|
||||
if (!nfs4_init_copy_state(nn, copy))
|
||||
goto out_err;
|
||||
refcount_set(&async_copy->refcount, 1);
|
||||
memcpy(©->cp_res.cb_stateid, ©->cp_stateid.stid,
|
||||
memcpy(©->cp_res.cb_stateid, ©->cp_stateid.cs_stid,
|
||||
sizeof(copy->cp_res.cb_stateid));
|
||||
dup_copy_fields(copy, async_copy);
|
||||
async_copy->copy_task = kthread_create(nfsd4_do_async_copy,
|
||||
@ -1862,7 +1864,7 @@ find_async_copy(struct nfs4_client *clp, stateid_t *stateid)
|
||||
|
||||
spin_lock(&clp->async_lock);
|
||||
list_for_each_entry(copy, &clp->async_copies, copies) {
|
||||
if (memcmp(©->cp_stateid.stid, stateid, NFS4_STATEID_SIZE))
|
||||
if (memcmp(©->cp_stateid.cs_stid, stateid, NFS4_STATEID_SIZE))
|
||||
continue;
|
||||
refcount_inc(©->refcount);
|
||||
spin_unlock(&clp->async_lock);
|
||||
@ -1916,7 +1918,7 @@ nfsd4_copy_notify(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
|
||||
cps = nfs4_alloc_init_cpntf_state(nn, stid);
|
||||
if (!cps)
|
||||
goto out;
|
||||
memcpy(&cn->cpn_cnr_stateid, &cps->cp_stateid.stid, sizeof(stateid_t));
|
||||
memcpy(&cn->cpn_cnr_stateid, &cps->cp_stateid.cs_stid, sizeof(stateid_t));
|
||||
memcpy(&cps->cp_p_stateid, &stid->sc_stateid, sizeof(stateid_t));
|
||||
memcpy(&cps->cp_p_clid, &clp->cl_clientid, sizeof(clientid_t));
|
||||
|
||||
@ -2633,9 +2635,6 @@ nfsd4_proc_compound(struct svc_rqst *rqstp)
|
||||
status = nfserr_minor_vers_mismatch;
|
||||
if (nfsd_minorversion(nn, args->minorversion, NFSD_TEST) <= 0)
|
||||
goto out;
|
||||
status = nfserr_resource;
|
||||
if (args->opcnt > NFSD_MAX_OPS_PER_COMPOUND)
|
||||
goto out;
|
||||
|
||||
status = nfs41_check_op_ordering(args);
|
||||
if (status) {
|
||||
@ -2648,10 +2647,20 @@ nfsd4_proc_compound(struct svc_rqst *rqstp)
|
||||
|
||||
rqstp->rq_lease_breaker = (void **)&cstate->clp;
|
||||
|
||||
trace_nfsd_compound(rqstp, args->opcnt);
|
||||
trace_nfsd_compound(rqstp, args->tag, args->taglen, args->client_opcnt);
|
||||
while (!status && resp->opcnt < args->opcnt) {
|
||||
op = &args->ops[resp->opcnt++];
|
||||
|
||||
if (unlikely(resp->opcnt == NFSD_MAX_OPS_PER_COMPOUND)) {
|
||||
/* If there are still more operations to process,
|
||||
* stop here and report NFS4ERR_RESOURCE. */
|
||||
if (cstate->minorversion == 0 &&
|
||||
args->client_opcnt > resp->opcnt) {
|
||||
op->status = nfserr_resource;
|
||||
goto encode_op;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* The XDR decode routines may have pre-set op->status;
|
||||
* for example, if there is a miscellaneous XDR error
|
||||
@ -2727,8 +2736,8 @@ encode_op:
|
||||
status = op->status;
|
||||
}
|
||||
|
||||
trace_nfsd_compound_status(args->opcnt, resp->opcnt, status,
|
||||
nfsd4_op_name(op->opnum));
|
||||
trace_nfsd_compound_status(args->client_opcnt, resp->opcnt,
|
||||
status, nfsd4_op_name(op->opnum));
|
||||
|
||||
nfsd4_cstate_clear_replay(cstate);
|
||||
nfsd4_increment_op_stats(op->opnum);
|
||||
@ -2762,28 +2771,49 @@ out:
|
||||
|
||||
#define op_encode_channel_attrs_maxsz (6 + 1 + 1)
|
||||
|
||||
static inline u32 nfsd4_only_status_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)
|
||||
/*
|
||||
* The _rsize() helpers are invoked by the NFSv4 COMPOUND decoder, which
|
||||
* is called before sunrpc sets rq_res.buflen. Thus we have to compute
|
||||
* the maximum payload size here, based on transport limits and the size
|
||||
* of the remaining space in the rq_pages array.
|
||||
*/
|
||||
static u32 nfsd4_max_payload(const struct svc_rqst *rqstp)
|
||||
{
|
||||
u32 buflen;
|
||||
|
||||
buflen = (rqstp->rq_page_end - rqstp->rq_next_page) * PAGE_SIZE;
|
||||
buflen -= rqstp->rq_auth_slack;
|
||||
buflen -= rqstp->rq_res.head[0].iov_len;
|
||||
return min_t(u32, buflen, svc_max_payload(rqstp));
|
||||
}
|
||||
|
||||
static u32 nfsd4_only_status_rsize(const struct svc_rqst *rqstp,
|
||||
const struct nfsd4_op *op)
|
||||
{
|
||||
return (op_encode_hdr_size) * sizeof(__be32);
|
||||
}
|
||||
|
||||
static inline u32 nfsd4_status_stateid_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)
|
||||
static u32 nfsd4_status_stateid_rsize(const struct svc_rqst *rqstp,
|
||||
const struct nfsd4_op *op)
|
||||
{
|
||||
return (op_encode_hdr_size + op_encode_stateid_maxsz)* sizeof(__be32);
|
||||
}
|
||||
|
||||
static inline u32 nfsd4_access_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)
|
||||
static u32 nfsd4_access_rsize(const struct svc_rqst *rqstp,
|
||||
const struct nfsd4_op *op)
|
||||
{
|
||||
/* ac_supported, ac_resp_access */
|
||||
return (op_encode_hdr_size + 2)* sizeof(__be32);
|
||||
}
|
||||
|
||||
static inline u32 nfsd4_commit_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)
|
||||
static u32 nfsd4_commit_rsize(const struct svc_rqst *rqstp,
|
||||
const struct nfsd4_op *op)
|
||||
{
|
||||
return (op_encode_hdr_size + op_encode_verifier_maxsz) * sizeof(__be32);
|
||||
}
|
||||
|
||||
static inline u32 nfsd4_create_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)
|
||||
static u32 nfsd4_create_rsize(const struct svc_rqst *rqstp,
|
||||
const struct nfsd4_op *op)
|
||||
{
|
||||
return (op_encode_hdr_size + op_encode_change_info_maxsz
|
||||
+ nfs4_fattr_bitmap_maxsz) * sizeof(__be32);
|
||||
@ -2794,17 +2824,17 @@ static inline u32 nfsd4_create_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op
|
||||
* the op prematurely if the estimate is too large. We may turn off splice
|
||||
* reads unnecessarily.
|
||||
*/
|
||||
static inline u32 nfsd4_getattr_rsize(struct svc_rqst *rqstp,
|
||||
struct nfsd4_op *op)
|
||||
static u32 nfsd4_getattr_rsize(const struct svc_rqst *rqstp,
|
||||
const struct nfsd4_op *op)
|
||||
{
|
||||
u32 *bmap = op->u.getattr.ga_bmval;
|
||||
const u32 *bmap = op->u.getattr.ga_bmval;
|
||||
u32 bmap0 = bmap[0], bmap1 = bmap[1], bmap2 = bmap[2];
|
||||
u32 ret = 0;
|
||||
|
||||
if (bmap0 & FATTR4_WORD0_ACL)
|
||||
return svc_max_payload(rqstp);
|
||||
return nfsd4_max_payload(rqstp);
|
||||
if (bmap0 & FATTR4_WORD0_FS_LOCATIONS)
|
||||
return svc_max_payload(rqstp);
|
||||
return nfsd4_max_payload(rqstp);
|
||||
|
||||
if (bmap1 & FATTR4_WORD1_OWNER) {
|
||||
ret += IDMAP_NAMESZ + 4;
|
||||
@ -2832,24 +2862,28 @@ static inline u32 nfsd4_getattr_rsize(struct svc_rqst *rqstp,
|
||||
return ret;
|
||||
}
|
||||
|
||||
static inline u32 nfsd4_getfh_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)
|
||||
static u32 nfsd4_getfh_rsize(const struct svc_rqst *rqstp,
|
||||
const struct nfsd4_op *op)
|
||||
{
|
||||
return (op_encode_hdr_size + 1) * sizeof(__be32) + NFS4_FHSIZE;
|
||||
}
|
||||
|
||||
static inline u32 nfsd4_link_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)
|
||||
static u32 nfsd4_link_rsize(const struct svc_rqst *rqstp,
|
||||
const struct nfsd4_op *op)
|
||||
{
|
||||
return (op_encode_hdr_size + op_encode_change_info_maxsz)
|
||||
* sizeof(__be32);
|
||||
}
|
||||
|
||||
static inline u32 nfsd4_lock_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)
|
||||
static u32 nfsd4_lock_rsize(const struct svc_rqst *rqstp,
|
||||
const struct nfsd4_op *op)
|
||||
{
|
||||
return (op_encode_hdr_size + op_encode_lock_denied_maxsz)
|
||||
* sizeof(__be32);
|
||||
}
|
||||
|
||||
static inline u32 nfsd4_open_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)
|
||||
static u32 nfsd4_open_rsize(const struct svc_rqst *rqstp,
|
||||
const struct nfsd4_op *op)
|
||||
{
|
||||
return (op_encode_hdr_size + op_encode_stateid_maxsz
|
||||
+ op_encode_change_info_maxsz + 1
|
||||
@ -2857,20 +2891,18 @@ static inline u32 nfsd4_open_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)
|
||||
+ op_encode_delegation_maxsz) * sizeof(__be32);
|
||||
}
|
||||
|
||||
static inline u32 nfsd4_read_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)
|
||||
static u32 nfsd4_read_rsize(const struct svc_rqst *rqstp,
|
||||
const struct nfsd4_op *op)
|
||||
{
|
||||
u32 maxcount = 0, rlen = 0;
|
||||
|
||||
maxcount = svc_max_payload(rqstp);
|
||||
rlen = min(op->u.read.rd_length, maxcount);
|
||||
u32 rlen = min(op->u.read.rd_length, nfsd4_max_payload(rqstp));
|
||||
|
||||
return (op_encode_hdr_size + 2 + XDR_QUADLEN(rlen)) * sizeof(__be32);
|
||||
}
|
||||
|
||||
static inline u32 nfsd4_read_plus_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)
|
||||
static u32 nfsd4_read_plus_rsize(const struct svc_rqst *rqstp,
|
||||
const struct nfsd4_op *op)
|
||||
{
|
||||
u32 maxcount = svc_max_payload(rqstp);
|
||||
u32 rlen = min(op->u.read.rd_length, maxcount);
|
||||
u32 rlen = min(op->u.read.rd_length, nfsd4_max_payload(rqstp));
|
||||
/*
|
||||
* If we detect that the file changed during hole encoding, then we
|
||||
* recover by encoding the remaining reply as data. This means we need
|
||||
@ -2881,70 +2913,77 @@ static inline u32 nfsd4_read_plus_rsize(struct svc_rqst *rqstp, struct nfsd4_op
|
||||
return (op_encode_hdr_size + 2 + seg_len + XDR_QUADLEN(rlen)) * sizeof(__be32);
|
||||
}
|
||||
|
||||
static inline u32 nfsd4_readdir_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)
|
||||
static u32 nfsd4_readdir_rsize(const struct svc_rqst *rqstp,
|
||||
const struct nfsd4_op *op)
|
||||
{
|
||||
u32 maxcount = 0, rlen = 0;
|
||||
|
||||
maxcount = svc_max_payload(rqstp);
|
||||
rlen = min(op->u.readdir.rd_maxcount, maxcount);
|
||||
u32 rlen = min(op->u.readdir.rd_maxcount, nfsd4_max_payload(rqstp));
|
||||
|
||||
return (op_encode_hdr_size + op_encode_verifier_maxsz +
|
||||
XDR_QUADLEN(rlen)) * sizeof(__be32);
|
||||
}
|
||||
|
||||
static inline u32 nfsd4_readlink_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)
|
||||
static u32 nfsd4_readlink_rsize(const struct svc_rqst *rqstp,
|
||||
const struct nfsd4_op *op)
|
||||
{
|
||||
return (op_encode_hdr_size + 1) * sizeof(__be32) + PAGE_SIZE;
|
||||
}
|
||||
|
||||
static inline u32 nfsd4_remove_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)
|
||||
static u32 nfsd4_remove_rsize(const struct svc_rqst *rqstp,
|
||||
const struct nfsd4_op *op)
|
||||
{
|
||||
return (op_encode_hdr_size + op_encode_change_info_maxsz)
|
||||
* sizeof(__be32);
|
||||
}
|
||||
|
||||
static inline u32 nfsd4_rename_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)
|
||||
static u32 nfsd4_rename_rsize(const struct svc_rqst *rqstp,
|
||||
const struct nfsd4_op *op)
|
||||
{
|
||||
return (op_encode_hdr_size + op_encode_change_info_maxsz
|
||||
+ op_encode_change_info_maxsz) * sizeof(__be32);
|
||||
}
|
||||
|
||||
static inline u32 nfsd4_sequence_rsize(struct svc_rqst *rqstp,
|
||||
struct nfsd4_op *op)
|
||||
static u32 nfsd4_sequence_rsize(const struct svc_rqst *rqstp,
|
||||
const struct nfsd4_op *op)
|
||||
{
|
||||
return (op_encode_hdr_size
|
||||
+ XDR_QUADLEN(NFS4_MAX_SESSIONID_LEN) + 5) * sizeof(__be32);
|
||||
}
|
||||
|
||||
static inline u32 nfsd4_test_stateid_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)
|
||||
static u32 nfsd4_test_stateid_rsize(const struct svc_rqst *rqstp,
|
||||
const struct nfsd4_op *op)
|
||||
{
|
||||
return (op_encode_hdr_size + 1 + op->u.test_stateid.ts_num_ids)
|
||||
* sizeof(__be32);
|
||||
}
|
||||
|
||||
static inline u32 nfsd4_setattr_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)
|
||||
static u32 nfsd4_setattr_rsize(const struct svc_rqst *rqstp,
|
||||
const struct nfsd4_op *op)
|
||||
{
|
||||
return (op_encode_hdr_size + nfs4_fattr_bitmap_maxsz) * sizeof(__be32);
|
||||
}
|
||||
|
||||
static inline u32 nfsd4_secinfo_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)
|
||||
static u32 nfsd4_secinfo_rsize(const struct svc_rqst *rqstp,
|
||||
const struct nfsd4_op *op)
|
||||
{
|
||||
return (op_encode_hdr_size + RPC_AUTH_MAXFLAVOR *
|
||||
(4 + XDR_QUADLEN(GSS_OID_MAX_LEN))) * sizeof(__be32);
|
||||
}
|
||||
|
||||
static inline u32 nfsd4_setclientid_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)
|
||||
static u32 nfsd4_setclientid_rsize(const struct svc_rqst *rqstp,
|
||||
const struct nfsd4_op *op)
|
||||
{
|
||||
return (op_encode_hdr_size + 2 + XDR_QUADLEN(NFS4_VERIFIER_SIZE)) *
|
||||
sizeof(__be32);
|
||||
}
|
||||
|
||||
static inline u32 nfsd4_write_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)
|
||||
static u32 nfsd4_write_rsize(const struct svc_rqst *rqstp,
|
||||
const struct nfsd4_op *op)
|
||||
{
|
||||
return (op_encode_hdr_size + 2 + op_encode_verifier_maxsz) * sizeof(__be32);
|
||||
}
|
||||
|
||||
static inline u32 nfsd4_exchange_id_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)
|
||||
static u32 nfsd4_exchange_id_rsize(const struct svc_rqst *rqstp,
|
||||
const struct nfsd4_op *op)
|
||||
{
|
||||
return (op_encode_hdr_size + 2 + 1 + /* eir_clientid, eir_sequenceid */\
|
||||
1 + 1 + /* eir_flags, spr_how */\
|
||||
@ -2958,14 +2997,16 @@ static inline u32 nfsd4_exchange_id_rsize(struct svc_rqst *rqstp, struct nfsd4_o
|
||||
0 /* ignored eir_server_impl_id contents */) * sizeof(__be32);
|
||||
}
|
||||
|
||||
static inline u32 nfsd4_bind_conn_to_session_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)
|
||||
static u32 nfsd4_bind_conn_to_session_rsize(const struct svc_rqst *rqstp,
|
||||
const struct nfsd4_op *op)
|
||||
{
|
||||
return (op_encode_hdr_size + \
|
||||
XDR_QUADLEN(NFS4_MAX_SESSIONID_LEN) + /* bctsr_sessid */\
|
||||
2 /* bctsr_dir, use_conn_in_rdma_mode */) * sizeof(__be32);
|
||||
}
|
||||
|
||||
static inline u32 nfsd4_create_session_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)
|
||||
static u32 nfsd4_create_session_rsize(const struct svc_rqst *rqstp,
|
||||
const struct nfsd4_op *op)
|
||||
{
|
||||
return (op_encode_hdr_size + \
|
||||
XDR_QUADLEN(NFS4_MAX_SESSIONID_LEN) + /* sessionid */\
|
||||
@ -2974,7 +3015,8 @@ static inline u32 nfsd4_create_session_rsize(struct svc_rqst *rqstp, struct nfsd
|
||||
op_encode_channel_attrs_maxsz) * sizeof(__be32);
|
||||
}
|
||||
|
||||
static inline u32 nfsd4_copy_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)
|
||||
static u32 nfsd4_copy_rsize(const struct svc_rqst *rqstp,
|
||||
const struct nfsd4_op *op)
|
||||
{
|
||||
return (op_encode_hdr_size +
|
||||
1 /* wr_callback */ +
|
||||
@ -2986,16 +3028,16 @@ static inline u32 nfsd4_copy_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)
|
||||
1 /* cr_synchronous */) * sizeof(__be32);
|
||||
}
|
||||
|
||||
static inline u32 nfsd4_offload_status_rsize(struct svc_rqst *rqstp,
|
||||
struct nfsd4_op *op)
|
||||
static u32 nfsd4_offload_status_rsize(const struct svc_rqst *rqstp,
|
||||
const struct nfsd4_op *op)
|
||||
{
|
||||
return (op_encode_hdr_size +
|
||||
2 /* osr_count */ +
|
||||
1 /* osr_complete<1> optional 0 for now */) * sizeof(__be32);
|
||||
}
|
||||
|
||||
static inline u32 nfsd4_copy_notify_rsize(struct svc_rqst *rqstp,
|
||||
struct nfsd4_op *op)
|
||||
static u32 nfsd4_copy_notify_rsize(const struct svc_rqst *rqstp,
|
||||
const struct nfsd4_op *op)
|
||||
{
|
||||
return (op_encode_hdr_size +
|
||||
3 /* cnr_lease_time */ +
|
||||
@ -3010,12 +3052,10 @@ static inline u32 nfsd4_copy_notify_rsize(struct svc_rqst *rqstp,
|
||||
}
|
||||
|
||||
#ifdef CONFIG_NFSD_PNFS
|
||||
static inline u32 nfsd4_getdeviceinfo_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)
|
||||
static u32 nfsd4_getdeviceinfo_rsize(const struct svc_rqst *rqstp,
|
||||
const struct nfsd4_op *op)
|
||||
{
|
||||
u32 maxcount = 0, rlen = 0;
|
||||
|
||||
maxcount = svc_max_payload(rqstp);
|
||||
rlen = min(op->u.getdeviceinfo.gd_maxcount, maxcount);
|
||||
u32 rlen = min(op->u.getdeviceinfo.gd_maxcount, nfsd4_max_payload(rqstp));
|
||||
|
||||
return (op_encode_hdr_size +
|
||||
1 /* gd_layout_type*/ +
|
||||
@ -3028,7 +3068,8 @@ static inline u32 nfsd4_getdeviceinfo_rsize(struct svc_rqst *rqstp, struct nfsd4
|
||||
* so we need to define an arbitrary upper bound here.
|
||||
*/
|
||||
#define MAX_LAYOUT_SIZE 128
|
||||
static inline u32 nfsd4_layoutget_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)
|
||||
static u32 nfsd4_layoutget_rsize(const struct svc_rqst *rqstp,
|
||||
const struct nfsd4_op *op)
|
||||
{
|
||||
return (op_encode_hdr_size +
|
||||
1 /* logr_return_on_close */ +
|
||||
@ -3037,14 +3078,16 @@ static inline u32 nfsd4_layoutget_rsize(struct svc_rqst *rqstp, struct nfsd4_op
|
||||
MAX_LAYOUT_SIZE) * sizeof(__be32);
|
||||
}
|
||||
|
||||
static inline u32 nfsd4_layoutcommit_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)
|
||||
static u32 nfsd4_layoutcommit_rsize(const struct svc_rqst *rqstp,
|
||||
const struct nfsd4_op *op)
|
||||
{
|
||||
return (op_encode_hdr_size +
|
||||
1 /* locr_newsize */ +
|
||||
2 /* ns_size */) * sizeof(__be32);
|
||||
}
|
||||
|
||||
static inline u32 nfsd4_layoutreturn_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)
|
||||
static u32 nfsd4_layoutreturn_rsize(const struct svc_rqst *rqstp,
|
||||
const struct nfsd4_op *op)
|
||||
{
|
||||
return (op_encode_hdr_size +
|
||||
1 /* lrs_stateid */ +
|
||||
@ -3053,41 +3096,36 @@ static inline u32 nfsd4_layoutreturn_rsize(struct svc_rqst *rqstp, struct nfsd4_
|
||||
#endif /* CONFIG_NFSD_PNFS */
|
||||
|
||||
|
||||
static inline u32 nfsd4_seek_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)
|
||||
static u32 nfsd4_seek_rsize(const struct svc_rqst *rqstp,
|
||||
const struct nfsd4_op *op)
|
||||
{
|
||||
return (op_encode_hdr_size + 3) * sizeof(__be32);
|
||||
}
|
||||
|
||||
static inline u32 nfsd4_getxattr_rsize(struct svc_rqst *rqstp,
|
||||
struct nfsd4_op *op)
|
||||
static u32 nfsd4_getxattr_rsize(const struct svc_rqst *rqstp,
|
||||
const struct nfsd4_op *op)
|
||||
{
|
||||
u32 maxcount, rlen;
|
||||
|
||||
maxcount = svc_max_payload(rqstp);
|
||||
rlen = min_t(u32, XATTR_SIZE_MAX, maxcount);
|
||||
u32 rlen = min_t(u32, XATTR_SIZE_MAX, nfsd4_max_payload(rqstp));
|
||||
|
||||
return (op_encode_hdr_size + 1 + XDR_QUADLEN(rlen)) * sizeof(__be32);
|
||||
}
|
||||
|
||||
static inline u32 nfsd4_setxattr_rsize(struct svc_rqst *rqstp,
|
||||
struct nfsd4_op *op)
|
||||
static u32 nfsd4_setxattr_rsize(const struct svc_rqst *rqstp,
|
||||
const struct nfsd4_op *op)
|
||||
{
|
||||
return (op_encode_hdr_size + op_encode_change_info_maxsz)
|
||||
* sizeof(__be32);
|
||||
}
|
||||
static inline u32 nfsd4_listxattrs_rsize(struct svc_rqst *rqstp,
|
||||
struct nfsd4_op *op)
|
||||
static u32 nfsd4_listxattrs_rsize(const struct svc_rqst *rqstp,
|
||||
const struct nfsd4_op *op)
|
||||
{
|
||||
u32 maxcount, rlen;
|
||||
|
||||
maxcount = svc_max_payload(rqstp);
|
||||
rlen = min(op->u.listxattrs.lsxa_maxcount, maxcount);
|
||||
u32 rlen = min(op->u.listxattrs.lsxa_maxcount, nfsd4_max_payload(rqstp));
|
||||
|
||||
return (op_encode_hdr_size + 4 + XDR_QUADLEN(rlen)) * sizeof(__be32);
|
||||
}
|
||||
|
||||
static inline u32 nfsd4_removexattr_rsize(struct svc_rqst *rqstp,
|
||||
struct nfsd4_op *op)
|
||||
static u32 nfsd4_removexattr_rsize(const struct svc_rqst *rqstp,
|
||||
const struct nfsd4_op *op)
|
||||
{
|
||||
return (op_encode_hdr_size + op_encode_change_info_maxsz)
|
||||
* sizeof(__be32);
|
||||
@ -3576,6 +3614,7 @@ static const struct svc_procedure nfsd_procedures4[2] = {
|
||||
.pc_decode = nfssvc_decode_voidarg,
|
||||
.pc_encode = nfssvc_encode_voidres,
|
||||
.pc_argsize = sizeof(struct nfsd_voidargs),
|
||||
.pc_argzero = sizeof(struct nfsd_voidargs),
|
||||
.pc_ressize = sizeof(struct nfsd_voidres),
|
||||
.pc_cachetype = RC_NOCACHE,
|
||||
.pc_xdrressize = 1,
|
||||
@ -3586,6 +3625,7 @@ static const struct svc_procedure nfsd_procedures4[2] = {
|
||||
.pc_decode = nfs4svc_decode_compoundargs,
|
||||
.pc_encode = nfs4svc_encode_compoundres,
|
||||
.pc_argsize = sizeof(struct nfsd4_compoundargs),
|
||||
.pc_argzero = offsetof(struct nfsd4_compoundargs, iops),
|
||||
.pc_ressize = sizeof(struct nfsd4_compoundres),
|
||||
.pc_release = nfsd4_release_compoundargs,
|
||||
.pc_cachetype = RC_NOCACHE,
|
||||
|
@ -807,16 +807,18 @@ __cld_pipe_inprogress_downcall(const struct cld_msg_v2 __user *cmsg,
|
||||
if (get_user(namelen, &ci->cc_name.cn_len))
|
||||
return -EFAULT;
|
||||
name.data = memdup_user(&ci->cc_name.cn_id, namelen);
|
||||
if (IS_ERR_OR_NULL(name.data))
|
||||
return -EFAULT;
|
||||
if (IS_ERR(name.data))
|
||||
return PTR_ERR(name.data);
|
||||
name.len = namelen;
|
||||
get_user(princhashlen, &ci->cc_princhash.cp_len);
|
||||
if (princhashlen > 0) {
|
||||
princhash.data = memdup_user(
|
||||
&ci->cc_princhash.cp_data,
|
||||
princhashlen);
|
||||
if (IS_ERR_OR_NULL(princhash.data))
|
||||
return -EFAULT;
|
||||
if (IS_ERR(princhash.data)) {
|
||||
kfree(name.data);
|
||||
return PTR_ERR(princhash.data);
|
||||
}
|
||||
princhash.len = princhashlen;
|
||||
} else
|
||||
princhash.len = 0;
|
||||
@ -827,8 +829,8 @@ __cld_pipe_inprogress_downcall(const struct cld_msg_v2 __user *cmsg,
|
||||
if (get_user(namelen, &cnm->cn_len))
|
||||
return -EFAULT;
|
||||
name.data = memdup_user(&cnm->cn_id, namelen);
|
||||
if (IS_ERR_OR_NULL(name.data))
|
||||
return -EFAULT;
|
||||
if (IS_ERR(name.data))
|
||||
return PTR_ERR(name.data);
|
||||
name.len = namelen;
|
||||
}
|
||||
if (name.len > 5 && memcmp(name.data, "hash:", 5) == 0) {
|
||||
|
@ -160,6 +160,13 @@ static bool is_client_expired(struct nfs4_client *clp)
|
||||
return clp->cl_time == 0;
|
||||
}
|
||||
|
||||
static void nfsd4_dec_courtesy_client_count(struct nfsd_net *nn,
|
||||
struct nfs4_client *clp)
|
||||
{
|
||||
if (clp->cl_state != NFSD4_ACTIVE)
|
||||
atomic_add_unless(&nn->nfsd_courtesy_clients, -1, 0);
|
||||
}
|
||||
|
||||
static __be32 get_client_locked(struct nfs4_client *clp)
|
||||
{
|
||||
struct nfsd_net *nn = net_generic(clp->net, nfsd_net_id);
|
||||
@ -169,6 +176,7 @@ static __be32 get_client_locked(struct nfs4_client *clp)
|
||||
if (is_client_expired(clp))
|
||||
return nfserr_expired;
|
||||
atomic_inc(&clp->cl_rpc_users);
|
||||
nfsd4_dec_courtesy_client_count(nn, clp);
|
||||
clp->cl_state = NFSD4_ACTIVE;
|
||||
return nfs_ok;
|
||||
}
|
||||
@ -190,6 +198,7 @@ renew_client_locked(struct nfs4_client *clp)
|
||||
|
||||
list_move_tail(&clp->cl_lru, &nn->client_lru);
|
||||
clp->cl_time = ktime_get_boottime_seconds();
|
||||
nfsd4_dec_courtesy_client_count(nn, clp);
|
||||
clp->cl_state = NFSD4_ACTIVE;
|
||||
}
|
||||
|
||||
@ -357,6 +366,8 @@ nfsd4_cb_notify_lock_prepare(struct nfsd4_callback *cb)
|
||||
static int
|
||||
nfsd4_cb_notify_lock_done(struct nfsd4_callback *cb, struct rpc_task *task)
|
||||
{
|
||||
trace_nfsd_cb_notify_lock_done(&zero_stateid, task);
|
||||
|
||||
/*
|
||||
* Since this is just an optimization, we don't try very hard if it
|
||||
* turns out not to succeed. We'll requeue it on NFS4ERR_DELAY, and
|
||||
@ -963,19 +974,19 @@ out_free:
|
||||
* Create a unique stateid_t to represent each COPY.
|
||||
*/
|
||||
static int nfs4_init_cp_state(struct nfsd_net *nn, copy_stateid_t *stid,
|
||||
unsigned char sc_type)
|
||||
unsigned char cs_type)
|
||||
{
|
||||
int new_id;
|
||||
|
||||
stid->stid.si_opaque.so_clid.cl_boot = (u32)nn->boot_time;
|
||||
stid->stid.si_opaque.so_clid.cl_id = nn->s2s_cp_cl_id;
|
||||
stid->sc_type = sc_type;
|
||||
stid->cs_stid.si_opaque.so_clid.cl_boot = (u32)nn->boot_time;
|
||||
stid->cs_stid.si_opaque.so_clid.cl_id = nn->s2s_cp_cl_id;
|
||||
stid->cs_type = cs_type;
|
||||
|
||||
idr_preload(GFP_KERNEL);
|
||||
spin_lock(&nn->s2s_cp_lock);
|
||||
new_id = idr_alloc_cyclic(&nn->s2s_cp_stateids, stid, 0, 0, GFP_NOWAIT);
|
||||
stid->stid.si_opaque.so_id = new_id;
|
||||
stid->stid.si_generation = 1;
|
||||
stid->cs_stid.si_opaque.so_id = new_id;
|
||||
stid->cs_stid.si_generation = 1;
|
||||
spin_unlock(&nn->s2s_cp_lock);
|
||||
idr_preload_end();
|
||||
if (new_id < 0)
|
||||
@ -997,7 +1008,7 @@ struct nfs4_cpntf_state *nfs4_alloc_init_cpntf_state(struct nfsd_net *nn,
|
||||
if (!cps)
|
||||
return NULL;
|
||||
cps->cpntf_time = ktime_get_boottime_seconds();
|
||||
refcount_set(&cps->cp_stateid.sc_count, 1);
|
||||
refcount_set(&cps->cp_stateid.cs_count, 1);
|
||||
if (!nfs4_init_cp_state(nn, &cps->cp_stateid, NFS4_COPYNOTIFY_STID))
|
||||
goto out_free;
|
||||
spin_lock(&nn->s2s_cp_lock);
|
||||
@ -1013,11 +1024,11 @@ void nfs4_free_copy_state(struct nfsd4_copy *copy)
|
||||
{
|
||||
struct nfsd_net *nn;
|
||||
|
||||
WARN_ON_ONCE(copy->cp_stateid.sc_type != NFS4_COPY_STID);
|
||||
WARN_ON_ONCE(copy->cp_stateid.cs_type != NFS4_COPY_STID);
|
||||
nn = net_generic(copy->cp_clp->net, nfsd_net_id);
|
||||
spin_lock(&nn->s2s_cp_lock);
|
||||
idr_remove(&nn->s2s_cp_stateids,
|
||||
copy->cp_stateid.stid.si_opaque.so_id);
|
||||
copy->cp_stateid.cs_stid.si_opaque.so_id);
|
||||
spin_unlock(&nn->s2s_cp_lock);
|
||||
}
|
||||
|
||||
@ -1049,6 +1060,12 @@ static struct nfs4_ol_stateid * nfs4_alloc_open_stateid(struct nfs4_client *clp)
|
||||
|
||||
static void nfs4_free_deleg(struct nfs4_stid *stid)
|
||||
{
|
||||
struct nfs4_delegation *dp = delegstateid(stid);
|
||||
|
||||
WARN_ON_ONCE(!list_empty(&stid->sc_cp_list));
|
||||
WARN_ON_ONCE(!list_empty(&dp->dl_perfile));
|
||||
WARN_ON_ONCE(!list_empty(&dp->dl_perclnt));
|
||||
WARN_ON_ONCE(!list_empty(&dp->dl_recall_lru));
|
||||
kmem_cache_free(deleg_slab, stid);
|
||||
atomic_long_dec(&num_delegations);
|
||||
}
|
||||
@ -1462,6 +1479,7 @@ static void nfs4_free_ol_stateid(struct nfs4_stid *stid)
|
||||
release_all_access(stp);
|
||||
if (stp->st_stateowner)
|
||||
nfs4_put_stateowner(stp->st_stateowner);
|
||||
WARN_ON(!list_empty(&stid->sc_cp_list));
|
||||
kmem_cache_free(stateid_slab, stid);
|
||||
}
|
||||
|
||||
@ -2233,6 +2251,7 @@ __destroy_client(struct nfs4_client *clp)
|
||||
if (clp->cl_cb_conn.cb_xprt)
|
||||
svc_xprt_put(clp->cl_cb_conn.cb_xprt);
|
||||
atomic_add_unless(&nn->nfs4_client_count, -1, 0);
|
||||
nfsd4_dec_courtesy_client_count(nn, clp);
|
||||
free_client(clp);
|
||||
wake_up_all(&expiry_wq);
|
||||
}
|
||||
@ -2478,7 +2497,7 @@ static const char *cb_state2str(int state)
|
||||
|
||||
static int client_info_show(struct seq_file *m, void *v)
|
||||
{
|
||||
struct inode *inode = m->private;
|
||||
struct inode *inode = file_inode(m->file);
|
||||
struct nfs4_client *clp;
|
||||
u64 clid;
|
||||
|
||||
@ -2518,17 +2537,7 @@ static int client_info_show(struct seq_file *m, void *v)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int client_info_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return single_open(file, client_info_show, inode);
|
||||
}
|
||||
|
||||
static const struct file_operations client_info_fops = {
|
||||
.open = client_info_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
};
|
||||
DEFINE_SHOW_ATTRIBUTE(client_info);
|
||||
|
||||
static void *states_start(struct seq_file *s, loff_t *pos)
|
||||
__acquires(&clp->cl_lock)
|
||||
@ -4337,7 +4346,27 @@ out:
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
void nfsd4_init_leases_net(struct nfsd_net *nn)
|
||||
static unsigned long
|
||||
nfsd_courtesy_client_count(struct shrinker *shrink, struct shrink_control *sc)
|
||||
{
|
||||
int cnt;
|
||||
struct nfsd_net *nn = container_of(shrink,
|
||||
struct nfsd_net, nfsd_client_shrinker);
|
||||
|
||||
cnt = atomic_read(&nn->nfsd_courtesy_clients);
|
||||
if (cnt > 0)
|
||||
mod_delayed_work(laundry_wq, &nn->nfsd_shrinker_work, 0);
|
||||
return (unsigned long)cnt;
|
||||
}
|
||||
|
||||
static unsigned long
|
||||
nfsd_courtesy_client_scan(struct shrinker *shrink, struct shrink_control *sc)
|
||||
{
|
||||
return SHRINK_STOP;
|
||||
}
|
||||
|
||||
int
|
||||
nfsd4_init_leases_net(struct nfsd_net *nn)
|
||||
{
|
||||
struct sysinfo si;
|
||||
u64 max_clients;
|
||||
@ -4356,6 +4385,18 @@ void nfsd4_init_leases_net(struct nfsd_net *nn)
|
||||
max_clients = (u64)si.totalram * si.mem_unit / (1024 * 1024 * 1024);
|
||||
max_clients *= NFS4_CLIENTS_PER_GB;
|
||||
nn->nfs4_max_clients = max_t(int, max_clients, NFS4_CLIENTS_PER_GB);
|
||||
|
||||
atomic_set(&nn->nfsd_courtesy_clients, 0);
|
||||
nn->nfsd_client_shrinker.scan_objects = nfsd_courtesy_client_scan;
|
||||
nn->nfsd_client_shrinker.count_objects = nfsd_courtesy_client_count;
|
||||
nn->nfsd_client_shrinker.seeks = DEFAULT_SEEKS;
|
||||
return register_shrinker(&nn->nfsd_client_shrinker, "nfsd-client");
|
||||
}
|
||||
|
||||
void
|
||||
nfsd4_leases_net_shutdown(struct nfsd_net *nn)
|
||||
{
|
||||
unregister_shrinker(&nn->nfsd_client_shrinker);
|
||||
}
|
||||
|
||||
static void init_nfs4_replay(struct nfs4_replay *rp)
|
||||
@ -4715,6 +4756,35 @@ nfs4_share_conflict(struct svc_fh *current_fh, unsigned int deny_type)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static bool nfsd4_deleg_present(const struct inode *inode)
|
||||
{
|
||||
struct file_lock_context *ctx = smp_load_acquire(&inode->i_flctx);
|
||||
|
||||
return ctx && !list_empty_careful(&ctx->flc_lease);
|
||||
}
|
||||
|
||||
/**
|
||||
* nfsd_wait_for_delegreturn - wait for delegations to be returned
|
||||
* @rqstp: the RPC transaction being executed
|
||||
* @inode: in-core inode of the file being waited for
|
||||
*
|
||||
* The timeout prevents deadlock if all nfsd threads happen to be
|
||||
* tied up waiting for returning delegations.
|
||||
*
|
||||
* Return values:
|
||||
* %true: delegation was returned
|
||||
* %false: timed out waiting for delegreturn
|
||||
*/
|
||||
bool nfsd_wait_for_delegreturn(struct svc_rqst *rqstp, struct inode *inode)
|
||||
{
|
||||
long __maybe_unused timeo;
|
||||
|
||||
timeo = wait_var_event_timeout(inode, !nfsd4_deleg_present(inode),
|
||||
NFSD_DELEGRETURN_TIMEOUT);
|
||||
trace_nfsd_delegret_wakeup(rqstp, inode, timeo);
|
||||
return timeo > 0;
|
||||
}
|
||||
|
||||
static void nfsd4_cb_recall_prepare(struct nfsd4_callback *cb)
|
||||
{
|
||||
struct nfs4_delegation *dp = cb_to_delegation(cb);
|
||||
@ -4743,6 +4813,8 @@ static int nfsd4_cb_recall_done(struct nfsd4_callback *cb,
|
||||
{
|
||||
struct nfs4_delegation *dp = cb_to_delegation(cb);
|
||||
|
||||
trace_nfsd_cb_recall_done(&dp->dl_stid.sc_stateid, task);
|
||||
|
||||
if (dp->dl_stid.sc_type == NFS4_CLOSED_DELEG_STID ||
|
||||
dp->dl_stid.sc_type == NFS4_REVOKED_DELEG_STID)
|
||||
return 1;
|
||||
@ -4788,18 +4860,17 @@ static void nfsd_break_one_deleg(struct nfs4_delegation *dp)
|
||||
* We're assuming the state code never drops its reference
|
||||
* without first removing the lease. Since we're in this lease
|
||||
* callback (and since the lease code is serialized by the
|
||||
* i_lock) we know the server hasn't removed the lease yet, and
|
||||
* flc_lock) we know the server hasn't removed the lease yet, and
|
||||
* we know it's safe to take a reference.
|
||||
*/
|
||||
refcount_inc(&dp->dl_stid.sc_count);
|
||||
nfsd4_run_cb(&dp->dl_recall);
|
||||
WARN_ON_ONCE(!nfsd4_run_cb(&dp->dl_recall));
|
||||
}
|
||||
|
||||
/* Called from break_lease() with i_lock held. */
|
||||
/* Called from break_lease() with flc_lock held. */
|
||||
static bool
|
||||
nfsd_break_deleg_cb(struct file_lock *fl)
|
||||
{
|
||||
bool ret = false;
|
||||
struct nfs4_delegation *dp = (struct nfs4_delegation *)fl->fl_owner;
|
||||
struct nfs4_file *fp = dp->dl_stid.sc_file;
|
||||
struct nfs4_client *clp = dp->dl_stid.sc_client;
|
||||
@ -4825,7 +4896,7 @@ nfsd_break_deleg_cb(struct file_lock *fl)
|
||||
fp->fi_had_conflict = true;
|
||||
nfsd_break_one_deleg(dp);
|
||||
spin_unlock(&fp->fi_lock);
|
||||
return ret;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -5878,8 +5949,11 @@ nfs4_get_client_reaplist(struct nfsd_net *nn, struct list_head *reaplist,
|
||||
goto exp_client;
|
||||
if (!state_expired(lt, clp->cl_time))
|
||||
break;
|
||||
if (!atomic_read(&clp->cl_rpc_users))
|
||||
if (!atomic_read(&clp->cl_rpc_users)) {
|
||||
if (clp->cl_state == NFSD4_ACTIVE)
|
||||
atomic_inc(&nn->nfsd_courtesy_clients);
|
||||
clp->cl_state = NFSD4_COURTESY;
|
||||
}
|
||||
if (!client_has_state(clp))
|
||||
goto exp_client;
|
||||
if (!nfs4_anylock_blockers(clp))
|
||||
@ -5894,10 +5968,49 @@ exp_client:
|
||||
spin_unlock(&nn->client_lock);
|
||||
}
|
||||
|
||||
static void
|
||||
nfs4_get_courtesy_client_reaplist(struct nfsd_net *nn,
|
||||
struct list_head *reaplist)
|
||||
{
|
||||
unsigned int maxreap = 0, reapcnt = 0;
|
||||
struct list_head *pos, *next;
|
||||
struct nfs4_client *clp;
|
||||
|
||||
maxreap = NFSD_CLIENT_MAX_TRIM_PER_RUN;
|
||||
INIT_LIST_HEAD(reaplist);
|
||||
|
||||
spin_lock(&nn->client_lock);
|
||||
list_for_each_safe(pos, next, &nn->client_lru) {
|
||||
clp = list_entry(pos, struct nfs4_client, cl_lru);
|
||||
if (clp->cl_state == NFSD4_ACTIVE)
|
||||
break;
|
||||
if (reapcnt >= maxreap)
|
||||
break;
|
||||
if (!mark_client_expired_locked(clp)) {
|
||||
list_add(&clp->cl_lru, reaplist);
|
||||
reapcnt++;
|
||||
}
|
||||
}
|
||||
spin_unlock(&nn->client_lock);
|
||||
}
|
||||
|
||||
static void
|
||||
nfs4_process_client_reaplist(struct list_head *reaplist)
|
||||
{
|
||||
struct list_head *pos, *next;
|
||||
struct nfs4_client *clp;
|
||||
|
||||
list_for_each_safe(pos, next, reaplist) {
|
||||
clp = list_entry(pos, struct nfs4_client, cl_lru);
|
||||
trace_nfsd_clid_purged(&clp->cl_clientid);
|
||||
list_del_init(&clp->cl_lru);
|
||||
expire_client(clp);
|
||||
}
|
||||
}
|
||||
|
||||
static time64_t
|
||||
nfs4_laundromat(struct nfsd_net *nn)
|
||||
{
|
||||
struct nfs4_client *clp;
|
||||
struct nfs4_openowner *oo;
|
||||
struct nfs4_delegation *dp;
|
||||
struct nfs4_ol_stateid *stp;
|
||||
@ -5920,18 +6033,14 @@ nfs4_laundromat(struct nfsd_net *nn)
|
||||
spin_lock(&nn->s2s_cp_lock);
|
||||
idr_for_each_entry(&nn->s2s_cp_stateids, cps_t, i) {
|
||||
cps = container_of(cps_t, struct nfs4_cpntf_state, cp_stateid);
|
||||
if (cps->cp_stateid.sc_type == NFS4_COPYNOTIFY_STID &&
|
||||
if (cps->cp_stateid.cs_type == NFS4_COPYNOTIFY_STID &&
|
||||
state_expired(<, cps->cpntf_time))
|
||||
_free_cpntf_state_locked(nn, cps);
|
||||
}
|
||||
spin_unlock(&nn->s2s_cp_lock);
|
||||
nfs4_get_client_reaplist(nn, &reaplist, <);
|
||||
list_for_each_safe(pos, next, &reaplist) {
|
||||
clp = list_entry(pos, struct nfs4_client, cl_lru);
|
||||
trace_nfsd_clid_purged(&clp->cl_clientid);
|
||||
list_del_init(&clp->cl_lru);
|
||||
expire_client(clp);
|
||||
}
|
||||
nfs4_process_client_reaplist(&reaplist);
|
||||
|
||||
spin_lock(&state_lock);
|
||||
list_for_each_safe(pos, next, &nn->del_recall_lru) {
|
||||
dp = list_entry (pos, struct nfs4_delegation, dl_recall_lru);
|
||||
@ -6014,6 +6123,18 @@ laundromat_main(struct work_struct *laundry)
|
||||
queue_delayed_work(laundry_wq, &nn->laundromat_work, t*HZ);
|
||||
}
|
||||
|
||||
static void
|
||||
courtesy_client_reaper(struct work_struct *reaper)
|
||||
{
|
||||
struct list_head reaplist;
|
||||
struct delayed_work *dwork = to_delayed_work(reaper);
|
||||
struct nfsd_net *nn = container_of(dwork, struct nfsd_net,
|
||||
nfsd_shrinker_work);
|
||||
|
||||
nfs4_get_courtesy_client_reaplist(nn, &reaplist);
|
||||
nfs4_process_client_reaplist(&reaplist);
|
||||
}
|
||||
|
||||
static inline __be32 nfs4_check_fh(struct svc_fh *fhp, struct nfs4_stid *stp)
|
||||
{
|
||||
if (!fh_match(&fhp->fh_handle, &stp->sc_file->fi_fhandle))
|
||||
@ -6149,6 +6270,7 @@ nfsd4_lookup_stateid(struct nfsd4_compound_state *cstate,
|
||||
struct nfs4_stid **s, struct nfsd_net *nn)
|
||||
{
|
||||
__be32 status;
|
||||
struct nfs4_stid *stid;
|
||||
bool return_revoked = false;
|
||||
|
||||
/*
|
||||
@ -6171,15 +6293,16 @@ nfsd4_lookup_stateid(struct nfsd4_compound_state *cstate,
|
||||
}
|
||||
if (status)
|
||||
return status;
|
||||
*s = find_stateid_by_type(cstate->clp, stateid, typemask);
|
||||
if (!*s)
|
||||
stid = find_stateid_by_type(cstate->clp, stateid, typemask);
|
||||
if (!stid)
|
||||
return nfserr_bad_stateid;
|
||||
if (((*s)->sc_type == NFS4_REVOKED_DELEG_STID) && !return_revoked) {
|
||||
nfs4_put_stid(*s);
|
||||
if ((stid->sc_type == NFS4_REVOKED_DELEG_STID) && !return_revoked) {
|
||||
nfs4_put_stid(stid);
|
||||
if (cstate->minorversion)
|
||||
return nfserr_deleg_revoked;
|
||||
return nfserr_bad_stateid;
|
||||
}
|
||||
*s = stid;
|
||||
return nfs_ok;
|
||||
}
|
||||
|
||||
@ -6244,12 +6367,12 @@ out:
|
||||
static void
|
||||
_free_cpntf_state_locked(struct nfsd_net *nn, struct nfs4_cpntf_state *cps)
|
||||
{
|
||||
WARN_ON_ONCE(cps->cp_stateid.sc_type != NFS4_COPYNOTIFY_STID);
|
||||
if (!refcount_dec_and_test(&cps->cp_stateid.sc_count))
|
||||
WARN_ON_ONCE(cps->cp_stateid.cs_type != NFS4_COPYNOTIFY_STID);
|
||||
if (!refcount_dec_and_test(&cps->cp_stateid.cs_count))
|
||||
return;
|
||||
list_del(&cps->cp_list);
|
||||
idr_remove(&nn->s2s_cp_stateids,
|
||||
cps->cp_stateid.stid.si_opaque.so_id);
|
||||
cps->cp_stateid.cs_stid.si_opaque.so_id);
|
||||
kfree(cps);
|
||||
}
|
||||
/*
|
||||
@ -6271,12 +6394,12 @@ __be32 manage_cpntf_state(struct nfsd_net *nn, stateid_t *st,
|
||||
if (cps_t) {
|
||||
state = container_of(cps_t, struct nfs4_cpntf_state,
|
||||
cp_stateid);
|
||||
if (state->cp_stateid.sc_type != NFS4_COPYNOTIFY_STID) {
|
||||
if (state->cp_stateid.cs_type != NFS4_COPYNOTIFY_STID) {
|
||||
state = NULL;
|
||||
goto unlock;
|
||||
}
|
||||
if (!clp)
|
||||
refcount_inc(&state->cp_stateid.sc_count);
|
||||
refcount_inc(&state->cp_stateid.cs_count);
|
||||
else
|
||||
_free_cpntf_state_locked(nn, state);
|
||||
}
|
||||
@ -6684,6 +6807,7 @@ static void nfsd4_close_open_stateid(struct nfs4_ol_stateid *s)
|
||||
struct nfs4_client *clp = s->st_stid.sc_client;
|
||||
bool unhashed;
|
||||
LIST_HEAD(reaplist);
|
||||
struct nfs4_ol_stateid *stp;
|
||||
|
||||
spin_lock(&clp->cl_lock);
|
||||
unhashed = unhash_open_stateid(s, &reaplist);
|
||||
@ -6692,6 +6816,8 @@ static void nfsd4_close_open_stateid(struct nfs4_ol_stateid *s)
|
||||
if (unhashed)
|
||||
put_ol_stateid_locked(s, &reaplist);
|
||||
spin_unlock(&clp->cl_lock);
|
||||
list_for_each_entry(stp, &reaplist, st_locks)
|
||||
nfs4_free_cpntf_statelist(clp->net, &stp->st_stid);
|
||||
free_ol_stateid_reaplist(&reaplist);
|
||||
} else {
|
||||
spin_unlock(&clp->cl_lock);
|
||||
@ -6775,6 +6901,7 @@ nfsd4_delegreturn(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
|
||||
if (status)
|
||||
goto put_stateid;
|
||||
|
||||
wake_up_var(d_inode(cstate->current_fh.fh_dentry));
|
||||
destroy_delegation(dp);
|
||||
put_stateid:
|
||||
nfs4_put_stid(&dp->dl_stid);
|
||||
@ -7830,6 +7957,7 @@ static int nfs4_state_create_net(struct net *net)
|
||||
INIT_LIST_HEAD(&nn->blocked_locks_lru);
|
||||
|
||||
INIT_DELAYED_WORK(&nn->laundromat_work, laundromat_main);
|
||||
INIT_DELAYED_WORK(&nn->nfsd_shrinker_work, courtesy_client_reaper);
|
||||
get_net(net);
|
||||
|
||||
return 0;
|
||||
|
@ -42,6 +42,8 @@
|
||||
#include <linux/sunrpc/svcauth_gss.h>
|
||||
#include <linux/sunrpc/addr.h>
|
||||
#include <linux/xattr.h>
|
||||
#include <linux/vmalloc.h>
|
||||
|
||||
#include <uapi/linux/xattr.h>
|
||||
|
||||
#include "idmap.h"
|
||||
@ -791,6 +793,7 @@ nfsd4_decode_commit(struct nfsd4_compoundargs *argp, struct nfsd4_commit *commit
|
||||
return nfserr_bad_xdr;
|
||||
if (xdr_stream_decode_u32(argp->xdr, &commit->co_count) < 0)
|
||||
return nfserr_bad_xdr;
|
||||
memset(&commit->co_verf, 0, sizeof(commit->co_verf));
|
||||
return nfs_ok;
|
||||
}
|
||||
|
||||
@ -799,6 +802,7 @@ nfsd4_decode_create(struct nfsd4_compoundargs *argp, struct nfsd4_create *create
|
||||
{
|
||||
__be32 *p, status;
|
||||
|
||||
memset(create, 0, sizeof(*create));
|
||||
if (xdr_stream_decode_u32(argp->xdr, &create->cr_type) < 0)
|
||||
return nfserr_bad_xdr;
|
||||
switch (create->cr_type) {
|
||||
@ -848,6 +852,7 @@ nfsd4_decode_delegreturn(struct nfsd4_compoundargs *argp, struct nfsd4_delegretu
|
||||
static inline __be32
|
||||
nfsd4_decode_getattr(struct nfsd4_compoundargs *argp, struct nfsd4_getattr *getattr)
|
||||
{
|
||||
memset(getattr, 0, sizeof(*getattr));
|
||||
return nfsd4_decode_bitmap4(argp, getattr->ga_bmval,
|
||||
ARRAY_SIZE(getattr->ga_bmval));
|
||||
}
|
||||
@ -855,6 +860,7 @@ nfsd4_decode_getattr(struct nfsd4_compoundargs *argp, struct nfsd4_getattr *geta
|
||||
static __be32
|
||||
nfsd4_decode_link(struct nfsd4_compoundargs *argp, struct nfsd4_link *link)
|
||||
{
|
||||
memset(link, 0, sizeof(*link));
|
||||
return nfsd4_decode_component4(argp, &link->li_name, &link->li_namelen);
|
||||
}
|
||||
|
||||
@ -903,6 +909,7 @@ nfsd4_decode_locker4(struct nfsd4_compoundargs *argp, struct nfsd4_lock *lock)
|
||||
static __be32
|
||||
nfsd4_decode_lock(struct nfsd4_compoundargs *argp, struct nfsd4_lock *lock)
|
||||
{
|
||||
memset(lock, 0, sizeof(*lock));
|
||||
if (xdr_stream_decode_u32(argp->xdr, &lock->lk_type) < 0)
|
||||
return nfserr_bad_xdr;
|
||||
if ((lock->lk_type < NFS4_READ_LT) || (lock->lk_type > NFS4_WRITEW_LT))
|
||||
@ -919,6 +926,7 @@ nfsd4_decode_lock(struct nfsd4_compoundargs *argp, struct nfsd4_lock *lock)
|
||||
static __be32
|
||||
nfsd4_decode_lockt(struct nfsd4_compoundargs *argp, struct nfsd4_lockt *lockt)
|
||||
{
|
||||
memset(lockt, 0, sizeof(*lockt));
|
||||
if (xdr_stream_decode_u32(argp->xdr, &lockt->lt_type) < 0)
|
||||
return nfserr_bad_xdr;
|
||||
if ((lockt->lt_type < NFS4_READ_LT) || (lockt->lt_type > NFS4_WRITEW_LT))
|
||||
@ -1140,11 +1148,8 @@ nfsd4_decode_open(struct nfsd4_compoundargs *argp, struct nfsd4_open *open)
|
||||
__be32 status;
|
||||
u32 dummy;
|
||||
|
||||
memset(open->op_bmval, 0, sizeof(open->op_bmval));
|
||||
open->op_iattr.ia_valid = 0;
|
||||
open->op_openowner = NULL;
|
||||
memset(open, 0, sizeof(*open));
|
||||
|
||||
open->op_xdr_error = 0;
|
||||
if (xdr_stream_decode_u32(argp->xdr, &open->op_seqid) < 0)
|
||||
return nfserr_bad_xdr;
|
||||
/* deleg_want is ignored */
|
||||
@ -1179,6 +1184,8 @@ nfsd4_decode_open_confirm(struct nfsd4_compoundargs *argp, struct nfsd4_open_con
|
||||
if (xdr_stream_decode_u32(argp->xdr, &open_conf->oc_seqid) < 0)
|
||||
return nfserr_bad_xdr;
|
||||
|
||||
memset(&open_conf->oc_resp_stateid, 0,
|
||||
sizeof(open_conf->oc_resp_stateid));
|
||||
return nfs_ok;
|
||||
}
|
||||
|
||||
@ -1187,6 +1194,7 @@ nfsd4_decode_open_downgrade(struct nfsd4_compoundargs *argp, struct nfsd4_open_d
|
||||
{
|
||||
__be32 status;
|
||||
|
||||
memset(open_down, 0, sizeof(*open_down));
|
||||
status = nfsd4_decode_stateid4(argp, &open_down->od_stateid);
|
||||
if (status)
|
||||
return status;
|
||||
@ -1216,6 +1224,7 @@ nfsd4_decode_putfh(struct nfsd4_compoundargs *argp, struct nfsd4_putfh *putfh)
|
||||
if (!putfh->pf_fhval)
|
||||
return nfserr_jukebox;
|
||||
|
||||
putfh->no_verify = false;
|
||||
return nfs_ok;
|
||||
}
|
||||
|
||||
@ -1232,6 +1241,7 @@ nfsd4_decode_read(struct nfsd4_compoundargs *argp, struct nfsd4_read *read)
|
||||
{
|
||||
__be32 status;
|
||||
|
||||
memset(read, 0, sizeof(*read));
|
||||
status = nfsd4_decode_stateid4(argp, &read->rd_stateid);
|
||||
if (status)
|
||||
return status;
|
||||
@ -1248,6 +1258,7 @@ nfsd4_decode_readdir(struct nfsd4_compoundargs *argp, struct nfsd4_readdir *read
|
||||
{
|
||||
__be32 status;
|
||||
|
||||
memset(readdir, 0, sizeof(*readdir));
|
||||
if (xdr_stream_decode_u64(argp->xdr, &readdir->rd_cookie) < 0)
|
||||
return nfserr_bad_xdr;
|
||||
status = nfsd4_decode_verifier4(argp, &readdir->rd_verf);
|
||||
@ -1267,6 +1278,7 @@ nfsd4_decode_readdir(struct nfsd4_compoundargs *argp, struct nfsd4_readdir *read
|
||||
static __be32
|
||||
nfsd4_decode_remove(struct nfsd4_compoundargs *argp, struct nfsd4_remove *remove)
|
||||
{
|
||||
memset(&remove->rm_cinfo, 0, sizeof(remove->rm_cinfo));
|
||||
return nfsd4_decode_component4(argp, &remove->rm_name, &remove->rm_namelen);
|
||||
}
|
||||
|
||||
@ -1275,6 +1287,7 @@ nfsd4_decode_rename(struct nfsd4_compoundargs *argp, struct nfsd4_rename *rename
|
||||
{
|
||||
__be32 status;
|
||||
|
||||
memset(rename, 0, sizeof(*rename));
|
||||
status = nfsd4_decode_component4(argp, &rename->rn_sname, &rename->rn_snamelen);
|
||||
if (status)
|
||||
return status;
|
||||
@ -1291,6 +1304,7 @@ static __be32
|
||||
nfsd4_decode_secinfo(struct nfsd4_compoundargs *argp,
|
||||
struct nfsd4_secinfo *secinfo)
|
||||
{
|
||||
secinfo->si_exp = NULL;
|
||||
return nfsd4_decode_component4(argp, &secinfo->si_name, &secinfo->si_namelen);
|
||||
}
|
||||
|
||||
@ -1299,6 +1313,7 @@ nfsd4_decode_setattr(struct nfsd4_compoundargs *argp, struct nfsd4_setattr *seta
|
||||
{
|
||||
__be32 status;
|
||||
|
||||
memset(setattr, 0, sizeof(*setattr));
|
||||
status = nfsd4_decode_stateid4(argp, &setattr->sa_stateid);
|
||||
if (status)
|
||||
return status;
|
||||
@ -1313,6 +1328,8 @@ nfsd4_decode_setclientid(struct nfsd4_compoundargs *argp, struct nfsd4_setclient
|
||||
{
|
||||
__be32 *p, status;
|
||||
|
||||
memset(setclientid, 0, sizeof(*setclientid));
|
||||
|
||||
if (argp->minorversion >= 1)
|
||||
return nfserr_notsupp;
|
||||
|
||||
@ -1369,6 +1386,8 @@ nfsd4_decode_verify(struct nfsd4_compoundargs *argp, struct nfsd4_verify *verify
|
||||
{
|
||||
__be32 *p, status;
|
||||
|
||||
memset(verify, 0, sizeof(*verify));
|
||||
|
||||
status = nfsd4_decode_bitmap4(argp, verify->ve_bmval,
|
||||
ARRAY_SIZE(verify->ve_bmval));
|
||||
if (status)
|
||||
@ -1408,6 +1427,9 @@ nfsd4_decode_write(struct nfsd4_compoundargs *argp, struct nfsd4_write *write)
|
||||
if (!xdr_stream_subsegment(argp->xdr, &write->wr_payload, write->wr_buflen))
|
||||
return nfserr_bad_xdr;
|
||||
|
||||
write->wr_bytes_written = 0;
|
||||
write->wr_how_written = 0;
|
||||
memset(&write->wr_verifier, 0, sizeof(write->wr_verifier));
|
||||
return nfs_ok;
|
||||
}
|
||||
|
||||
@ -1432,6 +1454,7 @@ nfsd4_decode_release_lockowner(struct nfsd4_compoundargs *argp, struct nfsd4_rel
|
||||
|
||||
static __be32 nfsd4_decode_backchannel_ctl(struct nfsd4_compoundargs *argp, struct nfsd4_backchannel_ctl *bc)
|
||||
{
|
||||
memset(bc, 0, sizeof(*bc));
|
||||
if (xdr_stream_decode_u32(argp->xdr, &bc->bc_cb_program) < 0)
|
||||
return nfserr_bad_xdr;
|
||||
return nfsd4_decode_cb_sec(argp, &bc->bc_cb_sec);
|
||||
@ -1442,6 +1465,7 @@ static __be32 nfsd4_decode_bind_conn_to_session(struct nfsd4_compoundargs *argp,
|
||||
u32 use_conn_in_rdma_mode;
|
||||
__be32 status;
|
||||
|
||||
memset(bcts, 0, sizeof(*bcts));
|
||||
status = nfsd4_decode_sessionid4(argp, &bcts->sessionid);
|
||||
if (status)
|
||||
return status;
|
||||
@ -1583,6 +1607,7 @@ nfsd4_decode_exchange_id(struct nfsd4_compoundargs *argp,
|
||||
{
|
||||
__be32 status;
|
||||
|
||||
memset(exid, 0, sizeof(*exid));
|
||||
status = nfsd4_decode_verifier4(argp, &exid->verifier);
|
||||
if (status)
|
||||
return status;
|
||||
@ -1635,6 +1660,7 @@ nfsd4_decode_create_session(struct nfsd4_compoundargs *argp,
|
||||
{
|
||||
__be32 status;
|
||||
|
||||
memset(sess, 0, sizeof(*sess));
|
||||
status = nfsd4_decode_clientid4(argp, &sess->clientid);
|
||||
if (status)
|
||||
return status;
|
||||
@ -1650,11 +1676,7 @@ nfsd4_decode_create_session(struct nfsd4_compoundargs *argp,
|
||||
return status;
|
||||
if (xdr_stream_decode_u32(argp->xdr, &sess->callback_prog) < 0)
|
||||
return nfserr_bad_xdr;
|
||||
status = nfsd4_decode_cb_sec(argp, &sess->cb_sec);
|
||||
if (status)
|
||||
return status;
|
||||
|
||||
return nfs_ok;
|
||||
return nfsd4_decode_cb_sec(argp, &sess->cb_sec);
|
||||
}
|
||||
|
||||
static __be32
|
||||
@ -1678,6 +1700,7 @@ nfsd4_decode_getdeviceinfo(struct nfsd4_compoundargs *argp,
|
||||
{
|
||||
__be32 status;
|
||||
|
||||
memset(gdev, 0, sizeof(*gdev));
|
||||
status = nfsd4_decode_deviceid4(argp, &gdev->gd_devid);
|
||||
if (status)
|
||||
return status;
|
||||
@ -1698,6 +1721,7 @@ nfsd4_decode_layoutcommit(struct nfsd4_compoundargs *argp,
|
||||
{
|
||||
__be32 *p, status;
|
||||
|
||||
memset(lcp, 0, sizeof(*lcp));
|
||||
if (xdr_stream_decode_u64(argp->xdr, &lcp->lc_seg.offset) < 0)
|
||||
return nfserr_bad_xdr;
|
||||
if (xdr_stream_decode_u64(argp->xdr, &lcp->lc_seg.length) < 0)
|
||||
@ -1733,6 +1757,7 @@ nfsd4_decode_layoutget(struct nfsd4_compoundargs *argp,
|
||||
{
|
||||
__be32 status;
|
||||
|
||||
memset(lgp, 0, sizeof(*lgp));
|
||||
if (xdr_stream_decode_u32(argp->xdr, &lgp->lg_signal) < 0)
|
||||
return nfserr_bad_xdr;
|
||||
if (xdr_stream_decode_u32(argp->xdr, &lgp->lg_layout_type) < 0)
|
||||
@ -1758,6 +1783,7 @@ static __be32
|
||||
nfsd4_decode_layoutreturn(struct nfsd4_compoundargs *argp,
|
||||
struct nfsd4_layoutreturn *lrp)
|
||||
{
|
||||
memset(lrp, 0, sizeof(*lrp));
|
||||
if (xdr_stream_decode_bool(argp->xdr, &lrp->lr_reclaim) < 0)
|
||||
return nfserr_bad_xdr;
|
||||
if (xdr_stream_decode_u32(argp->xdr, &lrp->lr_layout_type) < 0)
|
||||
@ -1773,6 +1799,8 @@ static __be32 nfsd4_decode_secinfo_no_name(struct nfsd4_compoundargs *argp,
|
||||
{
|
||||
if (xdr_stream_decode_u32(argp->xdr, &sin->sin_style) < 0)
|
||||
return nfserr_bad_xdr;
|
||||
|
||||
sin->sin_exp = NULL;
|
||||
return nfs_ok;
|
||||
}
|
||||
|
||||
@ -1793,6 +1821,7 @@ nfsd4_decode_sequence(struct nfsd4_compoundargs *argp,
|
||||
seq->maxslots = be32_to_cpup(p++);
|
||||
seq->cachethis = be32_to_cpup(p);
|
||||
|
||||
seq->status_flags = 0;
|
||||
return nfs_ok;
|
||||
}
|
||||
|
||||
@ -1803,6 +1832,7 @@ nfsd4_decode_test_stateid(struct nfsd4_compoundargs *argp, struct nfsd4_test_sta
|
||||
__be32 status;
|
||||
u32 i;
|
||||
|
||||
memset(test_stateid, 0, sizeof(*test_stateid));
|
||||
if (xdr_stream_decode_u32(argp->xdr, &test_stateid->ts_num_ids) < 0)
|
||||
return nfserr_bad_xdr;
|
||||
|
||||
@ -1900,6 +1930,7 @@ nfsd4_decode_copy(struct nfsd4_compoundargs *argp, struct nfsd4_copy *copy)
|
||||
struct nl4_server *ns_dummy;
|
||||
__be32 status;
|
||||
|
||||
memset(copy, 0, sizeof(*copy));
|
||||
status = nfsd4_decode_stateid4(argp, ©->cp_src_stateid);
|
||||
if (status)
|
||||
return status;
|
||||
@ -1955,6 +1986,7 @@ nfsd4_decode_copy_notify(struct nfsd4_compoundargs *argp,
|
||||
{
|
||||
__be32 status;
|
||||
|
||||
memset(cn, 0, sizeof(*cn));
|
||||
cn->cpn_src = svcxdr_tmpalloc(argp, sizeof(*cn->cpn_src));
|
||||
if (cn->cpn_src == NULL)
|
||||
return nfserr_jukebox;
|
||||
@ -1972,6 +2004,8 @@ static __be32
|
||||
nfsd4_decode_offload_status(struct nfsd4_compoundargs *argp,
|
||||
struct nfsd4_offload_status *os)
|
||||
{
|
||||
os->count = 0;
|
||||
os->status = 0;
|
||||
return nfsd4_decode_stateid4(argp, &os->stateid);
|
||||
}
|
||||
|
||||
@ -1988,6 +2022,8 @@ nfsd4_decode_seek(struct nfsd4_compoundargs *argp, struct nfsd4_seek *seek)
|
||||
if (xdr_stream_decode_u32(argp->xdr, &seek->seek_whence) < 0)
|
||||
return nfserr_bad_xdr;
|
||||
|
||||
seek->seek_eof = 0;
|
||||
seek->seek_pos = 0;
|
||||
return nfs_ok;
|
||||
}
|
||||
|
||||
@ -2123,6 +2159,7 @@ nfsd4_decode_getxattr(struct nfsd4_compoundargs *argp,
|
||||
__be32 status;
|
||||
u32 maxcount;
|
||||
|
||||
memset(getxattr, 0, sizeof(*getxattr));
|
||||
status = nfsd4_decode_xattr_name(argp, &getxattr->getxa_name);
|
||||
if (status)
|
||||
return status;
|
||||
@ -2131,8 +2168,7 @@ nfsd4_decode_getxattr(struct nfsd4_compoundargs *argp,
|
||||
maxcount = min_t(u32, XATTR_SIZE_MAX, maxcount);
|
||||
|
||||
getxattr->getxa_len = maxcount;
|
||||
|
||||
return status;
|
||||
return nfs_ok;
|
||||
}
|
||||
|
||||
static __be32
|
||||
@ -2142,6 +2178,8 @@ nfsd4_decode_setxattr(struct nfsd4_compoundargs *argp,
|
||||
u32 flags, maxcount, size;
|
||||
__be32 status;
|
||||
|
||||
memset(setxattr, 0, sizeof(*setxattr));
|
||||
|
||||
if (xdr_stream_decode_u32(argp->xdr, &flags) < 0)
|
||||
return nfserr_bad_xdr;
|
||||
|
||||
@ -2180,6 +2218,8 @@ nfsd4_decode_listxattrs(struct nfsd4_compoundargs *argp,
|
||||
{
|
||||
u32 maxcount;
|
||||
|
||||
memset(listxattrs, 0, sizeof(*listxattrs));
|
||||
|
||||
if (xdr_stream_decode_u64(argp->xdr, &listxattrs->lsxa_cookie) < 0)
|
||||
return nfserr_bad_xdr;
|
||||
|
||||
@ -2207,6 +2247,7 @@ static __be32
|
||||
nfsd4_decode_removexattr(struct nfsd4_compoundargs *argp,
|
||||
struct nfsd4_removexattr *removexattr)
|
||||
{
|
||||
memset(removexattr, 0, sizeof(*removexattr));
|
||||
return nfsd4_decode_xattr_name(argp, &removexattr->rmxa_name);
|
||||
}
|
||||
|
||||
@ -2357,22 +2398,15 @@ nfsd4_decode_compound(struct nfsd4_compoundargs *argp)
|
||||
|
||||
if (xdr_stream_decode_u32(argp->xdr, &argp->minorversion) < 0)
|
||||
return false;
|
||||
if (xdr_stream_decode_u32(argp->xdr, &argp->opcnt) < 0)
|
||||
if (xdr_stream_decode_u32(argp->xdr, &argp->client_opcnt) < 0)
|
||||
return false;
|
||||
|
||||
/*
|
||||
* NFS4ERR_RESOURCE is a more helpful error than GARBAGE_ARGS
|
||||
* here, so we return success at the xdr level so that
|
||||
* nfsd4_proc can handle this is an NFS-level error.
|
||||
*/
|
||||
if (argp->opcnt > NFSD_MAX_OPS_PER_COMPOUND)
|
||||
return true;
|
||||
argp->opcnt = min_t(u32, argp->client_opcnt,
|
||||
NFSD_MAX_OPS_PER_COMPOUND);
|
||||
|
||||
if (argp->opcnt > ARRAY_SIZE(argp->iops)) {
|
||||
argp->ops = kzalloc(argp->opcnt * sizeof(*argp->ops), GFP_KERNEL);
|
||||
argp->ops = vcalloc(argp->opcnt, sizeof(*argp->ops));
|
||||
if (!argp->ops) {
|
||||
argp->ops = argp->iops;
|
||||
dprintk("nfsd: couldn't allocate room for COMPOUND\n");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -2774,9 +2808,10 @@ static __be32 fattr_handle_absent_fs(u32 *bmval0, u32 *bmval1, u32 *bmval2, u32
|
||||
}
|
||||
|
||||
|
||||
static int get_parent_attributes(struct svc_export *exp, struct kstat *stat)
|
||||
static int nfsd4_get_mounted_on_ino(struct svc_export *exp, u64 *pino)
|
||||
{
|
||||
struct path path = exp->ex_path;
|
||||
struct kstat stat;
|
||||
int err;
|
||||
|
||||
path_get(&path);
|
||||
@ -2784,8 +2819,10 @@ static int get_parent_attributes(struct svc_export *exp, struct kstat *stat)
|
||||
if (path.dentry != path.mnt->mnt_root)
|
||||
break;
|
||||
}
|
||||
err = vfs_getattr(&path, stat, STATX_BASIC_STATS, AT_STATX_SYNC_AS_STAT);
|
||||
err = vfs_getattr(&path, &stat, STATX_INO, AT_STATX_SYNC_AS_STAT);
|
||||
path_put(&path);
|
||||
if (!err)
|
||||
*pino = stat.ino;
|
||||
return err;
|
||||
}
|
||||
|
||||
@ -3282,22 +3319,21 @@ out_acl:
|
||||
*p++ = cpu_to_be32(stat.btime.tv_nsec);
|
||||
}
|
||||
if (bmval1 & FATTR4_WORD1_MOUNTED_ON_FILEID) {
|
||||
struct kstat parent_stat;
|
||||
u64 ino = stat.ino;
|
||||
|
||||
p = xdr_reserve_space(xdr, 8);
|
||||
if (!p)
|
||||
goto out_resource;
|
||||
/*
|
||||
* Get parent's attributes if not ignoring crossmount
|
||||
* and this is the root of a cross-mounted filesystem.
|
||||
* Get ino of mountpoint in parent filesystem, if not ignoring
|
||||
* crossmount and this is the root of a cross-mounted
|
||||
* filesystem.
|
||||
*/
|
||||
if (ignore_crossmnt == 0 &&
|
||||
dentry == exp->ex_path.mnt->mnt_root) {
|
||||
err = get_parent_attributes(exp, &parent_stat);
|
||||
err = nfsd4_get_mounted_on_ino(exp, &ino);
|
||||
if (err)
|
||||
goto out_nfserr;
|
||||
ino = parent_stat.ino;
|
||||
}
|
||||
p = xdr_encode_hyper(p, ino);
|
||||
}
|
||||
@ -3994,7 +4030,7 @@ nfsd4_encode_read(struct nfsd4_compoundres *resp, __be32 nfserr,
|
||||
}
|
||||
if (resp->xdr->buf->page_len && splice_ok) {
|
||||
WARN_ON_ONCE(1);
|
||||
return nfserr_resource;
|
||||
return nfserr_serverfault;
|
||||
}
|
||||
xdr_commit_encode(xdr);
|
||||
|
||||
@ -5394,7 +5430,7 @@ void nfsd4_release_compoundargs(struct svc_rqst *rqstp)
|
||||
struct nfsd4_compoundargs *args = rqstp->rq_argp;
|
||||
|
||||
if (args->ops != args->iops) {
|
||||
kfree(args->ops);
|
||||
vfree(args->ops);
|
||||
args->ops = args->iops;
|
||||
}
|
||||
while (args->to_free) {
|
||||
@ -5423,12 +5459,8 @@ bool
|
||||
nfs4svc_encode_compoundres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
||||
{
|
||||
struct nfsd4_compoundres *resp = rqstp->rq_resp;
|
||||
struct xdr_buf *buf = xdr->buf;
|
||||
__be32 *p;
|
||||
|
||||
WARN_ON_ONCE(buf->len != buf->head[0].iov_len + buf->page_len +
|
||||
buf->tail[0].iov_len);
|
||||
|
||||
/*
|
||||
* Send buffer space for the following items is reserved
|
||||
* at the top of nfsd4_proc_compound().
|
||||
|
@ -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
|
||||
* 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, "num entries: %u\n",
|
||||
@ -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);
|
||||
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)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int export_features_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
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,
|
||||
};
|
||||
DEFINE_SHOW_ATTRIBUTE(export_features);
|
||||
|
||||
#if defined(CONFIG_SUNRPC_GSS) || defined(CONFIG_SUNRPC_GSS_MODULE)
|
||||
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;
|
||||
}
|
||||
|
||||
static int supported_enctypes_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
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,
|
||||
};
|
||||
DEFINE_SHOW_ATTRIBUTE(supported_enctypes);
|
||||
#endif /* CONFIG_SUNRPC_GSS or CONFIG_SUNRPC_GSS_MODULE */
|
||||
|
||||
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,
|
||||
};
|
||||
|
||||
static const struct file_operations reply_cache_stats_operations = {
|
||||
.open = nfsd_reply_cache_stats_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
};
|
||||
DEFINE_SHOW_ATTRIBUTE(nfsd_reply_cache_stats);
|
||||
|
||||
static const struct file_operations filecache_ops = {
|
||||
.open = nfsd_file_cache_stats_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
};
|
||||
DEFINE_SHOW_ATTRIBUTE(nfsd_file_cache_stats);
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/*
|
||||
@ -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 */
|
||||
[NFSD_Export_Stats] = {"export_stats", &exports_nfsd_operations, S_IRUGO},
|
||||
[NFSD_Export_features] = {"export_features",
|
||||
&export_features_operations, S_IRUGO},
|
||||
&export_features_fops, S_IRUGO},
|
||||
[NFSD_FO_UnlockIP] = {"unlock_ip",
|
||||
&transaction_ops, S_IWUSR|S_IRUSR},
|
||||
[NFSD_FO_UnlockFS] = {"unlock_filesystem",
|
||||
@ -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_Pool_Threads] = {"pool_threads", &transaction_ops, S_IWUSR|S_IRUSR},
|
||||
[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_Ports] = {"portlist", &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_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)
|
||||
[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 */
|
||||
#ifdef CONFIG_NFSD_V4
|
||||
[NFSD_Leasetime] = {"nfsv4leasetime", &transaction_ops, S_IWUSR|S_IRUSR},
|
||||
@ -1481,11 +1453,12 @@ static __net_init int nfsd_init_net(struct net *net)
|
||||
goto out_idmap_error;
|
||||
nn->nfsd_versions = NULL;
|
||||
nn->nfsd4_minorversions = NULL;
|
||||
retval = nfsd4_init_leases_net(nn);
|
||||
if (retval)
|
||||
goto out_drc_error;
|
||||
retval = nfsd_reply_cache_init(nn);
|
||||
if (retval)
|
||||
goto out_drc_error;
|
||||
nfsd4_init_leases_net(nn);
|
||||
|
||||
get_random_bytes(&nn->siphash_key, sizeof(nn->siphash_key));
|
||||
seqlock_init(&nn->writeverf_lock);
|
||||
|
||||
@ -1507,6 +1480,7 @@ static __net_exit void nfsd_exit_net(struct net *net)
|
||||
nfsd_idmap_shutdown(net);
|
||||
nfsd_export_shutdown(net);
|
||||
nfsd_netns_free_versions(net_generic(net, nfsd_net_id));
|
||||
nfsd4_leases_net_shutdown(nn);
|
||||
}
|
||||
|
||||
static struct pernet_operations nfsd_net_ops = {
|
||||
|
@ -164,6 +164,7 @@ char * nfs4_recoverydir(void);
|
||||
bool nfsd4_spo_must_allow(struct svc_rqst *rqstp);
|
||||
int nfsd4_create_laundry_wq(void);
|
||||
void nfsd4_destroy_laundry_wq(void);
|
||||
bool nfsd_wait_for_delegreturn(struct svc_rqst *rqstp, struct inode *inode);
|
||||
#else
|
||||
static inline int nfsd4_init_slabs(void) { return 0; }
|
||||
static inline void nfsd4_free_slabs(void) { }
|
||||
@ -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 void nfsd4_destroy_laundry_wq(void) {};
|
||||
static inline bool nfsd_wait_for_delegreturn(struct svc_rqst *rqstp,
|
||||
struct inode *inode)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
@ -343,6 +349,7 @@ void nfsd_lockd_shutdown(void);
|
||||
#define NFSD_COURTESY_CLIENT_TIMEOUT (24 * 60 * 60) /* seconds */
|
||||
#define NFSD_CLIENT_MAX_TRIM_PER_RUN 128
|
||||
#define NFS4_CLIENTS_PER_GB 1024
|
||||
#define NFSD_DELEGRETURN_TIMEOUT (HZ / 34) /* 30ms */
|
||||
|
||||
/*
|
||||
* The following attributes are currently not supported by the NFSv4 server:
|
||||
@ -498,7 +505,8 @@ extern void unregister_cld_notifier(void);
|
||||
extern void nfsd4_ssc_init_umount_work(struct nfsd_net *nn);
|
||||
#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 */
|
||||
static inline int nfsd4_is_junction(struct dentry *dentry)
|
||||
@ -506,7 +514,8 @@ static inline int nfsd4_is_junction(struct dentry *dentry)
|
||||
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 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)
|
||||
skip_pseudoflavor_check:
|
||||
/* Finally, check access permissions. */
|
||||
error = nfsd_permission(rqstp, exp, dentry, access);
|
||||
|
||||
if (error) {
|
||||
dprintk("fh_verify: %pd2 permission failure, "
|
||||
"acc=%x, error=%d\n",
|
||||
dentry,
|
||||
access, ntohl(error));
|
||||
}
|
||||
trace_nfsd_fh_verify_err(rqstp, fhp, type, access, error);
|
||||
out:
|
||||
if (error == nfserr_stale)
|
||||
nfsd_stats_fh_stale_inc(exp);
|
||||
|
@ -185,6 +185,7 @@ nfsd_proc_read(struct svc_rqst *rqstp)
|
||||
argp->count, argp->offset);
|
||||
|
||||
argp->count = min_t(u32, argp->count, NFSSVC_MAXBLKSIZE_V2);
|
||||
argp->count = min_t(u32, argp->count, rqstp->rq_res.buflen);
|
||||
|
||||
v = 0;
|
||||
len = argp->count;
|
||||
@ -390,9 +391,8 @@ nfsd_proc_create(struct svc_rqst *rqstp)
|
||||
resp->status = nfs_ok;
|
||||
if (!inode) {
|
||||
/* File doesn't exist. Create it and set attrs */
|
||||
resp->status = nfsd_create_locked(rqstp, dirfhp, argp->name,
|
||||
argp->len, &attrs, type, rdev,
|
||||
newfhp);
|
||||
resp->status = nfsd_create_locked(rqstp, dirfhp, &attrs, type,
|
||||
rdev, newfhp);
|
||||
} else if (type == S_IFREG) {
|
||||
dprintk("nfsd: existing %s, valid=%x, size=%ld\n",
|
||||
argp->name, attr->ia_valid, (long) attr->ia_size);
|
||||
@ -567,24 +567,15 @@ static void nfsd_init_dirlist_pages(struct svc_rqst *rqstp,
|
||||
struct xdr_buf *buf = &resp->dirlist;
|
||||
struct xdr_stream *xdr = &resp->xdr;
|
||||
|
||||
count = clamp(count, (u32)(XDR_UNIT * 2), svc_max_payload(rqstp));
|
||||
|
||||
memset(buf, 0, sizeof(*buf));
|
||||
|
||||
/* 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;
|
||||
rqstp->rq_next_page++;
|
||||
|
||||
/* This is xdr_init_encode(), but it assumes that
|
||||
* 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;
|
||||
xdr_init_encode_pages(xdr, buf, buf->pages, NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -646,6 +637,7 @@ static const struct svc_procedure nfsd_procedures2[18] = {
|
||||
.pc_decode = nfssvc_decode_voidarg,
|
||||
.pc_encode = nfssvc_encode_voidres,
|
||||
.pc_argsize = sizeof(struct nfsd_voidargs),
|
||||
.pc_argzero = sizeof(struct nfsd_voidargs),
|
||||
.pc_ressize = sizeof(struct nfsd_voidres),
|
||||
.pc_cachetype = RC_NOCACHE,
|
||||
.pc_xdrressize = 0,
|
||||
@ -657,6 +649,7 @@ static const struct svc_procedure nfsd_procedures2[18] = {
|
||||
.pc_encode = nfssvc_encode_attrstatres,
|
||||
.pc_release = nfssvc_release_attrstat,
|
||||
.pc_argsize = sizeof(struct nfsd_fhandle),
|
||||
.pc_argzero = sizeof(struct nfsd_fhandle),
|
||||
.pc_ressize = sizeof(struct nfsd_attrstat),
|
||||
.pc_cachetype = RC_NOCACHE,
|
||||
.pc_xdrressize = ST+AT,
|
||||
@ -668,6 +661,7 @@ static const struct svc_procedure nfsd_procedures2[18] = {
|
||||
.pc_encode = nfssvc_encode_attrstatres,
|
||||
.pc_release = nfssvc_release_attrstat,
|
||||
.pc_argsize = sizeof(struct nfsd_sattrargs),
|
||||
.pc_argzero = sizeof(struct nfsd_sattrargs),
|
||||
.pc_ressize = sizeof(struct nfsd_attrstat),
|
||||
.pc_cachetype = RC_REPLBUFF,
|
||||
.pc_xdrressize = ST+AT,
|
||||
@ -678,6 +672,7 @@ static const struct svc_procedure nfsd_procedures2[18] = {
|
||||
.pc_decode = nfssvc_decode_voidarg,
|
||||
.pc_encode = nfssvc_encode_voidres,
|
||||
.pc_argsize = sizeof(struct nfsd_voidargs),
|
||||
.pc_argzero = sizeof(struct nfsd_voidargs),
|
||||
.pc_ressize = sizeof(struct nfsd_voidres),
|
||||
.pc_cachetype = RC_NOCACHE,
|
||||
.pc_xdrressize = 0,
|
||||
@ -689,6 +684,7 @@ static const struct svc_procedure nfsd_procedures2[18] = {
|
||||
.pc_encode = nfssvc_encode_diropres,
|
||||
.pc_release = nfssvc_release_diropres,
|
||||
.pc_argsize = sizeof(struct nfsd_diropargs),
|
||||
.pc_argzero = sizeof(struct nfsd_diropargs),
|
||||
.pc_ressize = sizeof(struct nfsd_diropres),
|
||||
.pc_cachetype = RC_NOCACHE,
|
||||
.pc_xdrressize = ST+FH+AT,
|
||||
@ -699,6 +695,7 @@ static const struct svc_procedure nfsd_procedures2[18] = {
|
||||
.pc_decode = nfssvc_decode_fhandleargs,
|
||||
.pc_encode = nfssvc_encode_readlinkres,
|
||||
.pc_argsize = sizeof(struct nfsd_fhandle),
|
||||
.pc_argzero = sizeof(struct nfsd_fhandle),
|
||||
.pc_ressize = sizeof(struct nfsd_readlinkres),
|
||||
.pc_cachetype = RC_NOCACHE,
|
||||
.pc_xdrressize = ST+1+NFS_MAXPATHLEN/4,
|
||||
@ -710,6 +707,7 @@ static const struct svc_procedure nfsd_procedures2[18] = {
|
||||
.pc_encode = nfssvc_encode_readres,
|
||||
.pc_release = nfssvc_release_readres,
|
||||
.pc_argsize = sizeof(struct nfsd_readargs),
|
||||
.pc_argzero = sizeof(struct nfsd_readargs),
|
||||
.pc_ressize = sizeof(struct nfsd_readres),
|
||||
.pc_cachetype = RC_NOCACHE,
|
||||
.pc_xdrressize = ST+AT+1+NFSSVC_MAXBLKSIZE_V2/4,
|
||||
@ -720,6 +718,7 @@ static const struct svc_procedure nfsd_procedures2[18] = {
|
||||
.pc_decode = nfssvc_decode_voidarg,
|
||||
.pc_encode = nfssvc_encode_voidres,
|
||||
.pc_argsize = sizeof(struct nfsd_voidargs),
|
||||
.pc_argzero = sizeof(struct nfsd_voidargs),
|
||||
.pc_ressize = sizeof(struct nfsd_voidres),
|
||||
.pc_cachetype = RC_NOCACHE,
|
||||
.pc_xdrressize = 0,
|
||||
@ -731,6 +730,7 @@ static const struct svc_procedure nfsd_procedures2[18] = {
|
||||
.pc_encode = nfssvc_encode_attrstatres,
|
||||
.pc_release = nfssvc_release_attrstat,
|
||||
.pc_argsize = sizeof(struct nfsd_writeargs),
|
||||
.pc_argzero = sizeof(struct nfsd_writeargs),
|
||||
.pc_ressize = sizeof(struct nfsd_attrstat),
|
||||
.pc_cachetype = RC_REPLBUFF,
|
||||
.pc_xdrressize = ST+AT,
|
||||
@ -742,6 +742,7 @@ static const struct svc_procedure nfsd_procedures2[18] = {
|
||||
.pc_encode = nfssvc_encode_diropres,
|
||||
.pc_release = nfssvc_release_diropres,
|
||||
.pc_argsize = sizeof(struct nfsd_createargs),
|
||||
.pc_argzero = sizeof(struct nfsd_createargs),
|
||||
.pc_ressize = sizeof(struct nfsd_diropres),
|
||||
.pc_cachetype = RC_REPLBUFF,
|
||||
.pc_xdrressize = ST+FH+AT,
|
||||
@ -752,6 +753,7 @@ static const struct svc_procedure nfsd_procedures2[18] = {
|
||||
.pc_decode = nfssvc_decode_diropargs,
|
||||
.pc_encode = nfssvc_encode_statres,
|
||||
.pc_argsize = sizeof(struct nfsd_diropargs),
|
||||
.pc_argzero = sizeof(struct nfsd_diropargs),
|
||||
.pc_ressize = sizeof(struct nfsd_stat),
|
||||
.pc_cachetype = RC_REPLSTAT,
|
||||
.pc_xdrressize = ST,
|
||||
@ -762,6 +764,7 @@ static const struct svc_procedure nfsd_procedures2[18] = {
|
||||
.pc_decode = nfssvc_decode_renameargs,
|
||||
.pc_encode = nfssvc_encode_statres,
|
||||
.pc_argsize = sizeof(struct nfsd_renameargs),
|
||||
.pc_argzero = sizeof(struct nfsd_renameargs),
|
||||
.pc_ressize = sizeof(struct nfsd_stat),
|
||||
.pc_cachetype = RC_REPLSTAT,
|
||||
.pc_xdrressize = ST,
|
||||
@ -772,6 +775,7 @@ static const struct svc_procedure nfsd_procedures2[18] = {
|
||||
.pc_decode = nfssvc_decode_linkargs,
|
||||
.pc_encode = nfssvc_encode_statres,
|
||||
.pc_argsize = sizeof(struct nfsd_linkargs),
|
||||
.pc_argzero = sizeof(struct nfsd_linkargs),
|
||||
.pc_ressize = sizeof(struct nfsd_stat),
|
||||
.pc_cachetype = RC_REPLSTAT,
|
||||
.pc_xdrressize = ST,
|
||||
@ -782,6 +786,7 @@ static const struct svc_procedure nfsd_procedures2[18] = {
|
||||
.pc_decode = nfssvc_decode_symlinkargs,
|
||||
.pc_encode = nfssvc_encode_statres,
|
||||
.pc_argsize = sizeof(struct nfsd_symlinkargs),
|
||||
.pc_argzero = sizeof(struct nfsd_symlinkargs),
|
||||
.pc_ressize = sizeof(struct nfsd_stat),
|
||||
.pc_cachetype = RC_REPLSTAT,
|
||||
.pc_xdrressize = ST,
|
||||
@ -793,6 +798,7 @@ static const struct svc_procedure nfsd_procedures2[18] = {
|
||||
.pc_encode = nfssvc_encode_diropres,
|
||||
.pc_release = nfssvc_release_diropres,
|
||||
.pc_argsize = sizeof(struct nfsd_createargs),
|
||||
.pc_argzero = sizeof(struct nfsd_createargs),
|
||||
.pc_ressize = sizeof(struct nfsd_diropres),
|
||||
.pc_cachetype = RC_REPLBUFF,
|
||||
.pc_xdrressize = ST+FH+AT,
|
||||
@ -803,6 +809,7 @@ static const struct svc_procedure nfsd_procedures2[18] = {
|
||||
.pc_decode = nfssvc_decode_diropargs,
|
||||
.pc_encode = nfssvc_encode_statres,
|
||||
.pc_argsize = sizeof(struct nfsd_diropargs),
|
||||
.pc_argzero = sizeof(struct nfsd_diropargs),
|
||||
.pc_ressize = sizeof(struct nfsd_stat),
|
||||
.pc_cachetype = RC_REPLSTAT,
|
||||
.pc_xdrressize = ST,
|
||||
@ -813,6 +820,7 @@ static const struct svc_procedure nfsd_procedures2[18] = {
|
||||
.pc_decode = nfssvc_decode_readdirargs,
|
||||
.pc_encode = nfssvc_encode_readdirres,
|
||||
.pc_argsize = sizeof(struct nfsd_readdirargs),
|
||||
.pc_argzero = sizeof(struct nfsd_readdirargs),
|
||||
.pc_ressize = sizeof(struct nfsd_readdirres),
|
||||
.pc_cachetype = RC_NOCACHE,
|
||||
.pc_name = "READDIR",
|
||||
@ -822,6 +830,7 @@ static const struct svc_procedure nfsd_procedures2[18] = {
|
||||
.pc_decode = nfssvc_decode_fhandleargs,
|
||||
.pc_encode = nfssvc_encode_statfsres,
|
||||
.pc_argsize = sizeof(struct nfsd_fhandle),
|
||||
.pc_argzero = sizeof(struct nfsd_fhandle),
|
||||
.pc_ressize = sizeof(struct nfsd_statfsres),
|
||||
.pc_cachetype = RC_NOCACHE,
|
||||
.pc_xdrressize = ST+5,
|
||||
|
@ -799,7 +799,7 @@ nfsd_svc(int nrservs, struct net *net, const struct cred *cred)
|
||||
if (nrservs == 0 && nn->nfsd_serv == NULL)
|
||||
goto out;
|
||||
|
||||
strlcpy(nn->nfsd_name, utsname()->nodename,
|
||||
strscpy(nn->nfsd_name, utsname()->nodename,
|
||||
sizeof(nn->nfsd_name));
|
||||
|
||||
error = nfsd_create_serv(net);
|
||||
|
@ -338,10 +338,8 @@ nfssvc_decode_writeargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
|
||||
return false;
|
||||
if (args->len > NFSSVC_MAXBLKSIZE_V2)
|
||||
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
|
||||
|
@ -57,11 +57,11 @@ typedef struct {
|
||||
} stateid_t;
|
||||
|
||||
typedef struct {
|
||||
stateid_t stid;
|
||||
stateid_t cs_stid;
|
||||
#define NFS4_COPY_STID 1
|
||||
#define NFS4_COPYNOTIFY_STID 2
|
||||
unsigned char sc_type;
|
||||
refcount_t sc_count;
|
||||
unsigned char cs_type;
|
||||
refcount_t cs_count;
|
||||
} copy_stateid_t;
|
||||
|
||||
struct nfsd4_callback {
|
||||
@ -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 */
|
||||
#define NFSD_MAX_SLOTS_PER_SESSION 160
|
||||
/* 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 */
|
||||
#define NFSD_SLOT_CACHE_SIZE 2048
|
||||
/* Maximum number of NFSD_SLOT_CACHE_SIZE slots per session */
|
||||
@ -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_init_cb(struct nfsd4_callback *cb, struct nfs4_client *clp,
|
||||
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 void nfsd4_destroy_callback_queue(void);
|
||||
extern void nfsd4_shutdown_callback(struct nfs4_client *);
|
||||
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,
|
||||
struct xdr_netobj princhash, 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 = {
|
||||
.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;
|
||||
|
||||
@ -72,17 +72,7 @@ static int nfsd_proc_show(struct seq_file *seq, void *v)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int nfsd_proc_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
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,
|
||||
};
|
||||
DEFINE_PROC_SHOW_ATTRIBUTE(nfsd);
|
||||
|
||||
int nfsd_percpu_counters_init(struct percpu_counter counters[], int num)
|
||||
{
|
||||
|
131
fs/nfsd/trace.h
131
fs/nfsd/trace.h
@ -84,19 +84,26 @@ DEFINE_NFSD_XDR_ERR_EVENT(cant_encode);
|
||||
{ NFSD_MAY_64BIT_COOKIE, "64BIT_COOKIE" })
|
||||
|
||||
TRACE_EVENT(nfsd_compound,
|
||||
TP_PROTO(const struct svc_rqst *rqst,
|
||||
u32 args_opcnt),
|
||||
TP_ARGS(rqst, args_opcnt),
|
||||
TP_PROTO(
|
||||
const struct svc_rqst *rqst,
|
||||
const char *tag,
|
||||
u32 taglen,
|
||||
u32 opcnt
|
||||
),
|
||||
TP_ARGS(rqst, tag, taglen, opcnt),
|
||||
TP_STRUCT__entry(
|
||||
__field(u32, xid)
|
||||
__field(u32, args_opcnt)
|
||||
__field(u32, opcnt)
|
||||
__string_len(tag, tag, taglen)
|
||||
),
|
||||
TP_fast_assign(
|
||||
__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",
|
||||
__entry->xid, __entry->args_opcnt)
|
||||
TP_printk("xid=0x%08x opcnt=%u tag=%s",
|
||||
__entry->xid, __entry->opcnt, __get_str(tag)
|
||||
)
|
||||
)
|
||||
|
||||
TRACE_EVENT(nfsd_compound_status,
|
||||
@ -195,7 +202,7 @@ TRACE_EVENT(nfsd_fh_verify,
|
||||
__sockaddr(client, rqstp->rq_xprt->xpt_remotelen)
|
||||
__field(u32, xid)
|
||||
__field(u32, fh_hash)
|
||||
__field(void *, inode)
|
||||
__field(const void *, inode)
|
||||
__field(unsigned long, type)
|
||||
__field(unsigned long, access)
|
||||
),
|
||||
@ -211,13 +218,55 @@ TRACE_EVENT(nfsd_fh_verify,
|
||||
__entry->type = type;
|
||||
__entry->access = access;
|
||||
),
|
||||
TP_printk("xid=0x%08x fh_hash=0x%08x inode=%p type=%s access=%s",
|
||||
__entry->xid, __entry->fh_hash, __entry->inode,
|
||||
TP_printk("xid=0x%08x fh_hash=0x%08x type=%s access=%s",
|
||||
__entry->xid, __entry->fh_hash,
|
||||
show_fs_file_type(__entry->type),
|
||||
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,
|
||||
TP_PROTO(struct svc_rqst *rqstp,
|
||||
struct svc_fh *fhp,
|
||||
@ -489,6 +538,29 @@ DEFINE_NFSD_COPY_ERR_EVENT(clone_file_range_err);
|
||||
#include "filecache.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,
|
||||
TP_PROTO(stateid_t *stp),
|
||||
TP_ARGS(stp),
|
||||
@ -1399,6 +1471,45 @@ TRACE_EVENT(nfsd_cb_offload,
|
||||
__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 */
|
||||
|
||||
#undef TRACE_INCLUDE_PATH
|
||||
|
128
fs/nfsd/vfs.c
128
fs/nfsd/vfs.c
@ -343,8 +343,61 @@ nfsd_get_write_access(struct svc_rqst *rqstp, struct svc_fh *fhp,
|
||||
return nfserrno(get_write_access(inode));
|
||||
}
|
||||
|
||||
/*
|
||||
* Set various file attributes. After this call fhp needs an fh_put.
|
||||
static int __nfsd_setattr(struct dentry *dentry, struct iattr *iap)
|
||||
{
|
||||
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
|
||||
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;
|
||||
umode_t ftype = 0;
|
||||
__be32 err;
|
||||
int host_err = 0;
|
||||
int host_err;
|
||||
bool get_write_count;
|
||||
bool size_change = (iap->ia_valid & ATTR_SIZE);
|
||||
int retries;
|
||||
|
||||
if (iap->ia_valid & ATTR_SIZE) {
|
||||
accmode |= NFSD_MAY_WRITE|NFSD_MAY_OWNER_OVERRIDE;
|
||||
@ -414,43 +468,13 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp,
|
||||
}
|
||||
|
||||
inode_lock(inode);
|
||||
if (size_change) {
|
||||
/*
|
||||
* 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,
|
||||
};
|
||||
|
||||
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;
|
||||
for (retries = 1;;) {
|
||||
host_err = __nfsd_setattr(dentry, iap);
|
||||
if (host_err != -EAGAIN || !retries--)
|
||||
break;
|
||||
if (!nfsd_wait_for_delegreturn(rqstp, inode))
|
||||
break;
|
||||
}
|
||||
|
||||
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)
|
||||
attr->na_labelerr = security_inode_setsecctx(dentry,
|
||||
attr->na_seclabel->data, attr->na_seclabel->len);
|
||||
@ -1255,7 +1279,7 @@ nfsd_check_ignore_resizing(struct iattr *iap)
|
||||
/* The parent directory should already be locked: */
|
||||
__be32
|
||||
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)
|
||||
{
|
||||
struct dentry *dentry, *dchild;
|
||||
@ -1382,8 +1406,7 @@ nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp,
|
||||
if (err)
|
||||
goto out_unlock;
|
||||
fh_fill_pre_attrs(fhp);
|
||||
err = nfsd_create_locked(rqstp, fhp, fname, flen, attrs, type,
|
||||
rdev, resfhp);
|
||||
err = nfsd_create_locked(rqstp, fhp, attrs, type, rdev, resfhp);
|
||||
fh_fill_post_attrs(fhp);
|
||||
out_unlock:
|
||||
inode_unlock(dentry->d_inode);
|
||||
@ -1673,7 +1696,15 @@ retry:
|
||||
.new_dir = tdir,
|
||||
.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) {
|
||||
host_err = commit_metadata(tfhp);
|
||||
if (!host_err)
|
||||
@ -1757,9 +1788,18 @@ nfsd_unlink(struct svc_rqst *rqstp, struct svc_fh *fhp, int type,
|
||||
|
||||
fh_fill_pre_attrs(fhp);
|
||||
if (type != S_IFDIR) {
|
||||
int retries;
|
||||
|
||||
if (rdentry->d_sb->s_export_op->flags & EXPORT_OP_CLOSE_BEFORE_UNLINK)
|
||||
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 {
|
||||
host_err = vfs_rmdir(&init_user_ns, dirp, rdentry);
|
||||
}
|
||||
|
@ -79,8 +79,8 @@ __be32 nfsd4_clone_file_range(struct svc_rqst *rqstp,
|
||||
u64 count, bool sync);
|
||||
#endif /* CONFIG_NFSD_V4 */
|
||||
__be32 nfsd_create_locked(struct svc_rqst *, struct svc_fh *,
|
||||
char *name, int len, struct nfsd_attrs *attrs,
|
||||
int type, dev_t rdev, struct svc_fh *res);
|
||||
struct nfsd_attrs *attrs, int type, dev_t rdev,
|
||||
struct svc_fh *res);
|
||||
__be32 nfsd_create(struct svc_rqst *, struct svc_fh *,
|
||||
char *name, int len, struct nfsd_attrs *attrs,
|
||||
int type, dev_t rdev, struct svc_fh *res);
|
||||
|
@ -717,13 +717,13 @@ struct nfsd4_compoundargs {
|
||||
struct svcxdr_tmpbuf *to_free;
|
||||
struct svc_rqst *rqstp;
|
||||
|
||||
u32 taglen;
|
||||
char * tag;
|
||||
u32 taglen;
|
||||
u32 minorversion;
|
||||
u32 client_opcnt;
|
||||
u32 opcnt;
|
||||
struct nfsd4_op *ops;
|
||||
struct nfsd4_op iops[8];
|
||||
int cachetype;
|
||||
};
|
||||
|
||||
struct nfsd4_compoundres {
|
||||
@ -732,8 +732,8 @@ struct nfsd4_compoundres {
|
||||
struct svc_rqst * rqstp;
|
||||
|
||||
__be32 *statusp;
|
||||
u32 taglen;
|
||||
char * tag;
|
||||
u32 taglen;
|
||||
u32 opcnt;
|
||||
|
||||
struct nfsd4_compound_state cstate;
|
||||
@ -888,7 +888,8 @@ struct nfsd4_operation {
|
||||
u32 op_flags;
|
||||
char *op_name;
|
||||
/* 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 *,
|
||||
union nfsd4_op_u *);
|
||||
void (*op_set_currentstateid)(struct nfsd4_compound_state *,
|
||||
|
@ -472,6 +472,7 @@ struct svc_procedure {
|
||||
/* XDR free result: */
|
||||
void (*pc_release)(struct svc_rqst *);
|
||||
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_cachetype; /* cache info (NFS) */
|
||||
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)
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
* 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)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
@ -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;
|
||||
buf->len = resv->iov_len;
|
||||
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;
|
||||
xdr->rqst = NULL;
|
||||
}
|
||||
|
@ -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,
|
||||
__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 int xdr_reserve_space_vec(struct xdr_stream *xdr, struct kvec *vec,
|
||||
size_t nbytes);
|
||||
|
@ -1205,7 +1205,7 @@ svc_generic_init_request(struct svc_rqst *rqstp,
|
||||
goto err_bad_proc;
|
||||
|
||||
/* 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);
|
||||
|
||||
/* Bump per-procedure stats counter */
|
||||
@ -1434,8 +1434,7 @@ svc_process(struct svc_rqst *rqstp)
|
||||
{
|
||||
struct kvec *argv = &rqstp->rq_arg.head[0];
|
||||
struct kvec *resv = &rqstp->rq_res.head[0];
|
||||
struct svc_serv *serv = rqstp->rq_server;
|
||||
u32 dir;
|
||||
__be32 dir;
|
||||
|
||||
#if IS_ENABLED(CONFIG_FAIL_SUNRPC)
|
||||
if (!fail_sunrpc.ignore_server_disconnect &&
|
||||
@ -1450,7 +1449,7 @@ svc_process(struct svc_rqst *rqstp)
|
||||
rqstp->rq_next_page = &rqstp->rq_respages[1];
|
||||
resv->iov_base = page_address(rqstp->rq_respages[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.page_base = 0;
|
||||
rqstp->rq_res.page_len = 0;
|
||||
@ -1458,18 +1457,17 @@ svc_process(struct svc_rqst *rqstp)
|
||||
rqstp->rq_res.tail[0].iov_base = NULL;
|
||||
rqstp->rq_res.tail[0].iov_len = 0;
|
||||
|
||||
dir = svc_getnl(argv);
|
||||
if (dir != 0) {
|
||||
/* direction != CALL */
|
||||
svc_printk(rqstp, "bad direction %d, dropping request\n", dir);
|
||||
serv->sv_stats->rpcbadfmt++;
|
||||
dir = svc_getu32(argv);
|
||||
if (dir != rpc_call)
|
||||
goto out_baddir;
|
||||
if (!svc_process_common(rqstp, argv, resv))
|
||||
goto out_drop;
|
||||
}
|
||||
|
||||
/* Returns 1 for send, 0 for drop */
|
||||
if (likely(svc_process_common(rqstp, argv, resv)))
|
||||
return svc_send(rqstp);
|
||||
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:
|
||||
svc_drop(rqstp);
|
||||
return 0;
|
||||
@ -1556,8 +1554,12 @@ out:
|
||||
EXPORT_SYMBOL_GPL(bc_svc_process);
|
||||
#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)
|
||||
{
|
||||
|
@ -946,6 +946,28 @@ void xdr_init_encode(struct xdr_stream *xdr, struct xdr_buf *buf, __be32 *p,
|
||||
}
|
||||
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: pointer to xdr_stream
|
||||
@ -1575,7 +1597,7 @@ EXPORT_SYMBOL_GPL(xdr_buf_from_iov);
|
||||
*
|
||||
* @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,
|
||||
unsigned int base, unsigned int len)
|
||||
|
Loading…
Reference in New Issue
Block a user