aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd/nfs3proc.c
diff options
context:
space:
mode:
authorDavid Woodhouse <dwmw2@infradead.org>2006-10-21 11:46:04 -0400
committerDavid Woodhouse <dwmw2@infradead.org>2006-10-21 11:46:04 -0400
commit513b046c96cc2fbce730a3474f6f7ff0c4fdd05c (patch)
treee8006368b6f643067486f92405a404757807d6da /fs/nfsd/nfs3proc.c
parent82810b7b6cc7a74c68881a13b0eb66c7a6370fcc (diff)
parentc7a3bd177f248d01ee18a01d22048c80e071c331 (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
Diffstat (limited to 'fs/nfsd/nfs3proc.c')
-rw-r--r--fs/nfsd/nfs3proc.c108
1 files changed, 57 insertions, 51 deletions
diff --git a/fs/nfsd/nfs3proc.c b/fs/nfsd/nfs3proc.c
index f61142afea44..64db601c2bd2 100644
--- a/fs/nfsd/nfs3proc.c
+++ b/fs/nfsd/nfs3proc.c
@@ -43,7 +43,7 @@ static int nfs3_ftypes[] = {
43/* 43/*
44 * NULL call. 44 * NULL call.
45 */ 45 */
46static int 46static __be32
47nfsd3_proc_null(struct svc_rqst *rqstp, void *argp, void *resp) 47nfsd3_proc_null(struct svc_rqst *rqstp, void *argp, void *resp)
48{ 48{
49 return nfs_ok; 49 return nfs_ok;
@@ -52,11 +52,12 @@ nfsd3_proc_null(struct svc_rqst *rqstp, void *argp, void *resp)
52/* 52/*
53 * Get a file's attributes 53 * Get a file's attributes
54 */ 54 */
55static int 55static __be32
56nfsd3_proc_getattr(struct svc_rqst *rqstp, struct nfsd_fhandle *argp, 56nfsd3_proc_getattr(struct svc_rqst *rqstp, struct nfsd_fhandle *argp,
57 struct nfsd3_attrstat *resp) 57 struct nfsd3_attrstat *resp)
58{ 58{
59 int err, nfserr; 59 int err;
60 __be32 nfserr;
60 61
61 dprintk("nfsd: GETATTR(3) %s\n", 62 dprintk("nfsd: GETATTR(3) %s\n",
62 SVCFH_fmt(&argp->fh)); 63 SVCFH_fmt(&argp->fh));
@@ -76,11 +77,11 @@ nfsd3_proc_getattr(struct svc_rqst *rqstp, struct nfsd_fhandle *argp,
76/* 77/*
77 * Set a file's attributes 78 * Set a file's attributes
78 */ 79 */
79static int 80static __be32
80nfsd3_proc_setattr(struct svc_rqst *rqstp, struct nfsd3_sattrargs *argp, 81nfsd3_proc_setattr(struct svc_rqst *rqstp, struct nfsd3_sattrargs *argp,
81 struct nfsd3_attrstat *resp) 82 struct nfsd3_attrstat *resp)
82{ 83{
83 int nfserr; 84 __be32 nfserr;
84 85
85 dprintk("nfsd: SETATTR(3) %s\n", 86 dprintk("nfsd: SETATTR(3) %s\n",
86 SVCFH_fmt(&argp->fh)); 87 SVCFH_fmt(&argp->fh));
@@ -94,11 +95,11 @@ nfsd3_proc_setattr(struct svc_rqst *rqstp, struct nfsd3_sattrargs *argp,
94/* 95/*
95 * Look up a path name component 96 * Look up a path name component
96 */ 97 */
97static int 98static __be32
98nfsd3_proc_lookup(struct svc_rqst *rqstp, struct nfsd3_diropargs *argp, 99nfsd3_proc_lookup(struct svc_rqst *rqstp, struct nfsd3_diropargs *argp,
99 struct nfsd3_diropres *resp) 100 struct nfsd3_diropres *resp)
100{ 101{
101 int nfserr; 102 __be32 nfserr;
102 103
103 dprintk("nfsd: LOOKUP(3) %s %.*s\n", 104 dprintk("nfsd: LOOKUP(3) %s %.*s\n",
104 SVCFH_fmt(&argp->fh), 105 SVCFH_fmt(&argp->fh),
@@ -118,11 +119,11 @@ nfsd3_proc_lookup(struct svc_rqst *rqstp, struct nfsd3_diropargs *argp,
118/* 119/*
119 * Check file access 120 * Check file access
120 */ 121 */
121static int 122static __be32
122nfsd3_proc_access(struct svc_rqst *rqstp, struct nfsd3_accessargs *argp, 123nfsd3_proc_access(struct svc_rqst *rqstp, struct nfsd3_accessargs *argp,
123 struct nfsd3_accessres *resp) 124 struct nfsd3_accessres *resp)
124{ 125{
125 int nfserr; 126 __be32 nfserr;
126 127
127 dprintk("nfsd: ACCESS(3) %s 0x%x\n", 128 dprintk("nfsd: ACCESS(3) %s 0x%x\n",
128 SVCFH_fmt(&argp->fh), 129 SVCFH_fmt(&argp->fh),
@@ -137,11 +138,11 @@ nfsd3_proc_access(struct svc_rqst *rqstp, struct nfsd3_accessargs *argp,
137/* 138/*
138 * Read a symlink. 139 * Read a symlink.
139 */ 140 */
140static int 141static __be32
141nfsd3_proc_readlink(struct svc_rqst *rqstp, struct nfsd3_readlinkargs *argp, 142nfsd3_proc_readlink(struct svc_rqst *rqstp, struct nfsd3_readlinkargs *argp,
142 struct nfsd3_readlinkres *resp) 143 struct nfsd3_readlinkres *resp)
143{ 144{
144 int nfserr; 145 __be32 nfserr;
145 146
146 dprintk("nfsd: READLINK(3) %s\n", SVCFH_fmt(&argp->fh)); 147 dprintk("nfsd: READLINK(3) %s\n", SVCFH_fmt(&argp->fh));
147 148
@@ -155,11 +156,12 @@ nfsd3_proc_readlink(struct svc_rqst *rqstp, struct nfsd3_readlinkargs *argp,
155/* 156/*
156 * Read a portion of a file. 157 * Read a portion of a file.
157 */ 158 */
158static int 159static __be32
159nfsd3_proc_read(struct svc_rqst *rqstp, struct nfsd3_readargs *argp, 160nfsd3_proc_read(struct svc_rqst *rqstp, struct nfsd3_readargs *argp,
160 struct nfsd3_readres *resp) 161 struct nfsd3_readres *resp)
161{ 162{
162 int nfserr; 163 __be32 nfserr;
164 u32 max_blocksize = svc_max_payload(rqstp);
163 165
164 dprintk("nfsd: READ(3) %s %lu bytes at %lu\n", 166 dprintk("nfsd: READ(3) %s %lu bytes at %lu\n",
165 SVCFH_fmt(&argp->fh), 167 SVCFH_fmt(&argp->fh),
@@ -172,15 +174,15 @@ nfsd3_proc_read(struct svc_rqst *rqstp, struct nfsd3_readargs *argp,
172 */ 174 */
173 175
174 resp->count = argp->count; 176 resp->count = argp->count;
175 if (NFSSVC_MAXBLKSIZE < resp->count) 177 if (max_blocksize < resp->count)
176 resp->count = NFSSVC_MAXBLKSIZE; 178 resp->count = max_blocksize;
177 179
178 svc_reserve(rqstp, ((1 + NFS3_POST_OP_ATTR_WORDS + 3)<<2) + resp->count +4); 180 svc_reserve(rqstp, ((1 + NFS3_POST_OP_ATTR_WORDS + 3)<<2) + resp->count +4);
179 181
180 fh_copy(&resp->fh, &argp->fh); 182 fh_copy(&resp->fh, &argp->fh);
181 nfserr = nfsd_read(rqstp, &resp->fh, NULL, 183 nfserr = nfsd_read(rqstp, &resp->fh, NULL,
182 argp->offset, 184 argp->offset,
183 argp->vec, argp->vlen, 185 rqstp->rq_vec, argp->vlen,
184 &resp->count); 186 &resp->count);
185 if (nfserr == 0) { 187 if (nfserr == 0) {
186 struct inode *inode = resp->fh.fh_dentry->d_inode; 188 struct inode *inode = resp->fh.fh_dentry->d_inode;
@@ -194,11 +196,11 @@ nfsd3_proc_read(struct svc_rqst *rqstp, struct nfsd3_readargs *argp,
194/* 196/*
195 * Write data to a file 197 * Write data to a file
196 */ 198 */
197static int 199static __be32
198nfsd3_proc_write(struct svc_rqst *rqstp, struct nfsd3_writeargs *argp, 200nfsd3_proc_write(struct svc_rqst *rqstp, struct nfsd3_writeargs *argp,
199 struct nfsd3_writeres *resp) 201 struct nfsd3_writeres *resp)
200{ 202{
201 int nfserr; 203 __be32 nfserr;
202 204
203 dprintk("nfsd: WRITE(3) %s %d bytes at %ld%s\n", 205 dprintk("nfsd: WRITE(3) %s %d bytes at %ld%s\n",
204 SVCFH_fmt(&argp->fh), 206 SVCFH_fmt(&argp->fh),
@@ -210,7 +212,7 @@ nfsd3_proc_write(struct svc_rqst *rqstp, struct nfsd3_writeargs *argp,
210 resp->committed = argp->stable; 212 resp->committed = argp->stable;
211 nfserr = nfsd_write(rqstp, &resp->fh, NULL, 213 nfserr = nfsd_write(rqstp, &resp->fh, NULL,
212 argp->offset, 214 argp->offset,
213 argp->vec, argp->vlen, 215 rqstp->rq_vec, argp->vlen,
214 argp->len, 216 argp->len,
215 &resp->committed); 217 &resp->committed);
216 resp->count = argp->count; 218 resp->count = argp->count;
@@ -222,13 +224,13 @@ nfsd3_proc_write(struct svc_rqst *rqstp, struct nfsd3_writeargs *argp,
222 * At least in theory; we'll see how it fares in practice when the 224 * At least in theory; we'll see how it fares in practice when the
223 * first reports about SunOS compatibility problems start to pour in... 225 * first reports about SunOS compatibility problems start to pour in...
224 */ 226 */
225static int 227static __be32
226nfsd3_proc_create(struct svc_rqst *rqstp, struct nfsd3_createargs *argp, 228nfsd3_proc_create(struct svc_rqst *rqstp, struct nfsd3_createargs *argp,
227 struct nfsd3_diropres *resp) 229 struct nfsd3_diropres *resp)
228{ 230{
229 svc_fh *dirfhp, *newfhp = NULL; 231 svc_fh *dirfhp, *newfhp = NULL;
230 struct iattr *attr; 232 struct iattr *attr;
231 u32 nfserr; 233 __be32 nfserr;
232 234
233 dprintk("nfsd: CREATE(3) %s %.*s\n", 235 dprintk("nfsd: CREATE(3) %s %.*s\n",
234 SVCFH_fmt(&argp->fh), 236 SVCFH_fmt(&argp->fh),
@@ -264,11 +266,11 @@ nfsd3_proc_create(struct svc_rqst *rqstp, struct nfsd3_createargs *argp,
264/* 266/*
265 * Make directory. This operation is not idempotent. 267 * Make directory. This operation is not idempotent.
266 */ 268 */
267static int 269static __be32
268nfsd3_proc_mkdir(struct svc_rqst *rqstp, struct nfsd3_createargs *argp, 270nfsd3_proc_mkdir(struct svc_rqst *rqstp, struct nfsd3_createargs *argp,
269 struct nfsd3_diropres *resp) 271 struct nfsd3_diropres *resp)
270{ 272{
271 int nfserr; 273 __be32 nfserr;
272 274
273 dprintk("nfsd: MKDIR(3) %s %.*s\n", 275 dprintk("nfsd: MKDIR(3) %s %.*s\n",
274 SVCFH_fmt(&argp->fh), 276 SVCFH_fmt(&argp->fh),
@@ -284,11 +286,11 @@ nfsd3_proc_mkdir(struct svc_rqst *rqstp, struct nfsd3_createargs *argp,
284 RETURN_STATUS(nfserr); 286 RETURN_STATUS(nfserr);
285} 287}
286 288
287static int 289static __be32
288nfsd3_proc_symlink(struct svc_rqst *rqstp, struct nfsd3_symlinkargs *argp, 290nfsd3_proc_symlink(struct svc_rqst *rqstp, struct nfsd3_symlinkargs *argp,
289 struct nfsd3_diropres *resp) 291 struct nfsd3_diropres *resp)
290{ 292{
291 int nfserr; 293 __be32 nfserr;
292 294
293 dprintk("nfsd: SYMLINK(3) %s %.*s -> %.*s\n", 295 dprintk("nfsd: SYMLINK(3) %s %.*s -> %.*s\n",
294 SVCFH_fmt(&argp->ffh), 296 SVCFH_fmt(&argp->ffh),
@@ -306,11 +308,12 @@ nfsd3_proc_symlink(struct svc_rqst *rqstp, struct nfsd3_symlinkargs *argp,
306/* 308/*
307 * Make socket/fifo/device. 309 * Make socket/fifo/device.
308 */ 310 */
309static int 311static __be32
310nfsd3_proc_mknod(struct svc_rqst *rqstp, struct nfsd3_mknodargs *argp, 312nfsd3_proc_mknod(struct svc_rqst *rqstp, struct nfsd3_mknodargs *argp,
311 struct nfsd3_diropres *resp) 313 struct nfsd3_diropres *resp)
312{ 314{
313 int nfserr, type; 315 __be32 nfserr;
316 int type;
314 dev_t rdev = 0; 317 dev_t rdev = 0;
315 318
316 dprintk("nfsd: MKNOD(3) %s %.*s\n", 319 dprintk("nfsd: MKNOD(3) %s %.*s\n",
@@ -342,11 +345,11 @@ nfsd3_proc_mknod(struct svc_rqst *rqstp, struct nfsd3_mknodargs *argp,
342/* 345/*
343 * Remove file/fifo/socket etc. 346 * Remove file/fifo/socket etc.
344 */ 347 */
345static int 348static __be32
346nfsd3_proc_remove(struct svc_rqst *rqstp, struct nfsd3_diropargs *argp, 349nfsd3_proc_remove(struct svc_rqst *rqstp, struct nfsd3_diropargs *argp,
347 struct nfsd3_attrstat *resp) 350 struct nfsd3_attrstat *resp)
348{ 351{
349 int nfserr; 352 __be32 nfserr;
350 353
351 dprintk("nfsd: REMOVE(3) %s %.*s\n", 354 dprintk("nfsd: REMOVE(3) %s %.*s\n",
352 SVCFH_fmt(&argp->fh), 355 SVCFH_fmt(&argp->fh),
@@ -362,11 +365,11 @@ nfsd3_proc_remove(struct svc_rqst *rqstp, struct nfsd3_diropargs *argp,
362/* 365/*
363 * Remove a directory 366 * Remove a directory
364 */ 367 */
365static int 368static __be32
366nfsd3_proc_rmdir(struct svc_rqst *rqstp, struct nfsd3_diropargs *argp, 369nfsd3_proc_rmdir(struct svc_rqst *rqstp, struct nfsd3_diropargs *argp,
367 struct nfsd3_attrstat *resp) 370 struct nfsd3_attrstat *resp)
368{ 371{
369 int nfserr; 372 __be32 nfserr;
370 373
371 dprintk("nfsd: RMDIR(3) %s %.*s\n", 374 dprintk("nfsd: RMDIR(3) %s %.*s\n",
372 SVCFH_fmt(&argp->fh), 375 SVCFH_fmt(&argp->fh),
@@ -378,11 +381,11 @@ nfsd3_proc_rmdir(struct svc_rqst *rqstp, struct nfsd3_diropargs *argp,
378 RETURN_STATUS(nfserr); 381 RETURN_STATUS(nfserr);
379} 382}
380 383
381static int 384static __be32
382nfsd3_proc_rename(struct svc_rqst *rqstp, struct nfsd3_renameargs *argp, 385nfsd3_proc_rename(struct svc_rqst *rqstp, struct nfsd3_renameargs *argp,
383 struct nfsd3_renameres *resp) 386 struct nfsd3_renameres *resp)
384{ 387{
385 int nfserr; 388 __be32 nfserr;
386 389
387 dprintk("nfsd: RENAME(3) %s %.*s ->\n", 390 dprintk("nfsd: RENAME(3) %s %.*s ->\n",
388 SVCFH_fmt(&argp->ffh), 391 SVCFH_fmt(&argp->ffh),
@@ -400,11 +403,11 @@ nfsd3_proc_rename(struct svc_rqst *rqstp, struct nfsd3_renameargs *argp,
400 RETURN_STATUS(nfserr); 403 RETURN_STATUS(nfserr);
401} 404}
402 405
403static int 406static __be32
404nfsd3_proc_link(struct svc_rqst *rqstp, struct nfsd3_linkargs *argp, 407nfsd3_proc_link(struct svc_rqst *rqstp, struct nfsd3_linkargs *argp,
405 struct nfsd3_linkres *resp) 408 struct nfsd3_linkres *resp)
406{ 409{
407 int nfserr; 410 __be32 nfserr;
408 411
409 dprintk("nfsd: LINK(3) %s ->\n", 412 dprintk("nfsd: LINK(3) %s ->\n",
410 SVCFH_fmt(&argp->ffh)); 413 SVCFH_fmt(&argp->ffh));
@@ -423,11 +426,12 @@ nfsd3_proc_link(struct svc_rqst *rqstp, struct nfsd3_linkargs *argp,
423/* 426/*
424 * Read a portion of a directory. 427 * Read a portion of a directory.
425 */ 428 */
426static int 429static __be32
427nfsd3_proc_readdir(struct svc_rqst *rqstp, struct nfsd3_readdirargs *argp, 430nfsd3_proc_readdir(struct svc_rqst *rqstp, struct nfsd3_readdirargs *argp,
428 struct nfsd3_readdirres *resp) 431 struct nfsd3_readdirres *resp)
429{ 432{
430 int nfserr, count; 433 __be32 nfserr;
434 int count;
431 435
432 dprintk("nfsd: READDIR(3) %s %d bytes at %d\n", 436 dprintk("nfsd: READDIR(3) %s %d bytes at %d\n",
433 SVCFH_fmt(&argp->fh), 437 SVCFH_fmt(&argp->fh),
@@ -458,11 +462,12 @@ nfsd3_proc_readdir(struct svc_rqst *rqstp, struct nfsd3_readdirargs *argp,
458 * Read a portion of a directory, including file handles and attrs. 462 * Read a portion of a directory, including file handles and attrs.
459 * For now, we choose to ignore the dircount parameter. 463 * For now, we choose to ignore the dircount parameter.
460 */ 464 */
461static int 465static __be32
462nfsd3_proc_readdirplus(struct svc_rqst *rqstp, struct nfsd3_readdirargs *argp, 466nfsd3_proc_readdirplus(struct svc_rqst *rqstp, struct nfsd3_readdirargs *argp,
463 struct nfsd3_readdirres *resp) 467 struct nfsd3_readdirres *resp)
464{ 468{
465 int nfserr, count = 0; 469 __be32 nfserr;
470 int count = 0;
466 loff_t offset; 471 loff_t offset;
467 int i; 472 int i;
468 caddr_t page_addr = NULL; 473 caddr_t page_addr = NULL;
@@ -516,11 +521,11 @@ nfsd3_proc_readdirplus(struct svc_rqst *rqstp, struct nfsd3_readdirargs *argp,
516/* 521/*
517 * Get file system stats 522 * Get file system stats
518 */ 523 */
519static int 524static __be32
520nfsd3_proc_fsstat(struct svc_rqst * rqstp, struct nfsd_fhandle *argp, 525nfsd3_proc_fsstat(struct svc_rqst * rqstp, struct nfsd_fhandle *argp,
521 struct nfsd3_fsstatres *resp) 526 struct nfsd3_fsstatres *resp)
522{ 527{
523 int nfserr; 528 __be32 nfserr;
524 529
525 dprintk("nfsd: FSSTAT(3) %s\n", 530 dprintk("nfsd: FSSTAT(3) %s\n",
526 SVCFH_fmt(&argp->fh)); 531 SVCFH_fmt(&argp->fh));
@@ -533,20 +538,21 @@ nfsd3_proc_fsstat(struct svc_rqst * rqstp, struct nfsd_fhandle *argp,
533/* 538/*
534 * Get file system info 539 * Get file system info
535 */ 540 */
536static int 541static __be32
537nfsd3_proc_fsinfo(struct svc_rqst * rqstp, struct nfsd_fhandle *argp, 542nfsd3_proc_fsinfo(struct svc_rqst * rqstp, struct nfsd_fhandle *argp,
538 struct nfsd3_fsinfores *resp) 543 struct nfsd3_fsinfores *resp)
539{ 544{
540 int nfserr; 545 __be32 nfserr;
546 u32 max_blocksize = svc_max_payload(rqstp);
541 547
542 dprintk("nfsd: FSINFO(3) %s\n", 548 dprintk("nfsd: FSINFO(3) %s\n",
543 SVCFH_fmt(&argp->fh)); 549 SVCFH_fmt(&argp->fh));
544 550
545 resp->f_rtmax = NFSSVC_MAXBLKSIZE; 551 resp->f_rtmax = max_blocksize;
546 resp->f_rtpref = NFSSVC_MAXBLKSIZE; 552 resp->f_rtpref = max_blocksize;
547 resp->f_rtmult = PAGE_SIZE; 553 resp->f_rtmult = PAGE_SIZE;
548 resp->f_wtmax = NFSSVC_MAXBLKSIZE; 554 resp->f_wtmax = max_blocksize;
549 resp->f_wtpref = NFSSVC_MAXBLKSIZE; 555 resp->f_wtpref = max_blocksize;
550 resp->f_wtmult = PAGE_SIZE; 556 resp->f_wtmult = PAGE_SIZE;
551 resp->f_dtpref = PAGE_SIZE; 557 resp->f_dtpref = PAGE_SIZE;
552 resp->f_maxfilesize = ~(u32) 0; 558 resp->f_maxfilesize = ~(u32) 0;
@@ -574,11 +580,11 @@ nfsd3_proc_fsinfo(struct svc_rqst * rqstp, struct nfsd_fhandle *argp,
574/* 580/*
575 * Get pathconf info for the specified file 581 * Get pathconf info for the specified file
576 */ 582 */
577static int 583static __be32
578nfsd3_proc_pathconf(struct svc_rqst * rqstp, struct nfsd_fhandle *argp, 584nfsd3_proc_pathconf(struct svc_rqst * rqstp, struct nfsd_fhandle *argp,
579 struct nfsd3_pathconfres *resp) 585 struct nfsd3_pathconfres *resp)
580{ 586{
581 int nfserr; 587 __be32 nfserr;
582 588
583 dprintk("nfsd: PATHCONF(3) %s\n", 589 dprintk("nfsd: PATHCONF(3) %s\n",
584 SVCFH_fmt(&argp->fh)); 590 SVCFH_fmt(&argp->fh));
@@ -617,11 +623,11 @@ nfsd3_proc_pathconf(struct svc_rqst * rqstp, struct nfsd_fhandle *argp,
617/* 623/*
618 * Commit a file (range) to stable storage. 624 * Commit a file (range) to stable storage.
619 */ 625 */
620static int 626static __be32
621nfsd3_proc_commit(struct svc_rqst * rqstp, struct nfsd3_commitargs *argp, 627nfsd3_proc_commit(struct svc_rqst * rqstp, struct nfsd3_commitargs *argp,
622 struct nfsd3_commitres *resp) 628 struct nfsd3_commitres *resp)
623{ 629{
624 int nfserr; 630 __be32 nfserr;
625 631
626 dprintk("nfsd: COMMIT(3) %s %u@%Lu\n", 632 dprintk("nfsd: COMMIT(3) %s %u@%Lu\n",
627 SVCFH_fmt(&argp->fh), 633 SVCFH_fmt(&argp->fh),