Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

Pull nfsd updates from Bruce Fields:
"A slow cycle for nfsd: mainly cleanup, including Neil's patch dropping
support for a filehandle format deprecated 20 years ago, and further
xdr-related cleanup from Chuck"

* tag 'nfsd-5.16' of git://linux-nfs.org/~bfields/linux: (26 commits)
nfsd4: remove obselete comment
nfsd: document server-to-server-copy parameters
NFSD:fix boolreturn.cocci warning
nfsd: update create verifier comment
SUNRPC: Change return value type of .pc_encode
SUNRPC: Replace the "__be32 *p" parameter to .pc_encode
NFSD: Save location of NFSv4 COMPOUND status
SUNRPC: Change return value type of .pc_decode
SUNRPC: Replace the "__be32 *p" parameter to .pc_decode
SUNRPC: De-duplicate .pc_release() call sites
SUNRPC: Simplify the SVC dispatch code path
SUNRPC: Capture value of xdr_buf::page_base
SUNRPC: Add trace event when alloc_pages_bulk() makes no progress
svcrdma: Split svcrmda_wc_{read,write} tracepoints
svcrdma: Split the svcrdma_wc_send() tracepoint
svcrdma: Split the svcrdma_wc_receive() tracepoint
NFSD: Have legacy NFSD WRITE decoders use xdr_stream_subsegment()
SUNRPC: xdr_stream_subsegment() must handle non-zero page_bases
NFSD: Initialize pointer ni with NULL and not plain integer 0
NFSD: simplify struct nfsfh
...

