@@ -28,6 +28,22 @@ static int nfs3_ftypes[] = {
2828 S_IFIFO , /* NF3FIFO */
2929};
3030
31+ static __be32 nfsd3_map_status (__be32 status )
32+ {
33+ switch (status ) {
34+ case nfs_ok :
35+ break ;
36+ case nfserr_nofilehandle :
37+ status = nfserr_badhandle ;
38+ break ;
39+ case nfserr_wrongsec :
40+ case nfserr_file_open :
41+ status = nfserr_acces ;
42+ break ;
43+ }
44+ return status ;
45+ }
46+
3147/*
3248 * NULL call.
3349 */
@@ -57,6 +73,7 @@ nfsd3_proc_getattr(struct svc_rqst *rqstp)
5773
5874 resp -> status = fh_getattr (& resp -> fh , & resp -> stat );
5975out :
76+ resp -> status = nfsd3_map_status (resp -> status );
6077 return rpc_success ;
6178}
6279
@@ -80,6 +97,7 @@ nfsd3_proc_setattr(struct svc_rqst *rqstp)
8097 if (argp -> check_guard )
8198 guardtime = & argp -> guardtime ;
8299 resp -> status = nfsd_setattr (rqstp , & resp -> fh , & attrs , guardtime );
100+ resp -> status = nfsd3_map_status (resp -> status );
83101 return rpc_success ;
84102}
85103
@@ -103,6 +121,7 @@ nfsd3_proc_lookup(struct svc_rqst *rqstp)
103121 resp -> status = nfsd_lookup (rqstp , & resp -> dirfh ,
104122 argp -> name , argp -> len ,
105123 & resp -> fh );
124+ resp -> status = nfsd3_map_status (resp -> status );
106125 return rpc_success ;
107126}
108127
@@ -122,6 +141,7 @@ nfsd3_proc_access(struct svc_rqst *rqstp)
122141 fh_copy (& resp -> fh , & argp -> fh );
123142 resp -> access = argp -> access ;
124143 resp -> status = nfsd_access (rqstp , & resp -> fh , & resp -> access , NULL );
144+ resp -> status = nfsd3_map_status (resp -> status );
125145 return rpc_success ;
126146}
127147
@@ -142,6 +162,7 @@ nfsd3_proc_readlink(struct svc_rqst *rqstp)
142162 resp -> pages = rqstp -> rq_next_page ++ ;
143163 resp -> status = nfsd_readlink (rqstp , & resp -> fh ,
144164 page_address (* resp -> pages ), & resp -> len );
165+ resp -> status = nfsd3_map_status (resp -> status );
145166 return rpc_success ;
146167}
147168
@@ -179,6 +200,7 @@ nfsd3_proc_read(struct svc_rqst *rqstp)
179200 fh_copy (& resp -> fh , & argp -> fh );
180201 resp -> status = nfsd_read (rqstp , & resp -> fh , argp -> offset ,
181202 & resp -> count , & resp -> eof );
203+ resp -> status = nfsd3_map_status (resp -> status );
182204 return rpc_success ;
183205}
184206
@@ -212,6 +234,7 @@ nfsd3_proc_write(struct svc_rqst *rqstp)
212234 rqstp -> rq_vec , nvecs , & cnt ,
213235 resp -> committed , resp -> verf );
214236 resp -> count = cnt ;
237+ resp -> status = nfsd3_map_status (resp -> status );
215238 return rpc_success ;
216239}
217240
@@ -359,6 +382,7 @@ nfsd3_proc_create(struct svc_rqst *rqstp)
359382 newfhp = fh_init (& resp -> fh , NFS3_FHSIZE );
360383
361384 resp -> status = nfsd3_create_file (rqstp , dirfhp , newfhp , argp );
385+ resp -> status = nfsd3_map_status (resp -> status );
362386 return rpc_success ;
363387}
364388
@@ -384,6 +408,7 @@ nfsd3_proc_mkdir(struct svc_rqst *rqstp)
384408 fh_init (& resp -> fh , NFS3_FHSIZE );
385409 resp -> status = nfsd_create (rqstp , & resp -> dirfh , argp -> name , argp -> len ,
386410 & attrs , S_IFDIR , 0 , & resp -> fh );
411+ resp -> status = nfsd3_map_status (resp -> status );
387412 return rpc_success ;
388413}
389414
@@ -424,6 +449,7 @@ nfsd3_proc_symlink(struct svc_rqst *rqstp)
424449 argp -> flen , argp -> tname , & attrs , & resp -> fh );
425450 kfree (argp -> tname );
426451out :
452+ resp -> status = nfsd3_map_status (resp -> status );
427453 return rpc_success ;
428454}
429455
@@ -465,6 +491,7 @@ nfsd3_proc_mknod(struct svc_rqst *rqstp)
465491 resp -> status = nfsd_create (rqstp , & resp -> dirfh , argp -> name , argp -> len ,
466492 & attrs , type , rdev , & resp -> fh );
467493out :
494+ resp -> status = nfsd3_map_status (resp -> status );
468495 return rpc_success ;
469496}
470497
@@ -486,6 +513,7 @@ nfsd3_proc_remove(struct svc_rqst *rqstp)
486513 fh_copy (& resp -> fh , & argp -> fh );
487514 resp -> status = nfsd_unlink (rqstp , & resp -> fh , - S_IFDIR ,
488515 argp -> name , argp -> len );
516+ resp -> status = nfsd3_map_status (resp -> status );
489517 return rpc_success ;
490518}
491519
@@ -506,6 +534,7 @@ nfsd3_proc_rmdir(struct svc_rqst *rqstp)
506534 fh_copy (& resp -> fh , & argp -> fh );
507535 resp -> status = nfsd_unlink (rqstp , & resp -> fh , S_IFDIR ,
508536 argp -> name , argp -> len );
537+ resp -> status = nfsd3_map_status (resp -> status );
509538 return rpc_success ;
510539}
511540
@@ -528,6 +557,7 @@ nfsd3_proc_rename(struct svc_rqst *rqstp)
528557 fh_copy (& resp -> tfh , & argp -> tfh );
529558 resp -> status = nfsd_rename (rqstp , & resp -> ffh , argp -> fname , argp -> flen ,
530559 & resp -> tfh , argp -> tname , argp -> tlen );
560+ resp -> status = nfsd3_map_status (resp -> status );
531561 return rpc_success ;
532562}
533563
@@ -548,6 +578,7 @@ nfsd3_proc_link(struct svc_rqst *rqstp)
548578 fh_copy (& resp -> tfh , & argp -> tfh );
549579 resp -> status = nfsd_link (rqstp , & resp -> tfh , argp -> tname , argp -> tlen ,
550580 & resp -> fh );
581+ resp -> status = nfsd3_map_status (resp -> status );
551582 return rpc_success ;
552583}
553584
@@ -600,6 +631,7 @@ nfsd3_proc_readdir(struct svc_rqst *rqstp)
600631 /* Recycle only pages that were part of the reply */
601632 rqstp -> rq_next_page = resp -> xdr .page_ptr + 1 ;
602633
634+ resp -> status = nfsd3_map_status (resp -> status );
603635 return rpc_success ;
604636}
605637
@@ -644,6 +676,7 @@ nfsd3_proc_readdirplus(struct svc_rqst *rqstp)
644676 rqstp -> rq_next_page = resp -> xdr .page_ptr + 1 ;
645677
646678out :
679+ resp -> status = nfsd3_map_status (resp -> status );
647680 return rpc_success ;
648681}
649682
@@ -661,6 +694,7 @@ nfsd3_proc_fsstat(struct svc_rqst *rqstp)
661694
662695 resp -> status = nfsd_statfs (rqstp , & argp -> fh , & resp -> stats , 0 );
663696 fh_put (& argp -> fh );
697+ resp -> status = nfsd3_map_status (resp -> status );
664698 return rpc_success ;
665699}
666700
@@ -704,6 +738,7 @@ nfsd3_proc_fsinfo(struct svc_rqst *rqstp)
704738 }
705739
706740 fh_put (& argp -> fh );
741+ resp -> status = nfsd3_map_status (resp -> status );
707742 return rpc_success ;
708743}
709744
@@ -746,6 +781,7 @@ nfsd3_proc_pathconf(struct svc_rqst *rqstp)
746781 }
747782
748783 fh_put (& argp -> fh );
784+ resp -> status = nfsd3_map_status (resp -> status );
749785 return rpc_success ;
750786}
751787
@@ -773,6 +809,7 @@ nfsd3_proc_commit(struct svc_rqst *rqstp)
773809 argp -> count , resp -> verf );
774810 nfsd_file_put (nf );
775811out :
812+ resp -> status = nfsd3_map_status (resp -> status );
776813 return rpc_success ;
777814}
778815
0 commit comments