@@ -28,6 +28,22 @@ static int nfs3_ftypes[] = {
28
28
S_IFIFO , /* NF3FIFO */
29
29
};
30
30
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
+
31
47
/*
32
48
* NULL call.
33
49
*/
@@ -57,6 +73,7 @@ nfsd3_proc_getattr(struct svc_rqst *rqstp)
57
73
58
74
resp -> status = fh_getattr (& resp -> fh , & resp -> stat );
59
75
out :
76
+ resp -> status = nfsd3_map_status (resp -> status );
60
77
return rpc_success ;
61
78
}
62
79
@@ -80,6 +97,7 @@ nfsd3_proc_setattr(struct svc_rqst *rqstp)
80
97
if (argp -> check_guard )
81
98
guardtime = & argp -> guardtime ;
82
99
resp -> status = nfsd_setattr (rqstp , & resp -> fh , & attrs , guardtime );
100
+ resp -> status = nfsd3_map_status (resp -> status );
83
101
return rpc_success ;
84
102
}
85
103
@@ -103,6 +121,7 @@ nfsd3_proc_lookup(struct svc_rqst *rqstp)
103
121
resp -> status = nfsd_lookup (rqstp , & resp -> dirfh ,
104
122
argp -> name , argp -> len ,
105
123
& resp -> fh );
124
+ resp -> status = nfsd3_map_status (resp -> status );
106
125
return rpc_success ;
107
126
}
108
127
@@ -122,6 +141,7 @@ nfsd3_proc_access(struct svc_rqst *rqstp)
122
141
fh_copy (& resp -> fh , & argp -> fh );
123
142
resp -> access = argp -> access ;
124
143
resp -> status = nfsd_access (rqstp , & resp -> fh , & resp -> access , NULL );
144
+ resp -> status = nfsd3_map_status (resp -> status );
125
145
return rpc_success ;
126
146
}
127
147
@@ -142,6 +162,7 @@ nfsd3_proc_readlink(struct svc_rqst *rqstp)
142
162
resp -> pages = rqstp -> rq_next_page ++ ;
143
163
resp -> status = nfsd_readlink (rqstp , & resp -> fh ,
144
164
page_address (* resp -> pages ), & resp -> len );
165
+ resp -> status = nfsd3_map_status (resp -> status );
145
166
return rpc_success ;
146
167
}
147
168
@@ -179,6 +200,7 @@ nfsd3_proc_read(struct svc_rqst *rqstp)
179
200
fh_copy (& resp -> fh , & argp -> fh );
180
201
resp -> status = nfsd_read (rqstp , & resp -> fh , argp -> offset ,
181
202
& resp -> count , & resp -> eof );
203
+ resp -> status = nfsd3_map_status (resp -> status );
182
204
return rpc_success ;
183
205
}
184
206
@@ -212,6 +234,7 @@ nfsd3_proc_write(struct svc_rqst *rqstp)
212
234
rqstp -> rq_vec , nvecs , & cnt ,
213
235
resp -> committed , resp -> verf );
214
236
resp -> count = cnt ;
237
+ resp -> status = nfsd3_map_status (resp -> status );
215
238
return rpc_success ;
216
239
}
217
240
@@ -359,6 +382,7 @@ nfsd3_proc_create(struct svc_rqst *rqstp)
359
382
newfhp = fh_init (& resp -> fh , NFS3_FHSIZE );
360
383
361
384
resp -> status = nfsd3_create_file (rqstp , dirfhp , newfhp , argp );
385
+ resp -> status = nfsd3_map_status (resp -> status );
362
386
return rpc_success ;
363
387
}
364
388
@@ -384,6 +408,7 @@ nfsd3_proc_mkdir(struct svc_rqst *rqstp)
384
408
fh_init (& resp -> fh , NFS3_FHSIZE );
385
409
resp -> status = nfsd_create (rqstp , & resp -> dirfh , argp -> name , argp -> len ,
386
410
& attrs , S_IFDIR , 0 , & resp -> fh );
411
+ resp -> status = nfsd3_map_status (resp -> status );
387
412
return rpc_success ;
388
413
}
389
414
@@ -424,6 +449,7 @@ nfsd3_proc_symlink(struct svc_rqst *rqstp)
424
449
argp -> flen , argp -> tname , & attrs , & resp -> fh );
425
450
kfree (argp -> tname );
426
451
out :
452
+ resp -> status = nfsd3_map_status (resp -> status );
427
453
return rpc_success ;
428
454
}
429
455
@@ -465,6 +491,7 @@ nfsd3_proc_mknod(struct svc_rqst *rqstp)
465
491
resp -> status = nfsd_create (rqstp , & resp -> dirfh , argp -> name , argp -> len ,
466
492
& attrs , type , rdev , & resp -> fh );
467
493
out :
494
+ resp -> status = nfsd3_map_status (resp -> status );
468
495
return rpc_success ;
469
496
}
470
497
@@ -486,6 +513,7 @@ nfsd3_proc_remove(struct svc_rqst *rqstp)
486
513
fh_copy (& resp -> fh , & argp -> fh );
487
514
resp -> status = nfsd_unlink (rqstp , & resp -> fh , - S_IFDIR ,
488
515
argp -> name , argp -> len );
516
+ resp -> status = nfsd3_map_status (resp -> status );
489
517
return rpc_success ;
490
518
}
491
519
@@ -506,6 +534,7 @@ nfsd3_proc_rmdir(struct svc_rqst *rqstp)
506
534
fh_copy (& resp -> fh , & argp -> fh );
507
535
resp -> status = nfsd_unlink (rqstp , & resp -> fh , S_IFDIR ,
508
536
argp -> name , argp -> len );
537
+ resp -> status = nfsd3_map_status (resp -> status );
509
538
return rpc_success ;
510
539
}
511
540
@@ -528,6 +557,7 @@ nfsd3_proc_rename(struct svc_rqst *rqstp)
528
557
fh_copy (& resp -> tfh , & argp -> tfh );
529
558
resp -> status = nfsd_rename (rqstp , & resp -> ffh , argp -> fname , argp -> flen ,
530
559
& resp -> tfh , argp -> tname , argp -> tlen );
560
+ resp -> status = nfsd3_map_status (resp -> status );
531
561
return rpc_success ;
532
562
}
533
563
@@ -548,6 +578,7 @@ nfsd3_proc_link(struct svc_rqst *rqstp)
548
578
fh_copy (& resp -> tfh , & argp -> tfh );
549
579
resp -> status = nfsd_link (rqstp , & resp -> tfh , argp -> tname , argp -> tlen ,
550
580
& resp -> fh );
581
+ resp -> status = nfsd3_map_status (resp -> status );
551
582
return rpc_success ;
552
583
}
553
584
@@ -600,6 +631,7 @@ nfsd3_proc_readdir(struct svc_rqst *rqstp)
600
631
/* Recycle only pages that were part of the reply */
601
632
rqstp -> rq_next_page = resp -> xdr .page_ptr + 1 ;
602
633
634
+ resp -> status = nfsd3_map_status (resp -> status );
603
635
return rpc_success ;
604
636
}
605
637
@@ -644,6 +676,7 @@ nfsd3_proc_readdirplus(struct svc_rqst *rqstp)
644
676
rqstp -> rq_next_page = resp -> xdr .page_ptr + 1 ;
645
677
646
678
out :
679
+ resp -> status = nfsd3_map_status (resp -> status );
647
680
return rpc_success ;
648
681
}
649
682
@@ -661,6 +694,7 @@ nfsd3_proc_fsstat(struct svc_rqst *rqstp)
661
694
662
695
resp -> status = nfsd_statfs (rqstp , & argp -> fh , & resp -> stats , 0 );
663
696
fh_put (& argp -> fh );
697
+ resp -> status = nfsd3_map_status (resp -> status );
664
698
return rpc_success ;
665
699
}
666
700
@@ -704,6 +738,7 @@ nfsd3_proc_fsinfo(struct svc_rqst *rqstp)
704
738
}
705
739
706
740
fh_put (& argp -> fh );
741
+ resp -> status = nfsd3_map_status (resp -> status );
707
742
return rpc_success ;
708
743
}
709
744
@@ -746,6 +781,7 @@ nfsd3_proc_pathconf(struct svc_rqst *rqstp)
746
781
}
747
782
748
783
fh_put (& argp -> fh );
784
+ resp -> status = nfsd3_map_status (resp -> status );
749
785
return rpc_success ;
750
786
}
751
787
@@ -773,6 +809,7 @@ nfsd3_proc_commit(struct svc_rqst *rqstp)
773
809
argp -> count , resp -> verf );
774
810
nfsd_file_put (nf );
775
811
out :
812
+ resp -> status = nfsd3_map_status (resp -> status );
776
813
return rpc_success ;
777
814
}
778
815
0 commit comments