+1149 -1044
+14
Documentation/admin-guide/kernel-parameters.txt
··· 3253 3253 driver. A non-zero value sets the minimum interval 3254 3254 in seconds between layoutstats transmissions. 3255 3255 3256 + nfsd.inter_copy_offload_enable = 3257 + [NFSv4.2] When set to 1, the server will support 3258 + server-to-server copies for which this server is 3259 + the destination of the copy. 3260 + 3261 + nfsd.nfsd4_ssc_umount_timeout = 3262 + [NFSv4.2] When used as the destination of a 3263 + server-to-server copy, knfsd temporarily mounts 3264 + the source server. It caches the mount in case 3265 + it will be needed again, and discards it if not 3266 + used for the number of milliseconds specified by 3267 + this parameter. 3268 + 3256 3269 nfsd.nfs4_disable_idmapping= 3257 3270 [NFSv4] When set to the default of '1', the NFSv4 3258 3271 server will return only numeric uids and gids to 3259 3272 clients using auth_sys, and will accept numeric uids 3260 3273 and gids from such clients. This is intended to ease 3261 3274 migration from NFSv2/v3. 3275 + 3262 3276 3263 3277 nmi_backtrace.backtrace_idle [KNL] 3264 3278 Dump stacks even of idle CPUs in response to an
+1
Documentation/filesystems/nfs/index.rst
··· 11 11 rpc-server-gss 12 12 nfs41-server 13 13 knfsd-stats 14 + reexport
+113
Documentation/filesystems/nfs/reexport.rst
··· 1 + Reexporting NFS filesystems 2 + =========================== 3 + 4 + Overview 5 + -------- 6 + 7 + It is possible to reexport an NFS filesystem over NFS. However, this 8 + feature comes with a number of limitations. Before trying it, we 9 + recommend some careful research to determine whether it will work for 10 + your purposes. 11 + 12 + A discussion of current known limitations follows. 13 + 14 + "fsid=" required, crossmnt broken 15 + --------------------------------- 16 + 17 + We require the "fsid=" export option on any reexport of an NFS 18 + filesystem. You can use "uuidgen -r" to generate a unique argument. 19 + 20 + The "crossmnt" export does not propagate "fsid=", so it will not allow 21 + traversing into further nfs filesystems; if you wish to export nfs 22 + filesystems mounted under the exported filesystem, you'll need to export 23 + them explicitly, assigning each its own unique "fsid= option. 24 + 25 + Reboot recovery 26 + --------------- 27 + 28 + The NFS protocol's normal reboot recovery mechanisms don't work for the 29 + case when the reexport server reboots. Clients will lose any locks 30 + they held before the reboot, and further IO will result in errors. 31 + Closing and reopening files should clear the errors. 32 + 33 + Filehandle limits 34 + ----------------- 35 + 36 + If the original server uses an X byte filehandle for a given object, the 37 + reexport server's filehandle for the reexported object will be X+22 38 + bytes, rounded up to the nearest multiple of four bytes. 39 + 40 + The result must fit into the RFC-mandated filehandle size limits: 41 + 42 + +-------+-----------+ 43 + | NFSv2 | 32 bytes | 44 + +-------+-----------+ 45 + | NFSv3 | 64 bytes | 46 + +-------+-----------+ 47 + | NFSv4 | 128 bytes | 48 + +-------+-----------+ 49 + 50 + So, for example, you will only be able to reexport a filesystem over 51 + NFSv2 if the original server gives you filehandles that fit in 10 52 + bytes--which is unlikely. 53 + 54 + In general there's no way to know the maximum filehandle size given out 55 + by an NFS server without asking the server vendor. 56 + 57 + But the following table gives a few examples. The first column is the 58 + typical length of the filehandle from a Linux server exporting the given 59 + filesystem, the second is the length after that nfs export is reexported 60 + by another Linux host: 61 + 62 + +--------+-------------------+----------------+ 63 + | | filehandle length | after reexport | 64 + +========+===================+================+ 65 + | ext4: | 28 bytes | 52 bytes | 66 + +--------+-------------------+----------------+ 67 + | xfs: | 32 bytes | 56 bytes | 68 + +--------+-------------------+----------------+ 69 + | btrfs: | 40 bytes | 64 bytes | 70 + +--------+-------------------+----------------+ 71 + 72 + All will therefore fit in an NFSv3 or NFSv4 filehandle after reexport, 73 + but none are reexportable over NFSv2. 74 + 75 + Linux server filehandles are a bit more complicated than this, though; 76 + for example: 77 + 78 + - The (non-default) "subtreecheck" export option generally 79 + requires another 4 to 8 bytes in the filehandle. 80 + - If you export a subdirectory of a filesystem (instead of 81 + exporting the filesystem root), that also usually adds 4 to 8 82 + bytes. 83 + - If you export over NFSv2, knfsd usually uses a shorter 84 + filesystem identifier that saves 8 bytes. 85 + - The root directory of an export uses a filehandle that is 86 + shorter. 87 + 88 + As you can see, the 128-byte NFSv4 filehandle is large enough that 89 + you're unlikely to have trouble using NFSv4 to reexport any filesystem 90 + exported from a Linux server. In general, if the original server is 91 + something that also supports NFSv3, you're *probably* OK. Re-exporting 92 + over NFSv3 may be dicier, and reexporting over NFSv2 will probably 93 + never work. 94 + 95 + For more details of Linux filehandle structure, the best reference is 96 + the source code and comments; see in particular: 97 + 98 + - include/linux/exportfs.h:enum fid_type 99 + - include/uapi/linux/nfsd/nfsfh.h:struct nfs_fhbase_new 100 + - fs/nfsd/nfsfh.c:set_version_and_fsid_type 101 + - fs/nfs/export.c:nfs_encode_fh 102 + 103 + Open DENY bits ignored 104 + ---------------------- 105 + 106 + NFS since NFSv4 supports ALLOW and DENY bits taken from Windows, which 107 + allow you, for example, to open a file in a mode which forbids other 108 + read opens or write opens. The Linux client doesn't use them, and the 109 + server's support has always been incomplete: they are enforced only 110 + against other NFS users, not against processes accessing the exported 111 + filesystem locally. A reexport server will also not pass them along to 112 + the original server, so they will not be enforced between clients of 113 + different reexport servers.
+2 -4
fs/lockd/svc.c
··· 780 780 static int nlmsvc_dispatch(struct svc_rqst *rqstp, __be32 *statp) 781 781 { 782 782 const struct svc_procedure *procp = rqstp->rq_procinfo; 783 - struct kvec *argv = rqstp->rq_arg.head; 784 - struct kvec *resv = rqstp->rq_res.head; 785 783 786 784 svcxdr_init_decode(rqstp); 787 - if (!procp->pc_decode(rqstp, argv->iov_base)) 785 + if (!procp->pc_decode(rqstp, &rqstp->rq_arg_stream)) 788 786 goto out_decode_err; 789 787 790 788 *statp = procp->pc_func(rqstp); ··· 792 794 return 1; 793 795 794 796 svcxdr_init_encode(rqstp); 795 - if (!procp->pc_encode(rqstp, resv->iov_base + resv->iov_len)) 797 + if (!procp->pc_encode(rqstp, &rqstp->rq_res_stream)) 796 798 goto out_encode_err; 797 799 798 800 return 1;
+71 -81
fs/lockd/xdr.c
··· 145 145 * Decode Call arguments 146 146 */ 147 147 148 - int 149 - nlmsvc_decode_void(struct svc_rqst *rqstp, __be32 *p) 148 + bool 149 + nlmsvc_decode_void(struct svc_rqst *rqstp, struct xdr_stream *xdr) 150 150 { 151 - return 1; 151 + return true; 152 152 } 153 153 154 - int 155 - nlmsvc_decode_testargs(struct svc_rqst *rqstp, __be32 *p) 154 + bool 155 + nlmsvc_decode_testargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) 156 156 { 157 - struct xdr_stream *xdr = &rqstp->rq_arg_stream; 158 157 struct nlm_args *argp = rqstp->rq_argp; 159 158 u32 exclusive; 160 159 161 160 if (!svcxdr_decode_cookie(xdr, &argp->cookie)) 162 - return 0; 161 + return false; 163 162 if (xdr_stream_decode_bool(xdr, &exclusive) < 0) 164 - return 0; 163 + return false; 165 164 if (!svcxdr_decode_lock(xdr, &argp->lock)) 166 - return 0; 165 + return false; 167 166 if (exclusive) 168 167 argp->lock.fl.fl_type = F_WRLCK; 169 168 170 - return 1; 169 + return true; 171 170 } 172 171 173 - int 174 - nlmsvc_decode_lockargs(struct svc_rqst *rqstp, __be32 *p) 172 + bool 173 + nlmsvc_decode_lockargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) 175 174 { 176 - struct xdr_stream *xdr = &rqstp->rq_arg_stream; 177 175 struct nlm_args *argp = rqstp->rq_argp; 178 176 u32 exclusive; 179 177 180 178 if (!svcxdr_decode_cookie(xdr, &argp->cookie)) 181 - return 0; 179 + return false; 182 180 if (xdr_stream_decode_bool(xdr, &argp->block) < 0) 183 - return 0; 181 + return false; 184 182 if (xdr_stream_decode_bool(xdr, &exclusive) < 0) 185 - return 0; 183 + return false; 186 184 if (!svcxdr_decode_lock(xdr, &argp->lock)) 187 - return 0; 185 + return false; 188 186 if (exclusive) 189 187 argp->lock.fl.fl_type = F_WRLCK; 190 188 if (xdr_stream_decode_bool(xdr, &argp->reclaim) < 0) 191 - return 0; 189 + return false; 192 190 if (xdr_stream_decode_u32(xdr, &argp->state) < 0) 193 - return 0; 191 + return false; 194 192 argp->monitor = 1; /* monitor client by default */ 195 193 196 - return 1; 194 + return true; 197 195 } 198 196 199 - int 200 - nlmsvc_decode_cancargs(struct svc_rqst *rqstp, __be32 *p) 197 + bool 198 + nlmsvc_decode_cancargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) 201 199 { 202 - struct xdr_stream *xdr = &rqstp->rq_arg_stream; 203 200 struct nlm_args *argp = rqstp->rq_argp; 204 201 u32 exclusive; 205 202 206 203 if (!svcxdr_decode_cookie(xdr, &argp->cookie)) 207 - return 0; 204 + return false; 208 205 if (xdr_stream_decode_bool(xdr, &argp->block) < 0) 209 - return 0; 206 + return false; 210 207 if (xdr_stream_decode_bool(xdr, &exclusive) < 0) 211 - return 0; 208 + return false; 212 209 if (!svcxdr_decode_lock(xdr, &argp->lock)) 213 - return 0; 210 + return false; 214 211 if (exclusive) 215 212 argp->lock.fl.fl_type = F_WRLCK; 216 213 217 - return 1; 214 + return true; 218 215 } 219 216 220 - int 221 - nlmsvc_decode_unlockargs(struct svc_rqst *rqstp, __be32 *p) 217 + bool 218 + nlmsvc_decode_unlockargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) 222 219 { 223 - struct xdr_stream *xdr = &rqstp->rq_arg_stream; 224 220 struct nlm_args *argp = rqstp->rq_argp; 225 221 226 222 if (!svcxdr_decode_cookie(xdr, &argp->cookie)) 227 - return 0; 223 + return false; 228 224 if (!svcxdr_decode_lock(xdr, &argp->lock)) 229 - return 0; 225 + return false; 230 226 argp->lock.fl.fl_type = F_UNLCK; 231 227 232 - return 1; 228 + return true; 233 229 } 234 230 235 - int 236 - nlmsvc_decode_res(struct svc_rqst *rqstp, __be32 *p) 231 + bool 232 + nlmsvc_decode_res(struct svc_rqst *rqstp, struct xdr_stream *xdr) 237 233 { 238 - struct xdr_stream *xdr = &rqstp->rq_arg_stream; 239 234 struct nlm_res *resp = rqstp->rq_argp; 240 235 241 236 if (!svcxdr_decode_cookie(xdr, &resp->cookie)) 242 - return 0; 237 + return false; 243 238 if (!svcxdr_decode_stats(xdr, &resp->status)) 244 - return 0; 239 + return false; 245 240 246 - return 1; 241 + return true; 247 242 } 248 243 249 - int 250 - nlmsvc_decode_reboot(struct svc_rqst *rqstp, __be32 *p) 244 + bool 245 + nlmsvc_decode_reboot(struct svc_rqst *rqstp, struct xdr_stream *xdr) 251 246 { 252 - struct xdr_stream *xdr = &rqstp->rq_arg_stream; 253 247 struct nlm_reboot *argp = rqstp->rq_argp; 248 + __be32 *p; 254 249 u32 len; 255 250 256 251 if (xdr_stream_decode_u32(xdr, &len) < 0) 257 - return 0; 252 + return false; 258 253 if (len > SM_MAXSTRLEN) 259 - return 0; 254 + return false; 260 255 p = xdr_inline_decode(xdr, len); 261 256 if (!p) 262 - return 0; 257 + return false; 263 258 argp->len = len; 264 259 argp->mon = (char *)p; 265 260 if (xdr_stream_decode_u32(xdr, &argp->state) < 0) 266 - return 0; 261 + return false; 267 262 p = xdr_inline_decode(xdr, SM_PRIV_SIZE); 268 263 if (!p) 269 - return 0; 264 + return false; 270 265 memcpy(&argp->priv.data, p, sizeof(argp->priv.data)); 271 266 272 - return 1; 267 + return true; 273 268 } 274 269 275 - int 276 - nlmsvc_decode_shareargs(struct svc_rqst *rqstp, __be32 *p) 270 + bool 271 + nlmsvc_decode_shareargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) 277 272 { 278 - struct xdr_stream *xdr = &rqstp->rq_arg_stream; 279 273 struct nlm_args *argp = rqstp->rq_argp; 280 274 struct nlm_lock *lock = &argp->lock; 281 275 ··· 278 284 lock->svid = ~(u32)0; 279 285 280 286 if (!svcxdr_decode_cookie(xdr, &argp->cookie)) 281 - return 0; 287 + return false; 282 288 if (!svcxdr_decode_string(xdr, &lock->caller, &lock->len)) 283 - return 0; 289 + return false; 284 290 if (!svcxdr_decode_fhandle(xdr, &lock->fh)) 285 - return 0; 291 + return false; 286 292 if (!svcxdr_decode_owner(xdr, &lock->oh)) 287 - return 0; 293 + return false; 288 294 /* XXX: Range checks are missing in the original code */ 289 295 if (xdr_stream_decode_u32(xdr, &argp->fsm_mode) < 0) 290 - return 0; 296 + return false; 291 297 if (xdr_stream_decode_u32(xdr, &argp->fsm_access) < 0) 292 - return 0; 298 + return false; 293 299 294 - return 1; 300 + return true; 295 301 } 296 302 297 - int 298 - nlmsvc_decode_notify(struct svc_rqst *rqstp, __be32 *p) 303 + bool 304 + nlmsvc_decode_notify(struct svc_rqst *rqstp, struct xdr_stream *xdr) 299 305 { 300 - struct xdr_stream *xdr = &rqstp->rq_arg_stream; 301 306 struct nlm_args *argp = rqstp->rq_argp; 302 307 struct nlm_lock *lock = &argp->lock; 303 308 304 309 if (!svcxdr_decode_string(xdr, &lock->caller, &lock->len)) 305 - return 0; 310 + return false; 306 311 if (xdr_stream_decode_u32(xdr, &argp->state) < 0) 307 - return 0; 312 + return false; 308 313 309 - return 1; 314 + return true; 310 315 } 311 316 312 317 ··· 313 320 * Encode Reply results 314 321 */ 315 322 316 - int 317 - nlmsvc_encode_void(struct svc_rqst *rqstp, __be32 *p) 323 + bool 324 + nlmsvc_encode_void(struct svc_rqst *rqstp, struct xdr_stream *xdr) 318 325 { 319 - return 1; 326 + return true; 320 327 } 321 328 322 - int 323 - nlmsvc_encode_testres(struct svc_rqst *rqstp, __be32 *p) 329 + bool 330 + nlmsvc_encode_testres(struct svc_rqst *rqstp, struct xdr_stream *xdr) 324 331 { 325 - struct xdr_stream *xdr = &rqstp->rq_res_stream; 326 332 struct nlm_res *resp = rqstp->rq_resp; 327 333 328 334 return svcxdr_encode_cookie(xdr, &resp->cookie) && 329 335 svcxdr_encode_testrply(xdr, resp); 330 336 } 331 337 332 - int 333 - nlmsvc_encode_res(struct svc_rqst *rqstp, __be32 *p) 338 + bool 339 + nlmsvc_encode_res(struct svc_rqst *rqstp, struct xdr_stream *xdr) 334 340 { 335 - struct xdr_stream *xdr = &rqstp->rq_res_stream; 336 341 struct nlm_res *resp = rqstp->rq_resp; 337 342 338 343 return svcxdr_encode_cookie(xdr, &resp->cookie) && 339 344 svcxdr_encode_stats(xdr, resp->status); 340 345 } 341 346 342 - int 343 - nlmsvc_encode_shareres(struct svc_rqst *rqstp, __be32 *p) 347 + bool 348 + nlmsvc_encode_shareres(struct svc_rqst *rqstp, struct xdr_stream *xdr) 344 349 { 345 - struct xdr_stream *xdr = &rqstp->rq_res_stream; 346 350 struct nlm_res *resp = rqstp->rq_resp; 347 351 348 352 if (!svcxdr_encode_cookie(xdr, &resp->cookie)) 349 - return 0; 353 + return false; 350 354 if (!svcxdr_encode_stats(xdr, resp->status)) 351 - return 0; 355 + return false; 352 356 /* sequence */ 353 357 if (xdr_stream_encode_u32(xdr, 0) < 0) 354 - return 0; 358 + return false; 355 359 356 - return 1; 360 + return true; 357 361 }
+72 -81
fs/lockd/xdr4.c
··· 144 144 * Decode Call arguments 145 145 */ 146 146 147 - int 148 - nlm4svc_decode_void(struct svc_rqst *rqstp, __be32 *p) 147 + bool 148 + nlm4svc_decode_void(struct svc_rqst *rqstp, struct xdr_stream *xdr) 149 149 { 150 - return 1; 150 + return true; 151 151 } 152 152 153 - int 154 - nlm4svc_decode_testargs(struct svc_rqst *rqstp, __be32 *p) 153 + bool 154 + nlm4svc_decode_testargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) 155 155 { 156 - struct xdr_stream *xdr = &rqstp->rq_arg_stream; 157 156 struct nlm_args *argp = rqstp->rq_argp; 158 157 u32 exclusive; 159 158 160 159 if (!svcxdr_decode_cookie(xdr, &argp->cookie)) 161 - return 0; 160 + return false; 162 161 if (xdr_stream_decode_bool(xdr, &exclusive) < 0) 163 - return 0; 162 + return false; 164 163 if (!svcxdr_decode_lock(xdr, &argp->lock)) 165 - return 0; 164 + return false; 166 165 if (exclusive) 167 166 argp->lock.fl.fl_type = F_WRLCK; 168 167 169 - return 1; 168 + return true; 170 169 } 171 170 172 - int 173 - nlm4svc_decode_lockargs(struct svc_rqst *rqstp, __be32 *p) 171 + bool 172 + nlm4svc_decode_lockargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) 174 173 { 175 - struct xdr_stream *xdr = &rqstp->rq_arg_stream; 176 174 struct nlm_args *argp = rqstp->rq_argp; 177 175 u32 exclusive; 178 176 179 177 if (!svcxdr_decode_cookie(xdr, &argp->cookie)) 180 - return 0; 178 + return false; 181 179 if (xdr_stream_decode_bool(xdr, &argp->block) < 0) 182 - return 0; 180 + return false; 183 181 if (xdr_stream_decode_bool(xdr, &exclusive) < 0) 184 - return 0; 182 + return false; 185 183 if (!svcxdr_decode_lock(xdr, &argp->lock)) 186 - return 0; 184 + return false; 187 185 if (exclusive) 188 186 argp->lock.fl.fl_type = F_WRLCK; 189 187 if (xdr_stream_decode_bool(xdr, &argp->reclaim) < 0) 190 - return 0; 188 + return false; 191 189 if (xdr_stream_decode_u32(xdr, &argp->state) < 0) 192 - return 0; 190 + return false; 193 191 argp->monitor = 1; /* monitor client by default */ 194 192 195 - return 1; 193 + return true; 196 194 } 197 195 198 - int 199 - nlm4svc_decode_cancargs(struct svc_rqst *rqstp, __be32 *p) 196 + bool 197 + nlm4svc_decode_cancargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) 200 198 { 201 - struct xdr_stream *xdr = &rqstp->rq_arg_stream; 202 199 struct nlm_args *argp = rqstp->rq_argp; 203 200 u32 exclusive; 204 201 205 202 if (!svcxdr_decode_cookie(xdr, &argp->cookie)) 206 - return 0; 203 + return false; 207 204 if (xdr_stream_decode_bool(xdr, &argp->block) < 0) 208 - return 0; 205 + return false; 209 206 if (xdr_stream_decode_bool(xdr, &exclusive) < 0) 210 - return 0; 207 + return false; 211 208 if (!svcxdr_decode_lock(xdr, &argp->lock)) 212 - return 0; 209 + return false; 213 210 if (exclusive) 214 211 argp->lock.fl.fl_type = F_WRLCK; 215 - return 1; 212 + 213 + return true; 216 214 } 217 215 218 - int 219 - nlm4svc_decode_unlockargs(struct svc_rqst *rqstp, __be32 *p) 216 + bool 217 + nlm4svc_decode_unlockargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) 220 218 { 221 - struct xdr_stream *xdr = &rqstp->rq_arg_stream; 222 219 struct nlm_args *argp = rqstp->rq_argp; 223 220 224 221 if (!svcxdr_decode_cookie(xdr, &argp->cookie)) 225 - return 0; 222 + return false; 226 223 if (!svcxdr_decode_lock(xdr, &argp->lock)) 227 - return 0; 224 + return false; 228 225 argp->lock.fl.fl_type = F_UNLCK; 229 226 230 - return 1; 227 + return true; 231 228 } 232 229 233 - int 234 - nlm4svc_decode_res(struct svc_rqst *rqstp, __be32 *p) 230 + bool 231 + nlm4svc_decode_res(struct svc_rqst *rqstp, struct xdr_stream *xdr) 235 232 { 236 - struct xdr_stream *xdr = &rqstp->rq_arg_stream; 237 233 struct nlm_res *resp = rqstp->rq_argp; 238 234 239 235 if (!svcxdr_decode_cookie(xdr, &resp->cookie)) 240 - return 0; 236 + return false; 241 237 if (!svcxdr_decode_stats(xdr, &resp->status)) 242 - return 0; 238 + return false; 243 239 244 - return 1; 240 + return true; 245 241 } 246 242 247 - int 248 - nlm4svc_decode_reboot(struct svc_rqst *rqstp, __be32 *p) 243 + bool 244 + nlm4svc_decode_reboot(struct svc_rqst *rqstp, struct xdr_stream *xdr) 249 245 { 250 - struct xdr_stream *xdr = &rqstp->rq_arg_stream; 251 246 struct nlm_reboot *argp = rqstp->rq_argp; 247 + __be32 *p; 252 248 u32 len; 253 249 254 250 if (xdr_stream_decode_u32(xdr, &len) < 0) 255 - return 0; 251 + return false; 256 252 if (len > SM_MAXSTRLEN) 257 - return 0; 253 + return false; 258 254 p = xdr_inline_decode(xdr, len); 259 255 if (!p) 260 - return 0; 256 + return false; 261 257 argp->len = len; 262 258 argp->mon = (char *)p; 263 259 if (xdr_stream_decode_u32(xdr, &argp->state) < 0) 264 - return 0; 260 + return false; 265 261 p = xdr_inline_decode(xdr, SM_PRIV_SIZE); 266 262 if (!p) 267 - return 0; 263 + return false; 268 264 memcpy(&argp->priv.data, p, sizeof(argp->priv.data)); 269 265 270 - return 1; 266 + return true; 271 267 } 272 268 273 - int 274 - nlm4svc_decode_shareargs(struct svc_rqst *rqstp, __be32 *p) 269 + bool 270 + nlm4svc_decode_shareargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) 275 271 { 276 - struct xdr_stream *xdr = &rqstp->rq_arg_stream; 277 272 struct nlm_args *argp = rqstp->rq_argp; 278 273 struct nlm_lock *lock = &argp->lock; 279 274 ··· 277 282 lock->svid = ~(u32)0; 278 283 279 284 if (!svcxdr_decode_cookie(xdr, &argp->cookie)) 280 - return 0; 285 + return false; 281 286 if (!svcxdr_decode_string(xdr, &lock->caller, &lock->len)) 282 - return 0; 287 + return false; 283 288 if (!svcxdr_decode_fhandle(xdr, &lock->fh)) 284 - return 0; 289 + return false; 285 290 if (!svcxdr_decode_owner(xdr, &lock->oh)) 286 - return 0; 291 + return false; 287 292 /* XXX: Range checks are missing in the original code */ 288 293 if (xdr_stream_decode_u32(xdr, &argp->fsm_mode) < 0) 289 - return 0; 294 + return false; 290 295 if (xdr_stream_decode_u32(xdr, &argp->fsm_access) < 0) 291 - return 0; 296 + return false; 292 297 293 - return 1; 298 + return true; 294 299 } 295 300 296 - int 297 - nlm4svc_decode_notify(struct svc_rqst *rqstp, __be32 *p) 301 + bool 302 + nlm4svc_decode_notify(struct svc_rqst *rqstp, struct xdr_stream *xdr) 298 303 { 299 - struct xdr_stream *xdr = &rqstp->rq_arg_stream; 300 304 struct nlm_args *argp = rqstp->rq_argp; 301 305 struct nlm_lock *lock = &argp->lock; 302 306 303 307 if (!svcxdr_decode_string(xdr, &lock->caller, &lock->len)) 304 - return 0; 308 + return false; 305 309 if (xdr_stream_decode_u32(xdr, &argp->state) < 0) 306 - return 0; 310 + return false; 307 311 308 - return 1; 312 + return true; 309 313 } 310 314 311 315 ··· 312 318 * Encode Reply results 313 319 */ 314 320 315 - int 316 - nlm4svc_encode_void(struct svc_rqst *rqstp, __be32 *p) 321 + bool 322 + nlm4svc_encode_void(struct svc_rqst *rqstp, struct xdr_stream *xdr) 317 323 { 318 - return 1; 324 + return true; 319 325 } 320 326 321 - int 322 - nlm4svc_encode_testres(struct svc_rqst *rqstp, __be32 *p) 327 + bool 328 + nlm4svc_encode_testres(struct svc_rqst *rqstp, struct xdr_stream *xdr) 323 329 { 324 - struct xdr_stream *xdr = &rqstp->rq_res_stream; 325 330 struct nlm_res *resp = rqstp->rq_resp; 326 331 327 332 return svcxdr_encode_cookie(xdr, &resp->cookie) && 328 333 svcxdr_encode_testrply(xdr, resp); 329 334 } 330 335 331 - int 332 - nlm4svc_encode_res(struct svc_rqst *rqstp, __be32 *p) 336 + bool 337 + nlm4svc_encode_res(struct svc_rqst *rqstp, struct xdr_stream *xdr) 333 338 { 334 - struct xdr_stream *xdr = &rqstp->rq_res_stream; 335 339 struct nlm_res *resp = rqstp->rq_resp; 336 340 337 341 return svcxdr_encode_cookie(xdr, &resp->cookie) && 338 342 svcxdr_encode_stats(xdr, resp->status); 339 343 } 340 344 341 - int 342 - nlm4svc_encode_shareres(struct svc_rqst *rqstp, __be32 *p) 345 + bool 346 + nlm4svc_encode_shareres(struct svc_rqst *rqstp, struct xdr_stream *xdr) 343 347 { 344 - struct xdr_stream *xdr = &rqstp->rq_res_stream; 345 348 struct nlm_res *resp = rqstp->rq_resp; 346 349 347 350 if (!svcxdr_encode_cookie(xdr, &resp->cookie)) 348 - return 0; 351 + return false; 349 352 if (!svcxdr_encode_stats(xdr, resp->status)) 350 - return 0; 353 + return false; 351 354 /* sequence */ 352 355 if (xdr_stream_encode_u32(xdr, 0) < 0) 353 - return 0; 356 + return false; 354 357 355 - return 1; 358 + return true; 356 359 }
+2 -2
fs/nfs/callback_xdr.c
··· 67 67 * svc_process_common() looks for an XDR encoder to know when 68 68 * not to drop a Reply. 69 69 */ 70 - static int nfs4_encode_void(struct svc_rqst *rqstp, __be32 *p) 70 + static bool nfs4_encode_void(struct svc_rqst *rqstp, struct xdr_stream *xdr) 71 71 { 72 - return xdr_ressize_check(rqstp, p); 72 + return true; 73 73 } 74 74 75 75 static __be32 decode_string(struct xdr_stream *xdr, unsigned int *len,
+1 -1
fs/nfsd/flexfilelayout.c
··· 61 61 goto out_error; 62 62 63 63 fl->fh.size = fhp->fh_handle.fh_size; 64 - memcpy(fl->fh.data, &fhp->fh_handle.fh_base, fl->fh.size); 64 + memcpy(fl->fh.data, &fhp->fh_handle.fh_raw, fl->fh.size); 65 65 66 66 /* Give whole file layout segments */ 67 67 seg->offset = 0;
+1 -1
fs/nfsd/lockd.c
··· 35 35 /* must initialize before using! but maxsize doesn't matter */ 36 36 fh_init(&fh,0); 37 37 fh.fh_handle.fh_size = f->size; 38 - memcpy((char*)&fh.fh_handle.fh_base, f->data, f->size); 38 + memcpy(&fh.fh_handle.fh_raw, f->data, f->size); 39 39 fh.fh_export = NULL; 40 40 41 41 access = (mode == O_WRONLY) ? NFSD_MAY_WRITE : NFSD_MAY_READ;
+22 -22
fs/nfsd/nfs2acl.c
··· 188 188 * XDR decode functions 189 189 */ 190 190 191 - static int nfsaclsvc_decode_getaclargs(struct svc_rqst *rqstp, __be32 *p) 191 + static bool 192 + nfsaclsvc_decode_getaclargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) 192 193 { 193 - struct xdr_stream *xdr = &rqstp->rq_arg_stream; 194 194 struct nfsd3_getaclargs *argp = rqstp->rq_argp; 195 195 196 196 if (!svcxdr_decode_fhandle(xdr, &argp->fh)) 197 - return 0; 197 + return false; 198 198 if (xdr_stream_decode_u32(xdr, &argp->mask) < 0) 199 - return 0; 199 + return false; 200 200 201 - return 1; 201 + return true; 202 202 } 203 203 204 - static int nfsaclsvc_decode_setaclargs(struct svc_rqst *rqstp, __be32 *p) 204 + static bool 205 + nfsaclsvc_decode_setaclargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) 205 206 { 206 - struct xdr_stream *xdr = &rqstp->rq_arg_stream; 207 207 struct nfsd3_setaclargs *argp = rqstp->rq_argp; 208 208 209 209 if (!svcxdr_decode_fhandle(xdr, &argp->fh)) 210 - return 0; 210 + return false; 211 211 if (xdr_stream_decode_u32(xdr, &argp->mask) < 0) 212 - return 0; 212 + return false; 213 213 if (argp->mask & ~NFS_ACL_MASK) 214 - return 0; 214 + return false; 215 215 if (!nfs_stream_decode_acl(xdr, NULL, (argp->mask & NFS_ACL) ? 216 216 &argp->acl_access : NULL)) 217 - return 0; 217 + return false; 218 218 if (!nfs_stream_decode_acl(xdr, NULL, (argp->mask & NFS_DFACL) ? 219 219 &argp->acl_default : NULL)) 220 - return 0; 220 + return false; 221 221 222 - return 1; 222 + return true; 223 223 } 224 224 225 - static int nfsaclsvc_decode_accessargs(struct svc_rqst *rqstp, __be32 *p) 225 + static bool 226 + nfsaclsvc_decode_accessargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) 226 227 { 227 - struct xdr_stream *xdr = &rqstp->rq_arg_stream; 228 228 struct nfsd3_accessargs *args = rqstp->rq_argp; 229 229 230 230 if (!svcxdr_decode_fhandle(xdr, &args->fh)) 231 - return 0; 231 + return false; 232 232 if (xdr_stream_decode_u32(xdr, &args->access) < 0) 233 - return 0; 233 + return false; 234 234 235 - return 1; 235 + return true; 236 236 } 237 237 238 238 /* ··· 240 240 */ 241 241 242 242 /* GETACL */ 243 - static int nfsaclsvc_encode_getaclres(struct svc_rqst *rqstp, __be32 *p) 243 + static bool 244 + nfsaclsvc_encode_getaclres(struct svc_rqst *rqstp, struct xdr_stream *xdr) 244 245 { 245 - struct xdr_stream *xdr = &rqstp->rq_res_stream; 246 246 struct nfsd3_getaclres *resp = rqstp->rq_resp; 247 247 struct dentry *dentry = resp->fh.fh_dentry; 248 248 struct inode *inode; ··· 280 280 } 281 281 282 282 /* ACCESS */ 283 - static int nfsaclsvc_encode_accessres(struct svc_rqst *rqstp, __be32 *p) 283 + static bool 284 + nfsaclsvc_encode_accessres(struct svc_rqst *rqstp, struct xdr_stream *xdr) 284 285 { 285 - struct xdr_stream *xdr = &rqstp->rq_res_stream; 286 286 struct nfsd3_accessres *resp = rqstp->rq_resp; 287 287 288 288 if (!svcxdr_encode_stat(xdr, resp->status))
+24 -24
fs/nfsd/nfs3acl.c
··· 127 127 * XDR decode functions 128 128 */ 129 129 130 - static int nfs3svc_decode_getaclargs(struct svc_rqst *rqstp, __be32 *p) 130 + static bool 131 + nfs3svc_decode_getaclargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) 131 132 { 132 - struct xdr_stream *xdr = &rqstp->rq_arg_stream; 133 133 struct nfsd3_getaclargs *args = rqstp->rq_argp; 134 134 135 135 if (!svcxdr_decode_nfs_fh3(xdr, &args->fh)) 136 - return 0; 136 + return false; 137 137 if (xdr_stream_decode_u32(xdr, &args->mask) < 0) 138 - return 0; 138 + return false; 139 139 140 - return 1; 140 + return true; 141 141 } 142 142 143 - static int nfs3svc_decode_setaclargs(struct svc_rqst *rqstp, __be32 *p) 143 + static bool 144 + nfs3svc_decode_setaclargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) 144 145 { 145 - struct xdr_stream *xdr = &rqstp->rq_arg_stream; 146 146 struct nfsd3_setaclargs *argp = rqstp->rq_argp; 147 147 148 148 if (!svcxdr_decode_nfs_fh3(xdr, &argp->fh)) 149 - return 0; 149 + return false; 150 150 if (xdr_stream_decode_u32(xdr, &argp->mask) < 0) 151 - return 0; 151 + return false; 152 152 if (argp->mask & ~NFS_ACL_MASK) 153 - return 0; 153 + return false; 154 154 if (!nfs_stream_decode_acl(xdr, NULL, (argp->mask & NFS_ACL) ? 155 155 &argp->acl_access : NULL)) 156 - return 0; 156 + return false; 157 157 if (!nfs_stream_decode_acl(xdr, NULL, (argp->mask & NFS_DFACL) ? 158 158 &argp->acl_default : NULL)) 159 - return 0; 159 + return false; 160 160 161 - return 1; 161 + return true; 162 162 } 163 163 164 164 /* ··· 166 166 */ 167 167 168 168 /* GETACL */ 169 - static int nfs3svc_encode_getaclres(struct svc_rqst *rqstp, __be32 *p) 169 + static bool 170 + nfs3svc_encode_getaclres(struct svc_rqst *rqstp, struct xdr_stream *xdr) 170 171 { 171 - struct xdr_stream *xdr = &rqstp->rq_res_stream; 172 172 struct nfsd3_getaclres *resp = rqstp->rq_resp; 173 173 struct dentry *dentry = resp->fh.fh_dentry; 174 174 struct kvec *head = rqstp->rq_res.head; ··· 178 178 int w; 179 179 180 180 if (!svcxdr_encode_nfsstat3(xdr, resp->status)) 181 - return 0; 181 + return false; 182 182 switch (resp->status) { 183 183 case nfs_ok: 184 184 inode = d_inode(dentry); 185 185 if (!svcxdr_encode_post_op_attr(rqstp, xdr, &resp->fh)) 186 - return 0; 186 + return false; 187 187 if (xdr_stream_encode_u32(xdr, resp->mask) < 0) 188 - return 0; 188 + return false; 189 189 190 190 base = (char *)xdr->p - (char *)head->iov_base; 191 191 ··· 194 194 (resp->mask & NFS_DFACL) ? resp->acl_default : NULL); 195 195 while (w > 0) { 196 196 if (!*(rqstp->rq_next_page++)) 197 - return 0; 197 + return false; 198 198 w -= PAGE_SIZE; 199 199 } 200 200 ··· 207 207 resp->mask & NFS_DFACL, 208 208 NFS_ACL_DEFAULT); 209 209 if (n <= 0) 210 - return 0; 210 + return false; 211 211 break; 212 212 default: 213 213 if (!svcxdr_encode_post_op_attr(rqstp, xdr, &resp->fh)) 214 - return 0; 214 + return false; 215 215 } 216 216 217 - return 1; 217 + return true; 218 218 } 219 219 220 220 /* SETACL */ 221 - static int nfs3svc_encode_setaclres(struct svc_rqst *rqstp, __be32 *p) 221 + static bool 222 + nfs3svc_encode_setaclres(struct svc_rqst *rqstp, struct xdr_stream *xdr) 222 223 { 223 - struct xdr_stream *xdr = &rqstp->rq_res_stream; 224 224 struct nfsd3_attrstat *resp = rqstp->rq_resp; 225 225 226 226 return svcxdr_encode_nfsstat3(xdr, resp->status) &&
+1 -2
fs/nfsd/nfs3proc.c
··· 201 201 202 202 fh_copy(&resp->fh, &argp->fh); 203 203 resp->committed = argp->stable; 204 - nvecs = svc_fill_write_vector(rqstp, rqstp->rq_arg.pages, 205 - &argp->first, cnt); 204 + nvecs = svc_fill_write_vector(rqstp, &argp->payload); 206 205 if (!nvecs) { 207 206 resp->status = nfserr_io; 208 207 goto out;
+175 -212
fs/nfsd/nfs3xdr.c
··· 92 92 return false; 93 93 fh_init(fhp, NFS3_FHSIZE); 94 94 fhp->fh_handle.fh_size = size; 95 - memcpy(&fhp->fh_handle.fh_base, p, size); 95 + memcpy(&fhp->fh_handle.fh_raw, p, size); 96 96 97 97 return true; 98 98 } ··· 131 131 *p++ = cpu_to_be32(size); 132 132 if (size) 133 133 p[XDR_QUADLEN(size) - 1] = 0; 134 - memcpy(p, &fhp->fh_handle.fh_base, size); 134 + memcpy(p, &fhp->fh_handle.fh_raw, size); 135 135 136 136 return true; 137 137 } ··· 556 556 * XDR decode functions 557 557 */ 558 558 559 - int 560 - nfs3svc_decode_fhandleargs(struct svc_rqst *rqstp, __be32 *p) 559 + bool 560 + nfs3svc_decode_fhandleargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) 561 561 { 562 - struct xdr_stream *xdr = &rqstp->rq_arg_stream; 563 562 struct nfsd_fhandle *args = rqstp->rq_argp; 564 563 565 564 return svcxdr_decode_nfs_fh3(xdr, &args->fh); 566 565 } 567 566 568 - int 569 - nfs3svc_decode_sattrargs(struct svc_rqst *rqstp, __be32 *p) 567 + bool 568 + nfs3svc_decode_sattrargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) 570 569 { 571 - struct xdr_stream *xdr = &rqstp->rq_arg_stream; 572 570 struct nfsd3_sattrargs *args = rqstp->rq_argp; 573 571 574 572 return svcxdr_decode_nfs_fh3(xdr, &args->fh) && ··· 574 576 svcxdr_decode_sattrguard3(xdr, args); 575 577 } 576 578 577 - int 578 - nfs3svc_decode_diropargs(struct svc_rqst *rqstp, __be32 *p) 579 + bool 580 + nfs3svc_decode_diropargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) 579 581 { 580 - struct xdr_stream *xdr = &rqstp->rq_arg_stream; 581 582 struct nfsd3_diropargs *args = rqstp->rq_argp; 582 583 583 584 return svcxdr_decode_diropargs3(xdr, &args->fh, &args->name, &args->len); 584 585 } 585 586 586 - int 587 - nfs3svc_decode_accessargs(struct svc_rqst *rqstp, __be32 *p) 587 + bool 588 + nfs3svc_decode_accessargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) 588 589 { 589 - struct xdr_stream *xdr = &rqstp->rq_arg_stream; 590 590 struct nfsd3_accessargs *args = rqstp->rq_argp; 591 591 592 592 if (!svcxdr_decode_nfs_fh3(xdr, &args->fh)) 593 - return 0; 593 + return false; 594 594 if (xdr_stream_decode_u32(xdr, &args->access) < 0) 595 - return 0; 595 + return false; 596 596 597 - return 1; 597 + return true; 598 598 } 599 599 600 - int 601 - nfs3svc_decode_readargs(struct svc_rqst *rqstp, __be32 *p) 600 + bool 601 + nfs3svc_decode_readargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) 602 602 { 603 - struct xdr_stream *xdr = &rqstp->rq_arg_stream; 604 603 struct nfsd3_readargs *args = rqstp->rq_argp; 605 604 606 605 if (!svcxdr_decode_nfs_fh3(xdr, &args->fh)) 607 - return 0; 606 + return false; 608 607 if (xdr_stream_decode_u64(xdr, &args->offset) < 0) 609 - return 0; 608 + return false; 610 609 if (xdr_stream_decode_u32(xdr, &args->count) < 0) 611 - return 0; 610 + return false; 612 611 613 - return 1; 612 + return true; 614 613 } 615 614 616 - int 617 - nfs3svc_decode_writeargs(struct svc_rqst *rqstp, __be32 *p) 615 + bool 616 + nfs3svc_decode_writeargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) 618 617 { 619 - struct xdr_stream *xdr = &rqstp->rq_arg_stream; 620 618 struct nfsd3_writeargs *args = rqstp->rq_argp; 621 619 u32 max_blocksize = svc_max_payload(rqstp); 622 - struct kvec *head = rqstp->rq_arg.head; 623 - struct kvec *tail = rqstp->rq_arg.tail; 624 - size_t remaining; 625 620 626 621 if (!svcxdr_decode_nfs_fh3(xdr, &args->fh)) 627 - return 0; 622 + return false; 628 623 if (xdr_stream_decode_u64(xdr, &args->offset) < 0) 629 - return 0; 624 + return false; 630 625 if (xdr_stream_decode_u32(xdr, &args->count) < 0) 631 - return 0; 626 + return false; 632 627 if (xdr_stream_decode_u32(xdr, &args->stable) < 0) 633 - return 0; 628 + return false; 634 629 635 630 /* opaque data */ 636 631 if (xdr_stream_decode_u32(xdr, &args->len) < 0) 637 - return 0; 632 + return false; 638 633 639 634 /* request sanity */ 640 635 if (args->count != args->len) 641 - return 0; 642 - remaining = head->iov_len + rqstp->rq_arg.page_len + tail->iov_len; 643 - remaining -= xdr_stream_pos(xdr); 644 - if (remaining < xdr_align_size(args->len)) 645 - return 0; 636 + return false; 646 637 if (args->count > max_blocksize) { 647 638 args->count = max_blocksize; 648 639 args->len = max_blocksize; 649 640 } 641 + if (!xdr_stream_subsegment(xdr, &args->payload, args->count)) 642 + return false; 650 643 651 - args->first.iov_base = xdr->p; 652 - args->first.iov_len = head->iov_len - xdr_stream_pos(xdr); 653 - 654 - return 1; 644 + return true; 655 645 } 656 646 657 - int 658 - nfs3svc_decode_createargs(struct svc_rqst *rqstp, __be32 *p) 647 + bool 648 + nfs3svc_decode_createargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) 659 649 { 660 - struct xdr_stream *xdr = &rqstp->rq_arg_stream; 661 650 struct nfsd3_createargs *args = rqstp->rq_argp; 662 651 663 652 if (!svcxdr_decode_diropargs3(xdr, &args->fh, &args->name, &args->len)) 664 - return 0; 653 + return false; 665 654 if (xdr_stream_decode_u32(xdr, &args->createmode) < 0) 666 - return 0; 655 + return false; 667 656 switch (args->createmode) { 668 657 case NFS3_CREATE_UNCHECKED: 669 658 case NFS3_CREATE_GUARDED: ··· 658 673 case NFS3_CREATE_EXCLUSIVE: 659 674 args->verf = xdr_inline_decode(xdr, NFS3_CREATEVERFSIZE); 660 675 if (!args->verf) 661 - return 0; 676 + return false; 662 677 break; 663 678 default: 664 - return 0; 679 + return false; 665 680 } 666 - return 1; 681 + return true; 667 682 } 668 683 669 - int 670 - nfs3svc_decode_mkdirargs(struct svc_rqst *rqstp, __be32 *p) 684 + bool 685 + nfs3svc_decode_mkdirargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) 671 686 { 672 - struct xdr_stream *xdr = &rqstp->rq_arg_stream; 673 687 struct nfsd3_createargs *args = rqstp->rq_argp; 674 688 675 689 return svcxdr_decode_diropargs3(xdr, &args->fh, ··· 676 692 svcxdr_decode_sattr3(rqstp, xdr, &args->attrs); 677 693 } 678 694 679 - int 680 - nfs3svc_decode_symlinkargs(struct svc_rqst *rqstp, __be32 *p) 695 + bool 696 + nfs3svc_decode_symlinkargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) 681 697 { 682 - struct xdr_stream *xdr = &rqstp->rq_arg_stream; 683 698 struct nfsd3_symlinkargs *args = rqstp->rq_argp; 684 699 struct kvec *head = rqstp->rq_arg.head; 685 700 struct kvec *tail = rqstp->rq_arg.tail; 686 701 size_t remaining; 687 702 688 703 if (!svcxdr_decode_diropargs3(xdr, &args->ffh, &args->fname, &args->flen)) 689 - return 0; 704 + return false; 690 705 if (!svcxdr_decode_sattr3(rqstp, xdr, &args->attrs)) 691 - return 0; 706 + return false; 692 707 if (xdr_stream_decode_u32(xdr, &args->tlen) < 0) 693 - return 0; 708 + return false; 694 709 695 710 /* request sanity */ 696 711 remaining = head->iov_len + rqstp->rq_arg.page_len + tail->iov_len; 697 712 remaining -= xdr_stream_pos(xdr); 698 713 if (remaining < xdr_align_size(args->tlen)) 699 - return 0; 714 + return false; 700 715 701 716 args->first.iov_base = xdr->p; 702 717 args->first.iov_len = head->iov_len - xdr_stream_pos(xdr); 703 718 704 - return 1; 719 + return true; 705 720 } 706 721 707 - int 708 - nfs3svc_decode_mknodargs(struct svc_rqst *rqstp, __be32 *p) 722 + bool 723 + nfs3svc_decode_mknodargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) 709 724 { 710 - struct xdr_stream *xdr = &rqstp->rq_arg_stream; 711 725 struct nfsd3_mknodargs *args = rqstp->rq_argp; 712 726 713 727 if (!svcxdr_decode_diropargs3(xdr, &args->fh, &args->name, &args->len)) 714 - return 0; 728 + return false; 715 729 if (xdr_stream_decode_u32(xdr, &args->ftype) < 0) 716 - return 0; 730 + return false; 717 731 switch (args->ftype) { 718 732 case NF3CHR: 719 733 case NF3BLK: ··· 725 743 /* Valid XDR but illegal file types */ 726 744 break; 727 745 default: 728 - return 0; 746 + return false; 729 747 } 730 748 731 - return 1; 749 + return true; 732 750 } 733 751 734 - int 735 - nfs3svc_decode_renameargs(struct svc_rqst *rqstp, __be32 *p) 752 + bool 753 + nfs3svc_decode_renameargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) 736 754 { 737 - struct xdr_stream *xdr = &rqstp->rq_arg_stream; 738 755 struct nfsd3_renameargs *args = rqstp->rq_argp; 739 756 740 757 return svcxdr_decode_diropargs3(xdr, &args->ffh, ··· 742 761 &args->tname, &args->tlen); 743 762 } 744 763 745 - int 746 - nfs3svc_decode_linkargs(struct svc_rqst *rqstp, __be32 *p) 764 + bool 765 + nfs3svc_decode_linkargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) 747 766 { 748 - struct xdr_stream *xdr = &rqstp->rq_arg_stream; 749 767 struct nfsd3_linkargs *args = rqstp->rq_argp; 750 768 751 769 return svcxdr_decode_nfs_fh3(xdr, &args->ffh) && ··· 752 772 &args->tname, &args->tlen); 753 773 } 754 774 755 - int 756 - nfs3svc_decode_readdirargs(struct svc_rqst *rqstp, __be32 *p) 775 + bool 776 + nfs3svc_decode_readdirargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) 757 777 { 758 - struct xdr_stream *xdr = &rqstp->rq_arg_stream; 759 778 struct nfsd3_readdirargs *args = rqstp->rq_argp; 760 779 761 780 if (!svcxdr_decode_nfs_fh3(xdr, &args->fh)) 762 - return 0; 781 + return false; 763 782 if (xdr_stream_decode_u64(xdr, &args->cookie) < 0) 764 - return 0; 783 + return false; 765 784 args->verf = xdr_inline_decode(xdr, NFS3_COOKIEVERFSIZE); 766 785 if (!args->verf) 767 - return 0; 786 + return false; 768 787 if (xdr_stream_decode_u32(xdr, &args->count) < 0) 769 - return 0; 788 + return false; 770 789 771 - return 1; 790 + return true; 772 791 } 773 792 774 - int 775 - nfs3svc_decode_readdirplusargs(struct svc_rqst *rqstp, __be32 *p) 793 + bool 794 + nfs3svc_decode_readdirplusargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) 776 795 { 777 - struct xdr_stream *xdr = &rqstp->rq_arg_stream; 778 796 struct nfsd3_readdirargs *args = rqstp->rq_argp; 779 797 u32 dircount; 780 798 781 799 if (!svcxdr_decode_nfs_fh3(xdr, &args->fh)) 782 - return 0; 800 + return false; 783 801 if (xdr_stream_decode_u64(xdr, &args->cookie) < 0) 784 - return 0; 802 + return false; 785 803 args->verf = xdr_inline_decode(xdr, NFS3_COOKIEVERFSIZE); 786 804 if (!args->verf) 787 - return 0; 805 + return false; 788 806 /* dircount is ignored */ 789 807 if (xdr_stream_decode_u32(xdr, &dircount) < 0) 790 - return 0; 808 + return false; 791 809 if (xdr_stream_decode_u32(xdr, &args->count) < 0) 792 - return 0; 810 + return false; 793 811 794 - return 1; 812 + return true; 795 813 } 796 814 797 - int 798 - nfs3svc_decode_commitargs(struct svc_rqst *rqstp, __be32 *p) 815 + bool 816 + nfs3svc_decode_commitargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) 799 817 { 800 - struct xdr_stream *xdr = &rqstp->rq_arg_stream; 801 818 struct nfsd3_commitargs *args = rqstp->rq_argp; 802 819 803 820 if (!svcxdr_decode_nfs_fh3(xdr, &args->fh)) 804 - return 0; 821 + return false; 805 822 if (xdr_stream_decode_u64(xdr, &args->offset) < 0) 806 - return 0; 823 + return false; 807 824 if (xdr_stream_decode_u32(xdr, &args->count) < 0) 808 - return 0; 825 + return false; 809 826 810 - return 1; 827 + return true; 811 828 } 812 829 813 830 /* ··· 812 835 */ 813 836 814 837 /* GETATTR */ 815 - int 816 - nfs3svc_encode_getattrres(struct svc_rqst *rqstp, __be32 *p) 838 + bool 839 + nfs3svc_encode_getattrres(struct svc_rqst *rqstp, struct xdr_stream *xdr) 817 840 { 818 - struct xdr_stream *xdr = &rqstp->rq_res_stream; 819 841 struct nfsd3_attrstat *resp = rqstp->rq_resp; 820 842 821 843 if (!svcxdr_encode_nfsstat3(xdr, resp->status)) 822 - return 0; 844 + return false; 823 845 switch (resp->status) { 824 846 case nfs_ok: 825 847 lease_get_mtime(d_inode(resp->fh.fh_dentry), &resp->stat.mtime); 826 848 if (!svcxdr_encode_fattr3(rqstp, xdr, &resp->fh, &resp->stat)) 827 - return 0; 849 + return false; 828 850 break; 829 851 } 830 852 831 - return 1; 853 + return true; 832 854 } 833 855 834 856 /* SETATTR, REMOVE, RMDIR */ 835 - int 836 - nfs3svc_encode_wccstat(struct svc_rqst *rqstp, __be32 *p) 857 + bool 858 + nfs3svc_encode_wccstat(struct svc_rqst *rqstp, struct xdr_stream *xdr) 837 859 { 838 - struct xdr_stream *xdr = &rqstp->rq_res_stream; 839 860 struct nfsd3_attrstat *resp = rqstp->rq_resp; 840 861 841 862 return svcxdr_encode_nfsstat3(xdr, resp->status) && ··· 841 866 } 842 867 843 868 /* LOOKUP */ 844 - int nfs3svc_encode_lookupres(struct svc_rqst *rqstp, __be32 *p) 869 + bool 870 + nfs3svc_encode_lookupres(struct svc_rqst *rqstp, struct xdr_stream *xdr) 845 871 { 846 - struct xdr_stream *xdr = &rqstp->rq_res_stream; 847 872 struct nfsd3_diropres *resp = rqstp->rq_resp; 848 873 849 874 if (!svcxdr_encode_nfsstat3(xdr, resp->status)) 850 - return 0; 875 + return false; 851 876 switch (resp->status) { 852 877 case nfs_ok: 853 878 if (!svcxdr_encode_nfs_fh3(xdr, &resp->fh)) 854 - return 0; 879 + return false; 855 880 if (!svcxdr_encode_post_op_attr(rqstp, xdr, &resp->fh)) 856 - return 0; 881 + return false; 857 882 if (!svcxdr_encode_post_op_attr(rqstp, xdr, &resp->dirfh)) 858 - return 0; 883 + return false; 859 884 break; 860 885 default: 861 886 if (!svcxdr_encode_post_op_attr(rqstp, xdr, &resp->dirfh)) 862 - return 0; 887 + return false; 863 888 } 864 889 865 - return 1; 890 + return true; 866 891 } 867 892 868 893 /* ACCESS */ 869 - int 870 - nfs3svc_encode_accessres(struct svc_rqst *rqstp, __be32 *p) 894 + bool 895 + nfs3svc_encode_accessres(struct svc_rqst *rqstp, struct xdr_stream *xdr) 871 896 { 872 - struct xdr_stream *xdr = &rqstp->rq_res_stream; 873 897 struct nfsd3_accessres *resp = rqstp->rq_resp; 874 898 875 899 if (!svcxdr_encode_nfsstat3(xdr, resp->status)) 876 - return 0; 900 + return false; 877 901 switch (resp->status) { 878 902 case nfs_ok: 879 903 if (!svcxdr_encode_post_op_attr(rqstp, xdr, &resp->fh)) 880 - return 0; 904 + return false; 881 905 if (xdr_stream_encode_u32(xdr, resp->access) < 0) 882 - return 0; 906 + return false; 883 907 break; 884 908 default: 885 909 if (!svcxdr_encode_post_op_attr(rqstp, xdr, &resp->fh)) 886 - return 0; 910 + return false; 887 911 } 888 912 889 - return 1; 913 + return true; 890 914 } 891 915 892 916 /* READLINK */ 893 - int 894 - nfs3svc_encode_readlinkres(struct svc_rqst *rqstp, __be32 *p) 917 + bool 918 + nfs3svc_encode_readlinkres(struct svc_rqst *rqstp, struct xdr_stream *xdr) 895 919 { 896 - struct xdr_stream *xdr = &rqstp->rq_res_stream; 897 920 struct nfsd3_readlinkres *resp = rqstp->rq_resp; 898 921 struct kvec *head = rqstp->rq_res.head; 899 922 900 923 if (!svcxdr_encode_nfsstat3(xdr, resp->status)) 901 - return 0; 924 + return false; 902 925 switch (resp->status) { 903 926 case nfs_ok: 904 927 if (!svcxdr_encode_post_op_attr(rqstp, xdr, &resp->fh)) 905 - return 0; 928 + return false; 906 929 if (xdr_stream_encode_u32(xdr, resp->len) < 0) 907 - return 0; 930 + return false; 908 931 xdr_write_pages(xdr, resp->pages, 0, resp->len); 909 932 if (svc_encode_result_payload(rqstp, head->iov_len, resp->len) < 0) 910 - return 0; 933 + return false; 911 934 break; 912 935 default: 913 936 if (!svcxdr_encode_post_op_attr(rqstp, xdr, &resp->fh)) 914 - return 0; 937 + return false; 915 938 } 916 939 917 - return 1; 940 + return true; 918 941 } 919 942 920 943 /* READ */ 921 - int 922 - nfs3svc_encode_readres(struct svc_rqst *rqstp, __be32 *p) 944 + bool 945 + nfs3svc_encode_readres(struct svc_rqst *rqstp, struct xdr_stream *xdr) 923 946 { 924 - struct xdr_stream *xdr = &rqstp->rq_res_stream; 925 947 struct nfsd3_readres *resp = rqstp->rq_resp; 926 948 struct kvec *head = rqstp->rq_res.head; 927 949 928 950 if (!svcxdr_encode_nfsstat3(xdr, resp->status)) 929 - return 0; 951 + return false; 930 952 switch (resp->status) { 931 953 case nfs_ok: 932 954 if (!svcxdr_encode_post_op_attr(rqstp, xdr, &resp->fh)) 933 - return 0; 955 + return false; 934 956 if (xdr_stream_encode_u32(xdr, resp->count) < 0) 935 - return 0; 957 + return false; 936 958 if (xdr_stream_encode_bool(xdr, resp->eof) < 0) 937 - return 0; 959 + return false; 938 960 if (xdr_stream_encode_u32(xdr, resp->count) < 0) 939 - return 0; 961 + return false; 940 962 xdr_write_pages(xdr, resp->pages, rqstp->rq_res.page_base, 941 963 resp->count); 942 964 if (svc_encode_result_payload(rqstp, head->iov_len, resp->count) < 0) 943 - return 0; 965 + return false; 944 966 break; 945 967 default: 946 968 if (!svcxdr_encode_post_op_attr(rqstp, xdr, &resp->fh)) 947 - return 0; 969 + return false; 948 970 } 949 971 950 - return 1; 972 + return true; 951 973 } 952 974 953 975 /* WRITE */ 954 - int 955 - nfs3svc_encode_writeres(struct svc_rqst *rqstp, __be32 *p) 976 + bool 977 + nfs3svc_encode_writeres(struct svc_rqst *rqstp, struct xdr_stream *xdr) 956 978 { 957 - struct xdr_stream *xdr = &rqstp->rq_res_stream; 958 979 struct nfsd3_writeres *resp = rqstp->rq_resp; 959 980 960 981 if (!svcxdr_encode_nfsstat3(xdr, resp->status)) 961 - return 0; 982 + return false; 962 983 switch (resp->status) { 963 984 case nfs_ok: 964 985 if (!svcxdr_encode_wcc_data(rqstp, xdr, &resp->fh)) 965 - return 0; 986 + return false; 966 987 if (xdr_stream_encode_u32(xdr, resp->count) < 0) 967 - return 0; 988 + return false; 968 989 if (xdr_stream_encode_u32(xdr, resp->committed) < 0) 969 - return 0; 990 + return false; 970 991 if (!svcxdr_encode_writeverf3(xdr, resp->verf)) 971 - return 0; 992 + return false; 972 993 break; 973 994 default: 974 995 if (!svcxdr_encode_wcc_data(rqstp, xdr, &resp->fh)) 975 - return 0; 996 + return false; 976 997 } 977 998 978 - return 1; 999 + return true; 979 1000 } 980 1001 981 1002 /* CREATE, MKDIR, SYMLINK, MKNOD */ 982 - int 983 - nfs3svc_encode_createres(struct svc_rqst *rqstp, __be32 *p) 1003 + bool 1004 + nfs3svc_encode_createres(struct svc_rqst *rqstp, struct xdr_stream *xdr) 984 1005 { 985 - struct xdr_stream *xdr = &rqstp->rq_res_stream; 986 1006 struct nfsd3_diropres *resp = rqstp->rq_resp; 987 1007 988 1008 if (!svcxdr_encode_nfsstat3(xdr, resp->status)) 989 - return 0; 1009 + return false; 990 1010 switch (resp->status) { 991 1011 case nfs_ok: 992 1012 if (!svcxdr_encode_post_op_fh3(xdr, &resp->fh)) 993 - return 0; 1013 + return false; 994 1014 if (!svcxdr_encode_post_op_attr(rqstp, xdr, &resp->fh)) 995 - return 0; 1015 + return false; 996 1016 if (!svcxdr_encode_wcc_data(rqstp, xdr, &resp->dirfh)) 997 - return 0; 1017 + return false; 998 1018 break; 999 1019 default: 1000 1020 if (!svcxdr_encode_wcc_data(rqstp, xdr, &resp->dirfh)) 1001 - return 0; 1021 + return false; 1002 1022 } 1003 1023 1004 - return 1; 1024 + return true; 1005 1025 } 1006 1026 1007 1027 /* RENAME */ 1008 - int 1009 - nfs3svc_encode_renameres(struct svc_rqst *rqstp, __be32 *p) 1028 + bool 1029 + nfs3svc_encode_renameres(struct svc_rqst *rqstp, struct xdr_stream *xdr) 1010 1030 { 1011 - struct xdr_stream *xdr = &rqstp->rq_res_stream; 1012 1031 struct nfsd3_renameres *resp = rqstp->rq_resp; 1013 1032 1014 1033 return svcxdr_encode_nfsstat3(xdr, resp->status) && ··· 1011 1042 } 1012 1043 1013 1044 /* LINK */ 1014 - int 1015 - nfs3svc_encode_linkres(struct svc_rqst *rqstp, __be32 *p) 1045 + bool 1046 + nfs3svc_encode_linkres(struct svc_rqst *rqstp, struct xdr_stream *xdr) 1016 1047 { 1017 - struct xdr_stream *xdr = &rqstp->rq_res_stream; 1018 1048 struct nfsd3_linkres *resp = rqstp->rq_resp; 1019 1049 1020 1050 return svcxdr_encode_nfsstat3(xdr, resp->status) && ··· 1022 1054 } 1023 1055 1024 1056 /* READDIR */ 1025 - int 1026 - nfs3svc_encode_readdirres(struct svc_rqst *rqstp, __be32 *p) 1057 + bool 1058 + nfs3svc_encode_readdirres(struct svc_rqst *rqstp, struct xdr_stream *xdr) 1027 1059 { 1028 - struct xdr_stream *xdr = &rqstp->rq_res_stream; 1029 1060 struct nfsd3_readdirres *resp = rqstp->rq_resp; 1030 1061 struct xdr_buf *dirlist = &resp->dirlist; 1031 1062 1032 1063 if (!svcxdr_encode_nfsstat3(xdr, resp->status)) 1033 - return 0; 1064 + return false; 1034 1065 switch (resp->status) { 1035 1066 case nfs_ok: 1036 1067 if (!svcxdr_encode_post_op_attr(rqstp, xdr, &resp->fh)) 1037 - return 0; 1068 + return false; 1038 1069 if (!svcxdr_encode_cookieverf3(xdr, resp->verf)) 1039 - return 0; 1070 + return false; 1040 1071 xdr_write_pages(xdr, dirlist->pages, 0, dirlist->len); 1041 1072 /* no more entries */ 1042 1073 if (xdr_stream_encode_item_absent(xdr) < 0) 1043 - return 0; 1074 + return false; 1044 1075 if (xdr_stream_encode_bool(xdr, resp->common.err == nfserr_eof) < 0) 1045 - return 0; 1076 + return false; 1046 1077 break; 1047 1078 default: 1048 1079 if (!svcxdr_encode_post_op_attr(rqstp, xdr, &resp->fh)) 1049 - return 0; 1080 + return false; 1050 1081 } 1051 1082 1052 - return 1; 1083 + return true; 1053 1084 } 1054 1085 1055 1086 static __be32 ··· 1275 1308 } 1276 1309 1277 1310 /* FSSTAT */ 1278 - int 1279 - nfs3svc_encode_fsstatres(struct svc_rqst *rqstp, __be32 *p) 1311 + bool 1312 + nfs3svc_encode_fsstatres(struct svc_rqst *rqstp, struct xdr_stream *xdr) 1280 1313 { 1281 - struct xdr_stream *xdr = &rqstp->rq_res_stream; 1282 1314 struct nfsd3_fsstatres *resp = rqstp->rq_resp; 1283 1315 1284 1316 if (!svcxdr_encode_nfsstat3(xdr, resp->status)) 1285 - return 0; 1317 + return false; 1286 1318 switch (resp->status) { 1287 1319 case nfs_ok: 1288 1320 if (!svcxdr_encode_post_op_attr(rqstp, xdr, &nfs3svc_null_fh)) 1289 - return 0; 1321 + return false; 1290 1322 if (!svcxdr_encode_fsstat3resok(xdr, resp)) 1291 - return 0; 1323 + return false; 1292 1324 break; 1293 1325 default: 1294 1326 if (!svcxdr_encode_post_op_attr(rqstp, xdr, &nfs3svc_null_fh)) 1295 - return 0; 1327 + return false; 1296 1328 } 1297 1329 1298 - return 1; 1330 + return true; 1299 1331 } 1300 1332 1301 1333 static bool ··· 1321 1355 } 1322 1356 1323 1357 /* FSINFO */ 1324 - int 1325 - nfs3svc_encode_fsinfores(struct svc_rqst *rqstp, __be32 *p) 1358 + bool 1359 + nfs3svc_encode_fsinfores(struct svc_rqst *rqstp, struct xdr_stream *xdr) 1326 1360 { 1327 - struct xdr_stream *xdr = &rqstp->rq_res_stream; 1328 1361 struct nfsd3_fsinfores *resp = rqstp->rq_resp; 1329 1362 1330 1363 if (!svcxdr_encode_nfsstat3(xdr, resp->status)) 1331 - return 0; 1364 + return false; 1332 1365 switch (resp->status) { 1333 1366 case nfs_ok: 1334 1367 if (!svcxdr_encode_post_op_attr(rqstp, xdr, &nfs3svc_null_fh)) 1335 - return 0; 1368 + return false; 1336 1369 if (!svcxdr_encode_fsinfo3resok(xdr, resp)) 1337 - return 0; 1370 + return false; 1338 1371 break; 1339 1372 default: 1340 1373 if (!svcxdr_encode_post_op_attr(rqstp, xdr, &nfs3svc_null_fh)) 1341 - return 0; 1374 + return false; 1342 1375 } 1343 1376 1344 - return 1; 1377 + return true; 1345 1378 } 1346 1379 1347 1380 static bool ··· 1363 1398 } 1364 1399 1365 1400 /* PATHCONF */ 1366 - int 1367 - nfs3svc_encode_pathconfres(struct svc_rqst *rqstp, __be32 *p) 1401 + bool 1402 + nfs3svc_encode_pathconfres(struct svc_rqst *rqstp, struct xdr_stream *xdr) 1368 1403 { 1369 - struct xdr_stream *xdr = &rqstp->rq_res_stream; 1370 1404 struct nfsd3_pathconfres *resp = rqstp->rq_resp; 1371 1405 1372 1406 if (!svcxdr_encode_nfsstat3(xdr, resp->status)) 1373 - return 0; 1407 + return false; 1374 1408 switch (resp->status) { 1375 1409 case nfs_ok: 1376 1410 if (!svcxdr_encode_post_op_attr(rqstp, xdr, &nfs3svc_null_fh)) 1377 - return 0; 1411 + return false; 1378 1412 if (!svcxdr_encode_pathconf3resok(xdr, resp)) 1379 - return 0; 1413 + return false; 1380 1414 break; 1381 1415 default: 1382 1416 if (!svcxdr_encode_post_op_attr(rqstp, xdr, &nfs3svc_null_fh)) 1383 - return 0; 1417 + return false; 1384 1418 } 1385 1419 1386 - return 1; 1420 + return true; 1387 1421 } 1388 1422 1389 1423 /* COMMIT */ 1390 - int 1391 - nfs3svc_encode_commitres(struct svc_rqst *rqstp, __be32 *p) 1424 + bool 1425 + nfs3svc_encode_commitres(struct svc_rqst *rqstp, struct xdr_stream *xdr) 1392 1426 { 1393 - struct xdr_stream *xdr = &rqstp->rq_res_stream; 1394 1427 struct nfsd3_commitres *resp = rqstp->rq_resp; 1395 1428 1396 1429 if (!svcxdr_encode_nfsstat3(xdr, resp->status)) 1397 - return 0; 1430 + return false; 1398 1431 switch (resp->status) { 1399 1432 case nfs_ok: 1400 1433 if (!svcxdr_encode_wcc_data(rqstp, xdr, &resp->fh)) 1401 - return 0; 1434 + return false; 1402 1435 if (!svcxdr_encode_writeverf3(xdr, resp->verf)) 1403 - return 0; 1436 + return false; 1404 1437 break; 1405 1438 default: 1406 1439 if (!svcxdr_encode_wcc_data(rqstp, xdr, &resp->fh)) 1407 - return 0; 1440 + return false; 1408 1441 } 1409 1442 1410 - return 1; 1443 + return true; 1411 1444 } 1412 1445 1413 1446 /*
+1 -1
fs/nfsd/nfs4callback.c
··· 121 121 122 122 BUG_ON(length > NFS4_FHSIZE); 123 123 p = xdr_reserve_space(xdr, 4 + length); 124 - xdr_encode_opaque(p, &fh->fh_base, length); 124 + xdr_encode_opaque(p, &fh->fh_raw, length); 125 125 } 126 126 127 127 /*
+5 -6
fs/nfsd/nfs4proc.c
··· 519 519 520 520 fh_put(&cstate->current_fh); 521 521 cstate->current_fh.fh_handle.fh_size = putfh->pf_fhlen; 522 - memcpy(&cstate->current_fh.fh_handle.fh_base, putfh->pf_fhval, 522 + memcpy(&cstate->current_fh.fh_handle.fh_raw, putfh->pf_fhval, 523 523 putfh->pf_fhlen); 524 524 ret = fh_verify(rqstp, &cstate->current_fh, 0, NFSD_MAY_BYPASS_GSS); 525 525 #ifdef CONFIG_NFSD_V4_2_INTER_SSC ··· 1033 1033 1034 1034 write->wr_how_written = write->wr_stable_how; 1035 1035 1036 - nvecs = svc_fill_write_vector(rqstp, write->wr_payload.pages, 1037 - write->wr_payload.head, write->wr_buflen); 1036 + nvecs = svc_fill_write_vector(rqstp, &write->wr_payload); 1038 1037 WARN_ON_ONCE(nvecs > ARRAY_SIZE(rqstp->rq_vec)); 1039 1038 1040 1039 status = nfsd_vfs_write(rqstp, &cstate->current_fh, nf, ··· 1177 1178 static __be32 nfsd4_ssc_setup_dul(struct nfsd_net *nn, char *ipaddr, 1178 1179 struct nfsd4_ssc_umount_item **retwork, struct vfsmount **ss_mnt) 1179 1180 { 1180 - struct nfsd4_ssc_umount_item *ni = 0; 1181 + struct nfsd4_ssc_umount_item *ni = NULL; 1181 1182 struct nfsd4_ssc_umount_item *work = NULL; 1182 1183 struct nfsd4_ssc_umount_item *tmp; 1183 1184 DEFINE_WAIT(wait); ··· 1382 1383 s_fh = &cstate->save_fh; 1383 1384 1384 1385 copy->c_fh.size = s_fh->fh_handle.fh_size; 1385 - memcpy(copy->c_fh.data, &s_fh->fh_handle.fh_base, copy->c_fh.size); 1386 + memcpy(copy->c_fh.data, &s_fh->fh_handle.fh_raw, copy->c_fh.size); 1386 1387 copy->stateid.seqid = cpu_to_be32(s_stid->si_generation); 1387 1388 memcpy(copy->stateid.other, (void *)&s_stid->si_opaque, 1388 1389 sizeof(stateid_opaque_t)); ··· 2461 2462 __be32 status; 2462 2463 2463 2464 resp->xdr = &rqstp->rq_res_stream; 2465 + resp->statusp = resp->xdr->p; 2464 2466 2465 2467 /* reserve space for: NFS status code */ 2466 2468 xdr_reserve_space(resp->xdr, XDR_UNIT); 2467 2469 2468 - resp->tagp = resp->xdr->p; 2469 2470 /* reserve space for: taglen, tag, and opcnt */ 2470 2471 xdr_reserve_space(resp->xdr, XDR_UNIT * 2 + args->taglen); 2471 2472 resp->taglen = args->taglen;
+3 -3
fs/nfsd/nfs4state.c
··· 1010 1010 } 1011 1011 spin_unlock(&blocked_delegations_lock); 1012 1012 } 1013 - hash = jhash(&fh->fh_base, fh->fh_size, 0); 1013 + hash = jhash(&fh->fh_raw, fh->fh_size, 0); 1014 1014 if (test_bit(hash&255, bd->set[0]) && 1015 1015 test_bit((hash>>8)&255, bd->set[0]) && 1016 1016 test_bit((hash>>16)&255, bd->set[0])) ··· 1029 1029 u32 hash; 1030 1030 struct bloom_pair *bd = &blocked_delegations; 1031 1031 1032 - hash = jhash(&fh->fh_base, fh->fh_size, 0); 1032 + hash = jhash(&fh->fh_raw, fh->fh_size, 0); 1033 1033 1034 1034 spin_lock(&blocked_delegations_lock); 1035 1035 __set_bit(hash&255, bd->set[bd->new]); ··· 5541 5541 static void nfsd4_ssc_expire_umount(struct nfsd_net *nn) 5542 5542 { 5543 5543 bool do_wakeup = false; 5544 - struct nfsd4_ssc_umount_item *ni = 0; 5544 + struct nfsd4_ssc_umount_item *ni = NULL; 5545 5545 struct nfsd4_ssc_umount_item *tmp; 5546 5546 5547 5547 spin_lock(&nn->nfsd_ssc_lock);
+29 -23
fs/nfsd/nfs4xdr.c
··· 2322 2322 return true; 2323 2323 } 2324 2324 2325 - static int 2325 + static bool 2326 2326 nfsd4_decode_compound(struct nfsd4_compoundargs *argp) 2327 2327 { 2328 2328 struct nfsd4_op *op; ··· 2335 2335 int i; 2336 2336 2337 2337 if (xdr_stream_decode_u32(argp->xdr, &argp->taglen) < 0) 2338 - return 0; 2338 + return false; 2339 2339 max_reply += XDR_UNIT; 2340 2340 argp->tag = NULL; 2341 2341 if (unlikely(argp->taglen)) { 2342 2342 if (argp->taglen > NFSD4_MAX_TAGLEN) 2343 - return 0; 2343 + return false; 2344 2344 p = xdr_inline_decode(argp->xdr, argp->taglen); 2345 2345 if (!p) 2346 - return 0; 2346 + return false; 2347 2347 argp->tag = svcxdr_savemem(argp, p, argp->taglen); 2348 2348 if (!argp->tag) 2349 - return 0; 2349 + return false; 2350 2350 max_reply += xdr_align_size(argp->taglen); 2351 2351 } 2352 2352 2353 2353 if (xdr_stream_decode_u32(argp->xdr, &argp->minorversion) < 0) 2354 - return 0; 2354 + return false; 2355 2355 if (xdr_stream_decode_u32(argp->xdr, &argp->opcnt) < 0) 2356 - return 0; 2356 + return false; 2357 2357 2358 2358 /* 2359 2359 * NFS4ERR_RESOURCE is a more helpful error than GARBAGE_ARGS ··· 2361 2361 * nfsd4_proc can handle this is an NFS-level error. 2362 2362 */ 2363 2363 if (argp->opcnt > NFSD_MAX_OPS_PER_COMPOUND) 2364 - return 1; 2364 + return true; 2365 2365 2366 2366 if (argp->opcnt > ARRAY_SIZE(argp->iops)) { 2367 2367 argp->ops = kzalloc(argp->opcnt * sizeof(*argp->ops), GFP_KERNEL); 2368 2368 if (!argp->ops) { 2369 2369 argp->ops = argp->iops; 2370 2370 dprintk("nfsd: couldn't allocate room for COMPOUND\n"); 2371 - return 0; 2371 + return false; 2372 2372 } 2373 2373 } 2374 2374 ··· 2380 2380 op->replay = NULL; 2381 2381 2382 2382 if (xdr_stream_decode_u32(argp->xdr, &op->opnum) < 0) 2383 - return 0; 2383 + return false; 2384 2384 if (nfsd4_opnum_in_range(argp, op)) { 2385 2385 op->status = nfsd4_dec_ops[op->opnum](argp, &op->u); 2386 2386 if (op->status != nfs_ok) ··· 2427 2427 if (readcount > 1 || max_reply > PAGE_SIZE - auth_slack) 2428 2428 clear_bit(RQ_SPLICE_OK, &argp->rqstp->rq_flags); 2429 2429 2430 - return 1; 2430 + return true; 2431 2431 } 2432 2432 2433 2433 static __be32 *encode_change(__be32 *p, struct kstat *stat, struct inode *inode, ··· 3110 3110 p = xdr_reserve_space(xdr, fhp->fh_handle.fh_size + 4); 3111 3111 if (!p) 3112 3112 goto out_resource; 3113 - p = xdr_encode_opaque(p, &fhp->fh_handle.fh_base, 3113 + p = xdr_encode_opaque(p, &fhp->fh_handle.fh_raw, 3114 3114 fhp->fh_handle.fh_size); 3115 3115 } 3116 3116 if (bmval0 & FATTR4_WORD0_FILEID) { ··· 3670 3670 p = xdr_reserve_space(xdr, len + 4); 3671 3671 if (!p) 3672 3672 return nfserr_resource; 3673 - p = xdr_encode_opaque(p, &fhp->fh_handle.fh_base, len); 3673 + p = xdr_encode_opaque(p, &fhp->fh_handle.fh_raw, len); 3674 3674 return 0; 3675 3675 } 3676 3676 ··· 5414 5414 } 5415 5415 } 5416 5416 5417 - int 5418 - nfs4svc_decode_compoundargs(struct svc_rqst *rqstp, __be32 *p) 5417 + bool 5418 + nfs4svc_decode_compoundargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) 5419 5419 { 5420 5420 struct nfsd4_compoundargs *args = rqstp->rq_argp; 5421 5421 5422 5422 /* svcxdr_tmp_alloc */ 5423 5423 args->to_free = NULL; 5424 5424 5425 - args->xdr = &rqstp->rq_arg_stream; 5425 + args->xdr = xdr; 5426 5426 args->ops = args->iops; 5427 5427 args->rqstp = rqstp; 5428 5428 5429 5429 return nfsd4_decode_compound(args); 5430 5430 } 5431 5431 5432 - int 5433 - nfs4svc_encode_compoundres(struct svc_rqst *rqstp, __be32 *p) 5432 + bool 5433 + nfs4svc_encode_compoundres(struct svc_rqst *rqstp, struct xdr_stream *xdr) 5434 5434 { 5435 5435 struct nfsd4_compoundres *resp = rqstp->rq_resp; 5436 - struct xdr_buf *buf = resp->xdr->buf; 5436 + struct xdr_buf *buf = xdr->buf; 5437 + __be32 *p; 5437 5438 5438 5439 WARN_ON_ONCE(buf->len != buf->head[0].iov_len + buf->page_len + 5439 5440 buf->tail[0].iov_len); 5440 5441 5441 - *p = resp->cstate.status; 5442 + /* 5443 + * Send buffer space for the following items is reserved 5444 + * at the top of nfsd4_proc_compound(). 5445 + */ 5446 + p = resp->statusp; 5442 5447 5443 - rqstp->rq_next_page = resp->xdr->page_ptr + 1; 5448 + *p++ = resp->cstate.status; 5444 5449 5445 - p = resp->tagp; 5450 + rqstp->rq_next_page = xdr->page_ptr + 1; 5451 + 5446 5452 *p++ = htonl(resp->taglen); 5447 5453 memcpy(p, resp->tag, resp->taglen); 5448 5454 p += XDR_QUADLEN(resp->taglen); 5449 5455 *p++ = htonl(resp->opcnt); 5450 5456 5451 5457 nfsd4_sequence_done(resp); 5452 - return 1; 5458 + return true; 5453 5459 }
+11 -6
fs/nfsd/nfscache.c
··· 241 241 list_move_tail(&rp->c_lru, &b->lru_head); 242 242 } 243 243 244 - static long 245 - prune_bucket(struct nfsd_drc_bucket *b, struct nfsd_net *nn) 244 + static long prune_bucket(struct nfsd_drc_bucket *b, struct nfsd_net *nn, 245 + unsigned int max) 246 246 { 247 247 struct svc_cacherep *rp, *tmp; 248 248 long freed = 0; ··· 258 258 time_before(jiffies, rp->c_timestamp + RC_EXPIRE)) 259 259 break; 260 260 nfsd_reply_cache_free_locked(b, rp, nn); 261 - freed++; 261 + if (max && freed++ > max) 262 + break; 262 263 } 263 264 return freed; 265 + } 266 + 267 + static long nfsd_prune_bucket(struct nfsd_drc_bucket *b, struct nfsd_net *nn) 268 + { 269 + return prune_bucket(b, nn, 3); 264 270 } 265 271 266 272 /* ··· 285 279 if (list_empty(&b->lru_head)) 286 280 continue; 287 281 spin_lock(&b->cache_lock); 288 - freed += prune_bucket(b, nn); 282 + freed += prune_bucket(b, nn, 0); 289 283 spin_unlock(&b->cache_lock); 290 284 } 291 285 return freed; ··· 459 453 atomic_inc(&nn->num_drc_entries); 460 454 nfsd_stats_drc_mem_usage_add(nn, sizeof(*rp)); 461 455 462 - /* go ahead and prune the cache */ 463 - prune_bucket(b, nn); 456 + nfsd_prune_bucket(b, nn); 464 457 465 458 out_unlock: 466 459 spin_unlock(&b->cache_lock);
+3 -3
fs/nfsd/nfsctl.c
··· 395 395 auth_domain_put(dom); 396 396 if (len) 397 397 return len; 398 - 398 + 399 399 mesg = buf; 400 400 len = SIMPLE_TRANSACTION_LIMIT; 401 - qword_addhex(&mesg, &len, (char*)&fh.fh_base, fh.fh_size); 401 + qword_addhex(&mesg, &len, fh.fh_raw, fh.fh_size); 402 402 mesg[-1] = '\n'; 403 - return mesg - buf; 403 + return mesg - buf; 404 404 } 405 405 406 406 /*
+4 -2
fs/nfsd/nfsd.h
··· 78 78 */ 79 79 struct nfsd_voidargs { }; 80 80 struct nfsd_voidres { }; 81 - int nfssvc_decode_voidarg(struct svc_rqst *rqstp, __be32 *p); 82 - int nfssvc_encode_voidres(struct svc_rqst *rqstp, __be32 *p); 81 + bool nfssvc_decode_voidarg(struct svc_rqst *rqstp, 82 + struct xdr_stream *xdr); 83 + bool nfssvc_encode_voidres(struct svc_rqst *rqstp, 84 + struct xdr_stream *xdr); 83 85 84 86 /* 85 87 * Function prototypes.
+52 -115
fs/nfsd/nfsfh.c
··· 154 154 static __be32 nfsd_set_fh_dentry(struct svc_rqst *rqstp, struct svc_fh *fhp) 155 155 { 156 156 struct knfsd_fh *fh = &fhp->fh_handle; 157 - struct fid *fid = NULL, sfid; 157 + struct fid *fid = NULL; 158 158 struct svc_export *exp; 159 159 struct dentry *dentry; 160 160 int fileid_type; 161 161 int data_left = fh->fh_size/4; 162 + int len; 162 163 __be32 error; 163 164 164 165 error = nfserr_stale; ··· 168 167 if (rqstp->rq_vers == 4 && fh->fh_size == 0) 169 168 return nfserr_nofilehandle; 170 169 171 - if (fh->fh_version == 1) { 172 - int len; 170 + if (fh->fh_version != 1) 171 + return error; 173 172 174 - if (--data_left < 0) 175 - return error; 176 - if (fh->fh_auth_type != 0) 177 - return error; 178 - len = key_len(fh->fh_fsid_type) / 4; 179 - if (len == 0) 180 - return error; 181 - if (fh->fh_fsid_type == FSID_MAJOR_MINOR) { 182 - /* deprecated, convert to type 3 */ 183 - len = key_len(FSID_ENCODE_DEV)/4; 184 - fh->fh_fsid_type = FSID_ENCODE_DEV; 185 - /* 186 - * struct knfsd_fh uses host-endian fields, which are 187 - * sometimes used to hold net-endian values. This 188 - * confuses sparse, so we must use __force here to 189 - * keep it from complaining. 190 - */ 191 - fh->fh_fsid[0] = new_encode_dev(MKDEV(ntohl((__force __be32)fh->fh_fsid[0]), 192 - ntohl((__force __be32)fh->fh_fsid[1]))); 193 - fh->fh_fsid[1] = fh->fh_fsid[2]; 194 - } 195 - data_left -= len; 196 - if (data_left < 0) 197 - return error; 198 - exp = rqst_exp_find(rqstp, fh->fh_fsid_type, fh->fh_fsid); 199 - fid = (struct fid *)(fh->fh_fsid + len); 200 - } else { 201 - __u32 tfh[2]; 202 - dev_t xdev; 203 - ino_t xino; 204 - 205 - if (fh->fh_size != NFS_FHSIZE) 206 - return error; 207 - /* assume old filehandle format */ 208 - xdev = old_decode_dev(fh->ofh_xdev); 209 - xino = u32_to_ino_t(fh->ofh_xino); 210 - mk_fsid(FSID_DEV, tfh, xdev, xino, 0, NULL); 211 - exp = rqst_exp_find(rqstp, FSID_DEV, tfh); 173 + if (--data_left < 0) 174 + return error; 175 + if (fh->fh_auth_type != 0) 176 + return error; 177 + len = key_len(fh->fh_fsid_type) / 4; 178 + if (len == 0) 179 + return error; 180 + if (fh->fh_fsid_type == FSID_MAJOR_MINOR) { 181 + /* deprecated, convert to type 3 */ 182 + len = key_len(FSID_ENCODE_DEV)/4; 183 + fh->fh_fsid_type = FSID_ENCODE_DEV; 184 + /* 185 + * struct knfsd_fh uses host-endian fields, which are 186 + * sometimes used to hold net-endian values. This 187 + * confuses sparse, so we must use __force here to 188 + * keep it from complaining. 189 + */ 190 + fh->fh_fsid[0] = new_encode_dev(MKDEV(ntohl((__force __be32)fh->fh_fsid[0]), 191 + ntohl((__force __be32)fh->fh_fsid[1]))); 192 + fh->fh_fsid[1] = fh->fh_fsid[2]; 212 193 } 194 + data_left -= len; 195 + if (data_left < 0) 196 + return error; 197 + exp = rqst_exp_find(rqstp, fh->fh_fsid_type, fh->fh_fsid); 198 + fid = (struct fid *)(fh->fh_fsid + len); 213 199 214 200 error = nfserr_stale; 215 201 if (IS_ERR(exp)) { ··· 241 253 if (rqstp->rq_vers > 2) 242 254 error = nfserr_badhandle; 243 255 244 - if (fh->fh_version != 1) { 245 - sfid.i32.ino = fh->ofh_ino; 246 - sfid.i32.gen = fh->ofh_generation; 247 - sfid.i32.parent_ino = fh->ofh_dirino; 248 - fid = &sfid; 249 - data_left = 3; 250 - if (fh->ofh_dirino == 0) 251 - fileid_type = FILEID_INO32_GEN; 252 - else 253 - fileid_type = FILEID_INO32_GEN_PARENT; 254 - } else 255 - fileid_type = fh->fh_fileid_type; 256 + fileid_type = fh->fh_fileid_type; 256 257 257 258 if (fileid_type == FILEID_ROOT) 258 259 dentry = dget(exp->ex_path.dentry); ··· 429 452 } 430 453 } 431 454 432 - /* 433 - * for composing old style file handles 434 - */ 435 - static inline void _fh_update_old(struct dentry *dentry, 436 - struct svc_export *exp, 437 - struct knfsd_fh *fh) 438 - { 439 - fh->ofh_ino = ino_t_to_u32(d_inode(dentry)->i_ino); 440 - fh->ofh_generation = d_inode(dentry)->i_generation; 441 - if (d_is_dir(dentry) || 442 - (exp->ex_flags & NFSEXP_NOSUBTREECHECK)) 443 - fh->ofh_dirino = 0; 444 - } 445 - 446 455 static bool is_root_export(struct svc_export *exp) 447 456 { 448 457 return exp->ex_path.dentry == exp->ex_path.dentry->d_sb->s_root; ··· 525 562 /* ref_fh is a reference file handle. 526 563 * if it is non-null and for the same filesystem, then we should compose 527 564 * a filehandle which is of the same version, where possible. 528 - * Currently, that means that if ref_fh->fh_handle.fh_version == 0xca 529 - * Then create a 32byte filehandle using nfs_fhbase_old 530 - * 531 565 */ 532 566 533 567 struct inode * inode = d_inode(dentry); ··· 560 600 fhp->fh_dentry = dget(dentry); /* our internal copy */ 561 601 fhp->fh_export = exp_get(exp); 562 602 563 - if (fhp->fh_handle.fh_version == 0xca) { 564 - /* old style filehandle please */ 565 - memset(&fhp->fh_handle.fh_base, 0, NFS_FHSIZE); 566 - fhp->fh_handle.fh_size = NFS_FHSIZE; 567 - fhp->fh_handle.ofh_dcookie = 0xfeebbaca; 568 - fhp->fh_handle.ofh_dev = old_encode_dev(ex_dev); 569 - fhp->fh_handle.ofh_xdev = fhp->fh_handle.ofh_dev; 570 - fhp->fh_handle.ofh_xino = 571 - ino_t_to_u32(d_inode(exp->ex_path.dentry)->i_ino); 572 - fhp->fh_handle.ofh_dirino = ino_t_to_u32(parent_ino(dentry)); 573 - if (inode) 574 - _fh_update_old(dentry, exp, &fhp->fh_handle); 575 - } else { 576 - fhp->fh_handle.fh_size = 577 - key_len(fhp->fh_handle.fh_fsid_type) + 4; 578 - fhp->fh_handle.fh_auth_type = 0; 603 + fhp->fh_handle.fh_size = 604 + key_len(fhp->fh_handle.fh_fsid_type) + 4; 605 + fhp->fh_handle.fh_auth_type = 0; 579 606 580 - mk_fsid(fhp->fh_handle.fh_fsid_type, 581 - fhp->fh_handle.fh_fsid, 582 - ex_dev, 583 - d_inode(exp->ex_path.dentry)->i_ino, 584 - exp->ex_fsid, exp->ex_uuid); 607 + mk_fsid(fhp->fh_handle.fh_fsid_type, 608 + fhp->fh_handle.fh_fsid, 609 + ex_dev, 610 + d_inode(exp->ex_path.dentry)->i_ino, 611 + exp->ex_fsid, exp->ex_uuid); 585 612 586 - if (inode) 587 - _fh_update(fhp, exp, dentry); 588 - if (fhp->fh_handle.fh_fileid_type == FILEID_INVALID) { 589 - fh_put(fhp); 590 - return nfserr_opnotsupp; 591 - } 613 + if (inode) 614 + _fh_update(fhp, exp, dentry); 615 + if (fhp->fh_handle.fh_fileid_type == FILEID_INVALID) { 616 + fh_put(fhp); 617 + return nfserr_opnotsupp; 592 618 } 593 619 594 620 return 0; ··· 595 649 dentry = fhp->fh_dentry; 596 650 if (d_really_is_negative(dentry)) 597 651 goto out_negative; 598 - if (fhp->fh_handle.fh_version != 1) { 599 - _fh_update_old(dentry, fhp->fh_export, &fhp->fh_handle); 600 - } else { 601 - if (fhp->fh_handle.fh_fileid_type != FILEID_ROOT) 602 - return 0; 652 + if (fhp->fh_handle.fh_fileid_type != FILEID_ROOT) 653 + return 0; 603 654 604 - _fh_update(fhp, fhp->fh_export, dentry); 605 - if (fhp->fh_handle.fh_fileid_type == FILEID_INVALID) 606 - return nfserr_opnotsupp; 607 - } 655 + _fh_update(fhp, fhp->fh_export, dentry); 656 + if (fhp->fh_handle.fh_fileid_type == FILEID_INVALID) 657 + return nfserr_opnotsupp; 608 658 return 0; 609 659 out_bad: 610 660 printk(KERN_ERR "fh_update: fh not verified!\n"); ··· 640 698 char * SVCFH_fmt(struct svc_fh *fhp) 641 699 { 642 700 struct knfsd_fh *fh = &fhp->fh_handle; 701 + static char buf[2+1+1+64*3+1]; 643 702 644 - static char buf[80]; 645 - sprintf(buf, "%d: %08x %08x %08x %08x %08x %08x", 646 - fh->fh_size, 647 - fh->fh_base.fh_pad[0], 648 - fh->fh_base.fh_pad[1], 649 - fh->fh_base.fh_pad[2], 650 - fh->fh_base.fh_pad[3], 651 - fh->fh_base.fh_pad[4], 652 - fh->fh_base.fh_pad[5]); 703 + if (fh->fh_size < 0 || fh->fh_size> 64) 704 + return "bad-fh"; 705 + sprintf(buf, "%d: %*ph", fh->fh_size, fh->fh_size, fh->fh_raw); 653 706 return buf; 654 707 } 655 708
+51 -4
fs/nfsd/nfsfh.h
··· 10 10 11 11 #include <linux/crc32.h> 12 12 #include <linux/sunrpc/svc.h> 13 - #include <uapi/linux/nfsd/nfsfh.h> 14 13 #include <linux/iversion.h> 15 14 #include <linux/exportfs.h> 15 + #include <linux/nfs4.h> 16 + 17 + /* 18 + * The file handle starts with a sequence of four-byte words. 19 + * The first word contains a version number (1) and three descriptor bytes 20 + * that tell how the remaining 3 variable length fields should be handled. 21 + * These three bytes are auth_type, fsid_type and fileid_type. 22 + * 23 + * All four-byte values are in host-byte-order. 24 + * 25 + * The auth_type field is deprecated and must be set to 0. 26 + * 27 + * The fsid_type identifies how the filesystem (or export point) is 28 + * encoded. 29 + * Current values: 30 + * 0 - 4 byte device id (ms-2-bytes major, ls-2-bytes minor), 4byte inode number 31 + * NOTE: we cannot use the kdev_t device id value, because kdev_t.h 32 + * says we mustn't. We must break it up and reassemble. 33 + * 1 - 4 byte user specified identifier 34 + * 2 - 4 byte major, 4 byte minor, 4 byte inode number - DEPRECATED 35 + * 3 - 4 byte device id, encoded for user-space, 4 byte inode number 36 + * 4 - 4 byte inode number and 4 byte uuid 37 + * 5 - 8 byte uuid 38 + * 6 - 16 byte uuid 39 + * 7 - 8 byte inode number and 16 byte uuid 40 + * 41 + * The fileid_type identifies how the file within the filesystem is encoded. 42 + * The values for this field are filesystem specific, exccept that 43 + * filesystems must not use the values '0' or '0xff'. 'See enum fid_type' 44 + * in include/linux/exportfs.h for currently registered values. 45 + */ 46 + 47 + struct knfsd_fh { 48 + unsigned int fh_size; /* 49 + * Points to the current size while 50 + * building a new file handle. 51 + */ 52 + union { 53 + char fh_raw[NFS4_FHSIZE]; 54 + struct { 55 + u8 fh_version; /* == 1 */ 56 + u8 fh_auth_type; /* deprecated */ 57 + u8 fh_fsid_type; 58 + u8 fh_fileid_type; 59 + u32 fh_fsid[]; /* flexible-array member */ 60 + }; 61 + }; 62 + }; 16 63 17 64 static inline __u32 ino_t_to_u32(ino_t ino) 18 65 { ··· 235 188 fh_copy_shallow(struct knfsd_fh *dst, struct knfsd_fh *src) 236 189 { 237 190 dst->fh_size = src->fh_size; 238 - memcpy(&dst->fh_base, &src->fh_base, src->fh_size); 191 + memcpy(&dst->fh_raw, &src->fh_raw, src->fh_size); 239 192 } 240 193 241 194 static __inline__ struct svc_fh * ··· 250 203 { 251 204 if (fh1->fh_size != fh2->fh_size) 252 205 return false; 253 - if (memcmp(fh1->fh_base.fh_pad, fh2->fh_base.fh_pad, fh1->fh_size) != 0) 206 + if (memcmp(fh1->fh_raw, fh2->fh_raw, fh1->fh_size) != 0) 254 207 return false; 255 208 return true; 256 209 } ··· 274 227 */ 275 228 static inline u32 knfsd_fh_hash(const struct knfsd_fh *fh) 276 229 { 277 - return ~crc32_le(0xFFFFFFFF, (unsigned char *)&fh->fh_base, fh->fh_size); 230 + return ~crc32_le(0xFFFFFFFF, fh->fh_raw, fh->fh_size); 278 231 } 279 232 #else 280 233 static inline u32 knfsd_fh_hash(const struct knfsd_fh *fh)
+1 -2
fs/nfsd/nfsproc.c
··· 234 234 SVCFH_fmt(&argp->fh), 235 235 argp->len, argp->offset); 236 236 237 - nvecs = svc_fill_write_vector(rqstp, rqstp->rq_arg.pages, 238 - &argp->first, cnt); 237 + nvecs = svc_fill_write_vector(rqstp, &argp->payload); 239 238 if (!nvecs) { 240 239 resp->status = nfserr_io; 241 240 goto out;
+12 -16
fs/nfsd/nfssvc.c
··· 1004 1004 int nfsd_dispatch(struct svc_rqst *rqstp, __be32 *statp) 1005 1005 { 1006 1006 const struct svc_procedure *proc = rqstp->rq_procinfo; 1007 - struct kvec *argv = &rqstp->rq_arg.head[0]; 1008 - struct kvec *resv = &rqstp->rq_res.head[0]; 1009 - __be32 *p; 1010 1007 1011 1008 /* 1012 1009 * Give the xdr decoder a chance to change this if it wants ··· 1012 1015 rqstp->rq_cachetype = proc->pc_cachetype; 1013 1016 1014 1017 svcxdr_init_decode(rqstp); 1015 - if (!proc->pc_decode(rqstp, argv->iov_base)) 1018 + if (!proc->pc_decode(rqstp, &rqstp->rq_arg_stream)) 1016 1019 goto out_decode_err; 1017 1020 1018 1021 switch (nfsd_cache_lookup(rqstp)) { ··· 1028 1031 * Need to grab the location to store the status, as 1029 1032 * NFSv4 does some encoding while processing 1030 1033 */ 1031 - p = resv->iov_base + resv->iov_len; 1032 1034 svcxdr_init_encode(rqstp); 1033 1035 1034 1036 *statp = proc->pc_func(rqstp); 1035 1037 if (*statp == rpc_drop_reply || test_bit(RQ_DROPME, &rqstp->rq_flags)) 1036 1038 goto out_update_drop; 1037 1039 1038 - if (!proc->pc_encode(rqstp, p)) 1040 + if (!proc->pc_encode(rqstp, &rqstp->rq_res_stream)) 1039 1041 goto out_encode_err; 1040 1042 1041 1043 nfsd_cache_update(rqstp, rqstp->rq_cachetype, statp + 1); ··· 1061 1065 /** 1062 1066 * nfssvc_decode_voidarg - Decode void arguments 1063 1067 * @rqstp: Server RPC transaction context 1064 - * @p: buffer containing arguments to decode 1068 + * @xdr: XDR stream positioned at arguments to decode 1065 1069 * 1066 1070 * Return values: 1067 - * %0: Arguments were not valid 1068 - * %1: Decoding was successful 1071 + * %false: Arguments were not valid 1072 + * %true: Decoding was successful 1069 1073 */ 1070 - int nfssvc_decode_voidarg(struct svc_rqst *rqstp, __be32 *p) 1074 + bool nfssvc_decode_voidarg(struct svc_rqst *rqstp, struct xdr_stream *xdr) 1071 1075 { 1072 - return 1; 1076 + return true; 1073 1077 } 1074 1078 1075 1079 /** 1076 1080 * nfssvc_encode_voidres - Encode void results 1077 1081 * @rqstp: Server RPC transaction context 1078 - * @p: buffer in which to encode results 1082 + * @xdr: XDR stream into which to encode results 1079 1083 * 1080 1084 * Return values: 1081 - * %0: Local error while encoding 1082 - * %1: Encoding was successful 1085 + * %false: Local error while encoding 1086 + * %true: Encoding was successful 1083 1087 */ 1084 - int nfssvc_encode_voidres(struct svc_rqst *rqstp, __be32 *p) 1088 + bool nfssvc_encode_voidres(struct svc_rqst *rqstp, struct xdr_stream *xdr) 1085 1089 { 1086 - return 1; 1090 + return true; 1087 1091 } 1088 1092 1089 1093 int nfsd_pool_stats_open(struct inode *inode, struct file *file)
+82 -105
fs/nfsd/nfsxdr.c
··· 64 64 if (!p) 65 65 return false; 66 66 fh_init(fhp, NFS_FHSIZE); 67 - memcpy(&fhp->fh_handle.fh_base, p, NFS_FHSIZE); 67 + memcpy(&fhp->fh_handle.fh_raw, p, NFS_FHSIZE); 68 68 fhp->fh_handle.fh_size = NFS_FHSIZE; 69 69 70 70 return true; ··· 78 78 p = xdr_reserve_space(xdr, NFS_FHSIZE); 79 79 if (!p) 80 80 return false; 81 - memcpy(p, &fhp->fh_handle.fh_base, NFS_FHSIZE); 81 + memcpy(p, &fhp->fh_handle.fh_raw, NFS_FHSIZE); 82 82 83 83 return true; 84 84 } ··· 272 272 * XDR decode functions 273 273 */ 274 274 275 - int 276 - nfssvc_decode_fhandleargs(struct svc_rqst *rqstp, __be32 *p) 275 + bool 276 + nfssvc_decode_fhandleargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) 277 277 { 278 - struct xdr_stream *xdr = &rqstp->rq_arg_stream; 279 278 struct nfsd_fhandle *args = rqstp->rq_argp; 280 279 281 280 return svcxdr_decode_fhandle(xdr, &args->fh); 282 281 } 283 282 284 - int 285 - nfssvc_decode_sattrargs(struct svc_rqst *rqstp, __be32 *p) 283 + bool 284 + nfssvc_decode_sattrargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) 286 285 { 287 - struct xdr_stream *xdr = &rqstp->rq_arg_stream; 288 286 struct nfsd_sattrargs *args = rqstp->rq_argp; 289 287 290 288 return svcxdr_decode_fhandle(xdr, &args->fh) && 291 289 svcxdr_decode_sattr(rqstp, xdr, &args->attrs); 292 290 } 293 291 294 - int 295 - nfssvc_decode_diropargs(struct svc_rqst *rqstp, __be32 *p) 292 + bool 293 + nfssvc_decode_diropargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) 296 294 { 297 - struct xdr_stream *xdr = &rqstp->rq_arg_stream; 298 295 struct nfsd_diropargs *args = rqstp->rq_argp; 299 296 300 297 return svcxdr_decode_diropargs(xdr, &args->fh, &args->name, &args->len); 301 298 } 302 299 303 - int 304 - nfssvc_decode_readargs(struct svc_rqst *rqstp, __be32 *p) 300 + bool 301 + nfssvc_decode_readargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) 305 302 { 306 - struct xdr_stream *xdr = &rqstp->rq_arg_stream; 307 303 struct nfsd_readargs *args = rqstp->rq_argp; 308 304 u32 totalcount; 309 305 310 306 if (!svcxdr_decode_fhandle(xdr, &args->fh)) 311 - return 0; 307 + return false; 312 308 if (xdr_stream_decode_u32(xdr, &args->offset) < 0) 313 - return 0; 309 + return false; 314 310 if (xdr_stream_decode_u32(xdr, &args->count) < 0) 315 - return 0; 311 + return false; 316 312 /* totalcount is ignored */ 317 313 if (xdr_stream_decode_u32(xdr, &totalcount) < 0) 318 - return 0; 314 + return false; 319 315 320 - return 1; 316 + return true; 321 317 } 322 318 323 - int 324 - nfssvc_decode_writeargs(struct svc_rqst *rqstp, __be32 *p) 319 + bool 320 + nfssvc_decode_writeargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) 325 321 { 326 - struct xdr_stream *xdr = &rqstp->rq_arg_stream; 327 322 struct nfsd_writeargs *args = rqstp->rq_argp; 328 - struct kvec *head = rqstp->rq_arg.head; 329 - struct kvec *tail = rqstp->rq_arg.tail; 330 323 u32 beginoffset, totalcount; 331 - size_t remaining; 332 324 333 325 if (!svcxdr_decode_fhandle(xdr, &args->fh)) 334 - return 0; 326 + return false; 335 327 /* beginoffset is ignored */ 336 328 if (xdr_stream_decode_u32(xdr, &beginoffset) < 0) 337 - return 0; 329 + return false; 338 330 if (xdr_stream_decode_u32(xdr, &args->offset) < 0) 339 - return 0; 331 + return false; 340 332 /* totalcount is ignored */ 341 333 if (xdr_stream_decode_u32(xdr, &totalcount) < 0) 342 - return 0; 334 + return false; 343 335 344 336 /* opaque data */ 345 337 if (xdr_stream_decode_u32(xdr, &args->len) < 0) 346 - return 0; 338 + return false; 347 339 if (args->len > NFSSVC_MAXBLKSIZE_V2) 348 - return 0; 349 - remaining = head->iov_len + rqstp->rq_arg.page_len + tail->iov_len; 350 - remaining -= xdr_stream_pos(xdr); 351 - if (remaining < xdr_align_size(args->len)) 352 - return 0; 353 - args->first.iov_base = xdr->p; 354 - args->first.iov_len = head->iov_len - xdr_stream_pos(xdr); 340 + return false; 341 + if (!xdr_stream_subsegment(xdr, &args->payload, args->len)) 342 + return false; 355 343 356 - return 1; 344 + return true; 357 345 } 358 346 359 - int 360 - nfssvc_decode_createargs(struct svc_rqst *rqstp, __be32 *p) 347 + bool 348 + nfssvc_decode_createargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) 361 349 { 362 - struct xdr_stream *xdr = &rqstp->rq_arg_stream; 363 350 struct nfsd_createargs *args = rqstp->rq_argp; 364 351 365 352 return svcxdr_decode_diropargs(xdr, &args->fh, ··· 354 367 svcxdr_decode_sattr(rqstp, xdr, &args->attrs); 355 368 } 356 369 357 - int 358 - nfssvc_decode_renameargs(struct svc_rqst *rqstp, __be32 *p) 370 + bool 371 + nfssvc_decode_renameargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) 359 372 { 360 - struct xdr_stream *xdr = &rqstp->rq_arg_stream; 361 373 struct nfsd_renameargs *args = rqstp->rq_argp; 362 374 363 375 return svcxdr_decode_diropargs(xdr, &args->ffh, ··· 365 379 &args->tname, &args->tlen); 366 380 } 367 381 368 - int 369 - nfssvc_decode_linkargs(struct svc_rqst *rqstp, __be32 *p) 382 + bool 383 + nfssvc_decode_linkargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) 370 384 { 371 - struct xdr_stream *xdr = &rqstp->rq_arg_stream; 372 385 struct nfsd_linkargs *args = rqstp->rq_argp; 373 386 374 387 return svcxdr_decode_fhandle(xdr, &args->ffh) && ··· 375 390 &args->tname, &args->tlen); 376 391 } 377 392 378 - int 379 - nfssvc_decode_symlinkargs(struct svc_rqst *rqstp, __be32 *p) 393 + bool 394 + nfssvc_decode_symlinkargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) 380 395 { 381 - struct xdr_stream *xdr = &rqstp->rq_arg_stream; 382 396 struct nfsd_symlinkargs *args = rqstp->rq_argp; 383 397 struct kvec *head = rqstp->rq_arg.head; 384 398 385 399 if (!svcxdr_decode_diropargs(xdr, &args->ffh, &args->fname, &args->flen)) 386 - return 0; 400 + return false; 387 401 if (xdr_stream_decode_u32(xdr, &args->tlen) < 0) 388 - return 0; 402 + return false; 389 403 if (args->tlen == 0) 390 - return 0; 404 + return false; 391 405 392 406 args->first.iov_len = head->iov_len - xdr_stream_pos(xdr); 393 407 args->first.iov_base = xdr_inline_decode(xdr, args->tlen); 394 408 if (!args->first.iov_base) 395 - return 0; 409 + return false; 396 410 return svcxdr_decode_sattr(rqstp, xdr, &args->attrs); 397 411 } 398 412 399 - int 400 - nfssvc_decode_readdirargs(struct svc_rqst *rqstp, __be32 *p) 413 + bool 414 + nfssvc_decode_readdirargs(struct svc_rqst *rqstp, struct xdr_stream *xdr) 401 415 { 402 - struct xdr_stream *xdr = &rqstp->rq_arg_stream; 403 416 struct nfsd_readdirargs *args = rqstp->rq_argp; 404 417 405 418 if (!svcxdr_decode_fhandle(xdr, &args->fh)) 406 - return 0; 419 + return false; 407 420 if (xdr_stream_decode_u32(xdr, &args->cookie) < 0) 408 - return 0; 421 + return false; 409 422 if (xdr_stream_decode_u32(xdr, &args->count) < 0) 410 - return 0; 423 + return false; 411 424 412 - return 1; 425 + return true; 413 426 } 414 427 415 428 /* 416 429 * XDR encode functions 417 430 */ 418 431 419 - int 420 - nfssvc_encode_statres(struct svc_rqst *rqstp, __be32 *p) 432 + bool 433 + nfssvc_encode_statres(struct svc_rqst *rqstp, struct xdr_stream *xdr) 421 434 { 422 - struct xdr_stream *xdr = &rqstp->rq_res_stream; 423 435 struct nfsd_stat *resp = rqstp->rq_resp; 424 436 425 437 return svcxdr_encode_stat(xdr, resp->status); 426 438 } 427 439 428 - int 429 - nfssvc_encode_attrstatres(struct svc_rqst *rqstp, __be32 *p) 440 + bool 441 + nfssvc_encode_attrstatres(struct svc_rqst *rqstp, struct xdr_stream *xdr) 430 442 { 431 - struct xdr_stream *xdr = &rqstp->rq_res_stream; 432 443 struct nfsd_attrstat *resp = rqstp->rq_resp; 433 444 434 445 if (!svcxdr_encode_stat(xdr, resp->status)) 435 - return 0; 446 + return false; 436 447 switch (resp->status) { 437 448 case nfs_ok: 438 449 if (!svcxdr_encode_fattr(rqstp, xdr, &resp->fh, &resp->stat)) 439 - return 0; 450 + return false; 440 451 break; 441 452 } 442 453 443 - return 1; 454 + return true; 444 455 } 445 456 446 - int 447 - nfssvc_encode_diropres(struct svc_rqst *rqstp, __be32 *p) 457 + bool 458 + nfssvc_encode_diropres(struct svc_rqst *rqstp, struct xdr_stream *xdr) 448 459 { 449 - struct xdr_stream *xdr = &rqstp->rq_res_stream; 450 460 struct nfsd_diropres *resp = rqstp->rq_resp; 451 461 452 462 if (!svcxdr_encode_stat(xdr, resp->status)) 453 - return 0; 463 + return false; 454 464 switch (resp->status) { 455 465 case nfs_ok: 456 466 if (!svcxdr_encode_fhandle(xdr, &resp->fh)) 457 - return 0; 467 + return false; 458 468 if (!svcxdr_encode_fattr(rqstp, xdr, &resp->fh, &resp->stat)) 459 - return 0; 469 + return false; 460 470 break; 461 471 } 462 472 463 - return 1; 473 + return true; 464 474 } 465 475 466 - int 467 - nfssvc_encode_readlinkres(struct svc_rqst *rqstp, __be32 *p) 476 + bool 477 + nfssvc_encode_readlinkres(struct svc_rqst *rqstp, struct xdr_stream *xdr) 468 478 { 469 - struct xdr_stream *xdr = &rqstp->rq_res_stream; 470 479 struct nfsd_readlinkres *resp = rqstp->rq_resp; 471 480 struct kvec *head = rqstp->rq_res.head; 472 481 473 482 if (!svcxdr_encode_stat(xdr, resp->status)) 474 - return 0; 483 + return false; 475 484 switch (resp->status) { 476 485 case nfs_ok: 477 486 if (xdr_stream_encode_u32(xdr, resp->len) < 0) 478 - return 0; 487 + return false; 479 488 xdr_write_pages(xdr, &resp->page, 0, resp->len); 480 489 if (svc_encode_result_payload(rqstp, head->iov_len, resp->len) < 0) 481 - return 0; 490 + return false; 482 491 break; 483 492 } 484 493 485 - return 1; 494 + return true; 486 495 } 487 496 488 - int 489 - nfssvc_encode_readres(struct svc_rqst *rqstp, __be32 *p) 497 + bool 498 + nfssvc_encode_readres(struct svc_rqst *rqstp, struct xdr_stream *xdr) 490 499 { 491 - struct xdr_stream *xdr = &rqstp->rq_res_stream; 492 500 struct nfsd_readres *resp = rqstp->rq_resp; 493 501 struct kvec *head = rqstp->rq_res.head; 494 502 495 503 if (!svcxdr_encode_stat(xdr, resp->status)) 496 - return 0; 504 + return false; 497 505 switch (resp->status) { 498 506 case nfs_ok: 499 507 if (!svcxdr_encode_fattr(rqstp, xdr, &resp->fh, &resp->stat)) 500 - return 0; 508 + return false; 501 509 if (xdr_stream_encode_u32(xdr, resp->count) < 0) 502 - return 0; 510 + return false; 503 511 xdr_write_pages(xdr, resp->pages, rqstp->rq_res.page_base, 504 512 resp->count); 505 513 if (svc_encode_result_payload(rqstp, head->iov_len, resp->count) < 0) 506 - return 0; 514 + return false; 507 515 break; 508 516 } 509 517 510 - return 1; 518 + return true; 511 519 } 512 520 513 - int 514 - nfssvc_encode_readdirres(struct svc_rqst *rqstp, __be32 *p) 521 + bool 522 + nfssvc_encode_readdirres(struct svc_rqst *rqstp, struct xdr_stream *xdr) 515 523 { 516 - struct xdr_stream *xdr = &rqstp->rq_res_stream; 517 524 struct nfsd_readdirres *resp = rqstp->rq_resp; 518 525 struct xdr_buf *dirlist = &resp->dirlist; 519 526 520 527 if (!svcxdr_encode_stat(xdr, resp->status)) 521 - return 0; 528 + return false; 522 529 switch (resp->status) { 523 530 case nfs_ok: 524 531 xdr_write_pages(xdr, dirlist->pages, 0, dirlist->len); 525 532 /* no more entries */ 526 533 if (xdr_stream_encode_item_absent(xdr) < 0) 527 - return 0; 534 + return false; 528 535 if (xdr_stream_encode_bool(xdr, resp->common.err == nfserr_eof) < 0) 529 - return 0; 536 + return false; 530 537 break; 531 538 } 532 539 533 - return 1; 540 + return true; 534 541 } 535 542 536 - int 537 - nfssvc_encode_statfsres(struct svc_rqst *rqstp, __be32 *p) 543 + bool 544 + nfssvc_encode_statfsres(struct svc_rqst *rqstp, struct xdr_stream *xdr) 538 545 { 539 - struct xdr_stream *xdr = &rqstp->rq_res_stream; 540 546 struct nfsd_statfsres *resp = rqstp->rq_resp; 541 547 struct kstatfs *stat = &resp->stats; 548 + __be32 *p; 542 549 543 550 if (!svcxdr_encode_stat(xdr, resp->status)) 544 - return 0; 551 + return false; 545 552 switch (resp->status) { 546 553 case nfs_ok: 547 554 p = xdr_reserve_space(xdr, XDR_UNIT * 5); 548 555 if (!p) 549 - return 0; 556 + return false; 550 557 *p++ = cpu_to_be32(NFSSVC_MAXBLKSIZE_V2); 551 558 *p++ = cpu_to_be32(stat->f_bsize); 552 559 *p++ = cpu_to_be32(stat->f_blocks); ··· 547 570 break; 548 571 } 549 572 550 - return 1; 573 + return true; 551 574 } 552 575 553 576 /**
+3 -4
fs/nfsd/vfs.c
··· 244 244 * returned. Otherwise the covered directory is returned. 245 245 * NOTE: this mountpoint crossing is not supported properly by all 246 246 * clients and is explicitly disallowed for NFSv3 247 + * NeilBrown <neilb@cse.unsw.edu.au> 247 248 */ 248 249 __be32 249 250 nfsd_lookup(struct svc_rqst *rqstp, struct svc_fh *fhp, const char *name, ··· 730 729 path.dentry = fhp->fh_dentry; 731 730 inode = d_inode(path.dentry); 732 731 733 - /* Disallow write access to files with the append-only bit set 734 - * or any access when mandatory locking enabled 735 - */ 736 732 err = nfserr_perm; 737 733 if (IS_APPEND(inode) && (may_flags & NFSD_MAY_WRITE)) 738 734 goto out; ··· 1408 1410 1409 1411 if (nfsd_create_is_exclusive(createmode)) { 1410 1412 /* solaris7 gets confused (bugid 4218508) if these have 1411 - * the high bit set, so just clear the high bits. If this is 1413 + * the high bit set, as do xfs filesystems without the 1414 + * "bigtime" feature. So just clear the high bits. If this is 1412 1415 * ever changed to use different attrs for storing the 1413 1416 * verifier, then do_open_lookup() will also need to be fixed 1414 1417 * accordingly.
+19 -18
fs/nfsd/xdr.h
··· 33 33 svc_fh fh; 34 34 __u32 offset; 35 35 int len; 36 - struct kvec first; 36 + struct xdr_buf payload; 37 37 }; 38 38 39 39 struct nfsd_createargs { ··· 141 141 #define NFS2_SVC_XDRSIZE sizeof(union nfsd_xdrstore) 142 142 143 143 144 - int nfssvc_decode_fhandleargs(struct svc_rqst *, __be32 *); 145 - int nfssvc_decode_sattrargs(struct svc_rqst *, __be32 *); 146 - int nfssvc_decode_diropargs(struct svc_rqst *, __be32 *); 147 - int nfssvc_decode_readargs(struct svc_rqst *, __be32 *); 148 - int nfssvc_decode_writeargs(struct svc_rqst *, __be32 *); 149 - int nfssvc_decode_createargs(struct svc_rqst *, __be32 *); 150 - int nfssvc_decode_renameargs(struct svc_rqst *, __be32 *); 151 - int nfssvc_decode_linkargs(struct svc_rqst *, __be32 *); 152 - int nfssvc_decode_symlinkargs(struct svc_rqst *, __be32 *); 153 - int nfssvc_decode_readdirargs(struct svc_rqst *, __be32 *); 154 - int nfssvc_encode_statres(struct svc_rqst *, __be32 *); 155 - int nfssvc_encode_attrstatres(struct svc_rqst *, __be32 *); 156 - int nfssvc_encode_diropres(struct svc_rqst *, __be32 *); 157 - int nfssvc_encode_readlinkres(struct svc_rqst *, __be32 *); 158 - int nfssvc_encode_readres(struct svc_rqst *, __be32 *); 159 - int nfssvc_encode_statfsres(struct svc_rqst *, __be32 *); 160 - int nfssvc_encode_readdirres(struct svc_rqst *, __be32 *); 144 + bool nfssvc_decode_fhandleargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); 145 + bool nfssvc_decode_sattrargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); 146 + bool nfssvc_decode_diropargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); 147 + bool nfssvc_decode_readargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); 148 + bool nfssvc_decode_writeargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); 149 + bool nfssvc_decode_createargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); 150 + bool nfssvc_decode_renameargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); 151 + bool nfssvc_decode_linkargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); 152 + bool nfssvc_decode_symlinkargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); 153 + bool nfssvc_decode_readdirargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); 154 + 155 + bool nfssvc_encode_statres(struct svc_rqst *rqstp, struct xdr_stream *xdr); 156 + bool nfssvc_encode_attrstatres(struct svc_rqst *rqstp, struct xdr_stream *xdr); 157 + bool nfssvc_encode_diropres(struct svc_rqst *rqstp, struct xdr_stream *xdr); 158 + bool nfssvc_encode_readlinkres(struct svc_rqst *rqstp, struct xdr_stream *xdr); 159 + bool nfssvc_encode_readres(struct svc_rqst *rqstp, struct xdr_stream *xdr); 160 + bool nfssvc_encode_statfsres(struct svc_rqst *rqstp, struct xdr_stream *xdr); 161 + bool nfssvc_encode_readdirres(struct svc_rqst *rqstp, struct xdr_stream *xdr); 161 162 162 163 void nfssvc_encode_nfscookie(struct nfsd_readdirres *resp, u32 offset); 163 164 int nfssvc_encode_entry(void *data, const char *name, int namlen,
+32 -31
fs/nfsd/xdr3.h
··· 40 40 __u32 count; 41 41 int stable; 42 42 __u32 len; 43 - struct kvec first; 43 + struct xdr_buf payload; 44 44 }; 45 45 46 46 struct nfsd3_createargs { ··· 265 265 266 266 #define NFS3_SVC_XDRSIZE sizeof(union nfsd3_xdrstore) 267 267 268 - int nfs3svc_decode_fhandleargs(struct svc_rqst *, __be32 *); 269 - int nfs3svc_decode_sattrargs(struct svc_rqst *, __be32 *); 270 - int nfs3svc_decode_diropargs(struct svc_rqst *, __be32 *); 271 - int nfs3svc_decode_accessargs(struct svc_rqst *, __be32 *); 272 - int nfs3svc_decode_readargs(struct svc_rqst *, __be32 *); 273 - int nfs3svc_decode_writeargs(struct svc_rqst *, __be32 *); 274 - int nfs3svc_decode_createargs(struct svc_rqst *, __be32 *); 275 - int nfs3svc_decode_mkdirargs(struct svc_rqst *, __be32 *); 276 - int nfs3svc_decode_mknodargs(struct svc_rqst *, __be32 *); 277 - int nfs3svc_decode_renameargs(struct svc_rqst *, __be32 *); 278 - int nfs3svc_decode_linkargs(struct svc_rqst *, __be32 *); 279 - int nfs3svc_decode_symlinkargs(struct svc_rqst *, __be32 *); 280 - int nfs3svc_decode_readdirargs(struct svc_rqst *, __be32 *); 281 - int nfs3svc_decode_readdirplusargs(struct svc_rqst *, __be32 *); 282 - int nfs3svc_decode_commitargs(struct svc_rqst *, __be32 *); 283 - int nfs3svc_encode_getattrres(struct svc_rqst *, __be32 *); 284 - int nfs3svc_encode_wccstat(struct svc_rqst *, __be32 *); 285 - int nfs3svc_encode_lookupres(struct svc_rqst *, __be32 *); 286 - int nfs3svc_encode_accessres(struct svc_rqst *, __be32 *); 287 - int nfs3svc_encode_readlinkres(struct svc_rqst *, __be32 *); 288 - int nfs3svc_encode_readres(struct svc_rqst *, __be32 *); 289 - int nfs3svc_encode_writeres(struct svc_rqst *, __be32 *); 290 - int nfs3svc_encode_createres(struct svc_rqst *, __be32 *); 291 - int nfs3svc_encode_renameres(struct svc_rqst *, __be32 *); 292 - int nfs3svc_encode_linkres(struct svc_rqst *, __be32 *); 293 - int nfs3svc_encode_readdirres(struct svc_rqst *, __be32 *); 294 - int nfs3svc_encode_fsstatres(struct svc_rqst *, __be32 *); 295 - int nfs3svc_encode_fsinfores(struct svc_rqst *, __be32 *); 296 - int nfs3svc_encode_pathconfres(struct svc_rqst *, __be32 *); 297 - int nfs3svc_encode_commitres(struct svc_rqst *, __be32 *); 268 + bool nfs3svc_decode_fhandleargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); 269 + bool nfs3svc_decode_sattrargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); 270 + bool nfs3svc_decode_diropargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); 271 + bool nfs3svc_decode_accessargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); 272 + bool nfs3svc_decode_readargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); 273 + bool nfs3svc_decode_writeargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); 274 + bool nfs3svc_decode_createargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); 275 + bool nfs3svc_decode_mkdirargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); 276 + bool nfs3svc_decode_mknodargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); 277 + bool nfs3svc_decode_renameargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); 278 + bool nfs3svc_decode_linkargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); 279 + bool nfs3svc_decode_symlinkargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); 280 + bool nfs3svc_decode_readdirargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); 281 + bool nfs3svc_decode_readdirplusargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); 282 + bool nfs3svc_decode_commitargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); 283 + 284 + bool nfs3svc_encode_getattrres(struct svc_rqst *rqstp, struct xdr_stream *xdr); 285 + bool nfs3svc_encode_wccstat(struct svc_rqst *rqstp, struct xdr_stream *xdr); 286 + bool nfs3svc_encode_lookupres(struct svc_rqst *rqstp, struct xdr_stream *xdr); 287 + bool nfs3svc_encode_accessres(struct svc_rqst *rqstp, struct xdr_stream *xdr); 288 + bool nfs3svc_encode_readlinkres(struct svc_rqst *rqstp, struct xdr_stream *xdr); 289 + bool nfs3svc_encode_readres(struct svc_rqst *rqstp, struct xdr_stream *xdr); 290 + bool nfs3svc_encode_writeres(struct svc_rqst *rqstp, struct xdr_stream *xdr); 291 + bool nfs3svc_encode_createres(struct svc_rqst *rqstp, struct xdr_stream *xdr); 292 + bool nfs3svc_encode_renameres(struct svc_rqst *rqstp, struct xdr_stream *xdr); 293 + bool nfs3svc_encode_linkres(struct svc_rqst *rqstp, struct xdr_stream *xdr); 294 + bool nfs3svc_encode_readdirres(struct svc_rqst *rqstp, struct xdr_stream *xdr); 295 + bool nfs3svc_encode_fsstatres(struct svc_rqst *rqstp, struct xdr_stream *xdr); 296 + bool nfs3svc_encode_fsinfores(struct svc_rqst *rqstp, struct xdr_stream *xdr); 297 + bool nfs3svc_encode_pathconfres(struct svc_rqst *rqstp, struct xdr_stream *xdr); 298 + bool nfs3svc_encode_commitres(struct svc_rqst *rqstp, struct xdr_stream *xdr); 298 299 299 300 void nfs3svc_release_fhandle(struct svc_rqst *); 300 301 void nfs3svc_release_fhandle2(struct svc_rqst *);
+4 -3
fs/nfsd/xdr4.h
··· 702 702 struct xdr_stream *xdr; 703 703 struct svc_rqst * rqstp; 704 704 705 + __be32 *statusp; 705 706 u32 taglen; 706 707 char * tag; 707 708 u32 opcnt; 708 - __be32 * tagp; /* tag, opcount encode location */ 709 + 709 710 struct nfsd4_compound_state cstate; 710 711 }; 711 712 ··· 757 756 758 757 759 758 bool nfsd4_mach_creds_match(struct nfs4_client *cl, struct svc_rqst *rqstp); 760 - int nfs4svc_decode_compoundargs(struct svc_rqst *, __be32 *); 761 - int nfs4svc_encode_compoundres(struct svc_rqst *, __be32 *); 759 + bool nfs4svc_decode_compoundargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); 760 + bool nfs4svc_encode_compoundres(struct svc_rqst *rqstp, struct xdr_stream *xdr); 762 761 __be32 nfsd4_check_resp_size(struct nfsd4_compoundres *, u32); 763 762 void nfsd4_encode_operation(struct nfsd4_compoundres *, struct nfsd4_op *); 764 763 void nfsd4_encode_replay(struct xdr_stream *xdr, struct nfsd4_op *op);
+14 -13
include/linux/lockd/xdr.h
··· 96 96 */ 97 97 #define NLMSVC_XDRSIZE sizeof(struct nlm_args) 98 98 99 - int nlmsvc_decode_testargs(struct svc_rqst *, __be32 *); 100 - int nlmsvc_encode_testres(struct svc_rqst *, __be32 *); 101 - int nlmsvc_decode_lockargs(struct svc_rqst *, __be32 *); 102 - int nlmsvc_decode_cancargs(struct svc_rqst *, __be32 *); 103 - int nlmsvc_decode_unlockargs(struct svc_rqst *, __be32 *); 104 - int nlmsvc_encode_res(struct svc_rqst *, __be32 *); 105 - int nlmsvc_decode_res(struct svc_rqst *, __be32 *); 106 - int nlmsvc_encode_void(struct svc_rqst *, __be32 *); 107 - int nlmsvc_decode_void(struct svc_rqst *, __be32 *); 108 - int nlmsvc_decode_shareargs(struct svc_rqst *, __be32 *); 109 - int nlmsvc_encode_shareres(struct svc_rqst *, __be32 *); 110 - int nlmsvc_decode_notify(struct svc_rqst *, __be32 *); 111 - int nlmsvc_decode_reboot(struct svc_rqst *, __be32 *); 99 + bool nlmsvc_decode_void(struct svc_rqst *rqstp, struct xdr_stream *xdr); 100 + bool nlmsvc_decode_testargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); 101 + bool nlmsvc_decode_lockargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); 102 + bool nlmsvc_decode_cancargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); 103 + bool nlmsvc_decode_unlockargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); 104 + bool nlmsvc_decode_res(struct svc_rqst *rqstp, struct xdr_stream *xdr); 105 + bool nlmsvc_decode_reboot(struct svc_rqst *rqstp, struct xdr_stream *xdr); 106 + bool nlmsvc_decode_shareargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); 107 + bool nlmsvc_decode_notify(struct svc_rqst *rqstp, struct xdr_stream *xdr); 108 + 109 + bool nlmsvc_encode_testres(struct svc_rqst *rqstp, struct xdr_stream *xdr); 110 + bool nlmsvc_encode_res(struct svc_rqst *rqstp, struct xdr_stream *xdr); 111 + bool nlmsvc_encode_void(struct svc_rqst *rqstp, struct xdr_stream *xdr); 112 + bool nlmsvc_encode_shareres(struct svc_rqst *rqstp, struct xdr_stream *xdr); 112 113 113 114 #endif /* LOCKD_XDR_H */
+13 -14
include/linux/lockd/xdr4.h
··· 22 22 #define nlm4_fbig cpu_to_be32(NLM_FBIG) 23 23 #define nlm4_failed cpu_to_be32(NLM_FAILED) 24 24 25 + bool nlm4svc_decode_void(struct svc_rqst *rqstp, struct xdr_stream *xdr); 26 + bool nlm4svc_decode_testargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); 27 + bool nlm4svc_decode_lockargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); 28 + bool nlm4svc_decode_cancargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); 29 + bool nlm4svc_decode_unlockargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); 30 + bool nlm4svc_decode_res(struct svc_rqst *rqstp, struct xdr_stream *xdr); 31 + bool nlm4svc_decode_reboot(struct svc_rqst *rqstp, struct xdr_stream *xdr); 32 + bool nlm4svc_decode_shareargs(struct svc_rqst *rqstp, struct xdr_stream *xdr); 33 + bool nlm4svc_decode_notify(struct svc_rqst *rqstp, struct xdr_stream *xdr); 25 34 26 - 27 - int nlm4svc_decode_testargs(struct svc_rqst *, __be32 *); 28 - int nlm4svc_encode_testres(struct svc_rqst *, __be32 *); 29 - int nlm4svc_decode_lockargs(struct svc_rqst *, __be32 *); 30 - int nlm4svc_decode_cancargs(struct svc_rqst *, __be32 *); 31 - int nlm4svc_decode_unlockargs(struct svc_rqst *, __be32 *); 32 - int nlm4svc_encode_res(struct svc_rqst *, __be32 *); 33 - int nlm4svc_decode_res(struct svc_rqst *, __be32 *); 34 - int nlm4svc_encode_void(struct svc_rqst *, __be32 *); 35 - int nlm4svc_decode_void(struct svc_rqst *, __be32 *); 36 - int nlm4svc_decode_shareargs(struct svc_rqst *, __be32 *); 37 - int nlm4svc_encode_shareres(struct svc_rqst *, __be32 *); 38 - int nlm4svc_decode_notify(struct svc_rqst *, __be32 *); 39 - int nlm4svc_decode_reboot(struct svc_rqst *, __be32 *); 35 + bool nlm4svc_encode_testres(struct svc_rqst *rqstp, struct xdr_stream *xdr); 36 + bool nlm4svc_encode_res(struct svc_rqst *rqstp, struct xdr_stream *xdr); 37 + bool nlm4svc_encode_void(struct svc_rqst *rqstp, struct xdr_stream *xdr); 38 + bool nlm4svc_encode_shareres(struct svc_rqst *rqstp, struct xdr_stream *xdr); 40 39 41 40 extern const struct rpc_version nlm_version4; 42 41
+6 -8
include/linux/sunrpc/svc.h
··· 443 443 /* Need xprt with congestion control */ 444 444 bool vs_need_cong_ctrl; 445 445 446 - /* Override dispatch function (e.g. when caching replies). 447 - * A return value of 0 means drop the request. 448 - * vs_dispatch == NULL means use default dispatcher. 449 - */ 446 + /* Dispatch function */ 450 447 int (*vs_dispatch)(struct svc_rqst *, __be32 *); 451 448 }; 452 449 ··· 454 457 /* process the request: */ 455 458 __be32 (*pc_func)(struct svc_rqst *); 456 459 /* XDR decode args: */ 457 - int (*pc_decode)(struct svc_rqst *, __be32 *data); 460 + bool (*pc_decode)(struct svc_rqst *rqstp, 461 + struct xdr_stream *xdr); 458 462 /* XDR encode result: */ 459 - int (*pc_encode)(struct svc_rqst *, __be32 *data); 463 + bool (*pc_encode)(struct svc_rqst *rqstp, 464 + struct xdr_stream *xdr); 460 465 /* XDR free result: */ 461 466 void (*pc_release)(struct svc_rqst *); 462 467 unsigned int pc_argsize; /* argument struct size */ ··· 531 532 unsigned int offset, 532 533 unsigned int length); 533 534 unsigned int svc_fill_write_vector(struct svc_rqst *rqstp, 534 - struct page **pages, 535 - struct kvec *first, size_t total); 535 + struct xdr_buf *payload); 536 536 char *svc_fill_symlink_pathname(struct svc_rqst *rqstp, 537 537 struct kvec *first, void *p, 538 538 size_t total);
+181 -4
include/trace/events/rpcrdma.h
··· 62 62 ), \ 63 63 TP_ARGS(wc, cid)) 64 64 65 + DECLARE_EVENT_CLASS(rpcrdma_send_completion_class, 66 + TP_PROTO( 67 + const struct ib_wc *wc, 68 + const struct rpc_rdma_cid *cid 69 + ), 70 + 71 + TP_ARGS(wc, cid), 72 + 73 + TP_STRUCT__entry( 74 + __field(u32, cq_id) 75 + __field(int, completion_id) 76 + ), 77 + 78 + TP_fast_assign( 79 + __entry->cq_id = cid->ci_queue_id; 80 + __entry->completion_id = cid->ci_completion_id; 81 + ), 82 + 83 + TP_printk("cq.id=%u cid=%d", 84 + __entry->cq_id, __entry->completion_id 85 + ) 86 + ); 87 + 88 + #define DEFINE_SEND_COMPLETION_EVENT(name) \ 89 + DEFINE_EVENT(rpcrdma_send_completion_class, name, \ 90 + TP_PROTO( \ 91 + const struct ib_wc *wc, \ 92 + const struct rpc_rdma_cid *cid \ 93 + ), \ 94 + TP_ARGS(wc, cid)) 95 + 96 + DECLARE_EVENT_CLASS(rpcrdma_send_flush_class, 97 + TP_PROTO( 98 + const struct ib_wc *wc, 99 + const struct rpc_rdma_cid *cid 100 + ), 101 + 102 + TP_ARGS(wc, cid), 103 + 104 + TP_STRUCT__entry( 105 + __field(u32, cq_id) 106 + __field(int, completion_id) 107 + __field(unsigned long, status) 108 + __field(unsigned int, vendor_err) 109 + ), 110 + 111 + TP_fast_assign( 112 + __entry->cq_id = cid->ci_queue_id; 113 + __entry->completion_id = cid->ci_completion_id; 114 + __entry->status = wc->status; 115 + __entry->vendor_err = wc->vendor_err; 116 + ), 117 + 118 + TP_printk("cq.id=%u cid=%d status=%s (%lu/0x%x)", 119 + __entry->cq_id, __entry->completion_id, 120 + rdma_show_wc_status(__entry->status), 121 + __entry->status, __entry->vendor_err 122 + ) 123 + ); 124 + 125 + #define DEFINE_SEND_FLUSH_EVENT(name) \ 126 + DEFINE_EVENT(rpcrdma_send_flush_class, name, \ 127 + TP_PROTO( \ 128 + const struct ib_wc *wc, \ 129 + const struct rpc_rdma_cid *cid \ 130 + ), \ 131 + TP_ARGS(wc, cid)) 132 + 65 133 DECLARE_EVENT_CLASS(rpcrdma_mr_completion_class, 66 134 TP_PROTO( 67 135 const struct ib_wc *wc, ··· 209 141 210 142 #define DEFINE_RECEIVE_COMPLETION_EVENT(name) \ 211 143 DEFINE_EVENT(rpcrdma_receive_completion_class, name, \ 144 + TP_PROTO( \ 145 + const struct ib_wc *wc, \ 146 + const struct rpc_rdma_cid *cid \ 147 + ), \ 148 + TP_ARGS(wc, cid)) 149 + 150 + DECLARE_EVENT_CLASS(rpcrdma_receive_success_class, 151 + TP_PROTO( 152 + const struct ib_wc *wc, 153 + const struct rpc_rdma_cid *cid 154 + ), 155 + 156 + TP_ARGS(wc, cid), 157 + 158 + TP_STRUCT__entry( 159 + __field(u32, cq_id) 160 + __field(int, completion_id) 161 + __field(u32, received) 162 + ), 163 + 164 + TP_fast_assign( 165 + __entry->cq_id = cid->ci_queue_id; 166 + __entry->completion_id = cid->ci_completion_id; 167 + __entry->received = wc->byte_len; 168 + ), 169 + 170 + TP_printk("cq.id=%u cid=%d received=%u", 171 + __entry->cq_id, __entry->completion_id, 172 + __entry->received 173 + ) 174 + ); 175 + 176 + #define DEFINE_RECEIVE_SUCCESS_EVENT(name) \ 177 + DEFINE_EVENT(rpcrdma_receive_success_class, name, \ 178 + TP_PROTO( \ 179 + const struct ib_wc *wc, \ 180 + const struct rpc_rdma_cid *cid \ 181 + ), \ 182 + TP_ARGS(wc, cid)) 183 + 184 + DECLARE_EVENT_CLASS(rpcrdma_receive_flush_class, 185 + TP_PROTO( 186 + const struct ib_wc *wc, 187 + const struct rpc_rdma_cid *cid 188 + ), 189 + 190 + TP_ARGS(wc, cid), 191 + 192 + TP_STRUCT__entry( 193 + __field(u32, cq_id) 194 + __field(int, completion_id) 195 + __field(unsigned long, status) 196 + __field(unsigned int, vendor_err) 197 + ), 198 + 199 + TP_fast_assign( 200 + __entry->cq_id = cid->ci_queue_id; 201 + __entry->completion_id = cid->ci_completion_id; 202 + __entry->status = wc->status; 203 + __entry->vendor_err = wc->vendor_err; 204 + ), 205 + 206 + TP_printk("cq.id=%u cid=%d status=%s (%lu/0x%x)", 207 + __entry->cq_id, __entry->completion_id, 208 + rdma_show_wc_status(__entry->status), 209 + __entry->status, __entry->vendor_err 210 + ) 211 + ); 212 + 213 + #define DEFINE_RECEIVE_FLUSH_EVENT(name) \ 214 + DEFINE_EVENT(rpcrdma_receive_flush_class, name, \ 212 215 TP_PROTO( \ 213 216 const struct ib_wc *wc, \ 214 217 const struct rpc_rdma_cid *cid \ ··· 2020 1881 ) 2021 1882 ); 2022 1883 2023 - DEFINE_COMPLETION_EVENT(svcrdma_wc_send); 1884 + DEFINE_SEND_COMPLETION_EVENT(svcrdma_wc_send); 1885 + DEFINE_SEND_FLUSH_EVENT(svcrdma_wc_send_flush); 1886 + DEFINE_SEND_FLUSH_EVENT(svcrdma_wc_send_err); 2024 1887 2025 1888 TRACE_EVENT(svcrdma_post_recv, 2026 1889 TP_PROTO( ··· 2046 1905 ) 2047 1906 ); 2048 1907 2049 - DEFINE_RECEIVE_COMPLETION_EVENT(svcrdma_wc_receive); 1908 + DEFINE_RECEIVE_SUCCESS_EVENT(svcrdma_wc_recv); 1909 + DEFINE_RECEIVE_FLUSH_EVENT(svcrdma_wc_recv_flush); 1910 + DEFINE_RECEIVE_FLUSH_EVENT(svcrdma_wc_recv_err); 2050 1911 2051 1912 TRACE_EVENT(svcrdma_rq_post_err, 2052 1913 TP_PROTO( ··· 2112 1969 DEFINE_POST_CHUNK_EVENT(write); 2113 1970 DEFINE_POST_CHUNK_EVENT(reply); 2114 1971 2115 - DEFINE_COMPLETION_EVENT(svcrdma_wc_read); 2116 - DEFINE_COMPLETION_EVENT(svcrdma_wc_write); 1972 + TRACE_EVENT(svcrdma_wc_read, 1973 + TP_PROTO( 1974 + const struct ib_wc *wc, 1975 + const struct rpc_rdma_cid *cid, 1976 + unsigned int totalbytes, 1977 + const ktime_t posttime 1978 + ), 1979 + 1980 + TP_ARGS(wc, cid, totalbytes, posttime), 1981 + 1982 + TP_STRUCT__entry( 1983 + __field(u32, cq_id) 1984 + __field(int, completion_id) 1985 + __field(s64, read_latency) 1986 + __field(unsigned int, totalbytes) 1987 + ), 1988 + 1989 + TP_fast_assign( 1990 + __entry->cq_id = cid->ci_queue_id; 1991 + __entry->completion_id = cid->ci_completion_id; 1992 + __entry->totalbytes = totalbytes; 1993 + __entry->read_latency = ktime_us_delta(ktime_get(), posttime); 1994 + ), 1995 + 1996 + TP_printk("cq.id=%u cid=%d totalbytes=%u latency-us=%lld", 1997 + __entry->cq_id, __entry->completion_id, 1998 + __entry->totalbytes, __entry->read_latency 1999 + ) 2000 + ); 2001 + 2002 + DEFINE_SEND_FLUSH_EVENT(svcrdma_wc_read_flush); 2003 + DEFINE_SEND_FLUSH_EVENT(svcrdma_wc_read_err); 2004 + 2005 + DEFINE_SEND_COMPLETION_EVENT(svcrdma_wc_write); 2006 + DEFINE_SEND_FLUSH_EVENT(svcrdma_wc_write_flush); 2007 + DEFINE_SEND_FLUSH_EVENT(svcrdma_wc_write_err); 2117 2008 2118 2009 TRACE_EVENT(svcrdma_qp_error, 2119 2010 TP_PROTO(
+32 -6
include/trace/events/sunrpc.h
··· 64 64 __field(size_t, head_len) 65 65 __field(const void *, tail_base) 66 66 __field(size_t, tail_len) 67 + __field(unsigned int, page_base) 67 68 __field(unsigned int, page_len) 68 69 __field(unsigned int, msg_len) 69 70 ), ··· 77 76 __entry->head_len = xdr->head[0].iov_len; 78 77 __entry->tail_base = xdr->tail[0].iov_base; 79 78 __entry->tail_len = xdr->tail[0].iov_len; 79 + __entry->page_base = xdr->page_base; 80 80 __entry->page_len = xdr->page_len; 81 81 __entry->msg_len = xdr->len; 82 82 ), 83 83 84 84 TP_printk(SUNRPC_TRACE_TASK_SPECIFIER 85 - " head=[%p,%zu] page=%u tail=[%p,%zu] len=%u", 85 + " head=[%p,%zu] page=%u(%u) tail=[%p,%zu] len=%u", 86 86 __entry->task_id, __entry->client_id, 87 - __entry->head_base, __entry->head_len, __entry->page_len, 88 - __entry->tail_base, __entry->tail_len, __entry->msg_len 87 + __entry->head_base, __entry->head_len, 88 + __entry->page_len, __entry->page_base, 89 + __entry->tail_base, __entry->tail_len, 90 + __entry->msg_len 89 91 ) 90 92 ); 91 93 ··· 1517 1513 __field(size_t, head_len) 1518 1514 __field(const void *, tail_base) 1519 1515 __field(size_t, tail_len) 1516 + __field(unsigned int, page_base) 1520 1517 __field(unsigned int, page_len) 1521 1518 __field(unsigned int, msg_len) 1522 1519 ), ··· 1528 1523 __entry->head_len = xdr->head[0].iov_len; 1529 1524 __entry->tail_base = xdr->tail[0].iov_base; 1530 1525 __entry->tail_len = xdr->tail[0].iov_len; 1526 + __entry->page_base = xdr->page_base; 1531 1527 __entry->page_len = xdr->page_len; 1532 1528 __entry->msg_len = xdr->len; 1533 1529 ), 1534 1530 1535 - TP_printk("xid=0x%08x head=[%p,%zu] page=%u tail=[%p,%zu] len=%u", 1531 + TP_printk("xid=0x%08x head=[%p,%zu] page=%u(%u) tail=[%p,%zu] len=%u", 1536 1532 __entry->xid, 1537 - __entry->head_base, __entry->head_len, __entry->page_len, 1538 - __entry->tail_base, __entry->tail_len, __entry->msg_len 1533 + __entry->head_base, __entry->head_len, 1534 + __entry->page_len, __entry->page_base, 1535 + __entry->tail_base, __entry->tail_len, 1536 + __entry->msg_len 1539 1537 ) 1540 1538 ); 1541 1539 ··· 1882 1874 ), 1883 1875 1884 1876 TP_printk("pid=%d", __entry->pid) 1877 + ); 1878 + 1879 + TRACE_EVENT(svc_alloc_arg_err, 1880 + TP_PROTO( 1881 + unsigned int pages 1882 + ), 1883 + 1884 + TP_ARGS(pages), 1885 + 1886 + TP_STRUCT__entry( 1887 + __field(unsigned int, pages) 1888 + ), 1889 + 1890 + TP_fast_assign( 1891 + __entry->pages = pages; 1892 + ), 1893 + 1894 + TP_printk("pages=%u", __entry->pages) 1885 1895 ); 1886 1896 1887 1897 TRACE_EVENT(svc_handle_xprt,
-115
include/uapi/linux/nfsd/nfsfh.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2 - /* 3 - * This file describes the layout of the file handles as passed 4 - * over the wire. 5 - * 6 - * Copyright (C) 1995, 1996, 1997 Olaf Kirch <okir@monad.swb.de> 7 - */ 8 - 9 - #ifndef _UAPI_LINUX_NFSD_FH_H 10 - #define _UAPI_LINUX_NFSD_FH_H 11 - 12 - #include <linux/types.h> 13 - #include <linux/nfs.h> 14 - #include <linux/nfs2.h> 15 - #include <linux/nfs3.h> 16 - #include <linux/nfs4.h> 17 - 18 - /* 19 - * This is the old "dentry style" Linux NFSv2 file handle. 20 - * 21 - * The xino and xdev fields are currently used to transport the 22 - * ino/dev of the exported inode. 23 - */ 24 - struct nfs_fhbase_old { 25 - __u32 fb_dcookie; /* dentry cookie - always 0xfeebbaca */ 26 - __u32 fb_ino; /* our inode number */ 27 - __u32 fb_dirino; /* dir inode number, 0 for directories */ 28 - __u32 fb_dev; /* our device */ 29 - __u32 fb_xdev; 30 - __u32 fb_xino; 31 - __u32 fb_generation; 32 - }; 33 - 34 - /* 35 - * This is the new flexible, extensible style NFSv2/v3/v4 file handle. 36 - * 37 - * The file handle starts with a sequence of four-byte words. 38 - * The first word contains a version number (1) and three descriptor bytes 39 - * that tell how the remaining 3 variable length fields should be handled. 40 - * These three bytes are auth_type, fsid_type and fileid_type. 41 - * 42 - * All four-byte values are in host-byte-order. 43 - * 44 - * The auth_type field is deprecated and must be set to 0. 45 - * 46 - * The fsid_type identifies how the filesystem (or export point) is 47 - * encoded. 48 - * Current values: 49 - * 0 - 4 byte device id (ms-2-bytes major, ls-2-bytes minor), 4byte inode number 50 - * NOTE: we cannot use the kdev_t device id value, because kdev_t.h 51 - * says we mustn't. We must break it up and reassemble. 52 - * 1 - 4 byte user specified identifier 53 - * 2 - 4 byte major, 4 byte minor, 4 byte inode number - DEPRECATED 54 - * 3 - 4 byte device id, encoded for user-space, 4 byte inode number 55 - * 4 - 4 byte inode number and 4 byte uuid 56 - * 5 - 8 byte uuid 57 - * 6 - 16 byte uuid 58 - * 7 - 8 byte inode number and 16 byte uuid 59 - * 60 - * The fileid_type identified how the file within the filesystem is encoded. 61 - * The values for this field are filesystem specific, exccept that 62 - * filesystems must not use the values '0' or '0xff'. 'See enum fid_type' 63 - * in include/linux/exportfs.h for currently registered values. 64 - */ 65 - struct nfs_fhbase_new { 66 - union { 67 - struct { 68 - __u8 fb_version_aux; /* == 1, even => nfs_fhbase_old */ 69 - __u8 fb_auth_type_aux; 70 - __u8 fb_fsid_type_aux; 71 - __u8 fb_fileid_type_aux; 72 - __u32 fb_auth[1]; 73 - /* __u32 fb_fsid[0]; floating */ 74 - /* __u32 fb_fileid[0]; floating */ 75 - }; 76 - struct { 77 - __u8 fb_version; /* == 1, even => nfs_fhbase_old */ 78 - __u8 fb_auth_type; 79 - __u8 fb_fsid_type; 80 - __u8 fb_fileid_type; 81 - __u32 fb_auth_flex[]; /* flexible-array member */ 82 - }; 83 - }; 84 - }; 85 - 86 - struct knfsd_fh { 87 - unsigned int fh_size; /* significant for NFSv3. 88 - * Points to the current size while building 89 - * a new file handle 90 - */ 91 - union { 92 - struct nfs_fhbase_old fh_old; 93 - __u32 fh_pad[NFS4_FHSIZE/4]; 94 - struct nfs_fhbase_new fh_new; 95 - } fh_base; 96 - }; 97 - 98 - #define ofh_dcookie fh_base.fh_old.fb_dcookie 99 - #define ofh_ino fh_base.fh_old.fb_ino 100 - #define ofh_dirino fh_base.fh_old.fb_dirino 101 - #define ofh_dev fh_base.fh_old.fb_dev 102 - #define ofh_xdev fh_base.fh_old.fb_xdev 103 - #define ofh_xino fh_base.fh_old.fb_xino 104 - #define ofh_generation fh_base.fh_old.fb_generation 105 - 106 - #define fh_version fh_base.fh_new.fb_version 107 - #define fh_fsid_type fh_base.fh_new.fb_fsid_type 108 - #define fh_auth_type fh_base.fh_new.fb_auth_type 109 - #define fh_fileid_type fh_base.fh_new.fb_fileid_type 110 - #define fh_fsid fh_base.fh_new.fb_auth_flex 111 - 112 - /* Do not use, provided for userspace compatiblity. */ 113 - #define fh_auth fh_base.fh_new.fb_auth 114 - 115 - #endif /* _UAPI_LINUX_NFSD_FH_H */
+16 -20
net/sunrpc/addr.c
··· 162 162 const size_t buflen, const char *delim, 163 163 struct sockaddr_in6 *sin6) 164 164 { 165 - char *p; 165 + char p[IPV6_SCOPE_ID_LEN + 1]; 166 166 size_t len; 167 + u32 scope_id = 0; 168 + struct net_device *dev; 167 169 168 170 if ((buf + buflen) == delim) 169 171 return 1; ··· 177 175 return 0; 178 176 179 177 len = (buf + buflen) - delim - 1; 180 - p = kmemdup_nul(delim + 1, len, GFP_KERNEL); 181 - if (p) { 182 - u32 scope_id = 0; 183 - struct net_device *dev; 178 + if (len > IPV6_SCOPE_ID_LEN) 179 + return 0; 184 180 185 - dev = dev_get_by_name(net, p); 186 - if (dev != NULL) { 187 - scope_id = dev->ifindex; 188 - dev_put(dev); 189 - } else { 190 - if (kstrtou32(p, 10, &scope_id) != 0) { 191 - kfree(p); 192 - return 0; 193 - } 194 - } 181 + memcpy(p, delim + 1, len); 182 + p[len] = 0; 195 183 196 - kfree(p); 197 - 198 - sin6->sin6_scope_id = scope_id; 199 - return 1; 184 + dev = dev_get_by_name(net, p); 185 + if (dev != NULL) { 186 + scope_id = dev->ifindex; 187 + dev_put(dev); 188 + } else { 189 + if (kstrtou32(p, 10, &scope_id) != 0) 190 + return 0; 200 191 } 201 192 202 - return 0; 193 + sin6->sin6_scope_id = scope_id; 194 + return 1; 203 195 } 204 196 205 197 static size_t rpc_pton6(struct net *net, const char *buf, const size_t buflen,
+1 -1
net/sunrpc/auth_gss/svcauth_gss.c
··· 781 781 svc_putnl(rqstp->rq_res.head, RPC_AUTH_GSS); 782 782 xdr_seq = kmalloc(4, GFP_KERNEL); 783 783 if (!xdr_seq) 784 - return -1; 784 + return -ENOMEM; 785 785 *xdr_seq = htonl(seq); 786 786 787 787 iov.iov_base = xdr_seq;
+13 -67
net/sunrpc/svc.c
··· 1186 1186 static __printf(2,3) void svc_printk(struct svc_rqst *rqstp, const char *fmt, ...) {} 1187 1187 #endif 1188 1188 1189 - static int 1190 - svc_generic_dispatch(struct svc_rqst *rqstp, __be32 *statp) 1191 - { 1192 - struct kvec *argv = &rqstp->rq_arg.head[0]; 1193 - struct kvec *resv = &rqstp->rq_res.head[0]; 1194 - const struct svc_procedure *procp = rqstp->rq_procinfo; 1195 - 1196 - /* 1197 - * Decode arguments 1198 - * XXX: why do we ignore the return value? 1199 - */ 1200 - if (procp->pc_decode && 1201 - !procp->pc_decode(rqstp, argv->iov_base)) { 1202 - *statp = rpc_garbage_args; 1203 - return 1; 1204 - } 1205 - 1206 - *statp = procp->pc_func(rqstp); 1207 - 1208 - if (*statp == rpc_drop_reply || 1209 - test_bit(RQ_DROPME, &rqstp->rq_flags)) 1210 - return 0; 1211 - 1212 - if (rqstp->rq_auth_stat != rpc_auth_ok) 1213 - return 1; 1214 - 1215 - if (*statp != rpc_success) 1216 - return 1; 1217 - 1218 - /* Encode reply */ 1219 - if (procp->pc_encode && 1220 - !procp->pc_encode(rqstp, resv->iov_base + resv->iov_len)) { 1221 - dprintk("svc: failed to encode reply\n"); 1222 - /* serv->sv_stats->rpcsystemerr++; */ 1223 - *statp = rpc_system_err; 1224 - } 1225 - return 1; 1226 - } 1227 - 1228 1189 __be32 1229 1190 svc_generic_init_request(struct svc_rqst *rqstp, 1230 1191 const struct svc_program *progp, ··· 1252 1291 __be32 *statp; 1253 1292 u32 prog, vers; 1254 1293 __be32 rpc_stat; 1255 - int auth_res; 1294 + int auth_res, rc; 1256 1295 __be32 *reply_statp; 1257 1296 1258 1297 rpc_stat = rpc_success; ··· 1353 1392 svc_reserve_auth(rqstp, procp->pc_xdrressize<<2); 1354 1393 1355 1394 /* Call the function that processes the request. */ 1356 - if (!process.dispatch) { 1357 - if (!svc_generic_dispatch(rqstp, statp)) 1358 - goto release_dropit; 1359 - if (*statp == rpc_garbage_args) 1360 - goto err_garbage; 1361 - } else { 1362 - dprintk("svc: calling dispatcher\n"); 1363 - if (!process.dispatch(rqstp, statp)) 1364 - goto release_dropit; /* Release reply info */ 1365 - } 1366 - 1395 + rc = process.dispatch(rqstp, statp); 1396 + if (procp->pc_release) 1397 + procp->pc_release(rqstp); 1398 + if (!rc) 1399 + goto dropit; 1367 1400 if (rqstp->rq_auth_stat != rpc_auth_ok) 1368 - goto err_release_bad_auth; 1401 + goto err_bad_auth; 1369 1402 1370 1403 /* Check RPC status result */ 1371 1404 if (*statp != rpc_success) 1372 1405 resv->iov_len = ((void*)statp) - resv->iov_base + 4; 1373 - 1374 - /* Release reply info */ 1375 - if (procp->pc_release) 1376 - procp->pc_release(rqstp); 1377 1406 1378 1407 if (procp->pc_encode == NULL) 1379 1408 goto dropit; ··· 1373 1422 goto close_xprt; 1374 1423 return 1; /* Caller can now send it */ 1375 1424 1376 - release_dropit: 1377 - if (procp->pc_release) 1378 - procp->pc_release(rqstp); 1379 1425 dropit: 1380 1426 svc_authorise(rqstp); /* doesn't hurt to call this twice */ 1381 1427 dprintk("svc: svc_process dropit\n"); ··· 1399 1451 svc_putnl(resv, 2); 1400 1452 goto sendit; 1401 1453 1402 - err_release_bad_auth: 1403 - if (procp->pc_release) 1404 - procp->pc_release(rqstp); 1405 1454 err_bad_auth: 1406 1455 dprintk("svc: authentication failed (%d)\n", 1407 1456 be32_to_cpu(rqstp->rq_auth_stat)); ··· 1621 1676 /** 1622 1677 * svc_fill_write_vector - Construct data argument for VFS write call 1623 1678 * @rqstp: svc_rqst to operate on 1624 - * @pages: list of pages containing data payload 1625 - * @first: buffer containing first section of write payload 1626 - * @total: total number of bytes of write payload 1679 + * @payload: xdr_buf containing only the write data payload 1627 1680 * 1628 1681 * Fills in rqstp::rq_vec, and returns the number of elements. 1629 1682 */ 1630 - unsigned int svc_fill_write_vector(struct svc_rqst *rqstp, struct page **pages, 1631 - struct kvec *first, size_t total) 1683 + unsigned int svc_fill_write_vector(struct svc_rqst *rqstp, 1684 + struct xdr_buf *payload) 1632 1685 { 1686 + struct page **pages = payload->pages; 1687 + struct kvec *first = payload->head; 1633 1688 struct kvec *vec = rqstp->rq_vec; 1689 + size_t total = payload->len; 1634 1690 unsigned int i; 1635 1691 1636 1692 /* Some types of transport can present the write payload
+1
net/sunrpc/svc_xprt.c
··· 687 687 set_current_state(TASK_RUNNING); 688 688 return -EINTR; 689 689 } 690 + trace_svc_alloc_arg_err(pages); 690 691 schedule_timeout(msecs_to_jiffies(500)); 691 692 } 692 693 rqstp->rq_page_end = &rqstp->rq_pages[pages];
+17 -15
net/sunrpc/xdr.c
··· 1633 1633 * Sets up @subbuf to represent a portion of @xdr. The portion 1634 1634 * starts at the current offset in @xdr, and extends for a length 1635 1635 * of @nbytes. If this is successful, @xdr is advanced to the next 1636 - * position following that portion. 1636 + * XDR data item following that portion. 1637 1637 * 1638 1638 * Return values: 1639 1639 * %true: @subbuf has been initialized, and @xdr has been advanced. ··· 1642 1642 bool xdr_stream_subsegment(struct xdr_stream *xdr, struct xdr_buf *subbuf, 1643 1643 unsigned int nbytes) 1644 1644 { 1645 - unsigned int remaining, offset, len; 1645 + unsigned int start = xdr_stream_pos(xdr); 1646 + unsigned int remaining, len; 1646 1647 1647 - if (xdr_buf_subsegment(xdr->buf, subbuf, xdr_stream_pos(xdr), nbytes)) 1648 + /* Extract @subbuf and bounds-check the fn arguments */ 1649 + if (xdr_buf_subsegment(xdr->buf, subbuf, start, nbytes)) 1648 1650 return false; 1649 1651 1650 - if (subbuf->head[0].iov_len) 1651 - if (!__xdr_inline_decode(xdr, subbuf->head[0].iov_len)) 1652 - return false; 1653 - 1654 - remaining = subbuf->page_len; 1655 - offset = subbuf->page_base; 1656 - while (remaining) { 1657 - len = min_t(unsigned int, remaining, PAGE_SIZE) - offset; 1658 - 1652 + /* Advance @xdr by @nbytes */ 1653 + for (remaining = nbytes; remaining;) { 1659 1654 if (xdr->p == xdr->end && !xdr_set_next_buffer(xdr)) 1660 1655 return false; 1661 - if (!__xdr_inline_decode(xdr, len)) 1662 - return false; 1663 1656 1657 + len = (char *)xdr->end - (char *)xdr->p; 1658 + if (remaining <= len) { 1659 + xdr->p = (__be32 *)((char *)xdr->p + 1660 + (remaining + xdr_pad_size(nbytes))); 1661 + break; 1662 + } 1663 + 1664 + xdr->p = (__be32 *)((char *)xdr->p + len); 1665 + xdr->end = xdr->p; 1664 1666 remaining -= len; 1665 - offset = 0; 1666 1667 } 1667 1668 1669 + xdr_stream_set_pos(xdr, start + nbytes); 1668 1670 return true; 1669 1671 } 1670 1672 EXPORT_SYMBOL_GPL(xdr_stream_subsegment);
+7 -2
net/sunrpc/xprtrdma/svc_rdma_recvfrom.c
··· 330 330 /* WARNING: Only wc->wr_cqe and wc->status are reliable */ 331 331 ctxt = container_of(cqe, struct svc_rdma_recv_ctxt, rc_cqe); 332 332 333 - trace_svcrdma_wc_receive(wc, &ctxt->rc_cid); 334 333 if (wc->status != IB_WC_SUCCESS) 335 334 goto flushed; 335 + trace_svcrdma_wc_recv(wc, &ctxt->rc_cid); 336 336 337 337 /* If receive posting fails, the connection is about to be 338 338 * lost anyway. The server will not be able to send a reply ··· 345 345 */ 346 346 if (rdma->sc_pending_recvs < rdma->sc_max_requests) 347 347 if (!svc_rdma_refresh_recvs(rdma, rdma->sc_recv_batch, false)) 348 - goto flushed; 348 + goto dropped; 349 349 350 350 /* All wc fields are now known to be valid */ 351 351 ctxt->rc_byte_len = wc->byte_len; ··· 360 360 return; 361 361 362 362 flushed: 363 + if (wc->status == IB_WC_WR_FLUSH_ERR) 364 + trace_svcrdma_wc_recv_flush(wc, &ctxt->rc_cid); 365 + else 366 + trace_svcrdma_wc_recv_err(wc, &ctxt->rc_cid); 367 + dropped: 363 368 svc_rdma_recv_ctxt_put(rdma, ctxt); 364 369 svc_xprt_deferred_close(&rdma->sc_xprt); 365 370 }
+26 -4
net/sunrpc/xprtrdma/svc_rdma_rw.c
··· 155 155 struct ib_cqe cc_cqe; 156 156 struct svcxprt_rdma *cc_rdma; 157 157 struct list_head cc_rwctxts; 158 + ktime_t cc_posttime; 158 159 int cc_sqecount; 159 160 enum ib_wc_status cc_status; 160 161 struct completion cc_done; ··· 268 267 struct svc_rdma_write_info *info = 269 268 container_of(cc, struct svc_rdma_write_info, wi_cc); 270 269 271 - trace_svcrdma_wc_write(wc, &cc->cc_cid); 270 + switch (wc->status) { 271 + case IB_WC_SUCCESS: 272 + trace_svcrdma_wc_write(wc, &cc->cc_cid); 273 + break; 274 + case IB_WC_WR_FLUSH_ERR: 275 + trace_svcrdma_wc_write_flush(wc, &cc->cc_cid); 276 + break; 277 + default: 278 + trace_svcrdma_wc_write_err(wc, &cc->cc_cid); 279 + } 272 280 273 281 svc_rdma_wake_send_waiters(rdma, cc->cc_sqecount); 274 282 ··· 330 320 struct ib_cqe *cqe = wc->wr_cqe; 331 321 struct svc_rdma_chunk_ctxt *cc = 332 322 container_of(cqe, struct svc_rdma_chunk_ctxt, cc_cqe); 333 - struct svcxprt_rdma *rdma = cc->cc_rdma; 323 + struct svc_rdma_read_info *info; 334 324 335 - trace_svcrdma_wc_read(wc, &cc->cc_cid); 325 + switch (wc->status) { 326 + case IB_WC_SUCCESS: 327 + info = container_of(cc, struct svc_rdma_read_info, ri_cc); 328 + trace_svcrdma_wc_read(wc, &cc->cc_cid, info->ri_totalbytes, 329 + cc->cc_posttime); 330 + break; 331 + case IB_WC_WR_FLUSH_ERR: 332 + trace_svcrdma_wc_read_flush(wc, &cc->cc_cid); 333 + break; 334 + default: 335 + trace_svcrdma_wc_read_err(wc, &cc->cc_cid); 336 + } 336 337 337 - svc_rdma_wake_send_waiters(rdma, cc->cc_sqecount); 338 + svc_rdma_wake_send_waiters(cc->cc_rdma, cc->cc_sqecount); 338 339 cc->cc_status = wc->status; 339 340 complete(&cc->cc_done); 340 341 return; ··· 384 363 do { 385 364 if (atomic_sub_return(cc->cc_sqecount, 386 365 &rdma->sc_sq_avail) > 0) { 366 + cc->cc_posttime = ktime_get(); 387 367 ret = ib_post_send(rdma->sc_qp, first_wr, &bad_wr); 388 368 if (ret) 389 369 break;
+11 -3
net/sunrpc/xprtrdma/svc_rdma_sendto.c
··· 280 280 struct svc_rdma_send_ctxt *ctxt = 281 281 container_of(cqe, struct svc_rdma_send_ctxt, sc_cqe); 282 282 283 - trace_svcrdma_wc_send(wc, &ctxt->sc_cid); 284 - 285 283 svc_rdma_wake_send_waiters(rdma, 1); 286 284 complete(&ctxt->sc_done); 287 285 288 286 if (unlikely(wc->status != IB_WC_SUCCESS)) 289 - svc_xprt_deferred_close(&rdma->sc_xprt); 287 + goto flushed; 288 + 289 + trace_svcrdma_wc_send(wc, &ctxt->sc_cid); 290 + return; 291 + 292 + flushed: 293 + if (wc->status != IB_WC_WR_FLUSH_ERR) 294 + trace_svcrdma_wc_send_err(wc, &ctxt->sc_cid); 295 + else 296 + trace_svcrdma_wc_send_flush(wc, &ctxt->sc_cid); 297 + svc_xprt_deferred_close(&rdma->sc_xprt); 290 298 } 291 299 292 300 /**