diff options
Diffstat (limited to 'fs/nfsd')
-rw-r--r-- | fs/nfsd/export.c | 4 | ||||
-rw-r--r-- | fs/nfsd/lockd.c | 16 | ||||
-rw-r--r-- | fs/nfsd/nfs2acl.c | 34 | ||||
-rw-r--r-- | fs/nfsd/nfs3acl.c | 20 | ||||
-rw-r--r-- | fs/nfsd/nfs3proc.c | 90 | ||||
-rw-r--r-- | fs/nfsd/nfs3xdr.c | 126 | ||||
-rw-r--r-- | fs/nfsd/nfs4callback.c | 26 | ||||
-rw-r--r-- | fs/nfsd/nfs4proc.c | 108 | ||||
-rw-r--r-- | fs/nfsd/nfs4recover.c | 14 | ||||
-rw-r--r-- | fs/nfsd/nfs4state.c | 119 | ||||
-rw-r--r-- | fs/nfsd/nfs4xdr.c | 273 | ||||
-rw-r--r-- | fs/nfsd/nfscache.c | 8 | ||||
-rw-r--r-- | fs/nfsd/nfsfh.c | 10 | ||||
-rw-r--r-- | fs/nfsd/nfsproc.c | 79 | ||||
-rw-r--r-- | fs/nfsd/nfssvc.c | 10 | ||||
-rw-r--r-- | fs/nfsd/nfsxdr.c | 72 | ||||
-rw-r--r-- | fs/nfsd/vfs.c | 299 |
17 files changed, 668 insertions, 640 deletions
diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c index e13fa23bd108..f37df46d2eaa 100644 --- a/fs/nfsd/export.c +++ b/fs/nfsd/export.c | |||
@@ -1148,12 +1148,12 @@ exp_find(struct auth_domain *clp, int fsid_type, u32 *fsidv, | |||
1148 | * for a given NFSv4 client. The root is defined to be the | 1148 | * for a given NFSv4 client. The root is defined to be the |
1149 | * export point with fsid==0 | 1149 | * export point with fsid==0 |
1150 | */ | 1150 | */ |
1151 | int | 1151 | __be32 |
1152 | exp_pseudoroot(struct auth_domain *clp, struct svc_fh *fhp, | 1152 | exp_pseudoroot(struct auth_domain *clp, struct svc_fh *fhp, |
1153 | struct cache_req *creq) | 1153 | struct cache_req *creq) |
1154 | { | 1154 | { |
1155 | struct svc_export *exp; | 1155 | struct svc_export *exp; |
1156 | int rv; | 1156 | __be32 rv; |
1157 | u32 fsidv[2]; | 1157 | u32 fsidv[2]; |
1158 | 1158 | ||
1159 | mk_fsid_v1(fsidv, 0); | 1159 | mk_fsid_v1(fsidv, 0); |
diff --git a/fs/nfsd/lockd.c b/fs/nfsd/lockd.c index 7b889ff15ae6..11fdaf7721b4 100644 --- a/fs/nfsd/lockd.c +++ b/fs/nfsd/lockd.c | |||
@@ -25,7 +25,7 @@ | |||
25 | static u32 | 25 | static u32 |
26 | nlm_fopen(struct svc_rqst *rqstp, struct nfs_fh *f, struct file **filp) | 26 | nlm_fopen(struct svc_rqst *rqstp, struct nfs_fh *f, struct file **filp) |
27 | { | 27 | { |
28 | u32 nfserr; | 28 | __be32 nfserr; |
29 | struct svc_fh fh; | 29 | struct svc_fh fh; |
30 | 30 | ||
31 | /* must initialize before using! but maxsize doesn't matter */ | 31 | /* must initialize before using! but maxsize doesn't matter */ |
@@ -39,18 +39,20 @@ nlm_fopen(struct svc_rqst *rqstp, struct nfs_fh *f, struct file **filp) | |||
39 | fh_put(&fh); | 39 | fh_put(&fh); |
40 | rqstp->rq_client = NULL; | 40 | rqstp->rq_client = NULL; |
41 | exp_readunlock(); | 41 | exp_readunlock(); |
42 | /* nlm and nfsd don't share error codes. | 42 | /* We return nlm error codes as nlm doesn't know |
43 | * we invent: 0 = no error | 43 | * about nfsd, but nfsd does know about nlm.. |
44 | * 1 = stale file handle | ||
45 | * 2 = other error | ||
46 | */ | 44 | */ |
47 | switch (nfserr) { | 45 | switch (nfserr) { |
48 | case nfs_ok: | 46 | case nfs_ok: |
49 | return 0; | 47 | return 0; |
48 | case nfserr_dropit: | ||
49 | return nlm_drop_reply; | ||
50 | #ifdef CONFIG_LOCKD_V4 | ||
50 | case nfserr_stale: | 51 | case nfserr_stale: |
51 | return 1; | 52 | return nlm4_stale_fh; |
53 | #endif | ||
52 | default: | 54 | default: |
53 | return 2; | 55 | return nlm_lck_denied; |
54 | } | 56 | } |
55 | } | 57 | } |
56 | 58 | ||
diff --git a/fs/nfsd/nfs2acl.c b/fs/nfsd/nfs2acl.c index 9187755661df..e3eca0816986 100644 --- a/fs/nfsd/nfs2acl.c +++ b/fs/nfsd/nfs2acl.c | |||
@@ -21,7 +21,7 @@ | |||
21 | /* | 21 | /* |
22 | * NULL call. | 22 | * NULL call. |
23 | */ | 23 | */ |
24 | static int | 24 | static __be32 |
25 | nfsacld_proc_null(struct svc_rqst *rqstp, void *argp, void *resp) | 25 | nfsacld_proc_null(struct svc_rqst *rqstp, void *argp, void *resp) |
26 | { | 26 | { |
27 | return nfs_ok; | 27 | return nfs_ok; |
@@ -30,12 +30,12 @@ nfsacld_proc_null(struct svc_rqst *rqstp, void *argp, void *resp) | |||
30 | /* | 30 | /* |
31 | * Get the Access and/or Default ACL of a file. | 31 | * Get the Access and/or Default ACL of a file. |
32 | */ | 32 | */ |
33 | static int nfsacld_proc_getacl(struct svc_rqst * rqstp, | 33 | static __be32 nfsacld_proc_getacl(struct svc_rqst * rqstp, |
34 | struct nfsd3_getaclargs *argp, struct nfsd3_getaclres *resp) | 34 | struct nfsd3_getaclargs *argp, struct nfsd3_getaclres *resp) |
35 | { | 35 | { |
36 | svc_fh *fh; | 36 | svc_fh *fh; |
37 | struct posix_acl *acl; | 37 | struct posix_acl *acl; |
38 | int nfserr = 0; | 38 | __be32 nfserr = 0; |
39 | 39 | ||
40 | dprintk("nfsd: GETACL(2acl) %s\n", SVCFH_fmt(&argp->fh)); | 40 | dprintk("nfsd: GETACL(2acl) %s\n", SVCFH_fmt(&argp->fh)); |
41 | 41 | ||
@@ -97,12 +97,12 @@ fail: | |||
97 | /* | 97 | /* |
98 | * Set the Access and/or Default ACL of a file. | 98 | * Set the Access and/or Default ACL of a file. |
99 | */ | 99 | */ |
100 | static int nfsacld_proc_setacl(struct svc_rqst * rqstp, | 100 | static __be32 nfsacld_proc_setacl(struct svc_rqst * rqstp, |
101 | struct nfsd3_setaclargs *argp, | 101 | struct nfsd3_setaclargs *argp, |
102 | struct nfsd_attrstat *resp) | 102 | struct nfsd_attrstat *resp) |
103 | { | 103 | { |
104 | svc_fh *fh; | 104 | svc_fh *fh; |
105 | int nfserr = 0; | 105 | __be32 nfserr = 0; |
106 | 106 | ||
107 | dprintk("nfsd: SETACL(2acl) %s\n", SVCFH_fmt(&argp->fh)); | 107 | dprintk("nfsd: SETACL(2acl) %s\n", SVCFH_fmt(&argp->fh)); |
108 | 108 | ||
@@ -128,7 +128,7 @@ static int nfsacld_proc_setacl(struct svc_rqst * rqstp, | |||
128 | /* | 128 | /* |
129 | * Check file attributes | 129 | * Check file attributes |
130 | */ | 130 | */ |
131 | static int nfsacld_proc_getattr(struct svc_rqst * rqstp, | 131 | static __be32 nfsacld_proc_getattr(struct svc_rqst * rqstp, |
132 | struct nfsd_fhandle *argp, struct nfsd_attrstat *resp) | 132 | struct nfsd_fhandle *argp, struct nfsd_attrstat *resp) |
133 | { | 133 | { |
134 | dprintk("nfsd: GETATTR %s\n", SVCFH_fmt(&argp->fh)); | 134 | dprintk("nfsd: GETATTR %s\n", SVCFH_fmt(&argp->fh)); |
@@ -140,10 +140,10 @@ static int nfsacld_proc_getattr(struct svc_rqst * rqstp, | |||
140 | /* | 140 | /* |
141 | * Check file access | 141 | * Check file access |
142 | */ | 142 | */ |
143 | static int nfsacld_proc_access(struct svc_rqst *rqstp, struct nfsd3_accessargs *argp, | 143 | static __be32 nfsacld_proc_access(struct svc_rqst *rqstp, struct nfsd3_accessargs *argp, |
144 | struct nfsd3_accessres *resp) | 144 | struct nfsd3_accessres *resp) |
145 | { | 145 | { |
146 | int nfserr; | 146 | __be32 nfserr; |
147 | 147 | ||
148 | dprintk("nfsd: ACCESS(2acl) %s 0x%x\n", | 148 | dprintk("nfsd: ACCESS(2acl) %s 0x%x\n", |
149 | SVCFH_fmt(&argp->fh), | 149 | SVCFH_fmt(&argp->fh), |
@@ -158,7 +158,7 @@ static int nfsacld_proc_access(struct svc_rqst *rqstp, struct nfsd3_accessargs * | |||
158 | /* | 158 | /* |
159 | * XDR decode functions | 159 | * XDR decode functions |
160 | */ | 160 | */ |
161 | static int nfsaclsvc_decode_getaclargs(struct svc_rqst *rqstp, u32 *p, | 161 | static int nfsaclsvc_decode_getaclargs(struct svc_rqst *rqstp, __be32 *p, |
162 | struct nfsd3_getaclargs *argp) | 162 | struct nfsd3_getaclargs *argp) |
163 | { | 163 | { |
164 | if (!(p = nfs2svc_decode_fh(p, &argp->fh))) | 164 | if (!(p = nfs2svc_decode_fh(p, &argp->fh))) |
@@ -169,7 +169,7 @@ static int nfsaclsvc_decode_getaclargs(struct svc_rqst *rqstp, u32 *p, | |||
169 | } | 169 | } |
170 | 170 | ||
171 | 171 | ||
172 | static int nfsaclsvc_decode_setaclargs(struct svc_rqst *rqstp, u32 *p, | 172 | static int nfsaclsvc_decode_setaclargs(struct svc_rqst *rqstp, __be32 *p, |
173 | struct nfsd3_setaclargs *argp) | 173 | struct nfsd3_setaclargs *argp) |
174 | { | 174 | { |
175 | struct kvec *head = rqstp->rq_arg.head; | 175 | struct kvec *head = rqstp->rq_arg.head; |
@@ -194,7 +194,7 @@ static int nfsaclsvc_decode_setaclargs(struct svc_rqst *rqstp, u32 *p, | |||
194 | return (n > 0); | 194 | return (n > 0); |
195 | } | 195 | } |
196 | 196 | ||
197 | static int nfsaclsvc_decode_fhandleargs(struct svc_rqst *rqstp, u32 *p, | 197 | static int nfsaclsvc_decode_fhandleargs(struct svc_rqst *rqstp, __be32 *p, |
198 | struct nfsd_fhandle *argp) | 198 | struct nfsd_fhandle *argp) |
199 | { | 199 | { |
200 | if (!(p = nfs2svc_decode_fh(p, &argp->fh))) | 200 | if (!(p = nfs2svc_decode_fh(p, &argp->fh))) |
@@ -202,7 +202,7 @@ static int nfsaclsvc_decode_fhandleargs(struct svc_rqst *rqstp, u32 *p, | |||
202 | return xdr_argsize_check(rqstp, p); | 202 | return xdr_argsize_check(rqstp, p); |
203 | } | 203 | } |
204 | 204 | ||
205 | static int nfsaclsvc_decode_accessargs(struct svc_rqst *rqstp, u32 *p, | 205 | static int nfsaclsvc_decode_accessargs(struct svc_rqst *rqstp, __be32 *p, |
206 | struct nfsd3_accessargs *argp) | 206 | struct nfsd3_accessargs *argp) |
207 | { | 207 | { |
208 | if (!(p = nfs2svc_decode_fh(p, &argp->fh))) | 208 | if (!(p = nfs2svc_decode_fh(p, &argp->fh))) |
@@ -217,7 +217,7 @@ static int nfsaclsvc_decode_accessargs(struct svc_rqst *rqstp, u32 *p, | |||
217 | */ | 217 | */ |
218 | 218 | ||
219 | /* GETACL */ | 219 | /* GETACL */ |
220 | static int nfsaclsvc_encode_getaclres(struct svc_rqst *rqstp, u32 *p, | 220 | static int nfsaclsvc_encode_getaclres(struct svc_rqst *rqstp, __be32 *p, |
221 | struct nfsd3_getaclres *resp) | 221 | struct nfsd3_getaclres *resp) |
222 | { | 222 | { |
223 | struct dentry *dentry = resp->fh.fh_dentry; | 223 | struct dentry *dentry = resp->fh.fh_dentry; |
@@ -259,7 +259,7 @@ static int nfsaclsvc_encode_getaclres(struct svc_rqst *rqstp, u32 *p, | |||
259 | return 1; | 259 | return 1; |
260 | } | 260 | } |
261 | 261 | ||
262 | static int nfsaclsvc_encode_attrstatres(struct svc_rqst *rqstp, u32 *p, | 262 | static int nfsaclsvc_encode_attrstatres(struct svc_rqst *rqstp, __be32 *p, |
263 | struct nfsd_attrstat *resp) | 263 | struct nfsd_attrstat *resp) |
264 | { | 264 | { |
265 | p = nfs2svc_encode_fattr(rqstp, p, &resp->fh); | 265 | p = nfs2svc_encode_fattr(rqstp, p, &resp->fh); |
@@ -267,7 +267,7 @@ static int nfsaclsvc_encode_attrstatres(struct svc_rqst *rqstp, u32 *p, | |||
267 | } | 267 | } |
268 | 268 | ||
269 | /* ACCESS */ | 269 | /* ACCESS */ |
270 | static int nfsaclsvc_encode_accessres(struct svc_rqst *rqstp, u32 *p, | 270 | static int nfsaclsvc_encode_accessres(struct svc_rqst *rqstp, __be32 *p, |
271 | struct nfsd3_accessres *resp) | 271 | struct nfsd3_accessres *resp) |
272 | { | 272 | { |
273 | p = nfs2svc_encode_fattr(rqstp, p, &resp->fh); | 273 | p = nfs2svc_encode_fattr(rqstp, p, &resp->fh); |
@@ -278,7 +278,7 @@ static int nfsaclsvc_encode_accessres(struct svc_rqst *rqstp, u32 *p, | |||
278 | /* | 278 | /* |
279 | * XDR release functions | 279 | * XDR release functions |
280 | */ | 280 | */ |
281 | static int nfsaclsvc_release_getacl(struct svc_rqst *rqstp, u32 *p, | 281 | static int nfsaclsvc_release_getacl(struct svc_rqst *rqstp, __be32 *p, |
282 | struct nfsd3_getaclres *resp) | 282 | struct nfsd3_getaclres *resp) |
283 | { | 283 | { |
284 | fh_put(&resp->fh); | 284 | fh_put(&resp->fh); |
@@ -287,7 +287,7 @@ static int nfsaclsvc_release_getacl(struct svc_rqst *rqstp, u32 *p, | |||
287 | return 1; | 287 | return 1; |
288 | } | 288 | } |
289 | 289 | ||
290 | static int nfsaclsvc_release_fhandle(struct svc_rqst *rqstp, u32 *p, | 290 | static int nfsaclsvc_release_fhandle(struct svc_rqst *rqstp, __be32 *p, |
291 | struct nfsd_fhandle *resp) | 291 | struct nfsd_fhandle *resp) |
292 | { | 292 | { |
293 | fh_put(&resp->fh); | 293 | fh_put(&resp->fh); |
diff --git a/fs/nfsd/nfs3acl.c b/fs/nfsd/nfs3acl.c index d4bdc00c1169..fcad2895ddb0 100644 --- a/fs/nfsd/nfs3acl.c +++ b/fs/nfsd/nfs3acl.c | |||
@@ -19,7 +19,7 @@ | |||
19 | /* | 19 | /* |
20 | * NULL call. | 20 | * NULL call. |
21 | */ | 21 | */ |
22 | static int | 22 | static __be32 |
23 | nfsd3_proc_null(struct svc_rqst *rqstp, void *argp, void *resp) | 23 | nfsd3_proc_null(struct svc_rqst *rqstp, void *argp, void *resp) |
24 | { | 24 | { |
25 | return nfs_ok; | 25 | return nfs_ok; |
@@ -28,12 +28,12 @@ nfsd3_proc_null(struct svc_rqst *rqstp, void *argp, void *resp) | |||
28 | /* | 28 | /* |
29 | * Get the Access and/or Default ACL of a file. | 29 | * Get the Access and/or Default ACL of a file. |
30 | */ | 30 | */ |
31 | static int nfsd3_proc_getacl(struct svc_rqst * rqstp, | 31 | static __be32 nfsd3_proc_getacl(struct svc_rqst * rqstp, |
32 | struct nfsd3_getaclargs *argp, struct nfsd3_getaclres *resp) | 32 | struct nfsd3_getaclargs *argp, struct nfsd3_getaclres *resp) |
33 | { | 33 | { |
34 | svc_fh *fh; | 34 | svc_fh *fh; |
35 | struct posix_acl *acl; | 35 | struct posix_acl *acl; |
36 | int nfserr = 0; | 36 | __be32 nfserr = 0; |
37 | 37 | ||
38 | fh = fh_copy(&resp->fh, &argp->fh); | 38 | fh = fh_copy(&resp->fh, &argp->fh); |
39 | if ((nfserr = fh_verify(rqstp, &resp->fh, 0, MAY_NOP))) | 39 | if ((nfserr = fh_verify(rqstp, &resp->fh, 0, MAY_NOP))) |
@@ -93,12 +93,12 @@ fail: | |||
93 | /* | 93 | /* |
94 | * Set the Access and/or Default ACL of a file. | 94 | * Set the Access and/or Default ACL of a file. |
95 | */ | 95 | */ |
96 | static int nfsd3_proc_setacl(struct svc_rqst * rqstp, | 96 | static __be32 nfsd3_proc_setacl(struct svc_rqst * rqstp, |
97 | struct nfsd3_setaclargs *argp, | 97 | struct nfsd3_setaclargs *argp, |
98 | struct nfsd3_attrstat *resp) | 98 | struct nfsd3_attrstat *resp) |
99 | { | 99 | { |
100 | svc_fh *fh; | 100 | svc_fh *fh; |
101 | int nfserr = 0; | 101 | __be32 nfserr = 0; |
102 | 102 | ||
103 | fh = fh_copy(&resp->fh, &argp->fh); | 103 | fh = fh_copy(&resp->fh, &argp->fh); |
104 | nfserr = fh_verify(rqstp, &resp->fh, 0, MAY_SATTR); | 104 | nfserr = fh_verify(rqstp, &resp->fh, 0, MAY_SATTR); |
@@ -122,7 +122,7 @@ static int nfsd3_proc_setacl(struct svc_rqst * rqstp, | |||
122 | /* | 122 | /* |
123 | * XDR decode functions | 123 | * XDR decode functions |
124 | */ | 124 | */ |
125 | static int nfs3svc_decode_getaclargs(struct svc_rqst *rqstp, u32 *p, | 125 | static int nfs3svc_decode_getaclargs(struct svc_rqst *rqstp, __be32 *p, |
126 | struct nfsd3_getaclargs *args) | 126 | struct nfsd3_getaclargs *args) |
127 | { | 127 | { |
128 | if (!(p = nfs3svc_decode_fh(p, &args->fh))) | 128 | if (!(p = nfs3svc_decode_fh(p, &args->fh))) |
@@ -133,7 +133,7 @@ static int nfs3svc_decode_getaclargs(struct svc_rqst *rqstp, u32 *p, | |||
133 | } | 133 | } |
134 | 134 | ||
135 | 135 | ||
136 | static int nfs3svc_decode_setaclargs(struct svc_rqst *rqstp, u32 *p, | 136 | static int nfs3svc_decode_setaclargs(struct svc_rqst *rqstp, __be32 *p, |
137 | struct nfsd3_setaclargs *args) | 137 | struct nfsd3_setaclargs *args) |
138 | { | 138 | { |
139 | struct kvec *head = rqstp->rq_arg.head; | 139 | struct kvec *head = rqstp->rq_arg.head; |
@@ -163,7 +163,7 @@ static int nfs3svc_decode_setaclargs(struct svc_rqst *rqstp, u32 *p, | |||
163 | */ | 163 | */ |
164 | 164 | ||
165 | /* GETACL */ | 165 | /* GETACL */ |
166 | static int nfs3svc_encode_getaclres(struct svc_rqst *rqstp, u32 *p, | 166 | static int nfs3svc_encode_getaclres(struct svc_rqst *rqstp, __be32 *p, |
167 | struct nfsd3_getaclres *resp) | 167 | struct nfsd3_getaclres *resp) |
168 | { | 168 | { |
169 | struct dentry *dentry = resp->fh.fh_dentry; | 169 | struct dentry *dentry = resp->fh.fh_dentry; |
@@ -208,7 +208,7 @@ static int nfs3svc_encode_getaclres(struct svc_rqst *rqstp, u32 *p, | |||
208 | } | 208 | } |
209 | 209 | ||
210 | /* SETACL */ | 210 | /* SETACL */ |
211 | static int nfs3svc_encode_setaclres(struct svc_rqst *rqstp, u32 *p, | 211 | static int nfs3svc_encode_setaclres(struct svc_rqst *rqstp, __be32 *p, |
212 | struct nfsd3_attrstat *resp) | 212 | struct nfsd3_attrstat *resp) |
213 | { | 213 | { |
214 | p = nfs3svc_encode_post_op_attr(rqstp, p, &resp->fh); | 214 | p = nfs3svc_encode_post_op_attr(rqstp, p, &resp->fh); |
@@ -219,7 +219,7 @@ static int nfs3svc_encode_setaclres(struct svc_rqst *rqstp, u32 *p, | |||
219 | /* | 219 | /* |
220 | * XDR release functions | 220 | * XDR release functions |
221 | */ | 221 | */ |
222 | static int nfs3svc_release_getacl(struct svc_rqst *rqstp, u32 *p, | 222 | static int nfs3svc_release_getacl(struct svc_rqst *rqstp, __be32 *p, |
223 | struct nfsd3_getaclres *resp) | 223 | struct nfsd3_getaclres *resp) |
224 | { | 224 | { |
225 | fh_put(&resp->fh); | 225 | fh_put(&resp->fh); |
diff --git a/fs/nfsd/nfs3proc.c b/fs/nfsd/nfs3proc.c index a5ebc7dbb384..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 | */ |
46 | static int | 46 | static __be32 |
47 | nfsd3_proc_null(struct svc_rqst *rqstp, void *argp, void *resp) | 47 | nfsd3_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 | */ |
55 | static int | 55 | static __be32 |
56 | nfsd3_proc_getattr(struct svc_rqst *rqstp, struct nfsd_fhandle *argp, | 56 | nfsd3_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 | */ |
79 | static int | 80 | static __be32 |
80 | nfsd3_proc_setattr(struct svc_rqst *rqstp, struct nfsd3_sattrargs *argp, | 81 | nfsd3_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 | */ |
97 | static int | 98 | static __be32 |
98 | nfsd3_proc_lookup(struct svc_rqst *rqstp, struct nfsd3_diropargs *argp, | 99 | nfsd3_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 | */ |
121 | static int | 122 | static __be32 |
122 | nfsd3_proc_access(struct svc_rqst *rqstp, struct nfsd3_accessargs *argp, | 123 | nfsd3_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 | */ |
140 | static int | 141 | static __be32 |
141 | nfsd3_proc_readlink(struct svc_rqst *rqstp, struct nfsd3_readlinkargs *argp, | 142 | nfsd3_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,11 @@ 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 | */ |
158 | static int | 159 | static __be32 |
159 | nfsd3_proc_read(struct svc_rqst *rqstp, struct nfsd3_readargs *argp, | 160 | nfsd3_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; |
163 | u32 max_blocksize = svc_max_payload(rqstp); | 164 | u32 max_blocksize = svc_max_payload(rqstp); |
164 | 165 | ||
165 | dprintk("nfsd: READ(3) %s %lu bytes at %lu\n", | 166 | dprintk("nfsd: READ(3) %s %lu bytes at %lu\n", |
@@ -195,11 +196,11 @@ nfsd3_proc_read(struct svc_rqst *rqstp, struct nfsd3_readargs *argp, | |||
195 | /* | 196 | /* |
196 | * Write data to a file | 197 | * Write data to a file |
197 | */ | 198 | */ |
198 | static int | 199 | static __be32 |
199 | nfsd3_proc_write(struct svc_rqst *rqstp, struct nfsd3_writeargs *argp, | 200 | nfsd3_proc_write(struct svc_rqst *rqstp, struct nfsd3_writeargs *argp, |
200 | struct nfsd3_writeres *resp) | 201 | struct nfsd3_writeres *resp) |
201 | { | 202 | { |
202 | int nfserr; | 203 | __be32 nfserr; |
203 | 204 | ||
204 | dprintk("nfsd: WRITE(3) %s %d bytes at %ld%s\n", | 205 | dprintk("nfsd: WRITE(3) %s %d bytes at %ld%s\n", |
205 | SVCFH_fmt(&argp->fh), | 206 | SVCFH_fmt(&argp->fh), |
@@ -223,13 +224,13 @@ nfsd3_proc_write(struct svc_rqst *rqstp, struct nfsd3_writeargs *argp, | |||
223 | * 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 |
224 | * first reports about SunOS compatibility problems start to pour in... | 225 | * first reports about SunOS compatibility problems start to pour in... |
225 | */ | 226 | */ |
226 | static int | 227 | static __be32 |
227 | nfsd3_proc_create(struct svc_rqst *rqstp, struct nfsd3_createargs *argp, | 228 | nfsd3_proc_create(struct svc_rqst *rqstp, struct nfsd3_createargs *argp, |
228 | struct nfsd3_diropres *resp) | 229 | struct nfsd3_diropres *resp) |
229 | { | 230 | { |
230 | svc_fh *dirfhp, *newfhp = NULL; | 231 | svc_fh *dirfhp, *newfhp = NULL; |
231 | struct iattr *attr; | 232 | struct iattr *attr; |
232 | u32 nfserr; | 233 | __be32 nfserr; |
233 | 234 | ||
234 | dprintk("nfsd: CREATE(3) %s %.*s\n", | 235 | dprintk("nfsd: CREATE(3) %s %.*s\n", |
235 | SVCFH_fmt(&argp->fh), | 236 | SVCFH_fmt(&argp->fh), |
@@ -265,11 +266,11 @@ nfsd3_proc_create(struct svc_rqst *rqstp, struct nfsd3_createargs *argp, | |||
265 | /* | 266 | /* |
266 | * Make directory. This operation is not idempotent. | 267 | * Make directory. This operation is not idempotent. |
267 | */ | 268 | */ |
268 | static int | 269 | static __be32 |
269 | nfsd3_proc_mkdir(struct svc_rqst *rqstp, struct nfsd3_createargs *argp, | 270 | nfsd3_proc_mkdir(struct svc_rqst *rqstp, struct nfsd3_createargs *argp, |
270 | struct nfsd3_diropres *resp) | 271 | struct nfsd3_diropres *resp) |
271 | { | 272 | { |
272 | int nfserr; | 273 | __be32 nfserr; |
273 | 274 | ||
274 | dprintk("nfsd: MKDIR(3) %s %.*s\n", | 275 | dprintk("nfsd: MKDIR(3) %s %.*s\n", |
275 | SVCFH_fmt(&argp->fh), | 276 | SVCFH_fmt(&argp->fh), |
@@ -285,11 +286,11 @@ nfsd3_proc_mkdir(struct svc_rqst *rqstp, struct nfsd3_createargs *argp, | |||
285 | RETURN_STATUS(nfserr); | 286 | RETURN_STATUS(nfserr); |
286 | } | 287 | } |
287 | 288 | ||
288 | static int | 289 | static __be32 |
289 | nfsd3_proc_symlink(struct svc_rqst *rqstp, struct nfsd3_symlinkargs *argp, | 290 | nfsd3_proc_symlink(struct svc_rqst *rqstp, struct nfsd3_symlinkargs *argp, |
290 | struct nfsd3_diropres *resp) | 291 | struct nfsd3_diropres *resp) |
291 | { | 292 | { |
292 | int nfserr; | 293 | __be32 nfserr; |
293 | 294 | ||
294 | dprintk("nfsd: SYMLINK(3) %s %.*s -> %.*s\n", | 295 | dprintk("nfsd: SYMLINK(3) %s %.*s -> %.*s\n", |
295 | SVCFH_fmt(&argp->ffh), | 296 | SVCFH_fmt(&argp->ffh), |
@@ -307,11 +308,12 @@ nfsd3_proc_symlink(struct svc_rqst *rqstp, struct nfsd3_symlinkargs *argp, | |||
307 | /* | 308 | /* |
308 | * Make socket/fifo/device. | 309 | * Make socket/fifo/device. |
309 | */ | 310 | */ |
310 | static int | 311 | static __be32 |
311 | nfsd3_proc_mknod(struct svc_rqst *rqstp, struct nfsd3_mknodargs *argp, | 312 | nfsd3_proc_mknod(struct svc_rqst *rqstp, struct nfsd3_mknodargs *argp, |
312 | struct nfsd3_diropres *resp) | 313 | struct nfsd3_diropres *resp) |
313 | { | 314 | { |
314 | int nfserr, type; | 315 | __be32 nfserr; |
316 | int type; | ||
315 | dev_t rdev = 0; | 317 | dev_t rdev = 0; |
316 | 318 | ||
317 | dprintk("nfsd: MKNOD(3) %s %.*s\n", | 319 | dprintk("nfsd: MKNOD(3) %s %.*s\n", |
@@ -343,11 +345,11 @@ nfsd3_proc_mknod(struct svc_rqst *rqstp, struct nfsd3_mknodargs *argp, | |||
343 | /* | 345 | /* |
344 | * Remove file/fifo/socket etc. | 346 | * Remove file/fifo/socket etc. |
345 | */ | 347 | */ |
346 | static int | 348 | static __be32 |
347 | nfsd3_proc_remove(struct svc_rqst *rqstp, struct nfsd3_diropargs *argp, | 349 | nfsd3_proc_remove(struct svc_rqst *rqstp, struct nfsd3_diropargs *argp, |
348 | struct nfsd3_attrstat *resp) | 350 | struct nfsd3_attrstat *resp) |
349 | { | 351 | { |
350 | int nfserr; | 352 | __be32 nfserr; |
351 | 353 | ||
352 | dprintk("nfsd: REMOVE(3) %s %.*s\n", | 354 | dprintk("nfsd: REMOVE(3) %s %.*s\n", |
353 | SVCFH_fmt(&argp->fh), | 355 | SVCFH_fmt(&argp->fh), |
@@ -363,11 +365,11 @@ nfsd3_proc_remove(struct svc_rqst *rqstp, struct nfsd3_diropargs *argp, | |||
363 | /* | 365 | /* |
364 | * Remove a directory | 366 | * Remove a directory |
365 | */ | 367 | */ |
366 | static int | 368 | static __be32 |
367 | nfsd3_proc_rmdir(struct svc_rqst *rqstp, struct nfsd3_diropargs *argp, | 369 | nfsd3_proc_rmdir(struct svc_rqst *rqstp, struct nfsd3_diropargs *argp, |
368 | struct nfsd3_attrstat *resp) | 370 | struct nfsd3_attrstat *resp) |
369 | { | 371 | { |
370 | int nfserr; | 372 | __be32 nfserr; |
371 | 373 | ||
372 | dprintk("nfsd: RMDIR(3) %s %.*s\n", | 374 | dprintk("nfsd: RMDIR(3) %s %.*s\n", |
373 | SVCFH_fmt(&argp->fh), | 375 | SVCFH_fmt(&argp->fh), |
@@ -379,11 +381,11 @@ nfsd3_proc_rmdir(struct svc_rqst *rqstp, struct nfsd3_diropargs *argp, | |||
379 | RETURN_STATUS(nfserr); | 381 | RETURN_STATUS(nfserr); |
380 | } | 382 | } |
381 | 383 | ||
382 | static int | 384 | static __be32 |
383 | nfsd3_proc_rename(struct svc_rqst *rqstp, struct nfsd3_renameargs *argp, | 385 | nfsd3_proc_rename(struct svc_rqst *rqstp, struct nfsd3_renameargs *argp, |
384 | struct nfsd3_renameres *resp) | 386 | struct nfsd3_renameres *resp) |
385 | { | 387 | { |
386 | int nfserr; | 388 | __be32 nfserr; |
387 | 389 | ||
388 | dprintk("nfsd: RENAME(3) %s %.*s ->\n", | 390 | dprintk("nfsd: RENAME(3) %s %.*s ->\n", |
389 | SVCFH_fmt(&argp->ffh), | 391 | SVCFH_fmt(&argp->ffh), |
@@ -401,11 +403,11 @@ nfsd3_proc_rename(struct svc_rqst *rqstp, struct nfsd3_renameargs *argp, | |||
401 | RETURN_STATUS(nfserr); | 403 | RETURN_STATUS(nfserr); |
402 | } | 404 | } |
403 | 405 | ||
404 | static int | 406 | static __be32 |
405 | nfsd3_proc_link(struct svc_rqst *rqstp, struct nfsd3_linkargs *argp, | 407 | nfsd3_proc_link(struct svc_rqst *rqstp, struct nfsd3_linkargs *argp, |
406 | struct nfsd3_linkres *resp) | 408 | struct nfsd3_linkres *resp) |
407 | { | 409 | { |
408 | int nfserr; | 410 | __be32 nfserr; |
409 | 411 | ||
410 | dprintk("nfsd: LINK(3) %s ->\n", | 412 | dprintk("nfsd: LINK(3) %s ->\n", |
411 | SVCFH_fmt(&argp->ffh)); | 413 | SVCFH_fmt(&argp->ffh)); |
@@ -424,11 +426,12 @@ nfsd3_proc_link(struct svc_rqst *rqstp, struct nfsd3_linkargs *argp, | |||
424 | /* | 426 | /* |
425 | * Read a portion of a directory. | 427 | * Read a portion of a directory. |
426 | */ | 428 | */ |
427 | static int | 429 | static __be32 |
428 | nfsd3_proc_readdir(struct svc_rqst *rqstp, struct nfsd3_readdirargs *argp, | 430 | nfsd3_proc_readdir(struct svc_rqst *rqstp, struct nfsd3_readdirargs *argp, |
429 | struct nfsd3_readdirres *resp) | 431 | struct nfsd3_readdirres *resp) |
430 | { | 432 | { |
431 | int nfserr, count; | 433 | __be32 nfserr; |
434 | int count; | ||
432 | 435 | ||
433 | dprintk("nfsd: READDIR(3) %s %d bytes at %d\n", | 436 | dprintk("nfsd: READDIR(3) %s %d bytes at %d\n", |
434 | SVCFH_fmt(&argp->fh), | 437 | SVCFH_fmt(&argp->fh), |
@@ -459,11 +462,12 @@ nfsd3_proc_readdir(struct svc_rqst *rqstp, struct nfsd3_readdirargs *argp, | |||
459 | * Read a portion of a directory, including file handles and attrs. | 462 | * Read a portion of a directory, including file handles and attrs. |
460 | * For now, we choose to ignore the dircount parameter. | 463 | * For now, we choose to ignore the dircount parameter. |
461 | */ | 464 | */ |
462 | static int | 465 | static __be32 |
463 | nfsd3_proc_readdirplus(struct svc_rqst *rqstp, struct nfsd3_readdirargs *argp, | 466 | nfsd3_proc_readdirplus(struct svc_rqst *rqstp, struct nfsd3_readdirargs *argp, |
464 | struct nfsd3_readdirres *resp) | 467 | struct nfsd3_readdirres *resp) |
465 | { | 468 | { |
466 | int nfserr, count = 0; | 469 | __be32 nfserr; |
470 | int count = 0; | ||
467 | loff_t offset; | 471 | loff_t offset; |
468 | int i; | 472 | int i; |
469 | caddr_t page_addr = NULL; | 473 | caddr_t page_addr = NULL; |
@@ -517,11 +521,11 @@ nfsd3_proc_readdirplus(struct svc_rqst *rqstp, struct nfsd3_readdirargs *argp, | |||
517 | /* | 521 | /* |
518 | * Get file system stats | 522 | * Get file system stats |
519 | */ | 523 | */ |
520 | static int | 524 | static __be32 |
521 | nfsd3_proc_fsstat(struct svc_rqst * rqstp, struct nfsd_fhandle *argp, | 525 | nfsd3_proc_fsstat(struct svc_rqst * rqstp, struct nfsd_fhandle *argp, |
522 | struct nfsd3_fsstatres *resp) | 526 | struct nfsd3_fsstatres *resp) |
523 | { | 527 | { |
524 | int nfserr; | 528 | __be32 nfserr; |
525 | 529 | ||
526 | dprintk("nfsd: FSSTAT(3) %s\n", | 530 | dprintk("nfsd: FSSTAT(3) %s\n", |
527 | SVCFH_fmt(&argp->fh)); | 531 | SVCFH_fmt(&argp->fh)); |
@@ -534,11 +538,11 @@ nfsd3_proc_fsstat(struct svc_rqst * rqstp, struct nfsd_fhandle *argp, | |||
534 | /* | 538 | /* |
535 | * Get file system info | 539 | * Get file system info |
536 | */ | 540 | */ |
537 | static int | 541 | static __be32 |
538 | nfsd3_proc_fsinfo(struct svc_rqst * rqstp, struct nfsd_fhandle *argp, | 542 | nfsd3_proc_fsinfo(struct svc_rqst * rqstp, struct nfsd_fhandle *argp, |
539 | struct nfsd3_fsinfores *resp) | 543 | struct nfsd3_fsinfores *resp) |
540 | { | 544 | { |
541 | int nfserr; | 545 | __be32 nfserr; |
542 | u32 max_blocksize = svc_max_payload(rqstp); | 546 | u32 max_blocksize = svc_max_payload(rqstp); |
543 | 547 | ||
544 | dprintk("nfsd: FSINFO(3) %s\n", | 548 | dprintk("nfsd: FSINFO(3) %s\n", |
@@ -576,11 +580,11 @@ nfsd3_proc_fsinfo(struct svc_rqst * rqstp, struct nfsd_fhandle *argp, | |||
576 | /* | 580 | /* |
577 | * Get pathconf info for the specified file | 581 | * Get pathconf info for the specified file |
578 | */ | 582 | */ |
579 | static int | 583 | static __be32 |
580 | nfsd3_proc_pathconf(struct svc_rqst * rqstp, struct nfsd_fhandle *argp, | 584 | nfsd3_proc_pathconf(struct svc_rqst * rqstp, struct nfsd_fhandle *argp, |
581 | struct nfsd3_pathconfres *resp) | 585 | struct nfsd3_pathconfres *resp) |
582 | { | 586 | { |
583 | int nfserr; | 587 | __be32 nfserr; |
584 | 588 | ||
585 | dprintk("nfsd: PATHCONF(3) %s\n", | 589 | dprintk("nfsd: PATHCONF(3) %s\n", |
586 | SVCFH_fmt(&argp->fh)); | 590 | SVCFH_fmt(&argp->fh)); |
@@ -619,11 +623,11 @@ nfsd3_proc_pathconf(struct svc_rqst * rqstp, struct nfsd_fhandle *argp, | |||
619 | /* | 623 | /* |
620 | * Commit a file (range) to stable storage. | 624 | * Commit a file (range) to stable storage. |
621 | */ | 625 | */ |
622 | static int | 626 | static __be32 |
623 | nfsd3_proc_commit(struct svc_rqst * rqstp, struct nfsd3_commitargs *argp, | 627 | nfsd3_proc_commit(struct svc_rqst * rqstp, struct nfsd3_commitargs *argp, |
624 | struct nfsd3_commitres *resp) | 628 | struct nfsd3_commitres *resp) |
625 | { | 629 | { |
626 | int nfserr; | 630 | __be32 nfserr; |
627 | 631 | ||
628 | dprintk("nfsd: COMMIT(3) %s %u@%Lu\n", | 632 | dprintk("nfsd: COMMIT(3) %s %u@%Lu\n", |
629 | SVCFH_fmt(&argp->fh), | 633 | SVCFH_fmt(&argp->fh), |
diff --git a/fs/nfsd/nfs3xdr.c b/fs/nfsd/nfs3xdr.c index 247d518248bf..b4baca3053c3 100644 --- a/fs/nfsd/nfs3xdr.c +++ b/fs/nfsd/nfs3xdr.c | |||
@@ -42,23 +42,23 @@ static u32 nfs3_ftypes[] = { | |||
42 | /* | 42 | /* |
43 | * XDR functions for basic NFS types | 43 | * XDR functions for basic NFS types |
44 | */ | 44 | */ |
45 | static inline u32 * | 45 | static inline __be32 * |
46 | encode_time3(u32 *p, struct timespec *time) | 46 | encode_time3(__be32 *p, struct timespec *time) |
47 | { | 47 | { |
48 | *p++ = htonl((u32) time->tv_sec); *p++ = htonl(time->tv_nsec); | 48 | *p++ = htonl((u32) time->tv_sec); *p++ = htonl(time->tv_nsec); |
49 | return p; | 49 | return p; |
50 | } | 50 | } |
51 | 51 | ||
52 | static inline u32 * | 52 | static inline __be32 * |
53 | decode_time3(u32 *p, struct timespec *time) | 53 | decode_time3(__be32 *p, struct timespec *time) |
54 | { | 54 | { |
55 | time->tv_sec = ntohl(*p++); | 55 | time->tv_sec = ntohl(*p++); |
56 | time->tv_nsec = ntohl(*p++); | 56 | time->tv_nsec = ntohl(*p++); |
57 | return p; | 57 | return p; |
58 | } | 58 | } |
59 | 59 | ||
60 | static inline u32 * | 60 | static inline __be32 * |
61 | decode_fh(u32 *p, struct svc_fh *fhp) | 61 | decode_fh(__be32 *p, struct svc_fh *fhp) |
62 | { | 62 | { |
63 | unsigned int size; | 63 | unsigned int size; |
64 | fh_init(fhp, NFS3_FHSIZE); | 64 | fh_init(fhp, NFS3_FHSIZE); |
@@ -72,13 +72,13 @@ decode_fh(u32 *p, struct svc_fh *fhp) | |||
72 | } | 72 | } |
73 | 73 | ||
74 | /* Helper function for NFSv3 ACL code */ | 74 | /* Helper function for NFSv3 ACL code */ |
75 | u32 *nfs3svc_decode_fh(u32 *p, struct svc_fh *fhp) | 75 | __be32 *nfs3svc_decode_fh(__be32 *p, struct svc_fh *fhp) |
76 | { | 76 | { |
77 | return decode_fh(p, fhp); | 77 | return decode_fh(p, fhp); |
78 | } | 78 | } |
79 | 79 | ||
80 | static inline u32 * | 80 | static inline __be32 * |
81 | encode_fh(u32 *p, struct svc_fh *fhp) | 81 | encode_fh(__be32 *p, struct svc_fh *fhp) |
82 | { | 82 | { |
83 | unsigned int size = fhp->fh_handle.fh_size; | 83 | unsigned int size = fhp->fh_handle.fh_size; |
84 | *p++ = htonl(size); | 84 | *p++ = htonl(size); |
@@ -91,8 +91,8 @@ encode_fh(u32 *p, struct svc_fh *fhp) | |||
91 | * Decode a file name and make sure that the path contains | 91 | * Decode a file name and make sure that the path contains |
92 | * no slashes or null bytes. | 92 | * no slashes or null bytes. |
93 | */ | 93 | */ |
94 | static inline u32 * | 94 | static inline __be32 * |
95 | decode_filename(u32 *p, char **namp, int *lenp) | 95 | decode_filename(__be32 *p, char **namp, int *lenp) |
96 | { | 96 | { |
97 | char *name; | 97 | char *name; |
98 | int i; | 98 | int i; |
@@ -107,8 +107,8 @@ decode_filename(u32 *p, char **namp, int *lenp) | |||
107 | return p; | 107 | return p; |
108 | } | 108 | } |
109 | 109 | ||
110 | static inline u32 * | 110 | static inline __be32 * |
111 | decode_sattr3(u32 *p, struct iattr *iap) | 111 | decode_sattr3(__be32 *p, struct iattr *iap) |
112 | { | 112 | { |
113 | u32 tmp; | 113 | u32 tmp; |
114 | 114 | ||
@@ -153,8 +153,8 @@ decode_sattr3(u32 *p, struct iattr *iap) | |||
153 | return p; | 153 | return p; |
154 | } | 154 | } |
155 | 155 | ||
156 | static inline u32 * | 156 | static inline __be32 * |
157 | encode_fattr3(struct svc_rqst *rqstp, u32 *p, struct svc_fh *fhp, | 157 | encode_fattr3(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp, |
158 | struct kstat *stat) | 158 | struct kstat *stat) |
159 | { | 159 | { |
160 | struct dentry *dentry = fhp->fh_dentry; | 160 | struct dentry *dentry = fhp->fh_dentry; |
@@ -186,8 +186,8 @@ encode_fattr3(struct svc_rqst *rqstp, u32 *p, struct svc_fh *fhp, | |||
186 | return p; | 186 | return p; |
187 | } | 187 | } |
188 | 188 | ||
189 | static inline u32 * | 189 | static inline __be32 * |
190 | encode_saved_post_attr(struct svc_rqst *rqstp, u32 *p, struct svc_fh *fhp) | 190 | encode_saved_post_attr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp) |
191 | { | 191 | { |
192 | struct inode *inode = fhp->fh_dentry->d_inode; | 192 | struct inode *inode = fhp->fh_dentry->d_inode; |
193 | 193 | ||
@@ -224,8 +224,8 @@ encode_saved_post_attr(struct svc_rqst *rqstp, u32 *p, struct svc_fh *fhp) | |||
224 | * The inode may be NULL if the call failed because of a stale file | 224 | * The inode may be NULL if the call failed because of a stale file |
225 | * handle. In this case, no attributes are returned. | 225 | * handle. In this case, no attributes are returned. |
226 | */ | 226 | */ |
227 | static u32 * | 227 | static __be32 * |
228 | encode_post_op_attr(struct svc_rqst *rqstp, u32 *p, struct svc_fh *fhp) | 228 | encode_post_op_attr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp) |
229 | { | 229 | { |
230 | struct dentry *dentry = fhp->fh_dentry; | 230 | struct dentry *dentry = fhp->fh_dentry; |
231 | if (dentry && dentry->d_inode != NULL) { | 231 | if (dentry && dentry->d_inode != NULL) { |
@@ -243,8 +243,8 @@ encode_post_op_attr(struct svc_rqst *rqstp, u32 *p, struct svc_fh *fhp) | |||
243 | } | 243 | } |
244 | 244 | ||
245 | /* Helper for NFSv3 ACLs */ | 245 | /* Helper for NFSv3 ACLs */ |
246 | u32 * | 246 | __be32 * |
247 | nfs3svc_encode_post_op_attr(struct svc_rqst *rqstp, u32 *p, struct svc_fh *fhp) | 247 | nfs3svc_encode_post_op_attr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp) |
248 | { | 248 | { |
249 | return encode_post_op_attr(rqstp, p, fhp); | 249 | return encode_post_op_attr(rqstp, p, fhp); |
250 | } | 250 | } |
@@ -252,8 +252,8 @@ nfs3svc_encode_post_op_attr(struct svc_rqst *rqstp, u32 *p, struct svc_fh *fhp) | |||
252 | /* | 252 | /* |
253 | * Enocde weak cache consistency data | 253 | * Enocde weak cache consistency data |
254 | */ | 254 | */ |
255 | static u32 * | 255 | static __be32 * |
256 | encode_wcc_data(struct svc_rqst *rqstp, u32 *p, struct svc_fh *fhp) | 256 | encode_wcc_data(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp) |
257 | { | 257 | { |
258 | struct dentry *dentry = fhp->fh_dentry; | 258 | struct dentry *dentry = fhp->fh_dentry; |
259 | 259 | ||
@@ -278,7 +278,7 @@ encode_wcc_data(struct svc_rqst *rqstp, u32 *p, struct svc_fh *fhp) | |||
278 | * XDR decode functions | 278 | * XDR decode functions |
279 | */ | 279 | */ |
280 | int | 280 | int |
281 | nfs3svc_decode_fhandle(struct svc_rqst *rqstp, u32 *p, struct nfsd_fhandle *args) | 281 | nfs3svc_decode_fhandle(struct svc_rqst *rqstp, __be32 *p, struct nfsd_fhandle *args) |
282 | { | 282 | { |
283 | if (!(p = decode_fh(p, &args->fh))) | 283 | if (!(p = decode_fh(p, &args->fh))) |
284 | return 0; | 284 | return 0; |
@@ -286,7 +286,7 @@ nfs3svc_decode_fhandle(struct svc_rqst *rqstp, u32 *p, struct nfsd_fhandle *args | |||
286 | } | 286 | } |
287 | 287 | ||
288 | int | 288 | int |
289 | nfs3svc_decode_sattrargs(struct svc_rqst *rqstp, u32 *p, | 289 | nfs3svc_decode_sattrargs(struct svc_rqst *rqstp, __be32 *p, |
290 | struct nfsd3_sattrargs *args) | 290 | struct nfsd3_sattrargs *args) |
291 | { | 291 | { |
292 | if (!(p = decode_fh(p, &args->fh)) | 292 | if (!(p = decode_fh(p, &args->fh)) |
@@ -303,7 +303,7 @@ nfs3svc_decode_sattrargs(struct svc_rqst *rqstp, u32 *p, | |||
303 | } | 303 | } |
304 | 304 | ||
305 | int | 305 | int |
306 | nfs3svc_decode_diropargs(struct svc_rqst *rqstp, u32 *p, | 306 | nfs3svc_decode_diropargs(struct svc_rqst *rqstp, __be32 *p, |
307 | struct nfsd3_diropargs *args) | 307 | struct nfsd3_diropargs *args) |
308 | { | 308 | { |
309 | if (!(p = decode_fh(p, &args->fh)) | 309 | if (!(p = decode_fh(p, &args->fh)) |
@@ -314,7 +314,7 @@ nfs3svc_decode_diropargs(struct svc_rqst *rqstp, u32 *p, | |||
314 | } | 314 | } |
315 | 315 | ||
316 | int | 316 | int |
317 | nfs3svc_decode_accessargs(struct svc_rqst *rqstp, u32 *p, | 317 | nfs3svc_decode_accessargs(struct svc_rqst *rqstp, __be32 *p, |
318 | struct nfsd3_accessargs *args) | 318 | struct nfsd3_accessargs *args) |
319 | { | 319 | { |
320 | if (!(p = decode_fh(p, &args->fh))) | 320 | if (!(p = decode_fh(p, &args->fh))) |
@@ -325,7 +325,7 @@ nfs3svc_decode_accessargs(struct svc_rqst *rqstp, u32 *p, | |||
325 | } | 325 | } |
326 | 326 | ||
327 | int | 327 | int |
328 | nfs3svc_decode_readargs(struct svc_rqst *rqstp, u32 *p, | 328 | nfs3svc_decode_readargs(struct svc_rqst *rqstp, __be32 *p, |
329 | struct nfsd3_readargs *args) | 329 | struct nfsd3_readargs *args) |
330 | { | 330 | { |
331 | unsigned int len; | 331 | unsigned int len; |
@@ -355,7 +355,7 @@ nfs3svc_decode_readargs(struct svc_rqst *rqstp, u32 *p, | |||
355 | } | 355 | } |
356 | 356 | ||
357 | int | 357 | int |
358 | nfs3svc_decode_writeargs(struct svc_rqst *rqstp, u32 *p, | 358 | nfs3svc_decode_writeargs(struct svc_rqst *rqstp, __be32 *p, |
359 | struct nfsd3_writeargs *args) | 359 | struct nfsd3_writeargs *args) |
360 | { | 360 | { |
361 | unsigned int len, v, hdr; | 361 | unsigned int len, v, hdr; |
@@ -393,7 +393,7 @@ nfs3svc_decode_writeargs(struct svc_rqst *rqstp, u32 *p, | |||
393 | } | 393 | } |
394 | 394 | ||
395 | int | 395 | int |
396 | nfs3svc_decode_createargs(struct svc_rqst *rqstp, u32 *p, | 396 | nfs3svc_decode_createargs(struct svc_rqst *rqstp, __be32 *p, |
397 | struct nfsd3_createargs *args) | 397 | struct nfsd3_createargs *args) |
398 | { | 398 | { |
399 | if (!(p = decode_fh(p, &args->fh)) | 399 | if (!(p = decode_fh(p, &args->fh)) |
@@ -417,7 +417,7 @@ nfs3svc_decode_createargs(struct svc_rqst *rqstp, u32 *p, | |||
417 | return xdr_argsize_check(rqstp, p); | 417 | return xdr_argsize_check(rqstp, p); |
418 | } | 418 | } |
419 | int | 419 | int |
420 | nfs3svc_decode_mkdirargs(struct svc_rqst *rqstp, u32 *p, | 420 | nfs3svc_decode_mkdirargs(struct svc_rqst *rqstp, __be32 *p, |
421 | struct nfsd3_createargs *args) | 421 | struct nfsd3_createargs *args) |
422 | { | 422 | { |
423 | if (!(p = decode_fh(p, &args->fh)) | 423 | if (!(p = decode_fh(p, &args->fh)) |
@@ -429,7 +429,7 @@ nfs3svc_decode_mkdirargs(struct svc_rqst *rqstp, u32 *p, | |||
429 | } | 429 | } |
430 | 430 | ||
431 | int | 431 | int |
432 | nfs3svc_decode_symlinkargs(struct svc_rqst *rqstp, u32 *p, | 432 | nfs3svc_decode_symlinkargs(struct svc_rqst *rqstp, __be32 *p, |
433 | struct nfsd3_symlinkargs *args) | 433 | struct nfsd3_symlinkargs *args) |
434 | { | 434 | { |
435 | unsigned int len; | 435 | unsigned int len; |
@@ -481,7 +481,7 @@ nfs3svc_decode_symlinkargs(struct svc_rqst *rqstp, u32 *p, | |||
481 | } | 481 | } |
482 | 482 | ||
483 | int | 483 | int |
484 | nfs3svc_decode_mknodargs(struct svc_rqst *rqstp, u32 *p, | 484 | nfs3svc_decode_mknodargs(struct svc_rqst *rqstp, __be32 *p, |
485 | struct nfsd3_mknodargs *args) | 485 | struct nfsd3_mknodargs *args) |
486 | { | 486 | { |
487 | if (!(p = decode_fh(p, &args->fh)) | 487 | if (!(p = decode_fh(p, &args->fh)) |
@@ -505,7 +505,7 @@ nfs3svc_decode_mknodargs(struct svc_rqst *rqstp, u32 *p, | |||
505 | } | 505 | } |
506 | 506 | ||
507 | int | 507 | int |
508 | nfs3svc_decode_renameargs(struct svc_rqst *rqstp, u32 *p, | 508 | nfs3svc_decode_renameargs(struct svc_rqst *rqstp, __be32 *p, |
509 | struct nfsd3_renameargs *args) | 509 | struct nfsd3_renameargs *args) |
510 | { | 510 | { |
511 | if (!(p = decode_fh(p, &args->ffh)) | 511 | if (!(p = decode_fh(p, &args->ffh)) |
@@ -518,7 +518,7 @@ nfs3svc_decode_renameargs(struct svc_rqst *rqstp, u32 *p, | |||
518 | } | 518 | } |
519 | 519 | ||
520 | int | 520 | int |
521 | nfs3svc_decode_readlinkargs(struct svc_rqst *rqstp, u32 *p, | 521 | nfs3svc_decode_readlinkargs(struct svc_rqst *rqstp, __be32 *p, |
522 | struct nfsd3_readlinkargs *args) | 522 | struct nfsd3_readlinkargs *args) |
523 | { | 523 | { |
524 | if (!(p = decode_fh(p, &args->fh))) | 524 | if (!(p = decode_fh(p, &args->fh))) |
@@ -530,7 +530,7 @@ nfs3svc_decode_readlinkargs(struct svc_rqst *rqstp, u32 *p, | |||
530 | } | 530 | } |
531 | 531 | ||
532 | int | 532 | int |
533 | nfs3svc_decode_linkargs(struct svc_rqst *rqstp, u32 *p, | 533 | nfs3svc_decode_linkargs(struct svc_rqst *rqstp, __be32 *p, |
534 | struct nfsd3_linkargs *args) | 534 | struct nfsd3_linkargs *args) |
535 | { | 535 | { |
536 | if (!(p = decode_fh(p, &args->ffh)) | 536 | if (!(p = decode_fh(p, &args->ffh)) |
@@ -542,7 +542,7 @@ nfs3svc_decode_linkargs(struct svc_rqst *rqstp, u32 *p, | |||
542 | } | 542 | } |
543 | 543 | ||
544 | int | 544 | int |
545 | nfs3svc_decode_readdirargs(struct svc_rqst *rqstp, u32 *p, | 545 | nfs3svc_decode_readdirargs(struct svc_rqst *rqstp, __be32 *p, |
546 | struct nfsd3_readdirargs *args) | 546 | struct nfsd3_readdirargs *args) |
547 | { | 547 | { |
548 | if (!(p = decode_fh(p, &args->fh))) | 548 | if (!(p = decode_fh(p, &args->fh))) |
@@ -562,7 +562,7 @@ nfs3svc_decode_readdirargs(struct svc_rqst *rqstp, u32 *p, | |||
562 | } | 562 | } |
563 | 563 | ||
564 | int | 564 | int |
565 | nfs3svc_decode_readdirplusargs(struct svc_rqst *rqstp, u32 *p, | 565 | nfs3svc_decode_readdirplusargs(struct svc_rqst *rqstp, __be32 *p, |
566 | struct nfsd3_readdirargs *args) | 566 | struct nfsd3_readdirargs *args) |
567 | { | 567 | { |
568 | int len, pn; | 568 | int len, pn; |
@@ -590,7 +590,7 @@ nfs3svc_decode_readdirplusargs(struct svc_rqst *rqstp, u32 *p, | |||
590 | } | 590 | } |
591 | 591 | ||
592 | int | 592 | int |
593 | nfs3svc_decode_commitargs(struct svc_rqst *rqstp, u32 *p, | 593 | nfs3svc_decode_commitargs(struct svc_rqst *rqstp, __be32 *p, |
594 | struct nfsd3_commitargs *args) | 594 | struct nfsd3_commitargs *args) |
595 | { | 595 | { |
596 | if (!(p = decode_fh(p, &args->fh))) | 596 | if (!(p = decode_fh(p, &args->fh))) |
@@ -609,14 +609,14 @@ nfs3svc_decode_commitargs(struct svc_rqst *rqstp, u32 *p, | |||
609 | * will work properly. | 609 | * will work properly. |
610 | */ | 610 | */ |
611 | int | 611 | int |
612 | nfs3svc_encode_voidres(struct svc_rqst *rqstp, u32 *p, void *dummy) | 612 | nfs3svc_encode_voidres(struct svc_rqst *rqstp, __be32 *p, void *dummy) |
613 | { | 613 | { |
614 | return xdr_ressize_check(rqstp, p); | 614 | return xdr_ressize_check(rqstp, p); |
615 | } | 615 | } |
616 | 616 | ||
617 | /* GETATTR */ | 617 | /* GETATTR */ |
618 | int | 618 | int |
619 | nfs3svc_encode_attrstat(struct svc_rqst *rqstp, u32 *p, | 619 | nfs3svc_encode_attrstat(struct svc_rqst *rqstp, __be32 *p, |
620 | struct nfsd3_attrstat *resp) | 620 | struct nfsd3_attrstat *resp) |
621 | { | 621 | { |
622 | if (resp->status == 0) | 622 | if (resp->status == 0) |
@@ -626,7 +626,7 @@ nfs3svc_encode_attrstat(struct svc_rqst *rqstp, u32 *p, | |||
626 | 626 | ||
627 | /* SETATTR, REMOVE, RMDIR */ | 627 | /* SETATTR, REMOVE, RMDIR */ |
628 | int | 628 | int |
629 | nfs3svc_encode_wccstat(struct svc_rqst *rqstp, u32 *p, | 629 | nfs3svc_encode_wccstat(struct svc_rqst *rqstp, __be32 *p, |
630 | struct nfsd3_attrstat *resp) | 630 | struct nfsd3_attrstat *resp) |
631 | { | 631 | { |
632 | p = encode_wcc_data(rqstp, p, &resp->fh); | 632 | p = encode_wcc_data(rqstp, p, &resp->fh); |
@@ -635,7 +635,7 @@ nfs3svc_encode_wccstat(struct svc_rqst *rqstp, u32 *p, | |||
635 | 635 | ||
636 | /* LOOKUP */ | 636 | /* LOOKUP */ |
637 | int | 637 | int |
638 | nfs3svc_encode_diropres(struct svc_rqst *rqstp, u32 *p, | 638 | nfs3svc_encode_diropres(struct svc_rqst *rqstp, __be32 *p, |
639 | struct nfsd3_diropres *resp) | 639 | struct nfsd3_diropres *resp) |
640 | { | 640 | { |
641 | if (resp->status == 0) { | 641 | if (resp->status == 0) { |
@@ -648,7 +648,7 @@ nfs3svc_encode_diropres(struct svc_rqst *rqstp, u32 *p, | |||
648 | 648 | ||
649 | /* ACCESS */ | 649 | /* ACCESS */ |
650 | int | 650 | int |
651 | nfs3svc_encode_accessres(struct svc_rqst *rqstp, u32 *p, | 651 | nfs3svc_encode_accessres(struct svc_rqst *rqstp, __be32 *p, |
652 | struct nfsd3_accessres *resp) | 652 | struct nfsd3_accessres *resp) |
653 | { | 653 | { |
654 | p = encode_post_op_attr(rqstp, p, &resp->fh); | 654 | p = encode_post_op_attr(rqstp, p, &resp->fh); |
@@ -659,7 +659,7 @@ nfs3svc_encode_accessres(struct svc_rqst *rqstp, u32 *p, | |||
659 | 659 | ||
660 | /* READLINK */ | 660 | /* READLINK */ |
661 | int | 661 | int |
662 | nfs3svc_encode_readlinkres(struct svc_rqst *rqstp, u32 *p, | 662 | nfs3svc_encode_readlinkres(struct svc_rqst *rqstp, __be32 *p, |
663 | struct nfsd3_readlinkres *resp) | 663 | struct nfsd3_readlinkres *resp) |
664 | { | 664 | { |
665 | p = encode_post_op_attr(rqstp, p, &resp->fh); | 665 | p = encode_post_op_attr(rqstp, p, &resp->fh); |
@@ -680,7 +680,7 @@ nfs3svc_encode_readlinkres(struct svc_rqst *rqstp, u32 *p, | |||
680 | 680 | ||
681 | /* READ */ | 681 | /* READ */ |
682 | int | 682 | int |
683 | nfs3svc_encode_readres(struct svc_rqst *rqstp, u32 *p, | 683 | nfs3svc_encode_readres(struct svc_rqst *rqstp, __be32 *p, |
684 | struct nfsd3_readres *resp) | 684 | struct nfsd3_readres *resp) |
685 | { | 685 | { |
686 | p = encode_post_op_attr(rqstp, p, &resp->fh); | 686 | p = encode_post_op_attr(rqstp, p, &resp->fh); |
@@ -704,7 +704,7 @@ nfs3svc_encode_readres(struct svc_rqst *rqstp, u32 *p, | |||
704 | 704 | ||
705 | /* WRITE */ | 705 | /* WRITE */ |
706 | int | 706 | int |
707 | nfs3svc_encode_writeres(struct svc_rqst *rqstp, u32 *p, | 707 | nfs3svc_encode_writeres(struct svc_rqst *rqstp, __be32 *p, |
708 | struct nfsd3_writeres *resp) | 708 | struct nfsd3_writeres *resp) |
709 | { | 709 | { |
710 | p = encode_wcc_data(rqstp, p, &resp->fh); | 710 | p = encode_wcc_data(rqstp, p, &resp->fh); |
@@ -719,7 +719,7 @@ nfs3svc_encode_writeres(struct svc_rqst *rqstp, u32 *p, | |||
719 | 719 | ||
720 | /* CREATE, MKDIR, SYMLINK, MKNOD */ | 720 | /* CREATE, MKDIR, SYMLINK, MKNOD */ |
721 | int | 721 | int |
722 | nfs3svc_encode_createres(struct svc_rqst *rqstp, u32 *p, | 722 | nfs3svc_encode_createres(struct svc_rqst *rqstp, __be32 *p, |
723 | struct nfsd3_diropres *resp) | 723 | struct nfsd3_diropres *resp) |
724 | { | 724 | { |
725 | if (resp->status == 0) { | 725 | if (resp->status == 0) { |
@@ -733,7 +733,7 @@ nfs3svc_encode_createres(struct svc_rqst *rqstp, u32 *p, | |||
733 | 733 | ||
734 | /* RENAME */ | 734 | /* RENAME */ |
735 | int | 735 | int |
736 | nfs3svc_encode_renameres(struct svc_rqst *rqstp, u32 *p, | 736 | nfs3svc_encode_renameres(struct svc_rqst *rqstp, __be32 *p, |
737 | struct nfsd3_renameres *resp) | 737 | struct nfsd3_renameres *resp) |
738 | { | 738 | { |
739 | p = encode_wcc_data(rqstp, p, &resp->ffh); | 739 | p = encode_wcc_data(rqstp, p, &resp->ffh); |
@@ -743,7 +743,7 @@ nfs3svc_encode_renameres(struct svc_rqst *rqstp, u32 *p, | |||
743 | 743 | ||
744 | /* LINK */ | 744 | /* LINK */ |
745 | int | 745 | int |
746 | nfs3svc_encode_linkres(struct svc_rqst *rqstp, u32 *p, | 746 | nfs3svc_encode_linkres(struct svc_rqst *rqstp, __be32 *p, |
747 | struct nfsd3_linkres *resp) | 747 | struct nfsd3_linkres *resp) |
748 | { | 748 | { |
749 | p = encode_post_op_attr(rqstp, p, &resp->fh); | 749 | p = encode_post_op_attr(rqstp, p, &resp->fh); |
@@ -753,7 +753,7 @@ nfs3svc_encode_linkres(struct svc_rqst *rqstp, u32 *p, | |||
753 | 753 | ||
754 | /* READDIR */ | 754 | /* READDIR */ |
755 | int | 755 | int |
756 | nfs3svc_encode_readdirres(struct svc_rqst *rqstp, u32 *p, | 756 | nfs3svc_encode_readdirres(struct svc_rqst *rqstp, __be32 *p, |
757 | struct nfsd3_readdirres *resp) | 757 | struct nfsd3_readdirres *resp) |
758 | { | 758 | { |
759 | p = encode_post_op_attr(rqstp, p, &resp->fh); | 759 | p = encode_post_op_attr(rqstp, p, &resp->fh); |
@@ -776,8 +776,8 @@ nfs3svc_encode_readdirres(struct svc_rqst *rqstp, u32 *p, | |||
776 | return xdr_ressize_check(rqstp, p); | 776 | return xdr_ressize_check(rqstp, p); |
777 | } | 777 | } |
778 | 778 | ||
779 | static inline u32 * | 779 | static inline __be32 * |
780 | encode_entry_baggage(struct nfsd3_readdirres *cd, u32 *p, const char *name, | 780 | encode_entry_baggage(struct nfsd3_readdirres *cd, __be32 *p, const char *name, |
781 | int namlen, ino_t ino) | 781 | int namlen, ino_t ino) |
782 | { | 782 | { |
783 | *p++ = xdr_one; /* mark entry present */ | 783 | *p++ = xdr_one; /* mark entry present */ |
@@ -790,8 +790,8 @@ encode_entry_baggage(struct nfsd3_readdirres *cd, u32 *p, const char *name, | |||
790 | return p; | 790 | return p; |
791 | } | 791 | } |
792 | 792 | ||
793 | static inline u32 * | 793 | static inline __be32 * |
794 | encode_entryplus_baggage(struct nfsd3_readdirres *cd, u32 *p, | 794 | encode_entryplus_baggage(struct nfsd3_readdirres *cd, __be32 *p, |
795 | struct svc_fh *fhp) | 795 | struct svc_fh *fhp) |
796 | { | 796 | { |
797 | p = encode_post_op_attr(cd->rqstp, p, fhp); | 797 | p = encode_post_op_attr(cd->rqstp, p, fhp); |
@@ -853,7 +853,7 @@ encode_entry(struct readdir_cd *ccd, const char *name, | |||
853 | { | 853 | { |
854 | struct nfsd3_readdirres *cd = container_of(ccd, struct nfsd3_readdirres, | 854 | struct nfsd3_readdirres *cd = container_of(ccd, struct nfsd3_readdirres, |
855 | common); | 855 | common); |
856 | u32 *p = cd->buffer; | 856 | __be32 *p = cd->buffer; |
857 | caddr_t curr_page_addr = NULL; | 857 | caddr_t curr_page_addr = NULL; |
858 | int pn; /* current page number */ | 858 | int pn; /* current page number */ |
859 | int slen; /* string (name) length */ | 859 | int slen; /* string (name) length */ |
@@ -919,7 +919,7 @@ encode_entry(struct readdir_cd *ccd, const char *name, | |||
919 | } else if (cd->rqstp->rq_respages[pn+1] != NULL) { | 919 | } else if (cd->rqstp->rq_respages[pn+1] != NULL) { |
920 | /* temporarily encode entry into next page, then move back to | 920 | /* temporarily encode entry into next page, then move back to |
921 | * current and next page in rq_respages[] */ | 921 | * current and next page in rq_respages[] */ |
922 | u32 *p1, *tmp; | 922 | __be32 *p1, *tmp; |
923 | int len1, len2; | 923 | int len1, len2; |
924 | 924 | ||
925 | /* grab next page for temporary storage of entry */ | 925 | /* grab next page for temporary storage of entry */ |
@@ -1009,7 +1009,7 @@ nfs3svc_encode_entry_plus(struct readdir_cd *cd, const char *name, | |||
1009 | 1009 | ||
1010 | /* FSSTAT */ | 1010 | /* FSSTAT */ |
1011 | int | 1011 | int |
1012 | nfs3svc_encode_fsstatres(struct svc_rqst *rqstp, u32 *p, | 1012 | nfs3svc_encode_fsstatres(struct svc_rqst *rqstp, __be32 *p, |
1013 | struct nfsd3_fsstatres *resp) | 1013 | struct nfsd3_fsstatres *resp) |
1014 | { | 1014 | { |
1015 | struct kstatfs *s = &resp->stats; | 1015 | struct kstatfs *s = &resp->stats; |
@@ -1031,7 +1031,7 @@ nfs3svc_encode_fsstatres(struct svc_rqst *rqstp, u32 *p, | |||
1031 | 1031 | ||
1032 | /* FSINFO */ | 1032 | /* FSINFO */ |
1033 | int | 1033 | int |
1034 | nfs3svc_encode_fsinfores(struct svc_rqst *rqstp, u32 *p, | 1034 | nfs3svc_encode_fsinfores(struct svc_rqst *rqstp, __be32 *p, |
1035 | struct nfsd3_fsinfores *resp) | 1035 | struct nfsd3_fsinfores *resp) |
1036 | { | 1036 | { |
1037 | *p++ = xdr_zero; /* no post_op_attr */ | 1037 | *p++ = xdr_zero; /* no post_op_attr */ |
@@ -1055,7 +1055,7 @@ nfs3svc_encode_fsinfores(struct svc_rqst *rqstp, u32 *p, | |||
1055 | 1055 | ||
1056 | /* PATHCONF */ | 1056 | /* PATHCONF */ |
1057 | int | 1057 | int |
1058 | nfs3svc_encode_pathconfres(struct svc_rqst *rqstp, u32 *p, | 1058 | nfs3svc_encode_pathconfres(struct svc_rqst *rqstp, __be32 *p, |
1059 | struct nfsd3_pathconfres *resp) | 1059 | struct nfsd3_pathconfres *resp) |
1060 | { | 1060 | { |
1061 | *p++ = xdr_zero; /* no post_op_attr */ | 1061 | *p++ = xdr_zero; /* no post_op_attr */ |
@@ -1074,7 +1074,7 @@ nfs3svc_encode_pathconfres(struct svc_rqst *rqstp, u32 *p, | |||
1074 | 1074 | ||
1075 | /* COMMIT */ | 1075 | /* COMMIT */ |
1076 | int | 1076 | int |
1077 | nfs3svc_encode_commitres(struct svc_rqst *rqstp, u32 *p, | 1077 | nfs3svc_encode_commitres(struct svc_rqst *rqstp, __be32 *p, |
1078 | struct nfsd3_commitres *resp) | 1078 | struct nfsd3_commitres *resp) |
1079 | { | 1079 | { |
1080 | p = encode_wcc_data(rqstp, p, &resp->fh); | 1080 | p = encode_wcc_data(rqstp, p, &resp->fh); |
@@ -1090,7 +1090,7 @@ nfs3svc_encode_commitres(struct svc_rqst *rqstp, u32 *p, | |||
1090 | * XDR release functions | 1090 | * XDR release functions |
1091 | */ | 1091 | */ |
1092 | int | 1092 | int |
1093 | nfs3svc_release_fhandle(struct svc_rqst *rqstp, u32 *p, | 1093 | nfs3svc_release_fhandle(struct svc_rqst *rqstp, __be32 *p, |
1094 | struct nfsd3_attrstat *resp) | 1094 | struct nfsd3_attrstat *resp) |
1095 | { | 1095 | { |
1096 | fh_put(&resp->fh); | 1096 | fh_put(&resp->fh); |
@@ -1098,7 +1098,7 @@ nfs3svc_release_fhandle(struct svc_rqst *rqstp, u32 *p, | |||
1098 | } | 1098 | } |
1099 | 1099 | ||
1100 | int | 1100 | int |
1101 | nfs3svc_release_fhandle2(struct svc_rqst *rqstp, u32 *p, | 1101 | nfs3svc_release_fhandle2(struct svc_rqst *rqstp, __be32 *p, |
1102 | struct nfsd3_fhandle_pair *resp) | 1102 | struct nfsd3_fhandle_pair *resp) |
1103 | { | 1103 | { |
1104 | fh_put(&resp->fh1); | 1104 | fh_put(&resp->fh1); |
diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c index f6ca9fb3fc63..f57655a7a2b6 100644 --- a/fs/nfsd/nfs4callback.c +++ b/fs/nfsd/nfs4callback.c | |||
@@ -85,8 +85,8 @@ enum nfs_cb_opnum4 { | |||
85 | /* | 85 | /* |
86 | * Generic encode routines from fs/nfs/nfs4xdr.c | 86 | * Generic encode routines from fs/nfs/nfs4xdr.c |
87 | */ | 87 | */ |
88 | static inline u32 * | 88 | static inline __be32 * |
89 | xdr_writemem(u32 *p, const void *ptr, int nbytes) | 89 | xdr_writemem(__be32 *p, const void *ptr, int nbytes) |
90 | { | 90 | { |
91 | int tmp = XDR_QUADLEN(nbytes); | 91 | int tmp = XDR_QUADLEN(nbytes); |
92 | if (!tmp) | 92 | if (!tmp) |
@@ -205,7 +205,7 @@ nfs_cb_stat_to_errno(int stat) | |||
205 | static int | 205 | static int |
206 | encode_cb_compound_hdr(struct xdr_stream *xdr, struct nfs4_cb_compound_hdr *hdr) | 206 | encode_cb_compound_hdr(struct xdr_stream *xdr, struct nfs4_cb_compound_hdr *hdr) |
207 | { | 207 | { |
208 | u32 * p; | 208 | __be32 * p; |
209 | 209 | ||
210 | RESERVE_SPACE(16); | 210 | RESERVE_SPACE(16); |
211 | WRITE32(0); /* tag length is always 0 */ | 211 | WRITE32(0); /* tag length is always 0 */ |
@@ -218,7 +218,7 @@ encode_cb_compound_hdr(struct xdr_stream *xdr, struct nfs4_cb_compound_hdr *hdr) | |||
218 | static int | 218 | static int |
219 | encode_cb_recall(struct xdr_stream *xdr, struct nfs4_cb_recall *cb_rec) | 219 | encode_cb_recall(struct xdr_stream *xdr, struct nfs4_cb_recall *cb_rec) |
220 | { | 220 | { |
221 | u32 *p; | 221 | __be32 *p; |
222 | int len = cb_rec->cbr_fhlen; | 222 | int len = cb_rec->cbr_fhlen; |
223 | 223 | ||
224 | RESERVE_SPACE(12+sizeof(cb_rec->cbr_stateid) + len); | 224 | RESERVE_SPACE(12+sizeof(cb_rec->cbr_stateid) + len); |
@@ -231,7 +231,7 @@ encode_cb_recall(struct xdr_stream *xdr, struct nfs4_cb_recall *cb_rec) | |||
231 | } | 231 | } |
232 | 232 | ||
233 | static int | 233 | static int |
234 | nfs4_xdr_enc_cb_null(struct rpc_rqst *req, u32 *p) | 234 | nfs4_xdr_enc_cb_null(struct rpc_rqst *req, __be32 *p) |
235 | { | 235 | { |
236 | struct xdr_stream xdrs, *xdr = &xdrs; | 236 | struct xdr_stream xdrs, *xdr = &xdrs; |
237 | 237 | ||
@@ -241,7 +241,7 @@ nfs4_xdr_enc_cb_null(struct rpc_rqst *req, u32 *p) | |||
241 | } | 241 | } |
242 | 242 | ||
243 | static int | 243 | static int |
244 | nfs4_xdr_enc_cb_recall(struct rpc_rqst *req, u32 *p, struct nfs4_cb_recall *args) | 244 | nfs4_xdr_enc_cb_recall(struct rpc_rqst *req, __be32 *p, struct nfs4_cb_recall *args) |
245 | { | 245 | { |
246 | struct xdr_stream xdr; | 246 | struct xdr_stream xdr; |
247 | struct nfs4_cb_compound_hdr hdr = { | 247 | struct nfs4_cb_compound_hdr hdr = { |
@@ -257,7 +257,7 @@ nfs4_xdr_enc_cb_recall(struct rpc_rqst *req, u32 *p, struct nfs4_cb_recall *args | |||
257 | 257 | ||
258 | static int | 258 | static int |
259 | decode_cb_compound_hdr(struct xdr_stream *xdr, struct nfs4_cb_compound_hdr *hdr){ | 259 | decode_cb_compound_hdr(struct xdr_stream *xdr, struct nfs4_cb_compound_hdr *hdr){ |
260 | u32 *p; | 260 | __be32 *p; |
261 | 261 | ||
262 | READ_BUF(8); | 262 | READ_BUF(8); |
263 | READ32(hdr->status); | 263 | READ32(hdr->status); |
@@ -272,7 +272,7 @@ decode_cb_compound_hdr(struct xdr_stream *xdr, struct nfs4_cb_compound_hdr *hdr) | |||
272 | static int | 272 | static int |
273 | decode_cb_op_hdr(struct xdr_stream *xdr, enum nfs_opnum4 expected) | 273 | decode_cb_op_hdr(struct xdr_stream *xdr, enum nfs_opnum4 expected) |
274 | { | 274 | { |
275 | u32 *p; | 275 | __be32 *p; |
276 | u32 op; | 276 | u32 op; |
277 | int32_t nfserr; | 277 | int32_t nfserr; |
278 | 278 | ||
@@ -291,13 +291,13 @@ decode_cb_op_hdr(struct xdr_stream *xdr, enum nfs_opnum4 expected) | |||
291 | } | 291 | } |
292 | 292 | ||
293 | static int | 293 | static int |
294 | nfs4_xdr_dec_cb_null(struct rpc_rqst *req, u32 *p) | 294 | nfs4_xdr_dec_cb_null(struct rpc_rqst *req, __be32 *p) |
295 | { | 295 | { |
296 | return 0; | 296 | return 0; |
297 | } | 297 | } |
298 | 298 | ||
299 | static int | 299 | static int |
300 | nfs4_xdr_dec_cb_recall(struct rpc_rqst *rqstp, u32 *p) | 300 | nfs4_xdr_dec_cb_recall(struct rpc_rqst *rqstp, __be32 *p) |
301 | { | 301 | { |
302 | struct xdr_stream xdr; | 302 | struct xdr_stream xdr; |
303 | struct nfs4_cb_compound_hdr hdr; | 303 | struct nfs4_cb_compound_hdr hdr; |
@@ -421,7 +421,7 @@ nfsd4_probe_callback(struct nfs4_client *clp) | |||
421 | 421 | ||
422 | /* Create RPC client */ | 422 | /* Create RPC client */ |
423 | cb->cb_client = rpc_create(&args); | 423 | cb->cb_client = rpc_create(&args); |
424 | if (!cb->cb_client) { | 424 | if (IS_ERR(cb->cb_client)) { |
425 | dprintk("NFSD: couldn't create callback client\n"); | 425 | dprintk("NFSD: couldn't create callback client\n"); |
426 | goto out_err; | 426 | goto out_err; |
427 | } | 427 | } |
@@ -448,10 +448,10 @@ nfsd4_probe_callback(struct nfs4_client *clp) | |||
448 | out_rpciod: | 448 | out_rpciod: |
449 | atomic_dec(&clp->cl_count); | 449 | atomic_dec(&clp->cl_count); |
450 | rpciod_down(); | 450 | rpciod_down(); |
451 | cb->cb_client = NULL; | ||
452 | out_clnt: | 451 | out_clnt: |
453 | rpc_shutdown_client(cb->cb_client); | 452 | rpc_shutdown_client(cb->cb_client); |
454 | out_err: | 453 | out_err: |
454 | cb->cb_client = NULL; | ||
455 | dprintk("NFSD: warning: no callback path to client %.*s\n", | 455 | dprintk("NFSD: warning: no callback path to client %.*s\n", |
456 | (int)clp->cl_name.len, clp->cl_name.data); | 456 | (int)clp->cl_name.len, clp->cl_name.data); |
457 | } | 457 | } |
@@ -461,7 +461,7 @@ nfs4_cb_null(struct rpc_task *task, void *dummy) | |||
461 | { | 461 | { |
462 | struct nfs4_client *clp = (struct nfs4_client *)task->tk_msg.rpc_argp; | 462 | struct nfs4_client *clp = (struct nfs4_client *)task->tk_msg.rpc_argp; |
463 | struct nfs4_callback *cb = &clp->cl_callback; | 463 | struct nfs4_callback *cb = &clp->cl_callback; |
464 | u32 addr = htonl(cb->cb_addr); | 464 | __be32 addr = htonl(cb->cb_addr); |
465 | 465 | ||
466 | dprintk("NFSD: nfs4_cb_null task->tk_status %d\n", task->tk_status); | 466 | dprintk("NFSD: nfs4_cb_null task->tk_status %d\n", task->tk_status); |
467 | 467 | ||
diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c index 8333db12caca..0a7bbdc4a10a 100644 --- a/fs/nfsd/nfs4proc.c +++ b/fs/nfsd/nfs4proc.c | |||
@@ -67,32 +67,32 @@ fh_dup2(struct svc_fh *dst, struct svc_fh *src) | |||
67 | *dst = *src; | 67 | *dst = *src; |
68 | } | 68 | } |
69 | 69 | ||
70 | static int | 70 | static __be32 |
71 | do_open_permission(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open *open) | 71 | do_open_permission(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open *open, int accmode) |
72 | { | 72 | { |
73 | int accmode, status; | 73 | __be32 status; |
74 | 74 | ||
75 | if (open->op_truncate && | 75 | if (open->op_truncate && |
76 | !(open->op_share_access & NFS4_SHARE_ACCESS_WRITE)) | 76 | !(open->op_share_access & NFS4_SHARE_ACCESS_WRITE)) |
77 | return nfserr_inval; | 77 | return nfserr_inval; |
78 | 78 | ||
79 | accmode = MAY_NOP; | ||
80 | if (open->op_share_access & NFS4_SHARE_ACCESS_READ) | 79 | if (open->op_share_access & NFS4_SHARE_ACCESS_READ) |
81 | accmode = MAY_READ; | 80 | accmode |= MAY_READ; |
82 | if (open->op_share_deny & NFS4_SHARE_ACCESS_WRITE) | 81 | if (open->op_share_access & NFS4_SHARE_ACCESS_WRITE) |
83 | accmode |= (MAY_WRITE | MAY_TRUNC); | 82 | accmode |= (MAY_WRITE | MAY_TRUNC); |
84 | accmode |= MAY_OWNER_OVERRIDE; | 83 | if (open->op_share_deny & NFS4_SHARE_DENY_WRITE) |
84 | accmode |= MAY_WRITE; | ||
85 | 85 | ||
86 | status = fh_verify(rqstp, current_fh, S_IFREG, accmode); | 86 | status = fh_verify(rqstp, current_fh, S_IFREG, accmode); |
87 | 87 | ||
88 | return status; | 88 | return status; |
89 | } | 89 | } |
90 | 90 | ||
91 | static int | 91 | static __be32 |
92 | do_open_lookup(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open *open) | 92 | do_open_lookup(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open *open) |
93 | { | 93 | { |
94 | struct svc_fh resfh; | 94 | struct svc_fh resfh; |
95 | int status; | 95 | __be32 status; |
96 | 96 | ||
97 | fh_init(&resfh, NFS4_FHSIZE); | 97 | fh_init(&resfh, NFS4_FHSIZE); |
98 | open->op_truncate = 0; | 98 | open->op_truncate = 0; |
@@ -124,17 +124,17 @@ do_open_lookup(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_o | |||
124 | &resfh.fh_handle.fh_base, | 124 | &resfh.fh_handle.fh_base, |
125 | resfh.fh_handle.fh_size); | 125 | resfh.fh_handle.fh_size); |
126 | 126 | ||
127 | status = do_open_permission(rqstp, current_fh, open); | 127 | status = do_open_permission(rqstp, current_fh, open, MAY_NOP); |
128 | } | 128 | } |
129 | 129 | ||
130 | fh_put(&resfh); | 130 | fh_put(&resfh); |
131 | return status; | 131 | return status; |
132 | } | 132 | } |
133 | 133 | ||
134 | static int | 134 | static __be32 |
135 | do_open_fhandle(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open *open) | 135 | do_open_fhandle(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open *open) |
136 | { | 136 | { |
137 | int status; | 137 | __be32 status; |
138 | 138 | ||
139 | /* Only reclaims from previously confirmed clients are valid */ | 139 | /* Only reclaims from previously confirmed clients are valid */ |
140 | if ((status = nfs4_check_open_reclaim(&open->op_clientid))) | 140 | if ((status = nfs4_check_open_reclaim(&open->op_clientid))) |
@@ -155,16 +155,16 @@ do_open_fhandle(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_ | |||
155 | open->op_truncate = (open->op_iattr.ia_valid & ATTR_SIZE) && | 155 | open->op_truncate = (open->op_iattr.ia_valid & ATTR_SIZE) && |
156 | (open->op_iattr.ia_size == 0); | 156 | (open->op_iattr.ia_size == 0); |
157 | 157 | ||
158 | status = do_open_permission(rqstp, current_fh, open); | 158 | status = do_open_permission(rqstp, current_fh, open, MAY_OWNER_OVERRIDE); |
159 | 159 | ||
160 | return status; | 160 | return status; |
161 | } | 161 | } |
162 | 162 | ||
163 | 163 | ||
164 | static inline int | 164 | static inline __be32 |
165 | nfsd4_open(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open *open, struct nfs4_stateowner **replay_owner) | 165 | nfsd4_open(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open *open, struct nfs4_stateowner **replay_owner) |
166 | { | 166 | { |
167 | int status; | 167 | __be32 status; |
168 | dprintk("NFSD: nfsd4_open filename %.*s op_stateowner %p\n", | 168 | dprintk("NFSD: nfsd4_open filename %.*s op_stateowner %p\n", |
169 | (int)open->op_fname.len, open->op_fname.data, | 169 | (int)open->op_fname.len, open->op_fname.data, |
170 | open->op_stateowner); | 170 | open->op_stateowner); |
@@ -177,7 +177,7 @@ nfsd4_open(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open | |||
177 | 177 | ||
178 | /* check seqid for replay. set nfs4_owner */ | 178 | /* check seqid for replay. set nfs4_owner */ |
179 | status = nfsd4_process_open1(open); | 179 | status = nfsd4_process_open1(open); |
180 | if (status == NFSERR_REPLAY_ME) { | 180 | if (status == nfserr_replay_me) { |
181 | struct nfs4_replay *rp = &open->op_stateowner->so_replay; | 181 | struct nfs4_replay *rp = &open->op_stateowner->so_replay; |
182 | fh_put(current_fh); | 182 | fh_put(current_fh); |
183 | current_fh->fh_handle.fh_size = rp->rp_openfh_len; | 183 | current_fh->fh_handle.fh_size = rp->rp_openfh_len; |
@@ -188,7 +188,7 @@ nfsd4_open(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open | |||
188 | dprintk("nfsd4_open: replay failed" | 188 | dprintk("nfsd4_open: replay failed" |
189 | " restoring previous filehandle\n"); | 189 | " restoring previous filehandle\n"); |
190 | else | 190 | else |
191 | status = NFSERR_REPLAY_ME; | 191 | status = nfserr_replay_me; |
192 | } | 192 | } |
193 | if (status) | 193 | if (status) |
194 | goto out; | 194 | goto out; |
@@ -261,7 +261,7 @@ out: | |||
261 | /* | 261 | /* |
262 | * filehandle-manipulating ops. | 262 | * filehandle-manipulating ops. |
263 | */ | 263 | */ |
264 | static inline int | 264 | static inline __be32 |
265 | nfsd4_getfh(struct svc_fh *current_fh, struct svc_fh **getfh) | 265 | nfsd4_getfh(struct svc_fh *current_fh, struct svc_fh **getfh) |
266 | { | 266 | { |
267 | if (!current_fh->fh_dentry) | 267 | if (!current_fh->fh_dentry) |
@@ -271,7 +271,7 @@ nfsd4_getfh(struct svc_fh *current_fh, struct svc_fh **getfh) | |||
271 | return nfs_ok; | 271 | return nfs_ok; |
272 | } | 272 | } |
273 | 273 | ||
274 | static inline int | 274 | static inline __be32 |
275 | nfsd4_putfh(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_putfh *putfh) | 275 | nfsd4_putfh(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_putfh *putfh) |
276 | { | 276 | { |
277 | fh_put(current_fh); | 277 | fh_put(current_fh); |
@@ -280,10 +280,10 @@ nfsd4_putfh(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_putf | |||
280 | return fh_verify(rqstp, current_fh, 0, MAY_NOP); | 280 | return fh_verify(rqstp, current_fh, 0, MAY_NOP); |
281 | } | 281 | } |
282 | 282 | ||
283 | static inline int | 283 | static inline __be32 |
284 | nfsd4_putrootfh(struct svc_rqst *rqstp, struct svc_fh *current_fh) | 284 | nfsd4_putrootfh(struct svc_rqst *rqstp, struct svc_fh *current_fh) |
285 | { | 285 | { |
286 | int status; | 286 | __be32 status; |
287 | 287 | ||
288 | fh_put(current_fh); | 288 | fh_put(current_fh); |
289 | status = exp_pseudoroot(rqstp->rq_client, current_fh, | 289 | status = exp_pseudoroot(rqstp->rq_client, current_fh, |
@@ -291,7 +291,7 @@ nfsd4_putrootfh(struct svc_rqst *rqstp, struct svc_fh *current_fh) | |||
291 | return status; | 291 | return status; |
292 | } | 292 | } |
293 | 293 | ||
294 | static inline int | 294 | static inline __be32 |
295 | nfsd4_restorefh(struct svc_fh *current_fh, struct svc_fh *save_fh) | 295 | nfsd4_restorefh(struct svc_fh *current_fh, struct svc_fh *save_fh) |
296 | { | 296 | { |
297 | if (!save_fh->fh_dentry) | 297 | if (!save_fh->fh_dentry) |
@@ -301,7 +301,7 @@ nfsd4_restorefh(struct svc_fh *current_fh, struct svc_fh *save_fh) | |||
301 | return nfs_ok; | 301 | return nfs_ok; |
302 | } | 302 | } |
303 | 303 | ||
304 | static inline int | 304 | static inline __be32 |
305 | nfsd4_savefh(struct svc_fh *current_fh, struct svc_fh *save_fh) | 305 | nfsd4_savefh(struct svc_fh *current_fh, struct svc_fh *save_fh) |
306 | { | 306 | { |
307 | if (!current_fh->fh_dentry) | 307 | if (!current_fh->fh_dentry) |
@@ -314,7 +314,7 @@ nfsd4_savefh(struct svc_fh *current_fh, struct svc_fh *save_fh) | |||
314 | /* | 314 | /* |
315 | * misc nfsv4 ops | 315 | * misc nfsv4 ops |
316 | */ | 316 | */ |
317 | static inline int | 317 | static inline __be32 |
318 | nfsd4_access(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_access *access) | 318 | nfsd4_access(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_access *access) |
319 | { | 319 | { |
320 | if (access->ac_req_access & ~NFS3_ACCESS_FULL) | 320 | if (access->ac_req_access & ~NFS3_ACCESS_FULL) |
@@ -324,10 +324,10 @@ nfsd4_access(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_acc | |||
324 | return nfsd_access(rqstp, current_fh, &access->ac_resp_access, &access->ac_supported); | 324 | return nfsd_access(rqstp, current_fh, &access->ac_resp_access, &access->ac_supported); |
325 | } | 325 | } |
326 | 326 | ||
327 | static inline int | 327 | static inline __be32 |
328 | nfsd4_commit(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_commit *commit) | 328 | nfsd4_commit(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_commit *commit) |
329 | { | 329 | { |
330 | int status; | 330 | __be32 status; |
331 | 331 | ||
332 | u32 *p = (u32 *)commit->co_verf.data; | 332 | u32 *p = (u32 *)commit->co_verf.data; |
333 | *p++ = nfssvc_boot.tv_sec; | 333 | *p++ = nfssvc_boot.tv_sec; |
@@ -339,11 +339,11 @@ nfsd4_commit(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_com | |||
339 | return status; | 339 | return status; |
340 | } | 340 | } |
341 | 341 | ||
342 | static int | 342 | static __be32 |
343 | nfsd4_create(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_create *create) | 343 | nfsd4_create(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_create *create) |
344 | { | 344 | { |
345 | struct svc_fh resfh; | 345 | struct svc_fh resfh; |
346 | int status; | 346 | __be32 status; |
347 | dev_t rdev; | 347 | dev_t rdev; |
348 | 348 | ||
349 | fh_init(&resfh, NFS4_FHSIZE); | 349 | fh_init(&resfh, NFS4_FHSIZE); |
@@ -423,10 +423,10 @@ nfsd4_create(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_cre | |||
423 | return status; | 423 | return status; |
424 | } | 424 | } |
425 | 425 | ||
426 | static inline int | 426 | static inline __be32 |
427 | nfsd4_getattr(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_getattr *getattr) | 427 | nfsd4_getattr(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_getattr *getattr) |
428 | { | 428 | { |
429 | int status; | 429 | __be32 status; |
430 | 430 | ||
431 | status = fh_verify(rqstp, current_fh, 0, MAY_NOP); | 431 | status = fh_verify(rqstp, current_fh, 0, MAY_NOP); |
432 | if (status) | 432 | if (status) |
@@ -442,11 +442,11 @@ nfsd4_getattr(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_ge | |||
442 | return nfs_ok; | 442 | return nfs_ok; |
443 | } | 443 | } |
444 | 444 | ||
445 | static inline int | 445 | static inline __be32 |
446 | nfsd4_link(struct svc_rqst *rqstp, struct svc_fh *current_fh, | 446 | nfsd4_link(struct svc_rqst *rqstp, struct svc_fh *current_fh, |
447 | struct svc_fh *save_fh, struct nfsd4_link *link) | 447 | struct svc_fh *save_fh, struct nfsd4_link *link) |
448 | { | 448 | { |
449 | int status = nfserr_nofilehandle; | 449 | __be32 status = nfserr_nofilehandle; |
450 | 450 | ||
451 | if (!save_fh->fh_dentry) | 451 | if (!save_fh->fh_dentry) |
452 | return status; | 452 | return status; |
@@ -456,11 +456,11 @@ nfsd4_link(struct svc_rqst *rqstp, struct svc_fh *current_fh, | |||
456 | return status; | 456 | return status; |
457 | } | 457 | } |
458 | 458 | ||
459 | static int | 459 | static __be32 |
460 | nfsd4_lookupp(struct svc_rqst *rqstp, struct svc_fh *current_fh) | 460 | nfsd4_lookupp(struct svc_rqst *rqstp, struct svc_fh *current_fh) |
461 | { | 461 | { |
462 | struct svc_fh tmp_fh; | 462 | struct svc_fh tmp_fh; |
463 | int ret; | 463 | __be32 ret; |
464 | 464 | ||
465 | fh_init(&tmp_fh, NFS4_FHSIZE); | 465 | fh_init(&tmp_fh, NFS4_FHSIZE); |
466 | if((ret = exp_pseudoroot(rqstp->rq_client, &tmp_fh, | 466 | if((ret = exp_pseudoroot(rqstp->rq_client, &tmp_fh, |
@@ -474,16 +474,16 @@ nfsd4_lookupp(struct svc_rqst *rqstp, struct svc_fh *current_fh) | |||
474 | return nfsd_lookup(rqstp, current_fh, "..", 2, current_fh); | 474 | return nfsd_lookup(rqstp, current_fh, "..", 2, current_fh); |
475 | } | 475 | } |
476 | 476 | ||
477 | static inline int | 477 | static inline __be32 |
478 | nfsd4_lookup(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_lookup *lookup) | 478 | nfsd4_lookup(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_lookup *lookup) |
479 | { | 479 | { |
480 | return nfsd_lookup(rqstp, current_fh, lookup->lo_name, lookup->lo_len, current_fh); | 480 | return nfsd_lookup(rqstp, current_fh, lookup->lo_name, lookup->lo_len, current_fh); |
481 | } | 481 | } |
482 | 482 | ||
483 | static inline int | 483 | static inline __be32 |
484 | nfsd4_read(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_read *read) | 484 | nfsd4_read(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_read *read) |
485 | { | 485 | { |
486 | int status; | 486 | __be32 status; |
487 | 487 | ||
488 | /* no need to check permission - this will be done in nfsd_read() */ | 488 | /* no need to check permission - this will be done in nfsd_read() */ |
489 | 489 | ||
@@ -508,7 +508,7 @@ out: | |||
508 | return status; | 508 | return status; |
509 | } | 509 | } |
510 | 510 | ||
511 | static inline int | 511 | static inline __be32 |
512 | nfsd4_readdir(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_readdir *readdir) | 512 | nfsd4_readdir(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_readdir *readdir) |
513 | { | 513 | { |
514 | u64 cookie = readdir->rd_cookie; | 514 | u64 cookie = readdir->rd_cookie; |
@@ -531,7 +531,7 @@ nfsd4_readdir(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_re | |||
531 | return nfs_ok; | 531 | return nfs_ok; |
532 | } | 532 | } |
533 | 533 | ||
534 | static inline int | 534 | static inline __be32 |
535 | nfsd4_readlink(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_readlink *readlink) | 535 | nfsd4_readlink(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_readlink *readlink) |
536 | { | 536 | { |
537 | readlink->rl_rqstp = rqstp; | 537 | readlink->rl_rqstp = rqstp; |
@@ -539,10 +539,10 @@ nfsd4_readlink(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_r | |||
539 | return nfs_ok; | 539 | return nfs_ok; |
540 | } | 540 | } |
541 | 541 | ||
542 | static inline int | 542 | static inline __be32 |
543 | nfsd4_remove(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_remove *remove) | 543 | nfsd4_remove(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_remove *remove) |
544 | { | 544 | { |
545 | int status; | 545 | __be32 status; |
546 | 546 | ||
547 | if (nfs4_in_grace()) | 547 | if (nfs4_in_grace()) |
548 | return nfserr_grace; | 548 | return nfserr_grace; |
@@ -556,11 +556,11 @@ nfsd4_remove(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_rem | |||
556 | return status; | 556 | return status; |
557 | } | 557 | } |
558 | 558 | ||
559 | static inline int | 559 | static inline __be32 |
560 | nfsd4_rename(struct svc_rqst *rqstp, struct svc_fh *current_fh, | 560 | nfsd4_rename(struct svc_rqst *rqstp, struct svc_fh *current_fh, |
561 | struct svc_fh *save_fh, struct nfsd4_rename *rename) | 561 | struct svc_fh *save_fh, struct nfsd4_rename *rename) |
562 | { | 562 | { |
563 | int status = nfserr_nofilehandle; | 563 | __be32 status = nfserr_nofilehandle; |
564 | 564 | ||
565 | if (!save_fh->fh_dentry) | 565 | if (!save_fh->fh_dentry) |
566 | return status; | 566 | return status; |
@@ -589,10 +589,10 @@ nfsd4_rename(struct svc_rqst *rqstp, struct svc_fh *current_fh, | |||
589 | return status; | 589 | return status; |
590 | } | 590 | } |
591 | 591 | ||
592 | static inline int | 592 | static inline __be32 |
593 | nfsd4_setattr(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_setattr *setattr) | 593 | nfsd4_setattr(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_setattr *setattr) |
594 | { | 594 | { |
595 | int status = nfs_ok; | 595 | __be32 status = nfs_ok; |
596 | 596 | ||
597 | if (setattr->sa_iattr.ia_valid & ATTR_SIZE) { | 597 | if (setattr->sa_iattr.ia_valid & ATTR_SIZE) { |
598 | nfs4_lock_state(); | 598 | nfs4_lock_state(); |
@@ -614,13 +614,13 @@ nfsd4_setattr(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_se | |||
614 | return status; | 614 | return status; |
615 | } | 615 | } |
616 | 616 | ||
617 | static inline int | 617 | static inline __be32 |
618 | nfsd4_write(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_write *write) | 618 | nfsd4_write(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_write *write) |
619 | { | 619 | { |
620 | stateid_t *stateid = &write->wr_stateid; | 620 | stateid_t *stateid = &write->wr_stateid; |
621 | struct file *filp = NULL; | 621 | struct file *filp = NULL; |
622 | u32 *p; | 622 | u32 *p; |
623 | int status = nfs_ok; | 623 | __be32 status = nfs_ok; |
624 | 624 | ||
625 | /* no need to check permission - this will be done in nfsd_write() */ | 625 | /* no need to check permission - this will be done in nfsd_write() */ |
626 | 626 | ||
@@ -661,12 +661,12 @@ nfsd4_write(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_writ | |||
661 | * attributes matched. VERIFY is implemented by mapping NFSERR_SAME | 661 | * attributes matched. VERIFY is implemented by mapping NFSERR_SAME |
662 | * to NFS_OK after the call; NVERIFY by mapping NFSERR_NOT_SAME to NFS_OK. | 662 | * to NFS_OK after the call; NVERIFY by mapping NFSERR_NOT_SAME to NFS_OK. |
663 | */ | 663 | */ |
664 | static int | 664 | static __be32 |
665 | nfsd4_verify(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_verify *verify) | 665 | nfsd4_verify(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_verify *verify) |
666 | { | 666 | { |
667 | u32 *buf, *p; | 667 | __be32 *buf, *p; |
668 | int count; | 668 | int count; |
669 | int status; | 669 | __be32 status; |
670 | 670 | ||
671 | status = fh_verify(rqstp, current_fh, 0, MAY_NOP); | 671 | status = fh_verify(rqstp, current_fh, 0, MAY_NOP); |
672 | if (status) | 672 | if (status) |
@@ -715,7 +715,7 @@ out_kfree: | |||
715 | /* | 715 | /* |
716 | * NULL call. | 716 | * NULL call. |
717 | */ | 717 | */ |
718 | static int | 718 | static __be32 |
719 | nfsd4_proc_null(struct svc_rqst *rqstp, void *argp, void *resp) | 719 | nfsd4_proc_null(struct svc_rqst *rqstp, void *argp, void *resp) |
720 | { | 720 | { |
721 | return nfs_ok; | 721 | return nfs_ok; |
@@ -731,7 +731,7 @@ static inline void nfsd4_increment_op_stats(u32 opnum) | |||
731 | /* | 731 | /* |
732 | * COMPOUND call. | 732 | * COMPOUND call. |
733 | */ | 733 | */ |
734 | static int | 734 | static __be32 |
735 | nfsd4_proc_compound(struct svc_rqst *rqstp, | 735 | nfsd4_proc_compound(struct svc_rqst *rqstp, |
736 | struct nfsd4_compoundargs *args, | 736 | struct nfsd4_compoundargs *args, |
737 | struct nfsd4_compoundres *resp) | 737 | struct nfsd4_compoundres *resp) |
@@ -741,7 +741,7 @@ nfsd4_proc_compound(struct svc_rqst *rqstp, | |||
741 | struct svc_fh *save_fh = NULL; | 741 | struct svc_fh *save_fh = NULL; |
742 | struct nfs4_stateowner *replay_owner = NULL; | 742 | struct nfs4_stateowner *replay_owner = NULL; |
743 | int slack_space; /* in words, not bytes! */ | 743 | int slack_space; /* in words, not bytes! */ |
744 | int status; | 744 | __be32 status; |
745 | 745 | ||
746 | status = nfserr_resource; | 746 | status = nfserr_resource; |
747 | current_fh = kmalloc(sizeof(*current_fh), GFP_KERNEL); | 747 | current_fh = kmalloc(sizeof(*current_fh), GFP_KERNEL); |
@@ -937,7 +937,7 @@ nfsd4_proc_compound(struct svc_rqst *rqstp, | |||
937 | } | 937 | } |
938 | 938 | ||
939 | encode_op: | 939 | encode_op: |
940 | if (op->status == NFSERR_REPLAY_ME) { | 940 | if (op->status == nfserr_replay_me) { |
941 | op->replay = &replay_owner->so_replay; | 941 | op->replay = &replay_owner->so_replay; |
942 | nfsd4_encode_replay(resp, op); | 942 | nfsd4_encode_replay(resp, op); |
943 | status = op->status = op->replay->rp_status; | 943 | status = op->status = op->replay->rp_status; |
diff --git a/fs/nfsd/nfs4recover.c b/fs/nfsd/nfs4recover.c index 1cbd2e4ee122..e9d07704680e 100644 --- a/fs/nfsd/nfs4recover.c +++ b/fs/nfsd/nfs4recover.c | |||
@@ -83,13 +83,13 @@ md5_to_hex(char *out, char *md5) | |||
83 | *out = '\0'; | 83 | *out = '\0'; |
84 | } | 84 | } |
85 | 85 | ||
86 | int | 86 | __be32 |
87 | nfs4_make_rec_clidname(char *dname, struct xdr_netobj *clname) | 87 | nfs4_make_rec_clidname(char *dname, struct xdr_netobj *clname) |
88 | { | 88 | { |
89 | struct xdr_netobj cksum; | 89 | struct xdr_netobj cksum; |
90 | struct hash_desc desc; | 90 | struct hash_desc desc; |
91 | struct scatterlist sg[1]; | 91 | struct scatterlist sg[1]; |
92 | int status = nfserr_resource; | 92 | __be32 status = nfserr_resource; |
93 | 93 | ||
94 | dprintk("NFSD: nfs4_make_rec_clidname for %.*s\n", | 94 | dprintk("NFSD: nfs4_make_rec_clidname for %.*s\n", |
95 | clname->len, clname->data); | 95 | clname->len, clname->data); |
@@ -193,7 +193,7 @@ nfsd4_build_dentrylist(void *arg, const char *name, int namlen, | |||
193 | struct dentry_list *child; | 193 | struct dentry_list *child; |
194 | 194 | ||
195 | if (name && isdotent(name, namlen)) | 195 | if (name && isdotent(name, namlen)) |
196 | return nfs_ok; | 196 | return 0; |
197 | dentry = lookup_one_len(name, parent, namlen); | 197 | dentry = lookup_one_len(name, parent, namlen); |
198 | if (IS_ERR(dentry)) | 198 | if (IS_ERR(dentry)) |
199 | return PTR_ERR(dentry); | 199 | return PTR_ERR(dentry); |
@@ -333,14 +333,14 @@ purge_old(struct dentry *parent, struct dentry *child) | |||
333 | int status; | 333 | int status; |
334 | 334 | ||
335 | if (nfs4_has_reclaimed_state(child->d_name.name)) | 335 | if (nfs4_has_reclaimed_state(child->d_name.name)) |
336 | return nfs_ok; | 336 | return 0; |
337 | 337 | ||
338 | status = nfsd4_clear_clid_dir(parent, child); | 338 | status = nfsd4_clear_clid_dir(parent, child); |
339 | if (status) | 339 | if (status) |
340 | printk("failed to remove client recovery directory %s\n", | 340 | printk("failed to remove client recovery directory %s\n", |
341 | child->d_name.name); | 341 | child->d_name.name); |
342 | /* Keep trying, success or failure: */ | 342 | /* Keep trying, success or failure: */ |
343 | return nfs_ok; | 343 | return 0; |
344 | } | 344 | } |
345 | 345 | ||
346 | void | 346 | void |
@@ -365,10 +365,10 @@ load_recdir(struct dentry *parent, struct dentry *child) | |||
365 | printk("nfsd4: illegal name %s in recovery directory\n", | 365 | printk("nfsd4: illegal name %s in recovery directory\n", |
366 | child->d_name.name); | 366 | child->d_name.name); |
367 | /* Keep trying; maybe the others are OK: */ | 367 | /* Keep trying; maybe the others are OK: */ |
368 | return nfs_ok; | 368 | return 0; |
369 | } | 369 | } |
370 | nfs4_client_to_reclaim(child->d_name.name); | 370 | nfs4_client_to_reclaim(child->d_name.name); |
371 | return nfs_ok; | 371 | return 0; |
372 | } | 372 | } |
373 | 373 | ||
374 | int | 374 | int |
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index ebcf226a9e4a..293b6495829f 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c | |||
@@ -710,10 +710,10 @@ out_err: | |||
710 | * as described above. | 710 | * as described above. |
711 | * | 711 | * |
712 | */ | 712 | */ |
713 | int | 713 | __be32 |
714 | nfsd4_setclientid(struct svc_rqst *rqstp, struct nfsd4_setclientid *setclid) | 714 | nfsd4_setclientid(struct svc_rqst *rqstp, struct nfsd4_setclientid *setclid) |
715 | { | 715 | { |
716 | u32 ip_addr = rqstp->rq_addr.sin_addr.s_addr; | 716 | __be32 ip_addr = rqstp->rq_addr.sin_addr.s_addr; |
717 | struct xdr_netobj clname = { | 717 | struct xdr_netobj clname = { |
718 | .len = setclid->se_namelen, | 718 | .len = setclid->se_namelen, |
719 | .data = setclid->se_name, | 719 | .data = setclid->se_name, |
@@ -721,7 +721,7 @@ nfsd4_setclientid(struct svc_rqst *rqstp, struct nfsd4_setclientid *setclid) | |||
721 | nfs4_verifier clverifier = setclid->se_verf; | 721 | nfs4_verifier clverifier = setclid->se_verf; |
722 | unsigned int strhashval; | 722 | unsigned int strhashval; |
723 | struct nfs4_client *conf, *unconf, *new; | 723 | struct nfs4_client *conf, *unconf, *new; |
724 | int status; | 724 | __be32 status; |
725 | char dname[HEXDIR_LEN]; | 725 | char dname[HEXDIR_LEN]; |
726 | 726 | ||
727 | if (!check_name(clname)) | 727 | if (!check_name(clname)) |
@@ -875,14 +875,14 @@ out: | |||
875 | * | 875 | * |
876 | * NOTE: callback information will be processed here in a future patch | 876 | * NOTE: callback information will be processed here in a future patch |
877 | */ | 877 | */ |
878 | int | 878 | __be32 |
879 | nfsd4_setclientid_confirm(struct svc_rqst *rqstp, struct nfsd4_setclientid_confirm *setclientid_confirm) | 879 | nfsd4_setclientid_confirm(struct svc_rqst *rqstp, struct nfsd4_setclientid_confirm *setclientid_confirm) |
880 | { | 880 | { |
881 | u32 ip_addr = rqstp->rq_addr.sin_addr.s_addr; | 881 | __be32 ip_addr = rqstp->rq_addr.sin_addr.s_addr; |
882 | struct nfs4_client *conf, *unconf; | 882 | struct nfs4_client *conf, *unconf; |
883 | nfs4_verifier confirm = setclientid_confirm->sc_confirm; | 883 | nfs4_verifier confirm = setclientid_confirm->sc_confirm; |
884 | clientid_t * clid = &setclientid_confirm->sc_clientid; | 884 | clientid_t * clid = &setclientid_confirm->sc_clientid; |
885 | int status; | 885 | __be32 status; |
886 | 886 | ||
887 | if (STALE_CLIENTID(clid)) | 887 | if (STALE_CLIENTID(clid)) |
888 | return nfserr_stale_clientid; | 888 | return nfserr_stale_clientid; |
@@ -1280,13 +1280,13 @@ test_share(struct nfs4_stateid *stp, struct nfsd4_open *open) { | |||
1280 | * Called to check deny when READ with all zero stateid or | 1280 | * Called to check deny when READ with all zero stateid or |
1281 | * WRITE with all zero or all one stateid | 1281 | * WRITE with all zero or all one stateid |
1282 | */ | 1282 | */ |
1283 | static int | 1283 | static __be32 |
1284 | nfs4_share_conflict(struct svc_fh *current_fh, unsigned int deny_type) | 1284 | nfs4_share_conflict(struct svc_fh *current_fh, unsigned int deny_type) |
1285 | { | 1285 | { |
1286 | struct inode *ino = current_fh->fh_dentry->d_inode; | 1286 | struct inode *ino = current_fh->fh_dentry->d_inode; |
1287 | struct nfs4_file *fp; | 1287 | struct nfs4_file *fp; |
1288 | struct nfs4_stateid *stp; | 1288 | struct nfs4_stateid *stp; |
1289 | int ret; | 1289 | __be32 ret; |
1290 | 1290 | ||
1291 | dprintk("NFSD: nfs4_share_conflict\n"); | 1291 | dprintk("NFSD: nfs4_share_conflict\n"); |
1292 | 1292 | ||
@@ -1444,7 +1444,7 @@ static struct lock_manager_operations nfsd_lease_mng_ops = { | |||
1444 | }; | 1444 | }; |
1445 | 1445 | ||
1446 | 1446 | ||
1447 | int | 1447 | __be32 |
1448 | nfsd4_process_open1(struct nfsd4_open *open) | 1448 | nfsd4_process_open1(struct nfsd4_open *open) |
1449 | { | 1449 | { |
1450 | clientid_t *clientid = &open->op_clientid; | 1450 | clientid_t *clientid = &open->op_clientid; |
@@ -1477,7 +1477,7 @@ nfsd4_process_open1(struct nfsd4_open *open) | |||
1477 | } | 1477 | } |
1478 | if (open->op_seqid == sop->so_seqid - 1) { | 1478 | if (open->op_seqid == sop->so_seqid - 1) { |
1479 | if (sop->so_replay.rp_buflen) | 1479 | if (sop->so_replay.rp_buflen) |
1480 | return NFSERR_REPLAY_ME; | 1480 | return nfserr_replay_me; |
1481 | /* The original OPEN failed so spectacularly | 1481 | /* The original OPEN failed so spectacularly |
1482 | * that we don't even have replay data saved! | 1482 | * that we don't even have replay data saved! |
1483 | * Therefore, we have no choice but to continue | 1483 | * Therefore, we have no choice but to continue |
@@ -1501,7 +1501,7 @@ renew: | |||
1501 | return nfs_ok; | 1501 | return nfs_ok; |
1502 | } | 1502 | } |
1503 | 1503 | ||
1504 | static inline int | 1504 | static inline __be32 |
1505 | nfs4_check_delegmode(struct nfs4_delegation *dp, int flags) | 1505 | nfs4_check_delegmode(struct nfs4_delegation *dp, int flags) |
1506 | { | 1506 | { |
1507 | if ((flags & WR_STATE) && (dp->dl_type == NFS4_OPEN_DELEGATE_READ)) | 1507 | if ((flags & WR_STATE) && (dp->dl_type == NFS4_OPEN_DELEGATE_READ)) |
@@ -1522,12 +1522,12 @@ find_delegation_file(struct nfs4_file *fp, stateid_t *stid) | |||
1522 | return NULL; | 1522 | return NULL; |
1523 | } | 1523 | } |
1524 | 1524 | ||
1525 | static int | 1525 | static __be32 |
1526 | nfs4_check_deleg(struct nfs4_file *fp, struct nfsd4_open *open, | 1526 | nfs4_check_deleg(struct nfs4_file *fp, struct nfsd4_open *open, |
1527 | struct nfs4_delegation **dp) | 1527 | struct nfs4_delegation **dp) |
1528 | { | 1528 | { |
1529 | int flags; | 1529 | int flags; |
1530 | int status = nfserr_bad_stateid; | 1530 | __be32 status = nfserr_bad_stateid; |
1531 | 1531 | ||
1532 | *dp = find_delegation_file(fp, &open->op_delegate_stateid); | 1532 | *dp = find_delegation_file(fp, &open->op_delegate_stateid); |
1533 | if (*dp == NULL) | 1533 | if (*dp == NULL) |
@@ -1546,11 +1546,11 @@ out: | |||
1546 | return nfs_ok; | 1546 | return nfs_ok; |
1547 | } | 1547 | } |
1548 | 1548 | ||
1549 | static int | 1549 | static __be32 |
1550 | nfs4_check_open(struct nfs4_file *fp, struct nfsd4_open *open, struct nfs4_stateid **stpp) | 1550 | nfs4_check_open(struct nfs4_file *fp, struct nfsd4_open *open, struct nfs4_stateid **stpp) |
1551 | { | 1551 | { |
1552 | struct nfs4_stateid *local; | 1552 | struct nfs4_stateid *local; |
1553 | int status = nfserr_share_denied; | 1553 | __be32 status = nfserr_share_denied; |
1554 | struct nfs4_stateowner *sop = open->op_stateowner; | 1554 | struct nfs4_stateowner *sop = open->op_stateowner; |
1555 | 1555 | ||
1556 | list_for_each_entry(local, &fp->fi_stateids, st_perfile) { | 1556 | list_for_each_entry(local, &fp->fi_stateids, st_perfile) { |
@@ -1575,7 +1575,7 @@ nfs4_alloc_stateid(void) | |||
1575 | return kmem_cache_alloc(stateid_slab, GFP_KERNEL); | 1575 | return kmem_cache_alloc(stateid_slab, GFP_KERNEL); |
1576 | } | 1576 | } |
1577 | 1577 | ||
1578 | static int | 1578 | static __be32 |
1579 | nfs4_new_open(struct svc_rqst *rqstp, struct nfs4_stateid **stpp, | 1579 | nfs4_new_open(struct svc_rqst *rqstp, struct nfs4_stateid **stpp, |
1580 | struct nfs4_delegation *dp, | 1580 | struct nfs4_delegation *dp, |
1581 | struct svc_fh *cur_fh, int flags) | 1581 | struct svc_fh *cur_fh, int flags) |
@@ -1590,7 +1590,7 @@ nfs4_new_open(struct svc_rqst *rqstp, struct nfs4_stateid **stpp, | |||
1590 | get_file(dp->dl_vfs_file); | 1590 | get_file(dp->dl_vfs_file); |
1591 | stp->st_vfs_file = dp->dl_vfs_file; | 1591 | stp->st_vfs_file = dp->dl_vfs_file; |
1592 | } else { | 1592 | } else { |
1593 | int status; | 1593 | __be32 status; |
1594 | status = nfsd_open(rqstp, cur_fh, S_IFREG, flags, | 1594 | status = nfsd_open(rqstp, cur_fh, S_IFREG, flags, |
1595 | &stp->st_vfs_file); | 1595 | &stp->st_vfs_file); |
1596 | if (status) { | 1596 | if (status) { |
@@ -1604,7 +1604,7 @@ nfs4_new_open(struct svc_rqst *rqstp, struct nfs4_stateid **stpp, | |||
1604 | return 0; | 1604 | return 0; |
1605 | } | 1605 | } |
1606 | 1606 | ||
1607 | static inline int | 1607 | static inline __be32 |
1608 | nfsd4_truncate(struct svc_rqst *rqstp, struct svc_fh *fh, | 1608 | nfsd4_truncate(struct svc_rqst *rqstp, struct svc_fh *fh, |
1609 | struct nfsd4_open *open) | 1609 | struct nfsd4_open *open) |
1610 | { | 1610 | { |
@@ -1619,22 +1619,22 @@ nfsd4_truncate(struct svc_rqst *rqstp, struct svc_fh *fh, | |||
1619 | return nfsd_setattr(rqstp, fh, &iattr, 0, (time_t)0); | 1619 | return nfsd_setattr(rqstp, fh, &iattr, 0, (time_t)0); |
1620 | } | 1620 | } |
1621 | 1621 | ||
1622 | static int | 1622 | static __be32 |
1623 | nfs4_upgrade_open(struct svc_rqst *rqstp, struct svc_fh *cur_fh, struct nfs4_stateid *stp, struct nfsd4_open *open) | 1623 | nfs4_upgrade_open(struct svc_rqst *rqstp, struct svc_fh *cur_fh, struct nfs4_stateid *stp, struct nfsd4_open *open) |
1624 | { | 1624 | { |
1625 | struct file *filp = stp->st_vfs_file; | 1625 | struct file *filp = stp->st_vfs_file; |
1626 | struct inode *inode = filp->f_dentry->d_inode; | 1626 | struct inode *inode = filp->f_dentry->d_inode; |
1627 | unsigned int share_access, new_writer; | 1627 | unsigned int share_access, new_writer; |
1628 | int status; | 1628 | __be32 status; |
1629 | 1629 | ||
1630 | set_access(&share_access, stp->st_access_bmap); | 1630 | set_access(&share_access, stp->st_access_bmap); |
1631 | new_writer = (~share_access) & open->op_share_access | 1631 | new_writer = (~share_access) & open->op_share_access |
1632 | & NFS4_SHARE_ACCESS_WRITE; | 1632 | & NFS4_SHARE_ACCESS_WRITE; |
1633 | 1633 | ||
1634 | if (new_writer) { | 1634 | if (new_writer) { |
1635 | status = get_write_access(inode); | 1635 | int err = get_write_access(inode); |
1636 | if (status) | 1636 | if (err) |
1637 | return nfserrno(status); | 1637 | return nfserrno(err); |
1638 | } | 1638 | } |
1639 | status = nfsd4_truncate(rqstp, cur_fh, open); | 1639 | status = nfsd4_truncate(rqstp, cur_fh, open); |
1640 | if (status) { | 1640 | if (status) { |
@@ -1738,14 +1738,14 @@ out: | |||
1738 | /* | 1738 | /* |
1739 | * called with nfs4_lock_state() held. | 1739 | * called with nfs4_lock_state() held. |
1740 | */ | 1740 | */ |
1741 | int | 1741 | __be32 |
1742 | nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open *open) | 1742 | nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open *open) |
1743 | { | 1743 | { |
1744 | struct nfs4_file *fp = NULL; | 1744 | struct nfs4_file *fp = NULL; |
1745 | struct inode *ino = current_fh->fh_dentry->d_inode; | 1745 | struct inode *ino = current_fh->fh_dentry->d_inode; |
1746 | struct nfs4_stateid *stp = NULL; | 1746 | struct nfs4_stateid *stp = NULL; |
1747 | struct nfs4_delegation *dp = NULL; | 1747 | struct nfs4_delegation *dp = NULL; |
1748 | int status; | 1748 | __be32 status; |
1749 | 1749 | ||
1750 | status = nfserr_inval; | 1750 | status = nfserr_inval; |
1751 | if (!access_valid(open->op_share_access) | 1751 | if (!access_valid(open->op_share_access) |
@@ -1833,11 +1833,11 @@ static struct work_struct laundromat_work; | |||
1833 | static void laundromat_main(void *); | 1833 | static void laundromat_main(void *); |
1834 | static DECLARE_WORK(laundromat_work, laundromat_main, NULL); | 1834 | static DECLARE_WORK(laundromat_work, laundromat_main, NULL); |
1835 | 1835 | ||
1836 | int | 1836 | __be32 |
1837 | nfsd4_renew(clientid_t *clid) | 1837 | nfsd4_renew(clientid_t *clid) |
1838 | { | 1838 | { |
1839 | struct nfs4_client *clp; | 1839 | struct nfs4_client *clp; |
1840 | int status; | 1840 | __be32 status; |
1841 | 1841 | ||
1842 | nfs4_lock_state(); | 1842 | nfs4_lock_state(); |
1843 | dprintk("process_renew(%08x/%08x): starting\n", | 1843 | dprintk("process_renew(%08x/%08x): starting\n", |
@@ -1996,9 +1996,9 @@ access_permit_write(unsigned long access_bmap) | |||
1996 | } | 1996 | } |
1997 | 1997 | ||
1998 | static | 1998 | static |
1999 | int nfs4_check_openmode(struct nfs4_stateid *stp, int flags) | 1999 | __be32 nfs4_check_openmode(struct nfs4_stateid *stp, int flags) |
2000 | { | 2000 | { |
2001 | int status = nfserr_openmode; | 2001 | __be32 status = nfserr_openmode; |
2002 | 2002 | ||
2003 | if ((flags & WR_STATE) && (!access_permit_write(stp->st_access_bmap))) | 2003 | if ((flags & WR_STATE) && (!access_permit_write(stp->st_access_bmap))) |
2004 | goto out; | 2004 | goto out; |
@@ -2009,7 +2009,7 @@ out: | |||
2009 | return status; | 2009 | return status; |
2010 | } | 2010 | } |
2011 | 2011 | ||
2012 | static inline int | 2012 | static inline __be32 |
2013 | check_special_stateids(svc_fh *current_fh, stateid_t *stateid, int flags) | 2013 | check_special_stateids(svc_fh *current_fh, stateid_t *stateid, int flags) |
2014 | { | 2014 | { |
2015 | /* Trying to call delegreturn with a special stateid? Yuch: */ | 2015 | /* Trying to call delegreturn with a special stateid? Yuch: */ |
@@ -2043,14 +2043,14 @@ io_during_grace_disallowed(struct inode *inode, int flags) | |||
2043 | /* | 2043 | /* |
2044 | * Checks for stateid operations | 2044 | * Checks for stateid operations |
2045 | */ | 2045 | */ |
2046 | int | 2046 | __be32 |
2047 | nfs4_preprocess_stateid_op(struct svc_fh *current_fh, stateid_t *stateid, int flags, struct file **filpp) | 2047 | nfs4_preprocess_stateid_op(struct svc_fh *current_fh, stateid_t *stateid, int flags, struct file **filpp) |
2048 | { | 2048 | { |
2049 | struct nfs4_stateid *stp = NULL; | 2049 | struct nfs4_stateid *stp = NULL; |
2050 | struct nfs4_delegation *dp = NULL; | 2050 | struct nfs4_delegation *dp = NULL; |
2051 | stateid_t *stidp; | 2051 | stateid_t *stidp; |
2052 | struct inode *ino = current_fh->fh_dentry->d_inode; | 2052 | struct inode *ino = current_fh->fh_dentry->d_inode; |
2053 | int status; | 2053 | __be32 status; |
2054 | 2054 | ||
2055 | dprintk("NFSD: preprocess_stateid_op: stateid = (%08x/%08x/%08x/%08x)\n", | 2055 | dprintk("NFSD: preprocess_stateid_op: stateid = (%08x/%08x/%08x/%08x)\n", |
2056 | stateid->si_boot, stateid->si_stateownerid, | 2056 | stateid->si_boot, stateid->si_stateownerid, |
@@ -2125,7 +2125,7 @@ setlkflg (int type) | |||
2125 | /* | 2125 | /* |
2126 | * Checks for sequence id mutating operations. | 2126 | * Checks for sequence id mutating operations. |
2127 | */ | 2127 | */ |
2128 | static int | 2128 | static __be32 |
2129 | nfs4_preprocess_seqid_op(struct svc_fh *current_fh, u32 seqid, stateid_t *stateid, int flags, struct nfs4_stateowner **sopp, struct nfs4_stateid **stpp, struct nfsd4_lock *lock) | 2129 | nfs4_preprocess_seqid_op(struct svc_fh *current_fh, u32 seqid, stateid_t *stateid, int flags, struct nfs4_stateowner **sopp, struct nfs4_stateid **stpp, struct nfsd4_lock *lock) |
2130 | { | 2130 | { |
2131 | struct nfs4_stateid *stp; | 2131 | struct nfs4_stateid *stp; |
@@ -2169,7 +2169,7 @@ nfs4_preprocess_seqid_op(struct svc_fh *current_fh, u32 seqid, stateid_t *statei | |||
2169 | clientid_t *lockclid = &lock->v.new.clientid; | 2169 | clientid_t *lockclid = &lock->v.new.clientid; |
2170 | struct nfs4_client *clp = sop->so_client; | 2170 | struct nfs4_client *clp = sop->so_client; |
2171 | int lkflg = 0; | 2171 | int lkflg = 0; |
2172 | int status; | 2172 | __be32 status; |
2173 | 2173 | ||
2174 | lkflg = setlkflg(lock->lk_type); | 2174 | lkflg = setlkflg(lock->lk_type); |
2175 | 2175 | ||
@@ -2233,7 +2233,7 @@ check_replay: | |||
2233 | if (seqid == sop->so_seqid - 1) { | 2233 | if (seqid == sop->so_seqid - 1) { |
2234 | dprintk("NFSD: preprocess_seqid_op: retransmission?\n"); | 2234 | dprintk("NFSD: preprocess_seqid_op: retransmission?\n"); |
2235 | /* indicate replay to calling function */ | 2235 | /* indicate replay to calling function */ |
2236 | return NFSERR_REPLAY_ME; | 2236 | return nfserr_replay_me; |
2237 | } | 2237 | } |
2238 | printk("NFSD: preprocess_seqid_op: bad seqid (expected %d, got %d)\n", | 2238 | printk("NFSD: preprocess_seqid_op: bad seqid (expected %d, got %d)\n", |
2239 | sop->so_seqid, seqid); | 2239 | sop->so_seqid, seqid); |
@@ -2241,10 +2241,10 @@ check_replay: | |||
2241 | return nfserr_bad_seqid; | 2241 | return nfserr_bad_seqid; |
2242 | } | 2242 | } |
2243 | 2243 | ||
2244 | int | 2244 | __be32 |
2245 | nfsd4_open_confirm(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open_confirm *oc, struct nfs4_stateowner **replay_owner) | 2245 | nfsd4_open_confirm(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open_confirm *oc, struct nfs4_stateowner **replay_owner) |
2246 | { | 2246 | { |
2247 | int status; | 2247 | __be32 status; |
2248 | struct nfs4_stateowner *sop; | 2248 | struct nfs4_stateowner *sop; |
2249 | struct nfs4_stateid *stp; | 2249 | struct nfs4_stateid *stp; |
2250 | 2250 | ||
@@ -2310,10 +2310,10 @@ reset_union_bmap_deny(unsigned long deny, unsigned long *bmap) | |||
2310 | } | 2310 | } |
2311 | } | 2311 | } |
2312 | 2312 | ||
2313 | int | 2313 | __be32 |
2314 | nfsd4_open_downgrade(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open_downgrade *od, struct nfs4_stateowner **replay_owner) | 2314 | nfsd4_open_downgrade(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open_downgrade *od, struct nfs4_stateowner **replay_owner) |
2315 | { | 2315 | { |
2316 | int status; | 2316 | __be32 status; |
2317 | struct nfs4_stateid *stp; | 2317 | struct nfs4_stateid *stp; |
2318 | unsigned int share_access; | 2318 | unsigned int share_access; |
2319 | 2319 | ||
@@ -2365,10 +2365,10 @@ out: | |||
2365 | /* | 2365 | /* |
2366 | * nfs4_unlock_state() called after encode | 2366 | * nfs4_unlock_state() called after encode |
2367 | */ | 2367 | */ |
2368 | int | 2368 | __be32 |
2369 | nfsd4_close(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_close *close, struct nfs4_stateowner **replay_owner) | 2369 | nfsd4_close(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_close *close, struct nfs4_stateowner **replay_owner) |
2370 | { | 2370 | { |
2371 | int status; | 2371 | __be32 status; |
2372 | struct nfs4_stateid *stp; | 2372 | struct nfs4_stateid *stp; |
2373 | 2373 | ||
2374 | dprintk("NFSD: nfsd4_close on file %.*s\n", | 2374 | dprintk("NFSD: nfsd4_close on file %.*s\n", |
@@ -2404,10 +2404,10 @@ out: | |||
2404 | return status; | 2404 | return status; |
2405 | } | 2405 | } |
2406 | 2406 | ||
2407 | int | 2407 | __be32 |
2408 | nfsd4_delegreturn(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_delegreturn *dr) | 2408 | nfsd4_delegreturn(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_delegreturn *dr) |
2409 | { | 2409 | { |
2410 | int status; | 2410 | __be32 status; |
2411 | 2411 | ||
2412 | if ((status = fh_verify(rqstp, current_fh, S_IFREG, 0))) | 2412 | if ((status = fh_verify(rqstp, current_fh, S_IFREG, 0))) |
2413 | goto out; | 2413 | goto out; |
@@ -2635,7 +2635,7 @@ check_lock_length(u64 offset, u64 length) | |||
2635 | /* | 2635 | /* |
2636 | * LOCK operation | 2636 | * LOCK operation |
2637 | */ | 2637 | */ |
2638 | int | 2638 | __be32 |
2639 | nfsd4_lock(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_lock *lock, struct nfs4_stateowner **replay_owner) | 2639 | nfsd4_lock(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_lock *lock, struct nfs4_stateowner **replay_owner) |
2640 | { | 2640 | { |
2641 | struct nfs4_stateowner *open_sop = NULL; | 2641 | struct nfs4_stateowner *open_sop = NULL; |
@@ -2644,8 +2644,9 @@ nfsd4_lock(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_lock | |||
2644 | struct file *filp; | 2644 | struct file *filp; |
2645 | struct file_lock file_lock; | 2645 | struct file_lock file_lock; |
2646 | struct file_lock conflock; | 2646 | struct file_lock conflock; |
2647 | int status = 0; | 2647 | __be32 status = 0; |
2648 | unsigned int strhashval; | 2648 | unsigned int strhashval; |
2649 | int err; | ||
2649 | 2650 | ||
2650 | dprintk("NFSD: nfsd4_lock: start=%Ld length=%Ld\n", | 2651 | dprintk("NFSD: nfsd4_lock: start=%Ld length=%Ld\n", |
2651 | (long long) lock->lk_offset, | 2652 | (long long) lock->lk_offset, |
@@ -2758,13 +2759,14 @@ nfsd4_lock(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_lock | |||
2758 | * locks_copy_lock: */ | 2759 | * locks_copy_lock: */ |
2759 | conflock.fl_ops = NULL; | 2760 | conflock.fl_ops = NULL; |
2760 | conflock.fl_lmops = NULL; | 2761 | conflock.fl_lmops = NULL; |
2761 | status = posix_lock_file_conf(filp, &file_lock, &conflock); | 2762 | err = posix_lock_file_conf(filp, &file_lock, &conflock); |
2762 | dprintk("NFSD: nfsd4_lock: posix_lock_file_conf status %d\n",status); | 2763 | dprintk("NFSD: nfsd4_lock: posix_lock_file_conf status %d\n",status); |
2763 | switch (-status) { | 2764 | switch (-err) { |
2764 | case 0: /* success! */ | 2765 | case 0: /* success! */ |
2765 | update_stateid(&lock_stp->st_stateid); | 2766 | update_stateid(&lock_stp->st_stateid); |
2766 | memcpy(&lock->lk_resp_stateid, &lock_stp->st_stateid, | 2767 | memcpy(&lock->lk_resp_stateid, &lock_stp->st_stateid, |
2767 | sizeof(stateid_t)); | 2768 | sizeof(stateid_t)); |
2769 | status = 0; | ||
2768 | break; | 2770 | break; |
2769 | case (EAGAIN): /* conflock holds conflicting lock */ | 2771 | case (EAGAIN): /* conflock holds conflicting lock */ |
2770 | status = nfserr_denied; | 2772 | status = nfserr_denied; |
@@ -2775,7 +2777,7 @@ nfsd4_lock(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_lock | |||
2775 | status = nfserr_deadlock; | 2777 | status = nfserr_deadlock; |
2776 | break; | 2778 | break; |
2777 | default: | 2779 | default: |
2778 | dprintk("NFSD: nfsd4_lock: posix_lock_file_conf() failed! status %d\n",status); | 2780 | dprintk("NFSD: nfsd4_lock: posix_lock_file_conf() failed! status %d\n",err); |
2779 | status = nfserr_resource; | 2781 | status = nfserr_resource; |
2780 | break; | 2782 | break; |
2781 | } | 2783 | } |
@@ -2793,14 +2795,14 @@ out: | |||
2793 | /* | 2795 | /* |
2794 | * LOCKT operation | 2796 | * LOCKT operation |
2795 | */ | 2797 | */ |
2796 | int | 2798 | __be32 |
2797 | nfsd4_lockt(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_lockt *lockt) | 2799 | nfsd4_lockt(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_lockt *lockt) |
2798 | { | 2800 | { |
2799 | struct inode *inode; | 2801 | struct inode *inode; |
2800 | struct file file; | 2802 | struct file file; |
2801 | struct file_lock file_lock; | 2803 | struct file_lock file_lock; |
2802 | struct file_lock conflock; | 2804 | struct file_lock conflock; |
2803 | int status; | 2805 | __be32 status; |
2804 | 2806 | ||
2805 | if (nfs4_in_grace()) | 2807 | if (nfs4_in_grace()) |
2806 | return nfserr_grace; | 2808 | return nfserr_grace; |
@@ -2873,13 +2875,14 @@ out: | |||
2873 | return status; | 2875 | return status; |
2874 | } | 2876 | } |
2875 | 2877 | ||
2876 | int | 2878 | __be32 |
2877 | nfsd4_locku(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_locku *locku, struct nfs4_stateowner **replay_owner) | 2879 | nfsd4_locku(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_locku *locku, struct nfs4_stateowner **replay_owner) |
2878 | { | 2880 | { |
2879 | struct nfs4_stateid *stp; | 2881 | struct nfs4_stateid *stp; |
2880 | struct file *filp = NULL; | 2882 | struct file *filp = NULL; |
2881 | struct file_lock file_lock; | 2883 | struct file_lock file_lock; |
2882 | int status; | 2884 | __be32 status; |
2885 | int err; | ||
2883 | 2886 | ||
2884 | dprintk("NFSD: nfsd4_locku: start=%Ld length=%Ld\n", | 2887 | dprintk("NFSD: nfsd4_locku: start=%Ld length=%Ld\n", |
2885 | (long long) locku->lu_offset, | 2888 | (long long) locku->lu_offset, |
@@ -2917,8 +2920,8 @@ nfsd4_locku(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_lock | |||
2917 | /* | 2920 | /* |
2918 | * Try to unlock the file in the VFS. | 2921 | * Try to unlock the file in the VFS. |
2919 | */ | 2922 | */ |
2920 | status = posix_lock_file(filp, &file_lock); | 2923 | err = posix_lock_file(filp, &file_lock); |
2921 | if (status) { | 2924 | if (err) { |
2922 | dprintk("NFSD: nfs4_locku: posix_lock_file failed!\n"); | 2925 | dprintk("NFSD: nfs4_locku: posix_lock_file failed!\n"); |
2923 | goto out_nfserr; | 2926 | goto out_nfserr; |
2924 | } | 2927 | } |
@@ -2937,7 +2940,7 @@ out: | |||
2937 | return status; | 2940 | return status; |
2938 | 2941 | ||
2939 | out_nfserr: | 2942 | out_nfserr: |
2940 | status = nfserrno(status); | 2943 | status = nfserrno(err); |
2941 | goto out; | 2944 | goto out; |
2942 | } | 2945 | } |
2943 | 2946 | ||
@@ -2965,7 +2968,7 @@ out: | |||
2965 | return status; | 2968 | return status; |
2966 | } | 2969 | } |
2967 | 2970 | ||
2968 | int | 2971 | __be32 |
2969 | nfsd4_release_lockowner(struct svc_rqst *rqstp, struct nfsd4_release_lockowner *rlockowner) | 2972 | nfsd4_release_lockowner(struct svc_rqst *rqstp, struct nfsd4_release_lockowner *rlockowner) |
2970 | { | 2973 | { |
2971 | clientid_t *clid = &rlockowner->rl_clientid; | 2974 | clientid_t *clid = &rlockowner->rl_clientid; |
@@ -2974,7 +2977,7 @@ nfsd4_release_lockowner(struct svc_rqst *rqstp, struct nfsd4_release_lockowner * | |||
2974 | struct xdr_netobj *owner = &rlockowner->rl_owner; | 2977 | struct xdr_netobj *owner = &rlockowner->rl_owner; |
2975 | struct list_head matches; | 2978 | struct list_head matches; |
2976 | int i; | 2979 | int i; |
2977 | int status; | 2980 | __be32 status; |
2978 | 2981 | ||
2979 | dprintk("nfsd4_release_lockowner clientid: (%08x/%08x):\n", | 2982 | dprintk("nfsd4_release_lockowner clientid: (%08x/%08x):\n", |
2980 | clid->cl_boot, clid->cl_id); | 2983 | clid->cl_boot, clid->cl_id); |
@@ -3111,7 +3114,7 @@ nfs4_find_reclaim_client(clientid_t *clid) | |||
3111 | /* | 3114 | /* |
3112 | * Called from OPEN. Look for clientid in reclaim list. | 3115 | * Called from OPEN. Look for clientid in reclaim list. |
3113 | */ | 3116 | */ |
3114 | int | 3117 | __be32 |
3115 | nfs4_check_open_reclaim(clientid_t *clid) | 3118 | nfs4_check_open_reclaim(clientid_t *clid) |
3116 | { | 3119 | { |
3117 | return nfs4_find_reclaim_client(clid) ? nfs_ok : nfserr_reclaim_bad; | 3120 | return nfs4_find_reclaim_client(clid) ? nfs_ok : nfserr_reclaim_bad; |
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index 41fc241b729a..f3f239db04bb 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c | |||
@@ -68,8 +68,8 @@ | |||
68 | #define NFS4_REFERRAL_FSID_MAJOR 0x8000000ULL | 68 | #define NFS4_REFERRAL_FSID_MAJOR 0x8000000ULL |
69 | #define NFS4_REFERRAL_FSID_MINOR 0x8000000ULL | 69 | #define NFS4_REFERRAL_FSID_MINOR 0x8000000ULL |
70 | 70 | ||
71 | static int | 71 | static __be32 |
72 | check_filename(char *str, int len, int err) | 72 | check_filename(char *str, int len, __be32 err) |
73 | { | 73 | { |
74 | int i; | 74 | int i; |
75 | 75 | ||
@@ -94,8 +94,8 @@ check_filename(char *str, int len, int err) | |||
94 | * consistent with the style used in NFSv2/v3... | 94 | * consistent with the style used in NFSv2/v3... |
95 | */ | 95 | */ |
96 | #define DECODE_HEAD \ | 96 | #define DECODE_HEAD \ |
97 | u32 *p; \ | 97 | __be32 *p; \ |
98 | int status | 98 | __be32 status |
99 | #define DECODE_TAIL \ | 99 | #define DECODE_TAIL \ |
100 | status = 0; \ | 100 | status = 0; \ |
101 | out: \ | 101 | out: \ |
@@ -144,13 +144,13 @@ xdr_error: \ | |||
144 | } \ | 144 | } \ |
145 | } while (0) | 145 | } while (0) |
146 | 146 | ||
147 | static u32 *read_buf(struct nfsd4_compoundargs *argp, int nbytes) | 147 | static __be32 *read_buf(struct nfsd4_compoundargs *argp, int nbytes) |
148 | { | 148 | { |
149 | /* We want more bytes than seem to be available. | 149 | /* We want more bytes than seem to be available. |
150 | * Maybe we need a new page, maybe we have just run out | 150 | * Maybe we need a new page, maybe we have just run out |
151 | */ | 151 | */ |
152 | int avail = (char*)argp->end - (char*)argp->p; | 152 | int avail = (char*)argp->end - (char*)argp->p; |
153 | u32 *p; | 153 | __be32 *p; |
154 | if (avail + argp->pagelen < nbytes) | 154 | if (avail + argp->pagelen < nbytes) |
155 | return NULL; | 155 | return NULL; |
156 | if (avail + PAGE_SIZE < nbytes) /* need more than a page !! */ | 156 | if (avail + PAGE_SIZE < nbytes) /* need more than a page !! */ |
@@ -197,7 +197,7 @@ defer_free(struct nfsd4_compoundargs *argp, | |||
197 | return 0; | 197 | return 0; |
198 | } | 198 | } |
199 | 199 | ||
200 | static char *savemem(struct nfsd4_compoundargs *argp, u32 *p, int nbytes) | 200 | static char *savemem(struct nfsd4_compoundargs *argp, __be32 *p, int nbytes) |
201 | { | 201 | { |
202 | void *new = NULL; | 202 | void *new = NULL; |
203 | if (p == argp->tmp) { | 203 | if (p == argp->tmp) { |
@@ -217,7 +217,7 @@ static char *savemem(struct nfsd4_compoundargs *argp, u32 *p, int nbytes) | |||
217 | } | 217 | } |
218 | 218 | ||
219 | 219 | ||
220 | static int | 220 | static __be32 |
221 | nfsd4_decode_bitmap(struct nfsd4_compoundargs *argp, u32 *bmval) | 221 | nfsd4_decode_bitmap(struct nfsd4_compoundargs *argp, u32 *bmval) |
222 | { | 222 | { |
223 | u32 bmlen; | 223 | u32 bmlen; |
@@ -240,13 +240,14 @@ nfsd4_decode_bitmap(struct nfsd4_compoundargs *argp, u32 *bmval) | |||
240 | DECODE_TAIL; | 240 | DECODE_TAIL; |
241 | } | 241 | } |
242 | 242 | ||
243 | static int | 243 | static __be32 |
244 | nfsd4_decode_fattr(struct nfsd4_compoundargs *argp, u32 *bmval, struct iattr *iattr, | 244 | nfsd4_decode_fattr(struct nfsd4_compoundargs *argp, u32 *bmval, struct iattr *iattr, |
245 | struct nfs4_acl **acl) | 245 | struct nfs4_acl **acl) |
246 | { | 246 | { |
247 | int expected_len, len = 0; | 247 | int expected_len, len = 0; |
248 | u32 dummy32; | 248 | u32 dummy32; |
249 | char *buf; | 249 | char *buf; |
250 | int host_err; | ||
250 | 251 | ||
251 | DECODE_HEAD; | 252 | DECODE_HEAD; |
252 | iattr->ia_valid = 0; | 253 | iattr->ia_valid = 0; |
@@ -280,7 +281,7 @@ nfsd4_decode_fattr(struct nfsd4_compoundargs *argp, u32 *bmval, struct iattr *ia | |||
280 | 281 | ||
281 | *acl = nfs4_acl_new(); | 282 | *acl = nfs4_acl_new(); |
282 | if (*acl == NULL) { | 283 | if (*acl == NULL) { |
283 | status = -ENOMEM; | 284 | host_err = -ENOMEM; |
284 | goto out_nfserr; | 285 | goto out_nfserr; |
285 | } | 286 | } |
286 | defer_free(argp, (void (*)(const void *))nfs4_acl_free, *acl); | 287 | defer_free(argp, (void (*)(const void *))nfs4_acl_free, *acl); |
@@ -295,20 +296,20 @@ nfsd4_decode_fattr(struct nfsd4_compoundargs *argp, u32 *bmval, struct iattr *ia | |||
295 | len += XDR_QUADLEN(dummy32) << 2; | 296 | len += XDR_QUADLEN(dummy32) << 2; |
296 | READMEM(buf, dummy32); | 297 | READMEM(buf, dummy32); |
297 | ace.whotype = nfs4_acl_get_whotype(buf, dummy32); | 298 | ace.whotype = nfs4_acl_get_whotype(buf, dummy32); |
298 | status = 0; | 299 | host_err = 0; |
299 | if (ace.whotype != NFS4_ACL_WHO_NAMED) | 300 | if (ace.whotype != NFS4_ACL_WHO_NAMED) |
300 | ace.who = 0; | 301 | ace.who = 0; |
301 | else if (ace.flag & NFS4_ACE_IDENTIFIER_GROUP) | 302 | else if (ace.flag & NFS4_ACE_IDENTIFIER_GROUP) |
302 | status = nfsd_map_name_to_gid(argp->rqstp, | 303 | host_err = nfsd_map_name_to_gid(argp->rqstp, |
303 | buf, dummy32, &ace.who); | 304 | buf, dummy32, &ace.who); |
304 | else | 305 | else |
305 | status = nfsd_map_name_to_uid(argp->rqstp, | 306 | host_err = nfsd_map_name_to_uid(argp->rqstp, |
306 | buf, dummy32, &ace.who); | 307 | buf, dummy32, &ace.who); |
307 | if (status) | 308 | if (host_err) |
308 | goto out_nfserr; | 309 | goto out_nfserr; |
309 | status = nfs4_acl_add_ace(*acl, ace.type, ace.flag, | 310 | host_err = nfs4_acl_add_ace(*acl, ace.type, ace.flag, |
310 | ace.access_mask, ace.whotype, ace.who); | 311 | ace.access_mask, ace.whotype, ace.who); |
311 | if (status) | 312 | if (host_err) |
312 | goto out_nfserr; | 313 | goto out_nfserr; |
313 | } | 314 | } |
314 | } else | 315 | } else |
@@ -327,7 +328,7 @@ nfsd4_decode_fattr(struct nfsd4_compoundargs *argp, u32 *bmval, struct iattr *ia | |||
327 | READ_BUF(dummy32); | 328 | READ_BUF(dummy32); |
328 | len += (XDR_QUADLEN(dummy32) << 2); | 329 | len += (XDR_QUADLEN(dummy32) << 2); |
329 | READMEM(buf, dummy32); | 330 | READMEM(buf, dummy32); |
330 | if ((status = nfsd_map_name_to_uid(argp->rqstp, buf, dummy32, &iattr->ia_uid))) | 331 | if ((host_err = nfsd_map_name_to_uid(argp->rqstp, buf, dummy32, &iattr->ia_uid))) |
331 | goto out_nfserr; | 332 | goto out_nfserr; |
332 | iattr->ia_valid |= ATTR_UID; | 333 | iattr->ia_valid |= ATTR_UID; |
333 | } | 334 | } |
@@ -338,7 +339,7 @@ nfsd4_decode_fattr(struct nfsd4_compoundargs *argp, u32 *bmval, struct iattr *ia | |||
338 | READ_BUF(dummy32); | 339 | READ_BUF(dummy32); |
339 | len += (XDR_QUADLEN(dummy32) << 2); | 340 | len += (XDR_QUADLEN(dummy32) << 2); |
340 | READMEM(buf, dummy32); | 341 | READMEM(buf, dummy32); |
341 | if ((status = nfsd_map_name_to_gid(argp->rqstp, buf, dummy32, &iattr->ia_gid))) | 342 | if ((host_err = nfsd_map_name_to_gid(argp->rqstp, buf, dummy32, &iattr->ia_gid))) |
342 | goto out_nfserr; | 343 | goto out_nfserr; |
343 | iattr->ia_valid |= ATTR_GID; | 344 | iattr->ia_valid |= ATTR_GID; |
344 | } | 345 | } |
@@ -414,11 +415,11 @@ nfsd4_decode_fattr(struct nfsd4_compoundargs *argp, u32 *bmval, struct iattr *ia | |||
414 | DECODE_TAIL; | 415 | DECODE_TAIL; |
415 | 416 | ||
416 | out_nfserr: | 417 | out_nfserr: |
417 | status = nfserrno(status); | 418 | status = nfserrno(host_err); |
418 | goto out; | 419 | goto out; |
419 | } | 420 | } |
420 | 421 | ||
421 | static int | 422 | static __be32 |
422 | nfsd4_decode_access(struct nfsd4_compoundargs *argp, struct nfsd4_access *access) | 423 | nfsd4_decode_access(struct nfsd4_compoundargs *argp, struct nfsd4_access *access) |
423 | { | 424 | { |
424 | DECODE_HEAD; | 425 | DECODE_HEAD; |
@@ -429,7 +430,7 @@ nfsd4_decode_access(struct nfsd4_compoundargs *argp, struct nfsd4_access *access | |||
429 | DECODE_TAIL; | 430 | DECODE_TAIL; |
430 | } | 431 | } |
431 | 432 | ||
432 | static int | 433 | static __be32 |
433 | nfsd4_decode_close(struct nfsd4_compoundargs *argp, struct nfsd4_close *close) | 434 | nfsd4_decode_close(struct nfsd4_compoundargs *argp, struct nfsd4_close *close) |
434 | { | 435 | { |
435 | DECODE_HEAD; | 436 | DECODE_HEAD; |
@@ -444,7 +445,7 @@ nfsd4_decode_close(struct nfsd4_compoundargs *argp, struct nfsd4_close *close) | |||
444 | } | 445 | } |
445 | 446 | ||
446 | 447 | ||
447 | static int | 448 | static __be32 |
448 | nfsd4_decode_commit(struct nfsd4_compoundargs *argp, struct nfsd4_commit *commit) | 449 | nfsd4_decode_commit(struct nfsd4_compoundargs *argp, struct nfsd4_commit *commit) |
449 | { | 450 | { |
450 | DECODE_HEAD; | 451 | DECODE_HEAD; |
@@ -456,7 +457,7 @@ nfsd4_decode_commit(struct nfsd4_compoundargs *argp, struct nfsd4_commit *commit | |||
456 | DECODE_TAIL; | 457 | DECODE_TAIL; |
457 | } | 458 | } |
458 | 459 | ||
459 | static int | 460 | static __be32 |
460 | nfsd4_decode_create(struct nfsd4_compoundargs *argp, struct nfsd4_create *create) | 461 | nfsd4_decode_create(struct nfsd4_compoundargs *argp, struct nfsd4_create *create) |
461 | { | 462 | { |
462 | DECODE_HEAD; | 463 | DECODE_HEAD; |
@@ -496,7 +497,7 @@ nfsd4_decode_create(struct nfsd4_compoundargs *argp, struct nfsd4_create *create | |||
496 | DECODE_TAIL; | 497 | DECODE_TAIL; |
497 | } | 498 | } |
498 | 499 | ||
499 | static inline int | 500 | static inline __be32 |
500 | nfsd4_decode_delegreturn(struct nfsd4_compoundargs *argp, struct nfsd4_delegreturn *dr) | 501 | nfsd4_decode_delegreturn(struct nfsd4_compoundargs *argp, struct nfsd4_delegreturn *dr) |
501 | { | 502 | { |
502 | DECODE_HEAD; | 503 | DECODE_HEAD; |
@@ -508,13 +509,13 @@ nfsd4_decode_delegreturn(struct nfsd4_compoundargs *argp, struct nfsd4_delegretu | |||
508 | DECODE_TAIL; | 509 | DECODE_TAIL; |
509 | } | 510 | } |
510 | 511 | ||
511 | static inline int | 512 | static inline __be32 |
512 | nfsd4_decode_getattr(struct nfsd4_compoundargs *argp, struct nfsd4_getattr *getattr) | 513 | nfsd4_decode_getattr(struct nfsd4_compoundargs *argp, struct nfsd4_getattr *getattr) |
513 | { | 514 | { |
514 | return nfsd4_decode_bitmap(argp, getattr->ga_bmval); | 515 | return nfsd4_decode_bitmap(argp, getattr->ga_bmval); |
515 | } | 516 | } |
516 | 517 | ||
517 | static int | 518 | static __be32 |
518 | nfsd4_decode_link(struct nfsd4_compoundargs *argp, struct nfsd4_link *link) | 519 | nfsd4_decode_link(struct nfsd4_compoundargs *argp, struct nfsd4_link *link) |
519 | { | 520 | { |
520 | DECODE_HEAD; | 521 | DECODE_HEAD; |
@@ -529,7 +530,7 @@ nfsd4_decode_link(struct nfsd4_compoundargs *argp, struct nfsd4_link *link) | |||
529 | DECODE_TAIL; | 530 | DECODE_TAIL; |
530 | } | 531 | } |
531 | 532 | ||
532 | static int | 533 | static __be32 |
533 | nfsd4_decode_lock(struct nfsd4_compoundargs *argp, struct nfsd4_lock *lock) | 534 | nfsd4_decode_lock(struct nfsd4_compoundargs *argp, struct nfsd4_lock *lock) |
534 | { | 535 | { |
535 | DECODE_HEAD; | 536 | DECODE_HEAD; |
@@ -568,7 +569,7 @@ nfsd4_decode_lock(struct nfsd4_compoundargs *argp, struct nfsd4_lock *lock) | |||
568 | DECODE_TAIL; | 569 | DECODE_TAIL; |
569 | } | 570 | } |
570 | 571 | ||
571 | static int | 572 | static __be32 |
572 | nfsd4_decode_lockt(struct nfsd4_compoundargs *argp, struct nfsd4_lockt *lockt) | 573 | nfsd4_decode_lockt(struct nfsd4_compoundargs *argp, struct nfsd4_lockt *lockt) |
573 | { | 574 | { |
574 | DECODE_HEAD; | 575 | DECODE_HEAD; |
@@ -587,7 +588,7 @@ nfsd4_decode_lockt(struct nfsd4_compoundargs *argp, struct nfsd4_lockt *lockt) | |||
587 | DECODE_TAIL; | 588 | DECODE_TAIL; |
588 | } | 589 | } |
589 | 590 | ||
590 | static int | 591 | static __be32 |
591 | nfsd4_decode_locku(struct nfsd4_compoundargs *argp, struct nfsd4_locku *locku) | 592 | nfsd4_decode_locku(struct nfsd4_compoundargs *argp, struct nfsd4_locku *locku) |
592 | { | 593 | { |
593 | DECODE_HEAD; | 594 | DECODE_HEAD; |
@@ -606,7 +607,7 @@ nfsd4_decode_locku(struct nfsd4_compoundargs *argp, struct nfsd4_locku *locku) | |||
606 | DECODE_TAIL; | 607 | DECODE_TAIL; |
607 | } | 608 | } |
608 | 609 | ||
609 | static int | 610 | static __be32 |
610 | nfsd4_decode_lookup(struct nfsd4_compoundargs *argp, struct nfsd4_lookup *lookup) | 611 | nfsd4_decode_lookup(struct nfsd4_compoundargs *argp, struct nfsd4_lookup *lookup) |
611 | { | 612 | { |
612 | DECODE_HEAD; | 613 | DECODE_HEAD; |
@@ -621,7 +622,7 @@ nfsd4_decode_lookup(struct nfsd4_compoundargs *argp, struct nfsd4_lookup *lookup | |||
621 | DECODE_TAIL; | 622 | DECODE_TAIL; |
622 | } | 623 | } |
623 | 624 | ||
624 | static int | 625 | static __be32 |
625 | nfsd4_decode_open(struct nfsd4_compoundargs *argp, struct nfsd4_open *open) | 626 | nfsd4_decode_open(struct nfsd4_compoundargs *argp, struct nfsd4_open *open) |
626 | { | 627 | { |
627 | DECODE_HEAD; | 628 | DECODE_HEAD; |
@@ -699,7 +700,7 @@ nfsd4_decode_open(struct nfsd4_compoundargs *argp, struct nfsd4_open *open) | |||
699 | DECODE_TAIL; | 700 | DECODE_TAIL; |
700 | } | 701 | } |
701 | 702 | ||
702 | static int | 703 | static __be32 |
703 | nfsd4_decode_open_confirm(struct nfsd4_compoundargs *argp, struct nfsd4_open_confirm *open_conf) | 704 | nfsd4_decode_open_confirm(struct nfsd4_compoundargs *argp, struct nfsd4_open_confirm *open_conf) |
704 | { | 705 | { |
705 | DECODE_HEAD; | 706 | DECODE_HEAD; |
@@ -713,7 +714,7 @@ nfsd4_decode_open_confirm(struct nfsd4_compoundargs *argp, struct nfsd4_open_con | |||
713 | DECODE_TAIL; | 714 | DECODE_TAIL; |
714 | } | 715 | } |
715 | 716 | ||
716 | static int | 717 | static __be32 |
717 | nfsd4_decode_open_downgrade(struct nfsd4_compoundargs *argp, struct nfsd4_open_downgrade *open_down) | 718 | nfsd4_decode_open_downgrade(struct nfsd4_compoundargs *argp, struct nfsd4_open_downgrade *open_down) |
718 | { | 719 | { |
719 | DECODE_HEAD; | 720 | DECODE_HEAD; |
@@ -729,7 +730,7 @@ nfsd4_decode_open_downgrade(struct nfsd4_compoundargs *argp, struct nfsd4_open_d | |||
729 | DECODE_TAIL; | 730 | DECODE_TAIL; |
730 | } | 731 | } |
731 | 732 | ||
732 | static int | 733 | static __be32 |
733 | nfsd4_decode_putfh(struct nfsd4_compoundargs *argp, struct nfsd4_putfh *putfh) | 734 | nfsd4_decode_putfh(struct nfsd4_compoundargs *argp, struct nfsd4_putfh *putfh) |
734 | { | 735 | { |
735 | DECODE_HEAD; | 736 | DECODE_HEAD; |
@@ -744,7 +745,7 @@ nfsd4_decode_putfh(struct nfsd4_compoundargs *argp, struct nfsd4_putfh *putfh) | |||
744 | DECODE_TAIL; | 745 | DECODE_TAIL; |
745 | } | 746 | } |
746 | 747 | ||
747 | static int | 748 | static __be32 |
748 | nfsd4_decode_read(struct nfsd4_compoundargs *argp, struct nfsd4_read *read) | 749 | nfsd4_decode_read(struct nfsd4_compoundargs *argp, struct nfsd4_read *read) |
749 | { | 750 | { |
750 | DECODE_HEAD; | 751 | DECODE_HEAD; |
@@ -758,7 +759,7 @@ nfsd4_decode_read(struct nfsd4_compoundargs *argp, struct nfsd4_read *read) | |||
758 | DECODE_TAIL; | 759 | DECODE_TAIL; |
759 | } | 760 | } |
760 | 761 | ||
761 | static int | 762 | static __be32 |
762 | nfsd4_decode_readdir(struct nfsd4_compoundargs *argp, struct nfsd4_readdir *readdir) | 763 | nfsd4_decode_readdir(struct nfsd4_compoundargs *argp, struct nfsd4_readdir *readdir) |
763 | { | 764 | { |
764 | DECODE_HEAD; | 765 | DECODE_HEAD; |
@@ -774,7 +775,7 @@ nfsd4_decode_readdir(struct nfsd4_compoundargs *argp, struct nfsd4_readdir *read | |||
774 | DECODE_TAIL; | 775 | DECODE_TAIL; |
775 | } | 776 | } |
776 | 777 | ||
777 | static int | 778 | static __be32 |
778 | nfsd4_decode_remove(struct nfsd4_compoundargs *argp, struct nfsd4_remove *remove) | 779 | nfsd4_decode_remove(struct nfsd4_compoundargs *argp, struct nfsd4_remove *remove) |
779 | { | 780 | { |
780 | DECODE_HEAD; | 781 | DECODE_HEAD; |
@@ -789,7 +790,7 @@ nfsd4_decode_remove(struct nfsd4_compoundargs *argp, struct nfsd4_remove *remove | |||
789 | DECODE_TAIL; | 790 | DECODE_TAIL; |
790 | } | 791 | } |
791 | 792 | ||
792 | static int | 793 | static __be32 |
793 | nfsd4_decode_rename(struct nfsd4_compoundargs *argp, struct nfsd4_rename *rename) | 794 | nfsd4_decode_rename(struct nfsd4_compoundargs *argp, struct nfsd4_rename *rename) |
794 | { | 795 | { |
795 | DECODE_HEAD; | 796 | DECODE_HEAD; |
@@ -809,7 +810,7 @@ nfsd4_decode_rename(struct nfsd4_compoundargs *argp, struct nfsd4_rename *rename | |||
809 | DECODE_TAIL; | 810 | DECODE_TAIL; |
810 | } | 811 | } |
811 | 812 | ||
812 | static int | 813 | static __be32 |
813 | nfsd4_decode_renew(struct nfsd4_compoundargs *argp, clientid_t *clientid) | 814 | nfsd4_decode_renew(struct nfsd4_compoundargs *argp, clientid_t *clientid) |
814 | { | 815 | { |
815 | DECODE_HEAD; | 816 | DECODE_HEAD; |
@@ -820,7 +821,7 @@ nfsd4_decode_renew(struct nfsd4_compoundargs *argp, clientid_t *clientid) | |||
820 | DECODE_TAIL; | 821 | DECODE_TAIL; |
821 | } | 822 | } |
822 | 823 | ||
823 | static int | 824 | static __be32 |
824 | nfsd4_decode_setattr(struct nfsd4_compoundargs *argp, struct nfsd4_setattr *setattr) | 825 | nfsd4_decode_setattr(struct nfsd4_compoundargs *argp, struct nfsd4_setattr *setattr) |
825 | { | 826 | { |
826 | DECODE_HEAD; | 827 | DECODE_HEAD; |
@@ -834,7 +835,7 @@ nfsd4_decode_setattr(struct nfsd4_compoundargs *argp, struct nfsd4_setattr *seta | |||
834 | DECODE_TAIL; | 835 | DECODE_TAIL; |
835 | } | 836 | } |
836 | 837 | ||
837 | static int | 838 | static __be32 |
838 | nfsd4_decode_setclientid(struct nfsd4_compoundargs *argp, struct nfsd4_setclientid *setclientid) | 839 | nfsd4_decode_setclientid(struct nfsd4_compoundargs *argp, struct nfsd4_setclientid *setclientid) |
839 | { | 840 | { |
840 | DECODE_HEAD; | 841 | DECODE_HEAD; |
@@ -859,7 +860,7 @@ nfsd4_decode_setclientid(struct nfsd4_compoundargs *argp, struct nfsd4_setclient | |||
859 | DECODE_TAIL; | 860 | DECODE_TAIL; |
860 | } | 861 | } |
861 | 862 | ||
862 | static int | 863 | static __be32 |
863 | nfsd4_decode_setclientid_confirm(struct nfsd4_compoundargs *argp, struct nfsd4_setclientid_confirm *scd_c) | 864 | nfsd4_decode_setclientid_confirm(struct nfsd4_compoundargs *argp, struct nfsd4_setclientid_confirm *scd_c) |
864 | { | 865 | { |
865 | DECODE_HEAD; | 866 | DECODE_HEAD; |
@@ -872,7 +873,7 @@ nfsd4_decode_setclientid_confirm(struct nfsd4_compoundargs *argp, struct nfsd4_s | |||
872 | } | 873 | } |
873 | 874 | ||
874 | /* Also used for NVERIFY */ | 875 | /* Also used for NVERIFY */ |
875 | static int | 876 | static __be32 |
876 | nfsd4_decode_verify(struct nfsd4_compoundargs *argp, struct nfsd4_verify *verify) | 877 | nfsd4_decode_verify(struct nfsd4_compoundargs *argp, struct nfsd4_verify *verify) |
877 | { | 878 | { |
878 | #if 0 | 879 | #if 0 |
@@ -908,7 +909,7 @@ nfsd4_decode_verify(struct nfsd4_compoundargs *argp, struct nfsd4_verify *verify | |||
908 | DECODE_TAIL; | 909 | DECODE_TAIL; |
909 | } | 910 | } |
910 | 911 | ||
911 | static int | 912 | static __be32 |
912 | nfsd4_decode_write(struct nfsd4_compoundargs *argp, struct nfsd4_write *write) | 913 | nfsd4_decode_write(struct nfsd4_compoundargs *argp, struct nfsd4_write *write) |
913 | { | 914 | { |
914 | int avail; | 915 | int avail; |
@@ -951,15 +952,15 @@ nfsd4_decode_write(struct nfsd4_compoundargs *argp, struct nfsd4_write *write) | |||
951 | argp->pagelen -= len; | 952 | argp->pagelen -= len; |
952 | } | 953 | } |
953 | } | 954 | } |
954 | argp->end = (u32*) (argp->rqstp->rq_vec[v].iov_base + argp->rqstp->rq_vec[v].iov_len); | 955 | argp->end = (__be32*) (argp->rqstp->rq_vec[v].iov_base + argp->rqstp->rq_vec[v].iov_len); |
955 | argp->p = (u32*) (argp->rqstp->rq_vec[v].iov_base + (XDR_QUADLEN(len) << 2)); | 956 | argp->p = (__be32*) (argp->rqstp->rq_vec[v].iov_base + (XDR_QUADLEN(len) << 2)); |
956 | argp->rqstp->rq_vec[v].iov_len = len; | 957 | argp->rqstp->rq_vec[v].iov_len = len; |
957 | write->wr_vlen = v+1; | 958 | write->wr_vlen = v+1; |
958 | 959 | ||
959 | DECODE_TAIL; | 960 | DECODE_TAIL; |
960 | } | 961 | } |
961 | 962 | ||
962 | static int | 963 | static __be32 |
963 | nfsd4_decode_release_lockowner(struct nfsd4_compoundargs *argp, struct nfsd4_release_lockowner *rlockowner) | 964 | nfsd4_decode_release_lockowner(struct nfsd4_compoundargs *argp, struct nfsd4_release_lockowner *rlockowner) |
964 | { | 965 | { |
965 | DECODE_HEAD; | 966 | DECODE_HEAD; |
@@ -973,7 +974,7 @@ nfsd4_decode_release_lockowner(struct nfsd4_compoundargs *argp, struct nfsd4_rel | |||
973 | DECODE_TAIL; | 974 | DECODE_TAIL; |
974 | } | 975 | } |
975 | 976 | ||
976 | static int | 977 | static __be32 |
977 | nfsd4_decode_compound(struct nfsd4_compoundargs *argp) | 978 | nfsd4_decode_compound(struct nfsd4_compoundargs *argp) |
978 | { | 979 | { |
979 | DECODE_HEAD; | 980 | DECODE_HEAD; |
@@ -1179,7 +1180,7 @@ nfsd4_decode_compound(struct nfsd4_compoundargs *argp) | |||
1179 | * task to translate them into Linux-specific versions which are more | 1180 | * task to translate them into Linux-specific versions which are more |
1180 | * consistent with the style used in NFSv2/v3... | 1181 | * consistent with the style used in NFSv2/v3... |
1181 | */ | 1182 | */ |
1182 | #define ENCODE_HEAD u32 *p | 1183 | #define ENCODE_HEAD __be32 *p |
1183 | 1184 | ||
1184 | #define WRITE32(n) *p++ = htonl(n) | 1185 | #define WRITE32(n) *p++ = htonl(n) |
1185 | #define WRITE64(n) do { \ | 1186 | #define WRITE64(n) do { \ |
@@ -1209,8 +1210,8 @@ nfsd4_decode_compound(struct nfsd4_compoundargs *argp) | |||
1209 | * Header routine to setup seqid operation replay cache | 1210 | * Header routine to setup seqid operation replay cache |
1210 | */ | 1211 | */ |
1211 | #define ENCODE_SEQID_OP_HEAD \ | 1212 | #define ENCODE_SEQID_OP_HEAD \ |
1212 | u32 *p; \ | 1213 | __be32 *p; \ |
1213 | u32 *save; \ | 1214 | __be32 *save; \ |
1214 | \ | 1215 | \ |
1215 | save = resp->p; | 1216 | save = resp->p; |
1216 | 1217 | ||
@@ -1234,11 +1235,11 @@ nfsd4_decode_compound(struct nfsd4_compoundargs *argp) | |||
1234 | /* Encode as an array of strings the string given with components | 1235 | /* Encode as an array of strings the string given with components |
1235 | * seperated @sep. | 1236 | * seperated @sep. |
1236 | */ | 1237 | */ |
1237 | static int nfsd4_encode_components(char sep, char *components, | 1238 | static __be32 nfsd4_encode_components(char sep, char *components, |
1238 | u32 **pp, int *buflen) | 1239 | __be32 **pp, int *buflen) |
1239 | { | 1240 | { |
1240 | u32 *p = *pp; | 1241 | __be32 *p = *pp; |
1241 | u32 *countp = p; | 1242 | __be32 *countp = p; |
1242 | int strlen, count=0; | 1243 | int strlen, count=0; |
1243 | char *str, *end; | 1244 | char *str, *end; |
1244 | 1245 | ||
@@ -1271,11 +1272,11 @@ static int nfsd4_encode_components(char sep, char *components, | |||
1271 | /* | 1272 | /* |
1272 | * encode a location element of a fs_locations structure | 1273 | * encode a location element of a fs_locations structure |
1273 | */ | 1274 | */ |
1274 | static int nfsd4_encode_fs_location4(struct nfsd4_fs_location *location, | 1275 | static __be32 nfsd4_encode_fs_location4(struct nfsd4_fs_location *location, |
1275 | u32 **pp, int *buflen) | 1276 | __be32 **pp, int *buflen) |
1276 | { | 1277 | { |
1277 | int status; | 1278 | __be32 status; |
1278 | u32 *p = *pp; | 1279 | __be32 *p = *pp; |
1279 | 1280 | ||
1280 | status = nfsd4_encode_components(':', location->hosts, &p, buflen); | 1281 | status = nfsd4_encode_components(':', location->hosts, &p, buflen); |
1281 | if (status) | 1282 | if (status) |
@@ -1292,16 +1293,15 @@ static int nfsd4_encode_fs_location4(struct nfsd4_fs_location *location, | |||
1292 | * Returned string is safe to use as long as the caller holds a reference | 1293 | * Returned string is safe to use as long as the caller holds a reference |
1293 | * to @exp. | 1294 | * to @exp. |
1294 | */ | 1295 | */ |
1295 | static char *nfsd4_path(struct svc_rqst *rqstp, struct svc_export *exp) | 1296 | static char *nfsd4_path(struct svc_rqst *rqstp, struct svc_export *exp, __be32 *stat) |
1296 | { | 1297 | { |
1297 | struct svc_fh tmp_fh; | 1298 | struct svc_fh tmp_fh; |
1298 | char *path, *rootpath; | 1299 | char *path, *rootpath; |
1299 | int stat; | ||
1300 | 1300 | ||
1301 | fh_init(&tmp_fh, NFS4_FHSIZE); | 1301 | fh_init(&tmp_fh, NFS4_FHSIZE); |
1302 | stat = exp_pseudoroot(rqstp->rq_client, &tmp_fh, &rqstp->rq_chandle); | 1302 | *stat = exp_pseudoroot(rqstp->rq_client, &tmp_fh, &rqstp->rq_chandle); |
1303 | if (stat) | 1303 | if (*stat) |
1304 | return ERR_PTR(stat); | 1304 | return NULL; |
1305 | rootpath = tmp_fh.fh_export->ex_path; | 1305 | rootpath = tmp_fh.fh_export->ex_path; |
1306 | 1306 | ||
1307 | path = exp->ex_path; | 1307 | path = exp->ex_path; |
@@ -1309,7 +1309,8 @@ static char *nfsd4_path(struct svc_rqst *rqstp, struct svc_export *exp) | |||
1309 | if (strncmp(path, rootpath, strlen(rootpath))) { | 1309 | if (strncmp(path, rootpath, strlen(rootpath))) { |
1310 | printk("nfsd: fs_locations failed;" | 1310 | printk("nfsd: fs_locations failed;" |
1311 | "%s is not contained in %s\n", path, rootpath); | 1311 | "%s is not contained in %s\n", path, rootpath); |
1312 | return ERR_PTR(-EOPNOTSUPP); | 1312 | *stat = nfserr_notsupp; |
1313 | return NULL; | ||
1313 | } | 1314 | } |
1314 | 1315 | ||
1315 | return path + strlen(rootpath); | 1316 | return path + strlen(rootpath); |
@@ -1318,17 +1319,18 @@ static char *nfsd4_path(struct svc_rqst *rqstp, struct svc_export *exp) | |||
1318 | /* | 1319 | /* |
1319 | * encode a fs_locations structure | 1320 | * encode a fs_locations structure |
1320 | */ | 1321 | */ |
1321 | static int nfsd4_encode_fs_locations(struct svc_rqst *rqstp, | 1322 | static __be32 nfsd4_encode_fs_locations(struct svc_rqst *rqstp, |
1322 | struct svc_export *exp, | 1323 | struct svc_export *exp, |
1323 | u32 **pp, int *buflen) | 1324 | __be32 **pp, int *buflen) |
1324 | { | 1325 | { |
1325 | int status, i; | 1326 | __be32 status; |
1326 | u32 *p = *pp; | 1327 | int i; |
1328 | __be32 *p = *pp; | ||
1327 | struct nfsd4_fs_locations *fslocs = &exp->ex_fslocs; | 1329 | struct nfsd4_fs_locations *fslocs = &exp->ex_fslocs; |
1328 | char *root = nfsd4_path(rqstp, exp); | 1330 | char *root = nfsd4_path(rqstp, exp, &status); |
1329 | 1331 | ||
1330 | if (IS_ERR(root)) | 1332 | if (status) |
1331 | return PTR_ERR(root); | 1333 | return status; |
1332 | status = nfsd4_encode_components('/', root, &p, buflen); | 1334 | status = nfsd4_encode_components('/', root, &p, buflen); |
1333 | if (status) | 1335 | if (status) |
1334 | return status; | 1336 | return status; |
@@ -1352,9 +1354,9 @@ static u32 nfs4_ftypes[16] = { | |||
1352 | NF4SOCK, NF4BAD, NF4LNK, NF4BAD, | 1354 | NF4SOCK, NF4BAD, NF4LNK, NF4BAD, |
1353 | }; | 1355 | }; |
1354 | 1356 | ||
1355 | static int | 1357 | static __be32 |
1356 | nfsd4_encode_name(struct svc_rqst *rqstp, int whotype, uid_t id, int group, | 1358 | nfsd4_encode_name(struct svc_rqst *rqstp, int whotype, uid_t id, int group, |
1357 | u32 **p, int *buflen) | 1359 | __be32 **p, int *buflen) |
1358 | { | 1360 | { |
1359 | int status; | 1361 | int status; |
1360 | 1362 | ||
@@ -1374,21 +1376,21 @@ nfsd4_encode_name(struct svc_rqst *rqstp, int whotype, uid_t id, int group, | |||
1374 | return 0; | 1376 | return 0; |
1375 | } | 1377 | } |
1376 | 1378 | ||
1377 | static inline int | 1379 | static inline __be32 |
1378 | nfsd4_encode_user(struct svc_rqst *rqstp, uid_t uid, u32 **p, int *buflen) | 1380 | nfsd4_encode_user(struct svc_rqst *rqstp, uid_t uid, __be32 **p, int *buflen) |
1379 | { | 1381 | { |
1380 | return nfsd4_encode_name(rqstp, NFS4_ACL_WHO_NAMED, uid, 0, p, buflen); | 1382 | return nfsd4_encode_name(rqstp, NFS4_ACL_WHO_NAMED, uid, 0, p, buflen); |
1381 | } | 1383 | } |
1382 | 1384 | ||
1383 | static inline int | 1385 | static inline __be32 |
1384 | nfsd4_encode_group(struct svc_rqst *rqstp, uid_t gid, u32 **p, int *buflen) | 1386 | nfsd4_encode_group(struct svc_rqst *rqstp, uid_t gid, __be32 **p, int *buflen) |
1385 | { | 1387 | { |
1386 | return nfsd4_encode_name(rqstp, NFS4_ACL_WHO_NAMED, gid, 1, p, buflen); | 1388 | return nfsd4_encode_name(rqstp, NFS4_ACL_WHO_NAMED, gid, 1, p, buflen); |
1387 | } | 1389 | } |
1388 | 1390 | ||
1389 | static inline int | 1391 | static inline __be32 |
1390 | nfsd4_encode_aclname(struct svc_rqst *rqstp, int whotype, uid_t id, int group, | 1392 | nfsd4_encode_aclname(struct svc_rqst *rqstp, int whotype, uid_t id, int group, |
1391 | u32 **p, int *buflen) | 1393 | __be32 **p, int *buflen) |
1392 | { | 1394 | { |
1393 | return nfsd4_encode_name(rqstp, whotype, id, group, p, buflen); | 1395 | return nfsd4_encode_name(rqstp, whotype, id, group, p, buflen); |
1394 | } | 1396 | } |
@@ -1397,7 +1399,7 @@ nfsd4_encode_aclname(struct svc_rqst *rqstp, int whotype, uid_t id, int group, | |||
1397 | FATTR4_WORD0_RDATTR_ERROR) | 1399 | FATTR4_WORD0_RDATTR_ERROR) |
1398 | #define WORD1_ABSENT_FS_ATTRS FATTR4_WORD1_MOUNTED_ON_FILEID | 1400 | #define WORD1_ABSENT_FS_ATTRS FATTR4_WORD1_MOUNTED_ON_FILEID |
1399 | 1401 | ||
1400 | static int fattr_handle_absent_fs(u32 *bmval0, u32 *bmval1, u32 *rdattr_err) | 1402 | static __be32 fattr_handle_absent_fs(u32 *bmval0, u32 *bmval1, u32 *rdattr_err) |
1401 | { | 1403 | { |
1402 | /* As per referral draft: */ | 1404 | /* As per referral draft: */ |
1403 | if (*bmval0 & ~WORD0_ABSENT_FS_ATTRS || | 1405 | if (*bmval0 & ~WORD0_ABSENT_FS_ATTRS || |
@@ -1420,9 +1422,9 @@ static int fattr_handle_absent_fs(u32 *bmval0, u32 *bmval1, u32 *rdattr_err) | |||
1420 | * @countp is the buffer size in _words_; upon successful return this becomes | 1422 | * @countp is the buffer size in _words_; upon successful return this becomes |
1421 | * replaced with the number of words written. | 1423 | * replaced with the number of words written. |
1422 | */ | 1424 | */ |
1423 | int | 1425 | __be32 |
1424 | nfsd4_encode_fattr(struct svc_fh *fhp, struct svc_export *exp, | 1426 | nfsd4_encode_fattr(struct svc_fh *fhp, struct svc_export *exp, |
1425 | struct dentry *dentry, u32 *buffer, int *countp, u32 *bmval, | 1427 | struct dentry *dentry, __be32 *buffer, int *countp, u32 *bmval, |
1426 | struct svc_rqst *rqstp) | 1428 | struct svc_rqst *rqstp) |
1427 | { | 1429 | { |
1428 | u32 bmval0 = bmval[0]; | 1430 | u32 bmval0 = bmval[0]; |
@@ -1431,12 +1433,13 @@ nfsd4_encode_fattr(struct svc_fh *fhp, struct svc_export *exp, | |||
1431 | struct svc_fh tempfh; | 1433 | struct svc_fh tempfh; |
1432 | struct kstatfs statfs; | 1434 | struct kstatfs statfs; |
1433 | int buflen = *countp << 2; | 1435 | int buflen = *countp << 2; |
1434 | u32 *attrlenp; | 1436 | __be32 *attrlenp; |
1435 | u32 dummy; | 1437 | u32 dummy; |
1436 | u64 dummy64; | 1438 | u64 dummy64; |
1437 | u32 rdattr_err = 0; | 1439 | u32 rdattr_err = 0; |
1438 | u32 *p = buffer; | 1440 | __be32 *p = buffer; |
1439 | int status; | 1441 | __be32 status; |
1442 | int err; | ||
1440 | int aclsupport = 0; | 1443 | int aclsupport = 0; |
1441 | struct nfs4_acl *acl = NULL; | 1444 | struct nfs4_acl *acl = NULL; |
1442 | 1445 | ||
@@ -1450,14 +1453,14 @@ nfsd4_encode_fattr(struct svc_fh *fhp, struct svc_export *exp, | |||
1450 | goto out; | 1453 | goto out; |
1451 | } | 1454 | } |
1452 | 1455 | ||
1453 | status = vfs_getattr(exp->ex_mnt, dentry, &stat); | 1456 | err = vfs_getattr(exp->ex_mnt, dentry, &stat); |
1454 | if (status) | 1457 | if (err) |
1455 | goto out_nfserr; | 1458 | goto out_nfserr; |
1456 | if ((bmval0 & (FATTR4_WORD0_FILES_FREE | FATTR4_WORD0_FILES_TOTAL)) || | 1459 | if ((bmval0 & (FATTR4_WORD0_FILES_FREE | FATTR4_WORD0_FILES_TOTAL)) || |
1457 | (bmval1 & (FATTR4_WORD1_SPACE_AVAIL | FATTR4_WORD1_SPACE_FREE | | 1460 | (bmval1 & (FATTR4_WORD1_SPACE_AVAIL | FATTR4_WORD1_SPACE_FREE | |
1458 | FATTR4_WORD1_SPACE_TOTAL))) { | 1461 | FATTR4_WORD1_SPACE_TOTAL))) { |
1459 | status = vfs_statfs(dentry, &statfs); | 1462 | err = vfs_statfs(dentry, &statfs); |
1460 | if (status) | 1463 | if (err) |
1461 | goto out_nfserr; | 1464 | goto out_nfserr; |
1462 | } | 1465 | } |
1463 | if ((bmval0 & (FATTR4_WORD0_FILEHANDLE | FATTR4_WORD0_FSID)) && !fhp) { | 1466 | if ((bmval0 & (FATTR4_WORD0_FILEHANDLE | FATTR4_WORD0_FSID)) && !fhp) { |
@@ -1469,15 +1472,15 @@ nfsd4_encode_fattr(struct svc_fh *fhp, struct svc_export *exp, | |||
1469 | } | 1472 | } |
1470 | if (bmval0 & (FATTR4_WORD0_ACL | FATTR4_WORD0_ACLSUPPORT | 1473 | if (bmval0 & (FATTR4_WORD0_ACL | FATTR4_WORD0_ACLSUPPORT |
1471 | | FATTR4_WORD0_SUPPORTED_ATTRS)) { | 1474 | | FATTR4_WORD0_SUPPORTED_ATTRS)) { |
1472 | status = nfsd4_get_nfs4_acl(rqstp, dentry, &acl); | 1475 | err = nfsd4_get_nfs4_acl(rqstp, dentry, &acl); |
1473 | aclsupport = (status == 0); | 1476 | aclsupport = (err == 0); |
1474 | if (bmval0 & FATTR4_WORD0_ACL) { | 1477 | if (bmval0 & FATTR4_WORD0_ACL) { |
1475 | if (status == -EOPNOTSUPP) | 1478 | if (err == -EOPNOTSUPP) |
1476 | bmval0 &= ~FATTR4_WORD0_ACL; | 1479 | bmval0 &= ~FATTR4_WORD0_ACL; |
1477 | else if (status == -EINVAL) { | 1480 | else if (err == -EINVAL) { |
1478 | status = nfserr_attrnotsupp; | 1481 | status = nfserr_attrnotsupp; |
1479 | goto out; | 1482 | goto out; |
1480 | } else if (status != 0) | 1483 | } else if (err != 0) |
1481 | goto out_nfserr; | 1484 | goto out_nfserr; |
1482 | } | 1485 | } |
1483 | } | 1486 | } |
@@ -1817,7 +1820,7 @@ out: | |||
1817 | fh_put(&tempfh); | 1820 | fh_put(&tempfh); |
1818 | return status; | 1821 | return status; |
1819 | out_nfserr: | 1822 | out_nfserr: |
1820 | status = nfserrno(status); | 1823 | status = nfserrno(err); |
1821 | goto out; | 1824 | goto out; |
1822 | out_resource: | 1825 | out_resource: |
1823 | *countp = 0; | 1826 | *countp = 0; |
@@ -1828,13 +1831,13 @@ out_serverfault: | |||
1828 | goto out; | 1831 | goto out; |
1829 | } | 1832 | } |
1830 | 1833 | ||
1831 | static int | 1834 | static __be32 |
1832 | nfsd4_encode_dirent_fattr(struct nfsd4_readdir *cd, | 1835 | nfsd4_encode_dirent_fattr(struct nfsd4_readdir *cd, |
1833 | const char *name, int namlen, u32 *p, int *buflen) | 1836 | const char *name, int namlen, __be32 *p, int *buflen) |
1834 | { | 1837 | { |
1835 | struct svc_export *exp = cd->rd_fhp->fh_export; | 1838 | struct svc_export *exp = cd->rd_fhp->fh_export; |
1836 | struct dentry *dentry; | 1839 | struct dentry *dentry; |
1837 | int nfserr; | 1840 | __be32 nfserr; |
1838 | 1841 | ||
1839 | dentry = lookup_one_len(name, cd->rd_fhp->fh_dentry, namlen); | 1842 | dentry = lookup_one_len(name, cd->rd_fhp->fh_dentry, namlen); |
1840 | if (IS_ERR(dentry)) | 1843 | if (IS_ERR(dentry)) |
@@ -1863,10 +1866,10 @@ out_put: | |||
1863 | return nfserr; | 1866 | return nfserr; |
1864 | } | 1867 | } |
1865 | 1868 | ||
1866 | static u32 * | 1869 | static __be32 * |
1867 | nfsd4_encode_rdattr_error(u32 *p, int buflen, int nfserr) | 1870 | nfsd4_encode_rdattr_error(__be32 *p, int buflen, __be32 nfserr) |
1868 | { | 1871 | { |
1869 | u32 *attrlenp; | 1872 | __be32 *attrlenp; |
1870 | 1873 | ||
1871 | if (buflen < 6) | 1874 | if (buflen < 6) |
1872 | return NULL; | 1875 | return NULL; |
@@ -1886,8 +1889,8 @@ nfsd4_encode_dirent(struct readdir_cd *ccd, const char *name, int namlen, | |||
1886 | { | 1889 | { |
1887 | struct nfsd4_readdir *cd = container_of(ccd, struct nfsd4_readdir, common); | 1890 | struct nfsd4_readdir *cd = container_of(ccd, struct nfsd4_readdir, common); |
1888 | int buflen; | 1891 | int buflen; |
1889 | u32 *p = cd->buffer; | 1892 | __be32 *p = cd->buffer; |
1890 | int nfserr = nfserr_toosmall; | 1893 | __be32 nfserr = nfserr_toosmall; |
1891 | 1894 | ||
1892 | /* In nfsv4, "." and ".." never make it onto the wire.. */ | 1895 | /* In nfsv4, "." and ".." never make it onto the wire.. */ |
1893 | if (name && isdotent(name, namlen)) { | 1896 | if (name && isdotent(name, namlen)) { |
@@ -1943,7 +1946,7 @@ fail: | |||
1943 | } | 1946 | } |
1944 | 1947 | ||
1945 | static void | 1948 | static void |
1946 | nfsd4_encode_access(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_access *access) | 1949 | nfsd4_encode_access(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_access *access) |
1947 | { | 1950 | { |
1948 | ENCODE_HEAD; | 1951 | ENCODE_HEAD; |
1949 | 1952 | ||
@@ -1956,7 +1959,7 @@ nfsd4_encode_access(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_acc | |||
1956 | } | 1959 | } |
1957 | 1960 | ||
1958 | static void | 1961 | static void |
1959 | nfsd4_encode_close(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_close *close) | 1962 | nfsd4_encode_close(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_close *close) |
1960 | { | 1963 | { |
1961 | ENCODE_SEQID_OP_HEAD; | 1964 | ENCODE_SEQID_OP_HEAD; |
1962 | 1965 | ||
@@ -1971,7 +1974,7 @@ nfsd4_encode_close(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_clos | |||
1971 | 1974 | ||
1972 | 1975 | ||
1973 | static void | 1976 | static void |
1974 | nfsd4_encode_commit(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_commit *commit) | 1977 | nfsd4_encode_commit(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_commit *commit) |
1975 | { | 1978 | { |
1976 | ENCODE_HEAD; | 1979 | ENCODE_HEAD; |
1977 | 1980 | ||
@@ -1983,7 +1986,7 @@ nfsd4_encode_commit(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_com | |||
1983 | } | 1986 | } |
1984 | 1987 | ||
1985 | static void | 1988 | static void |
1986 | nfsd4_encode_create(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_create *create) | 1989 | nfsd4_encode_create(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_create *create) |
1987 | { | 1990 | { |
1988 | ENCODE_HEAD; | 1991 | ENCODE_HEAD; |
1989 | 1992 | ||
@@ -1997,8 +2000,8 @@ nfsd4_encode_create(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_cre | |||
1997 | } | 2000 | } |
1998 | } | 2001 | } |
1999 | 2002 | ||
2000 | static int | 2003 | static __be32 |
2001 | nfsd4_encode_getattr(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_getattr *getattr) | 2004 | nfsd4_encode_getattr(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_getattr *getattr) |
2002 | { | 2005 | { |
2003 | struct svc_fh *fhp = getattr->ga_fhp; | 2006 | struct svc_fh *fhp = getattr->ga_fhp; |
2004 | int buflen; | 2007 | int buflen; |
@@ -2016,7 +2019,7 @@ nfsd4_encode_getattr(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_ge | |||
2016 | } | 2019 | } |
2017 | 2020 | ||
2018 | static void | 2021 | static void |
2019 | nfsd4_encode_getfh(struct nfsd4_compoundres *resp, int nfserr, struct svc_fh *fhp) | 2022 | nfsd4_encode_getfh(struct nfsd4_compoundres *resp, __be32 nfserr, struct svc_fh *fhp) |
2020 | { | 2023 | { |
2021 | unsigned int len; | 2024 | unsigned int len; |
2022 | ENCODE_HEAD; | 2025 | ENCODE_HEAD; |
@@ -2056,7 +2059,7 @@ nfsd4_encode_lock_denied(struct nfsd4_compoundres *resp, struct nfsd4_lock_denie | |||
2056 | } | 2059 | } |
2057 | 2060 | ||
2058 | static void | 2061 | static void |
2059 | nfsd4_encode_lock(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_lock *lock) | 2062 | nfsd4_encode_lock(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_lock *lock) |
2060 | { | 2063 | { |
2061 | ENCODE_SEQID_OP_HEAD; | 2064 | ENCODE_SEQID_OP_HEAD; |
2062 | 2065 | ||
@@ -2072,14 +2075,14 @@ nfsd4_encode_lock(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_lock | |||
2072 | } | 2075 | } |
2073 | 2076 | ||
2074 | static void | 2077 | static void |
2075 | nfsd4_encode_lockt(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_lockt *lockt) | 2078 | nfsd4_encode_lockt(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_lockt *lockt) |
2076 | { | 2079 | { |
2077 | if (nfserr == nfserr_denied) | 2080 | if (nfserr == nfserr_denied) |
2078 | nfsd4_encode_lock_denied(resp, &lockt->lt_denied); | 2081 | nfsd4_encode_lock_denied(resp, &lockt->lt_denied); |
2079 | } | 2082 | } |
2080 | 2083 | ||
2081 | static void | 2084 | static void |
2082 | nfsd4_encode_locku(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_locku *locku) | 2085 | nfsd4_encode_locku(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_locku *locku) |
2083 | { | 2086 | { |
2084 | ENCODE_SEQID_OP_HEAD; | 2087 | ENCODE_SEQID_OP_HEAD; |
2085 | 2088 | ||
@@ -2095,7 +2098,7 @@ nfsd4_encode_locku(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_lock | |||
2095 | 2098 | ||
2096 | 2099 | ||
2097 | static void | 2100 | static void |
2098 | nfsd4_encode_link(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_link *link) | 2101 | nfsd4_encode_link(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_link *link) |
2099 | { | 2102 | { |
2100 | ENCODE_HEAD; | 2103 | ENCODE_HEAD; |
2101 | 2104 | ||
@@ -2108,7 +2111,7 @@ nfsd4_encode_link(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_link | |||
2108 | 2111 | ||
2109 | 2112 | ||
2110 | static void | 2113 | static void |
2111 | nfsd4_encode_open(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_open *open) | 2114 | nfsd4_encode_open(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_open *open) |
2112 | { | 2115 | { |
2113 | ENCODE_SEQID_OP_HEAD; | 2116 | ENCODE_SEQID_OP_HEAD; |
2114 | 2117 | ||
@@ -2173,7 +2176,7 @@ out: | |||
2173 | } | 2176 | } |
2174 | 2177 | ||
2175 | static void | 2178 | static void |
2176 | nfsd4_encode_open_confirm(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_open_confirm *oc) | 2179 | nfsd4_encode_open_confirm(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_open_confirm *oc) |
2177 | { | 2180 | { |
2178 | ENCODE_SEQID_OP_HEAD; | 2181 | ENCODE_SEQID_OP_HEAD; |
2179 | 2182 | ||
@@ -2188,7 +2191,7 @@ nfsd4_encode_open_confirm(struct nfsd4_compoundres *resp, int nfserr, struct nfs | |||
2188 | } | 2191 | } |
2189 | 2192 | ||
2190 | static void | 2193 | static void |
2191 | nfsd4_encode_open_downgrade(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_open_downgrade *od) | 2194 | nfsd4_encode_open_downgrade(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_open_downgrade *od) |
2192 | { | 2195 | { |
2193 | ENCODE_SEQID_OP_HEAD; | 2196 | ENCODE_SEQID_OP_HEAD; |
2194 | 2197 | ||
@@ -2202,8 +2205,8 @@ nfsd4_encode_open_downgrade(struct nfsd4_compoundres *resp, int nfserr, struct n | |||
2202 | ENCODE_SEQID_OP_TAIL(od->od_stateowner); | 2205 | ENCODE_SEQID_OP_TAIL(od->od_stateowner); |
2203 | } | 2206 | } |
2204 | 2207 | ||
2205 | static int | 2208 | static __be32 |
2206 | nfsd4_encode_read(struct nfsd4_compoundres *resp, int nfserr, | 2209 | nfsd4_encode_read(struct nfsd4_compoundres *resp, __be32 nfserr, |
2207 | struct nfsd4_read *read) | 2210 | struct nfsd4_read *read) |
2208 | { | 2211 | { |
2209 | u32 eof; | 2212 | u32 eof; |
@@ -2267,8 +2270,8 @@ nfsd4_encode_read(struct nfsd4_compoundres *resp, int nfserr, | |||
2267 | return 0; | 2270 | return 0; |
2268 | } | 2271 | } |
2269 | 2272 | ||
2270 | static int | 2273 | static __be32 |
2271 | nfsd4_encode_readlink(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_readlink *readlink) | 2274 | nfsd4_encode_readlink(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_readlink *readlink) |
2272 | { | 2275 | { |
2273 | int maxcount; | 2276 | int maxcount; |
2274 | char *page; | 2277 | char *page; |
@@ -2315,12 +2318,12 @@ nfsd4_encode_readlink(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_r | |||
2315 | return 0; | 2318 | return 0; |
2316 | } | 2319 | } |
2317 | 2320 | ||
2318 | static int | 2321 | static __be32 |
2319 | nfsd4_encode_readdir(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_readdir *readdir) | 2322 | nfsd4_encode_readdir(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_readdir *readdir) |
2320 | { | 2323 | { |
2321 | int maxcount; | 2324 | int maxcount; |
2322 | loff_t offset; | 2325 | loff_t offset; |
2323 | u32 *page, *savep, *tailbase; | 2326 | __be32 *page, *savep, *tailbase; |
2324 | ENCODE_HEAD; | 2327 | ENCODE_HEAD; |
2325 | 2328 | ||
2326 | if (nfserr) | 2329 | if (nfserr) |
@@ -2395,7 +2398,7 @@ err_no_verf: | |||
2395 | } | 2398 | } |
2396 | 2399 | ||
2397 | static void | 2400 | static void |
2398 | nfsd4_encode_remove(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_remove *remove) | 2401 | nfsd4_encode_remove(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_remove *remove) |
2399 | { | 2402 | { |
2400 | ENCODE_HEAD; | 2403 | ENCODE_HEAD; |
2401 | 2404 | ||
@@ -2407,7 +2410,7 @@ nfsd4_encode_remove(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_rem | |||
2407 | } | 2410 | } |
2408 | 2411 | ||
2409 | static void | 2412 | static void |
2410 | nfsd4_encode_rename(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_rename *rename) | 2413 | nfsd4_encode_rename(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_rename *rename) |
2411 | { | 2414 | { |
2412 | ENCODE_HEAD; | 2415 | ENCODE_HEAD; |
2413 | 2416 | ||
@@ -2424,7 +2427,7 @@ nfsd4_encode_rename(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_ren | |||
2424 | * regardless of the error status. | 2427 | * regardless of the error status. |
2425 | */ | 2428 | */ |
2426 | static void | 2429 | static void |
2427 | nfsd4_encode_setattr(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_setattr *setattr) | 2430 | nfsd4_encode_setattr(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_setattr *setattr) |
2428 | { | 2431 | { |
2429 | ENCODE_HEAD; | 2432 | ENCODE_HEAD; |
2430 | 2433 | ||
@@ -2443,7 +2446,7 @@ nfsd4_encode_setattr(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_se | |||
2443 | } | 2446 | } |
2444 | 2447 | ||
2445 | static void | 2448 | static void |
2446 | nfsd4_encode_setclientid(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_setclientid *scd) | 2449 | nfsd4_encode_setclientid(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_setclientid *scd) |
2447 | { | 2450 | { |
2448 | ENCODE_HEAD; | 2451 | ENCODE_HEAD; |
2449 | 2452 | ||
@@ -2462,7 +2465,7 @@ nfsd4_encode_setclientid(struct nfsd4_compoundres *resp, int nfserr, struct nfsd | |||
2462 | } | 2465 | } |
2463 | 2466 | ||
2464 | static void | 2467 | static void |
2465 | nfsd4_encode_write(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_write *write) | 2468 | nfsd4_encode_write(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_write *write) |
2466 | { | 2469 | { |
2467 | ENCODE_HEAD; | 2470 | ENCODE_HEAD; |
2468 | 2471 | ||
@@ -2478,7 +2481,7 @@ nfsd4_encode_write(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_writ | |||
2478 | void | 2481 | void |
2479 | nfsd4_encode_operation(struct nfsd4_compoundres *resp, struct nfsd4_op *op) | 2482 | nfsd4_encode_operation(struct nfsd4_compoundres *resp, struct nfsd4_op *op) |
2480 | { | 2483 | { |
2481 | u32 *statp; | 2484 | __be32 *statp; |
2482 | ENCODE_HEAD; | 2485 | ENCODE_HEAD; |
2483 | 2486 | ||
2484 | RESERVE_SPACE(8); | 2487 | RESERVE_SPACE(8); |
@@ -2616,7 +2619,7 @@ nfsd4_encode_replay(struct nfsd4_compoundres *resp, struct nfsd4_op *op) | |||
2616 | */ | 2619 | */ |
2617 | 2620 | ||
2618 | int | 2621 | int |
2619 | nfs4svc_encode_voidres(struct svc_rqst *rqstp, u32 *p, void *dummy) | 2622 | nfs4svc_encode_voidres(struct svc_rqst *rqstp, __be32 *p, void *dummy) |
2620 | { | 2623 | { |
2621 | return xdr_ressize_check(rqstp, p); | 2624 | return xdr_ressize_check(rqstp, p); |
2622 | } | 2625 | } |
@@ -2638,9 +2641,9 @@ void nfsd4_release_compoundargs(struct nfsd4_compoundargs *args) | |||
2638 | } | 2641 | } |
2639 | 2642 | ||
2640 | int | 2643 | int |
2641 | nfs4svc_decode_compoundargs(struct svc_rqst *rqstp, u32 *p, struct nfsd4_compoundargs *args) | 2644 | nfs4svc_decode_compoundargs(struct svc_rqst *rqstp, __be32 *p, struct nfsd4_compoundargs *args) |
2642 | { | 2645 | { |
2643 | int status; | 2646 | __be32 status; |
2644 | 2647 | ||
2645 | args->p = p; | 2648 | args->p = p; |
2646 | args->end = rqstp->rq_arg.head[0].iov_base + rqstp->rq_arg.head[0].iov_len; | 2649 | args->end = rqstp->rq_arg.head[0].iov_base + rqstp->rq_arg.head[0].iov_len; |
@@ -2659,7 +2662,7 @@ nfs4svc_decode_compoundargs(struct svc_rqst *rqstp, u32 *p, struct nfsd4_compoun | |||
2659 | } | 2662 | } |
2660 | 2663 | ||
2661 | int | 2664 | int |
2662 | nfs4svc_encode_compoundres(struct svc_rqst *rqstp, u32 *p, struct nfsd4_compoundres *resp) | 2665 | nfs4svc_encode_compoundres(struct svc_rqst *rqstp, __be32 *p, struct nfsd4_compoundres *resp) |
2663 | { | 2666 | { |
2664 | /* | 2667 | /* |
2665 | * All that remains is to write the tag and operation count... | 2668 | * All that remains is to write the tag and operation count... |
diff --git a/fs/nfsd/nfscache.c b/fs/nfsd/nfscache.c index fdf7cf3dfadc..6100bbe27432 100644 --- a/fs/nfsd/nfscache.c +++ b/fs/nfsd/nfscache.c | |||
@@ -29,7 +29,7 @@ | |||
29 | */ | 29 | */ |
30 | #define CACHESIZE 1024 | 30 | #define CACHESIZE 1024 |
31 | #define HASHSIZE 64 | 31 | #define HASHSIZE 64 |
32 | #define REQHASH(xid) ((((xid) >> 24) ^ (xid)) & (HASHSIZE-1)) | 32 | #define REQHASH(xid) (((((__force __u32)xid) >> 24) ^ ((__force __u32)xid)) & (HASHSIZE-1)) |
33 | 33 | ||
34 | static struct hlist_head * hash_list; | 34 | static struct hlist_head * hash_list; |
35 | static struct list_head lru_head; | 35 | static struct list_head lru_head; |
@@ -127,8 +127,8 @@ nfsd_cache_lookup(struct svc_rqst *rqstp, int type) | |||
127 | struct hlist_node *hn; | 127 | struct hlist_node *hn; |
128 | struct hlist_head *rh; | 128 | struct hlist_head *rh; |
129 | struct svc_cacherep *rp; | 129 | struct svc_cacherep *rp; |
130 | u32 xid = rqstp->rq_xid, | 130 | __be32 xid = rqstp->rq_xid; |
131 | proto = rqstp->rq_prot, | 131 | u32 proto = rqstp->rq_prot, |
132 | vers = rqstp->rq_vers, | 132 | vers = rqstp->rq_vers, |
133 | proc = rqstp->rq_proc; | 133 | proc = rqstp->rq_proc; |
134 | unsigned long age; | 134 | unsigned long age; |
@@ -258,7 +258,7 @@ found_entry: | |||
258 | * In this case, nfsd_cache_update is called with statp == NULL. | 258 | * In this case, nfsd_cache_update is called with statp == NULL. |
259 | */ | 259 | */ |
260 | void | 260 | void |
261 | nfsd_cache_update(struct svc_rqst *rqstp, int cachetype, u32 *statp) | 261 | nfsd_cache_update(struct svc_rqst *rqstp, int cachetype, __be32 *statp) |
262 | { | 262 | { |
263 | struct svc_cacherep *rp; | 263 | struct svc_cacherep *rp; |
264 | struct kvec *resv = &rqstp->rq_res.head[0], *cachv; | 264 | struct kvec *resv = &rqstp->rq_res.head[0], *cachv; |
diff --git a/fs/nfsd/nfsfh.c b/fs/nfsd/nfsfh.c index 501d83884530..727ab3bd450d 100644 --- a/fs/nfsd/nfsfh.c +++ b/fs/nfsd/nfsfh.c | |||
@@ -76,7 +76,7 @@ static int nfsd_acceptable(void *expv, struct dentry *dentry) | |||
76 | * comment in the NFSv3 spec says this is incorrect (implementation notes for | 76 | * comment in the NFSv3 spec says this is incorrect (implementation notes for |
77 | * the write call). | 77 | * the write call). |
78 | */ | 78 | */ |
79 | static inline int | 79 | static inline __be32 |
80 | nfsd_mode_check(struct svc_rqst *rqstp, umode_t mode, int type) | 80 | nfsd_mode_check(struct svc_rqst *rqstp, umode_t mode, int type) |
81 | { | 81 | { |
82 | /* Type can be negative when creating hardlinks - not to a dir */ | 82 | /* Type can be negative when creating hardlinks - not to a dir */ |
@@ -110,13 +110,13 @@ nfsd_mode_check(struct svc_rqst *rqstp, umode_t mode, int type) | |||
110 | * This is only called at the start of an nfsproc call, so fhp points to | 110 | * This is only called at the start of an nfsproc call, so fhp points to |
111 | * a svc_fh which is all 0 except for the over-the-wire file handle. | 111 | * a svc_fh which is all 0 except for the over-the-wire file handle. |
112 | */ | 112 | */ |
113 | u32 | 113 | __be32 |
114 | fh_verify(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, int access) | 114 | fh_verify(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, int access) |
115 | { | 115 | { |
116 | struct knfsd_fh *fh = &fhp->fh_handle; | 116 | struct knfsd_fh *fh = &fhp->fh_handle; |
117 | struct svc_export *exp = NULL; | 117 | struct svc_export *exp = NULL; |
118 | struct dentry *dentry; | 118 | struct dentry *dentry; |
119 | u32 error = 0; | 119 | __be32 error = 0; |
120 | 120 | ||
121 | dprintk("nfsd: fh_verify(%s)\n", SVCFH_fmt(fhp)); | 121 | dprintk("nfsd: fh_verify(%s)\n", SVCFH_fmt(fhp)); |
122 | 122 | ||
@@ -315,7 +315,7 @@ static inline void _fh_update_old(struct dentry *dentry, | |||
315 | fh->ofh_dirino = 0; | 315 | fh->ofh_dirino = 0; |
316 | } | 316 | } |
317 | 317 | ||
318 | int | 318 | __be32 |
319 | fh_compose(struct svc_fh *fhp, struct svc_export *exp, struct dentry *dentry, struct svc_fh *ref_fh) | 319 | fh_compose(struct svc_fh *fhp, struct svc_export *exp, struct dentry *dentry, struct svc_fh *ref_fh) |
320 | { | 320 | { |
321 | /* ref_fh is a reference file handle. | 321 | /* ref_fh is a reference file handle. |
@@ -451,7 +451,7 @@ fh_compose(struct svc_fh *fhp, struct svc_export *exp, struct dentry *dentry, st | |||
451 | * Update file handle information after changing a dentry. | 451 | * Update file handle information after changing a dentry. |
452 | * This is only called by nfsd_create, nfsd_create_v3 and nfsd_proc_create | 452 | * This is only called by nfsd_create, nfsd_create_v3 and nfsd_proc_create |
453 | */ | 453 | */ |
454 | int | 454 | __be32 |
455 | fh_update(struct svc_fh *fhp) | 455 | fh_update(struct svc_fh *fhp) |
456 | { | 456 | { |
457 | struct dentry *dentry; | 457 | struct dentry *dentry; |
diff --git a/fs/nfsd/nfsproc.c b/fs/nfsd/nfsproc.c index 9ee1dab5d44a..ec983b777680 100644 --- a/fs/nfsd/nfsproc.c +++ b/fs/nfsd/nfsproc.c | |||
@@ -30,22 +30,22 @@ typedef struct svc_buf svc_buf; | |||
30 | #define NFSDDBG_FACILITY NFSDDBG_PROC | 30 | #define NFSDDBG_FACILITY NFSDDBG_PROC |
31 | 31 | ||
32 | 32 | ||
33 | static int | 33 | static __be32 |
34 | nfsd_proc_null(struct svc_rqst *rqstp, void *argp, void *resp) | 34 | nfsd_proc_null(struct svc_rqst *rqstp, void *argp, void *resp) |
35 | { | 35 | { |
36 | return nfs_ok; | 36 | return nfs_ok; |
37 | } | 37 | } |
38 | 38 | ||
39 | static int | 39 | static __be32 |
40 | nfsd_return_attrs(int err, struct nfsd_attrstat *resp) | 40 | nfsd_return_attrs(__be32 err, struct nfsd_attrstat *resp) |
41 | { | 41 | { |
42 | if (err) return err; | 42 | if (err) return err; |
43 | return nfserrno(vfs_getattr(resp->fh.fh_export->ex_mnt, | 43 | return nfserrno(vfs_getattr(resp->fh.fh_export->ex_mnt, |
44 | resp->fh.fh_dentry, | 44 | resp->fh.fh_dentry, |
45 | &resp->stat)); | 45 | &resp->stat)); |
46 | } | 46 | } |
47 | static int | 47 | static __be32 |
48 | nfsd_return_dirop(int err, struct nfsd_diropres *resp) | 48 | nfsd_return_dirop(__be32 err, struct nfsd_diropres *resp) |
49 | { | 49 | { |
50 | if (err) return err; | 50 | if (err) return err; |
51 | return nfserrno(vfs_getattr(resp->fh.fh_export->ex_mnt, | 51 | return nfserrno(vfs_getattr(resp->fh.fh_export->ex_mnt, |
@@ -56,11 +56,11 @@ nfsd_return_dirop(int err, struct nfsd_diropres *resp) | |||
56 | * Get a file's attributes | 56 | * Get a file's attributes |
57 | * N.B. After this call resp->fh needs an fh_put | 57 | * N.B. After this call resp->fh needs an fh_put |
58 | */ | 58 | */ |
59 | static int | 59 | static __be32 |
60 | nfsd_proc_getattr(struct svc_rqst *rqstp, struct nfsd_fhandle *argp, | 60 | nfsd_proc_getattr(struct svc_rqst *rqstp, struct nfsd_fhandle *argp, |
61 | struct nfsd_attrstat *resp) | 61 | struct nfsd_attrstat *resp) |
62 | { | 62 | { |
63 | int nfserr; | 63 | __be32 nfserr; |
64 | dprintk("nfsd: GETATTR %s\n", SVCFH_fmt(&argp->fh)); | 64 | dprintk("nfsd: GETATTR %s\n", SVCFH_fmt(&argp->fh)); |
65 | 65 | ||
66 | fh_copy(&resp->fh, &argp->fh); | 66 | fh_copy(&resp->fh, &argp->fh); |
@@ -72,11 +72,11 @@ nfsd_proc_getattr(struct svc_rqst *rqstp, struct nfsd_fhandle *argp, | |||
72 | * Set a file's attributes | 72 | * Set a file's attributes |
73 | * N.B. After this call resp->fh needs an fh_put | 73 | * N.B. After this call resp->fh needs an fh_put |
74 | */ | 74 | */ |
75 | static int | 75 | static __be32 |
76 | nfsd_proc_setattr(struct svc_rqst *rqstp, struct nfsd_sattrargs *argp, | 76 | nfsd_proc_setattr(struct svc_rqst *rqstp, struct nfsd_sattrargs *argp, |
77 | struct nfsd_attrstat *resp) | 77 | struct nfsd_attrstat *resp) |
78 | { | 78 | { |
79 | int nfserr; | 79 | __be32 nfserr; |
80 | dprintk("nfsd: SETATTR %s, valid=%x, size=%ld\n", | 80 | dprintk("nfsd: SETATTR %s, valid=%x, size=%ld\n", |
81 | SVCFH_fmt(&argp->fh), | 81 | SVCFH_fmt(&argp->fh), |
82 | argp->attrs.ia_valid, (long) argp->attrs.ia_size); | 82 | argp->attrs.ia_valid, (long) argp->attrs.ia_size); |
@@ -92,11 +92,11 @@ nfsd_proc_setattr(struct svc_rqst *rqstp, struct nfsd_sattrargs *argp, | |||
92 | * doesn't exist yet. | 92 | * doesn't exist yet. |
93 | * N.B. After this call resp->fh needs an fh_put | 93 | * N.B. After this call resp->fh needs an fh_put |
94 | */ | 94 | */ |
95 | static int | 95 | static __be32 |
96 | nfsd_proc_lookup(struct svc_rqst *rqstp, struct nfsd_diropargs *argp, | 96 | nfsd_proc_lookup(struct svc_rqst *rqstp, struct nfsd_diropargs *argp, |
97 | struct nfsd_diropres *resp) | 97 | struct nfsd_diropres *resp) |
98 | { | 98 | { |
99 | int nfserr; | 99 | __be32 nfserr; |
100 | 100 | ||
101 | dprintk("nfsd: LOOKUP %s %.*s\n", | 101 | dprintk("nfsd: LOOKUP %s %.*s\n", |
102 | SVCFH_fmt(&argp->fh), argp->len, argp->name); | 102 | SVCFH_fmt(&argp->fh), argp->len, argp->name); |
@@ -112,11 +112,11 @@ nfsd_proc_lookup(struct svc_rqst *rqstp, struct nfsd_diropargs *argp, | |||
112 | /* | 112 | /* |
113 | * Read a symlink. | 113 | * Read a symlink. |
114 | */ | 114 | */ |
115 | static int | 115 | static __be32 |
116 | nfsd_proc_readlink(struct svc_rqst *rqstp, struct nfsd_readlinkargs *argp, | 116 | nfsd_proc_readlink(struct svc_rqst *rqstp, struct nfsd_readlinkargs *argp, |
117 | struct nfsd_readlinkres *resp) | 117 | struct nfsd_readlinkres *resp) |
118 | { | 118 | { |
119 | int nfserr; | 119 | __be32 nfserr; |
120 | 120 | ||
121 | dprintk("nfsd: READLINK %s\n", SVCFH_fmt(&argp->fh)); | 121 | dprintk("nfsd: READLINK %s\n", SVCFH_fmt(&argp->fh)); |
122 | 122 | ||
@@ -132,11 +132,11 @@ nfsd_proc_readlink(struct svc_rqst *rqstp, struct nfsd_readlinkargs *argp, | |||
132 | * Read a portion of a file. | 132 | * Read a portion of a file. |
133 | * N.B. After this call resp->fh needs an fh_put | 133 | * N.B. After this call resp->fh needs an fh_put |
134 | */ | 134 | */ |
135 | static int | 135 | static __be32 |
136 | nfsd_proc_read(struct svc_rqst *rqstp, struct nfsd_readargs *argp, | 136 | nfsd_proc_read(struct svc_rqst *rqstp, struct nfsd_readargs *argp, |
137 | struct nfsd_readres *resp) | 137 | struct nfsd_readres *resp) |
138 | { | 138 | { |
139 | int nfserr; | 139 | __be32 nfserr; |
140 | 140 | ||
141 | dprintk("nfsd: READ %s %d bytes at %d\n", | 141 | dprintk("nfsd: READ %s %d bytes at %d\n", |
142 | SVCFH_fmt(&argp->fh), | 142 | SVCFH_fmt(&argp->fh), |
@@ -172,11 +172,11 @@ nfsd_proc_read(struct svc_rqst *rqstp, struct nfsd_readargs *argp, | |||
172 | * Write data to a file | 172 | * Write data to a file |
173 | * N.B. After this call resp->fh needs an fh_put | 173 | * N.B. After this call resp->fh needs an fh_put |
174 | */ | 174 | */ |
175 | static int | 175 | static __be32 |
176 | nfsd_proc_write(struct svc_rqst *rqstp, struct nfsd_writeargs *argp, | 176 | nfsd_proc_write(struct svc_rqst *rqstp, struct nfsd_writeargs *argp, |
177 | struct nfsd_attrstat *resp) | 177 | struct nfsd_attrstat *resp) |
178 | { | 178 | { |
179 | int nfserr; | 179 | __be32 nfserr; |
180 | int stable = 1; | 180 | int stable = 1; |
181 | 181 | ||
182 | dprintk("nfsd: WRITE %s %d bytes at %d\n", | 182 | dprintk("nfsd: WRITE %s %d bytes at %d\n", |
@@ -197,7 +197,7 @@ nfsd_proc_write(struct svc_rqst *rqstp, struct nfsd_writeargs *argp, | |||
197 | * and the actual create() call in compliance with VFS protocols. | 197 | * and the actual create() call in compliance with VFS protocols. |
198 | * N.B. After this call _both_ argp->fh and resp->fh need an fh_put | 198 | * N.B. After this call _both_ argp->fh and resp->fh need an fh_put |
199 | */ | 199 | */ |
200 | static int | 200 | static __be32 |
201 | nfsd_proc_create(struct svc_rqst *rqstp, struct nfsd_createargs *argp, | 201 | nfsd_proc_create(struct svc_rqst *rqstp, struct nfsd_createargs *argp, |
202 | struct nfsd_diropres *resp) | 202 | struct nfsd_diropres *resp) |
203 | { | 203 | { |
@@ -206,7 +206,8 @@ nfsd_proc_create(struct svc_rqst *rqstp, struct nfsd_createargs *argp, | |||
206 | struct iattr *attr = &argp->attrs; | 206 | struct iattr *attr = &argp->attrs; |
207 | struct inode *inode; | 207 | struct inode *inode; |
208 | struct dentry *dchild; | 208 | struct dentry *dchild; |
209 | int nfserr, type, mode; | 209 | int type, mode; |
210 | __be32 nfserr; | ||
210 | dev_t rdev = 0, wanted = new_decode_dev(attr->ia_size); | 211 | dev_t rdev = 0, wanted = new_decode_dev(attr->ia_size); |
211 | 212 | ||
212 | dprintk("nfsd: CREATE %s %.*s\n", | 213 | dprintk("nfsd: CREATE %s %.*s\n", |
@@ -348,11 +349,11 @@ done: | |||
348 | return nfsd_return_dirop(nfserr, resp); | 349 | return nfsd_return_dirop(nfserr, resp); |
349 | } | 350 | } |
350 | 351 | ||
351 | static int | 352 | static __be32 |
352 | nfsd_proc_remove(struct svc_rqst *rqstp, struct nfsd_diropargs *argp, | 353 | nfsd_proc_remove(struct svc_rqst *rqstp, struct nfsd_diropargs *argp, |
353 | void *resp) | 354 | void *resp) |
354 | { | 355 | { |
355 | int nfserr; | 356 | __be32 nfserr; |
356 | 357 | ||
357 | dprintk("nfsd: REMOVE %s %.*s\n", SVCFH_fmt(&argp->fh), | 358 | dprintk("nfsd: REMOVE %s %.*s\n", SVCFH_fmt(&argp->fh), |
358 | argp->len, argp->name); | 359 | argp->len, argp->name); |
@@ -363,11 +364,11 @@ nfsd_proc_remove(struct svc_rqst *rqstp, struct nfsd_diropargs *argp, | |||
363 | return nfserr; | 364 | return nfserr; |
364 | } | 365 | } |
365 | 366 | ||
366 | static int | 367 | static __be32 |
367 | nfsd_proc_rename(struct svc_rqst *rqstp, struct nfsd_renameargs *argp, | 368 | nfsd_proc_rename(struct svc_rqst *rqstp, struct nfsd_renameargs *argp, |
368 | void *resp) | 369 | void *resp) |
369 | { | 370 | { |
370 | int nfserr; | 371 | __be32 nfserr; |
371 | 372 | ||
372 | dprintk("nfsd: RENAME %s %.*s -> \n", | 373 | dprintk("nfsd: RENAME %s %.*s -> \n", |
373 | SVCFH_fmt(&argp->ffh), argp->flen, argp->fname); | 374 | SVCFH_fmt(&argp->ffh), argp->flen, argp->fname); |
@@ -381,11 +382,11 @@ nfsd_proc_rename(struct svc_rqst *rqstp, struct nfsd_renameargs *argp, | |||
381 | return nfserr; | 382 | return nfserr; |
382 | } | 383 | } |
383 | 384 | ||
384 | static int | 385 | static __be32 |
385 | nfsd_proc_link(struct svc_rqst *rqstp, struct nfsd_linkargs *argp, | 386 | nfsd_proc_link(struct svc_rqst *rqstp, struct nfsd_linkargs *argp, |
386 | void *resp) | 387 | void *resp) |
387 | { | 388 | { |
388 | int nfserr; | 389 | __be32 nfserr; |
389 | 390 | ||
390 | dprintk("nfsd: LINK %s ->\n", | 391 | dprintk("nfsd: LINK %s ->\n", |
391 | SVCFH_fmt(&argp->ffh)); | 392 | SVCFH_fmt(&argp->ffh)); |
@@ -401,12 +402,12 @@ nfsd_proc_link(struct svc_rqst *rqstp, struct nfsd_linkargs *argp, | |||
401 | return nfserr; | 402 | return nfserr; |
402 | } | 403 | } |
403 | 404 | ||
404 | static int | 405 | static __be32 |
405 | nfsd_proc_symlink(struct svc_rqst *rqstp, struct nfsd_symlinkargs *argp, | 406 | nfsd_proc_symlink(struct svc_rqst *rqstp, struct nfsd_symlinkargs *argp, |
406 | void *resp) | 407 | void *resp) |
407 | { | 408 | { |
408 | struct svc_fh newfh; | 409 | struct svc_fh newfh; |
409 | int nfserr; | 410 | __be32 nfserr; |
410 | 411 | ||
411 | dprintk("nfsd: SYMLINK %s %.*s -> %.*s\n", | 412 | dprintk("nfsd: SYMLINK %s %.*s -> %.*s\n", |
412 | SVCFH_fmt(&argp->ffh), argp->flen, argp->fname, | 413 | SVCFH_fmt(&argp->ffh), argp->flen, argp->fname, |
@@ -430,11 +431,11 @@ nfsd_proc_symlink(struct svc_rqst *rqstp, struct nfsd_symlinkargs *argp, | |||
430 | * Make directory. This operation is not idempotent. | 431 | * Make directory. This operation is not idempotent. |
431 | * N.B. After this call resp->fh needs an fh_put | 432 | * N.B. After this call resp->fh needs an fh_put |
432 | */ | 433 | */ |
433 | static int | 434 | static __be32 |
434 | nfsd_proc_mkdir(struct svc_rqst *rqstp, struct nfsd_createargs *argp, | 435 | nfsd_proc_mkdir(struct svc_rqst *rqstp, struct nfsd_createargs *argp, |
435 | struct nfsd_diropres *resp) | 436 | struct nfsd_diropres *resp) |
436 | { | 437 | { |
437 | int nfserr; | 438 | __be32 nfserr; |
438 | 439 | ||
439 | dprintk("nfsd: MKDIR %s %.*s\n", SVCFH_fmt(&argp->fh), argp->len, argp->name); | 440 | dprintk("nfsd: MKDIR %s %.*s\n", SVCFH_fmt(&argp->fh), argp->len, argp->name); |
440 | 441 | ||
@@ -454,11 +455,11 @@ nfsd_proc_mkdir(struct svc_rqst *rqstp, struct nfsd_createargs *argp, | |||
454 | /* | 455 | /* |
455 | * Remove a directory | 456 | * Remove a directory |
456 | */ | 457 | */ |
457 | static int | 458 | static __be32 |
458 | nfsd_proc_rmdir(struct svc_rqst *rqstp, struct nfsd_diropargs *argp, | 459 | nfsd_proc_rmdir(struct svc_rqst *rqstp, struct nfsd_diropargs *argp, |
459 | void *resp) | 460 | void *resp) |
460 | { | 461 | { |
461 | int nfserr; | 462 | __be32 nfserr; |
462 | 463 | ||
463 | dprintk("nfsd: RMDIR %s %.*s\n", SVCFH_fmt(&argp->fh), argp->len, argp->name); | 464 | dprintk("nfsd: RMDIR %s %.*s\n", SVCFH_fmt(&argp->fh), argp->len, argp->name); |
464 | 465 | ||
@@ -470,11 +471,12 @@ nfsd_proc_rmdir(struct svc_rqst *rqstp, struct nfsd_diropargs *argp, | |||
470 | /* | 471 | /* |
471 | * Read a portion of a directory. | 472 | * Read a portion of a directory. |
472 | */ | 473 | */ |
473 | static int | 474 | static __be32 |
474 | nfsd_proc_readdir(struct svc_rqst *rqstp, struct nfsd_readdirargs *argp, | 475 | nfsd_proc_readdir(struct svc_rqst *rqstp, struct nfsd_readdirargs *argp, |
475 | struct nfsd_readdirres *resp) | 476 | struct nfsd_readdirres *resp) |
476 | { | 477 | { |
477 | int nfserr, count; | 478 | int count; |
479 | __be32 nfserr; | ||
478 | loff_t offset; | 480 | loff_t offset; |
479 | 481 | ||
480 | dprintk("nfsd: READDIR %s %d bytes at %d\n", | 482 | dprintk("nfsd: READDIR %s %d bytes at %d\n", |
@@ -509,11 +511,11 @@ nfsd_proc_readdir(struct svc_rqst *rqstp, struct nfsd_readdirargs *argp, | |||
509 | /* | 511 | /* |
510 | * Get file system info | 512 | * Get file system info |
511 | */ | 513 | */ |
512 | static int | 514 | static __be32 |
513 | nfsd_proc_statfs(struct svc_rqst * rqstp, struct nfsd_fhandle *argp, | 515 | nfsd_proc_statfs(struct svc_rqst * rqstp, struct nfsd_fhandle *argp, |
514 | struct nfsd_statfsres *resp) | 516 | struct nfsd_statfsres *resp) |
515 | { | 517 | { |
516 | int nfserr; | 518 | __be32 nfserr; |
517 | 519 | ||
518 | dprintk("nfsd: STATFS %s\n", SVCFH_fmt(&argp->fh)); | 520 | dprintk("nfsd: STATFS %s\n", SVCFH_fmt(&argp->fh)); |
519 | 521 | ||
@@ -579,11 +581,11 @@ struct svc_version nfsd_version2 = { | |||
579 | /* | 581 | /* |
580 | * Map errnos to NFS errnos. | 582 | * Map errnos to NFS errnos. |
581 | */ | 583 | */ |
582 | int | 584 | __be32 |
583 | nfserrno (int errno) | 585 | nfserrno (int errno) |
584 | { | 586 | { |
585 | static struct { | 587 | static struct { |
586 | int nfserr; | 588 | __be32 nfserr; |
587 | int syserr; | 589 | int syserr; |
588 | } nfs_errtbl[] = { | 590 | } nfs_errtbl[] = { |
589 | { nfs_ok, 0 }, | 591 | { nfs_ok, 0 }, |
@@ -615,11 +617,10 @@ nfserrno (int errno) | |||
615 | { nfserr_badname, -ESRCH }, | 617 | { nfserr_badname, -ESRCH }, |
616 | { nfserr_io, -ETXTBSY }, | 618 | { nfserr_io, -ETXTBSY }, |
617 | { nfserr_notsupp, -EOPNOTSUPP }, | 619 | { nfserr_notsupp, -EOPNOTSUPP }, |
618 | { -1, -EIO } | ||
619 | }; | 620 | }; |
620 | int i; | 621 | int i; |
621 | 622 | ||
622 | for (i = 0; nfs_errtbl[i].nfserr != -1; i++) { | 623 | for (i = 0; i < ARRAY_SIZE(nfs_errtbl); i++) { |
623 | if (nfs_errtbl[i].syserr == errno) | 624 | if (nfs_errtbl[i].syserr == errno) |
624 | return nfs_errtbl[i].nfserr; | 625 | return nfs_errtbl[i].nfserr; |
625 | } | 626 | } |
diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c index 013b38996e64..0aaccb03bf76 100644 --- a/fs/nfsd/nfssvc.c +++ b/fs/nfsd/nfssvc.c | |||
@@ -491,12 +491,12 @@ out: | |||
491 | } | 491 | } |
492 | 492 | ||
493 | int | 493 | int |
494 | nfsd_dispatch(struct svc_rqst *rqstp, u32 *statp) | 494 | nfsd_dispatch(struct svc_rqst *rqstp, __be32 *statp) |
495 | { | 495 | { |
496 | struct svc_procedure *proc; | 496 | struct svc_procedure *proc; |
497 | kxdrproc_t xdr; | 497 | kxdrproc_t xdr; |
498 | u32 nfserr; | 498 | __be32 nfserr; |
499 | u32 *nfserrp; | 499 | __be32 *nfserrp; |
500 | 500 | ||
501 | dprintk("nfsd_dispatch: vers %d proc %d\n", | 501 | dprintk("nfsd_dispatch: vers %d proc %d\n", |
502 | rqstp->rq_vers, rqstp->rq_proc); | 502 | rqstp->rq_vers, rqstp->rq_proc); |
@@ -515,7 +515,7 @@ nfsd_dispatch(struct svc_rqst *rqstp, u32 *statp) | |||
515 | 515 | ||
516 | /* Decode arguments */ | 516 | /* Decode arguments */ |
517 | xdr = proc->pc_decode; | 517 | xdr = proc->pc_decode; |
518 | if (xdr && !xdr(rqstp, (u32*)rqstp->rq_arg.head[0].iov_base, | 518 | if (xdr && !xdr(rqstp, (__be32*)rqstp->rq_arg.head[0].iov_base, |
519 | rqstp->rq_argp)) { | 519 | rqstp->rq_argp)) { |
520 | dprintk("nfsd: failed to decode arguments!\n"); | 520 | dprintk("nfsd: failed to decode arguments!\n"); |
521 | nfsd_cache_update(rqstp, RC_NOCACHE, NULL); | 521 | nfsd_cache_update(rqstp, RC_NOCACHE, NULL); |
@@ -528,7 +528,7 @@ nfsd_dispatch(struct svc_rqst *rqstp, u32 *statp) | |||
528 | */ | 528 | */ |
529 | nfserrp = rqstp->rq_res.head[0].iov_base | 529 | nfserrp = rqstp->rq_res.head[0].iov_base |
530 | + rqstp->rq_res.head[0].iov_len; | 530 | + rqstp->rq_res.head[0].iov_len; |
531 | rqstp->rq_res.head[0].iov_len += sizeof(u32); | 531 | rqstp->rq_res.head[0].iov_len += sizeof(__be32); |
532 | 532 | ||
533 | /* Now call the procedure handler, and encode NFS status. */ | 533 | /* Now call the procedure handler, and encode NFS status. */ |
534 | nfserr = proc->pc_func(rqstp, rqstp->rq_argp, rqstp->rq_resp); | 534 | nfserr = proc->pc_func(rqstp, rqstp->rq_argp, rqstp->rq_resp); |
diff --git a/fs/nfsd/nfsxdr.c b/fs/nfsd/nfsxdr.c index 1135c0d14557..56ebb1443e0e 100644 --- a/fs/nfsd/nfsxdr.c +++ b/fs/nfsd/nfsxdr.c | |||
@@ -37,8 +37,8 @@ static u32 nfs_ftypes[] = { | |||
37 | /* | 37 | /* |
38 | * XDR functions for basic NFS types | 38 | * XDR functions for basic NFS types |
39 | */ | 39 | */ |
40 | static u32 * | 40 | static __be32 * |
41 | decode_fh(u32 *p, struct svc_fh *fhp) | 41 | decode_fh(__be32 *p, struct svc_fh *fhp) |
42 | { | 42 | { |
43 | fh_init(fhp, NFS_FHSIZE); | 43 | fh_init(fhp, NFS_FHSIZE); |
44 | memcpy(&fhp->fh_handle.fh_base, p, NFS_FHSIZE); | 44 | memcpy(&fhp->fh_handle.fh_base, p, NFS_FHSIZE); |
@@ -50,13 +50,13 @@ decode_fh(u32 *p, struct svc_fh *fhp) | |||
50 | } | 50 | } |
51 | 51 | ||
52 | /* Helper function for NFSv2 ACL code */ | 52 | /* Helper function for NFSv2 ACL code */ |
53 | u32 *nfs2svc_decode_fh(u32 *p, struct svc_fh *fhp) | 53 | __be32 *nfs2svc_decode_fh(__be32 *p, struct svc_fh *fhp) |
54 | { | 54 | { |
55 | return decode_fh(p, fhp); | 55 | return decode_fh(p, fhp); |
56 | } | 56 | } |
57 | 57 | ||
58 | static inline u32 * | 58 | static inline __be32 * |
59 | encode_fh(u32 *p, struct svc_fh *fhp) | 59 | encode_fh(__be32 *p, struct svc_fh *fhp) |
60 | { | 60 | { |
61 | memcpy(p, &fhp->fh_handle.fh_base, NFS_FHSIZE); | 61 | memcpy(p, &fhp->fh_handle.fh_base, NFS_FHSIZE); |
62 | return p + (NFS_FHSIZE>> 2); | 62 | return p + (NFS_FHSIZE>> 2); |
@@ -66,8 +66,8 @@ encode_fh(u32 *p, struct svc_fh *fhp) | |||
66 | * Decode a file name and make sure that the path contains | 66 | * Decode a file name and make sure that the path contains |
67 | * no slashes or null bytes. | 67 | * no slashes or null bytes. |
68 | */ | 68 | */ |
69 | static inline u32 * | 69 | static inline __be32 * |
70 | decode_filename(u32 *p, char **namp, int *lenp) | 70 | decode_filename(__be32 *p, char **namp, int *lenp) |
71 | { | 71 | { |
72 | char *name; | 72 | char *name; |
73 | int i; | 73 | int i; |
@@ -82,8 +82,8 @@ decode_filename(u32 *p, char **namp, int *lenp) | |||
82 | return p; | 82 | return p; |
83 | } | 83 | } |
84 | 84 | ||
85 | static inline u32 * | 85 | static inline __be32 * |
86 | decode_pathname(u32 *p, char **namp, int *lenp) | 86 | decode_pathname(__be32 *p, char **namp, int *lenp) |
87 | { | 87 | { |
88 | char *name; | 88 | char *name; |
89 | int i; | 89 | int i; |
@@ -98,8 +98,8 @@ decode_pathname(u32 *p, char **namp, int *lenp) | |||
98 | return p; | 98 | return p; |
99 | } | 99 | } |
100 | 100 | ||
101 | static inline u32 * | 101 | static inline __be32 * |
102 | decode_sattr(u32 *p, struct iattr *iap) | 102 | decode_sattr(__be32 *p, struct iattr *iap) |
103 | { | 103 | { |
104 | u32 tmp, tmp1; | 104 | u32 tmp, tmp1; |
105 | 105 | ||
@@ -151,8 +151,8 @@ decode_sattr(u32 *p, struct iattr *iap) | |||
151 | return p; | 151 | return p; |
152 | } | 152 | } |
153 | 153 | ||
154 | static u32 * | 154 | static __be32 * |
155 | encode_fattr(struct svc_rqst *rqstp, u32 *p, struct svc_fh *fhp, | 155 | encode_fattr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp, |
156 | struct kstat *stat) | 156 | struct kstat *stat) |
157 | { | 157 | { |
158 | struct dentry *dentry = fhp->fh_dentry; | 158 | struct dentry *dentry = fhp->fh_dentry; |
@@ -195,7 +195,7 @@ encode_fattr(struct svc_rqst *rqstp, u32 *p, struct svc_fh *fhp, | |||
195 | } | 195 | } |
196 | 196 | ||
197 | /* Helper function for NFSv2 ACL code */ | 197 | /* Helper function for NFSv2 ACL code */ |
198 | u32 *nfs2svc_encode_fattr(struct svc_rqst *rqstp, u32 *p, struct svc_fh *fhp) | 198 | __be32 *nfs2svc_encode_fattr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp) |
199 | { | 199 | { |
200 | struct kstat stat; | 200 | struct kstat stat; |
201 | vfs_getattr(fhp->fh_export->ex_mnt, fhp->fh_dentry, &stat); | 201 | vfs_getattr(fhp->fh_export->ex_mnt, fhp->fh_dentry, &stat); |
@@ -206,13 +206,13 @@ u32 *nfs2svc_encode_fattr(struct svc_rqst *rqstp, u32 *p, struct svc_fh *fhp) | |||
206 | * XDR decode functions | 206 | * XDR decode functions |
207 | */ | 207 | */ |
208 | int | 208 | int |
209 | nfssvc_decode_void(struct svc_rqst *rqstp, u32 *p, void *dummy) | 209 | nfssvc_decode_void(struct svc_rqst *rqstp, __be32 *p, void *dummy) |
210 | { | 210 | { |
211 | return xdr_argsize_check(rqstp, p); | 211 | return xdr_argsize_check(rqstp, p); |
212 | } | 212 | } |
213 | 213 | ||
214 | int | 214 | int |
215 | nfssvc_decode_fhandle(struct svc_rqst *rqstp, u32 *p, struct nfsd_fhandle *args) | 215 | nfssvc_decode_fhandle(struct svc_rqst *rqstp, __be32 *p, struct nfsd_fhandle *args) |
216 | { | 216 | { |
217 | if (!(p = decode_fh(p, &args->fh))) | 217 | if (!(p = decode_fh(p, &args->fh))) |
218 | return 0; | 218 | return 0; |
@@ -220,7 +220,7 @@ nfssvc_decode_fhandle(struct svc_rqst *rqstp, u32 *p, struct nfsd_fhandle *args) | |||
220 | } | 220 | } |
221 | 221 | ||
222 | int | 222 | int |
223 | nfssvc_decode_sattrargs(struct svc_rqst *rqstp, u32 *p, | 223 | nfssvc_decode_sattrargs(struct svc_rqst *rqstp, __be32 *p, |
224 | struct nfsd_sattrargs *args) | 224 | struct nfsd_sattrargs *args) |
225 | { | 225 | { |
226 | if (!(p = decode_fh(p, &args->fh)) | 226 | if (!(p = decode_fh(p, &args->fh)) |
@@ -231,7 +231,7 @@ nfssvc_decode_sattrargs(struct svc_rqst *rqstp, u32 *p, | |||
231 | } | 231 | } |
232 | 232 | ||
233 | int | 233 | int |
234 | nfssvc_decode_diropargs(struct svc_rqst *rqstp, u32 *p, | 234 | nfssvc_decode_diropargs(struct svc_rqst *rqstp, __be32 *p, |
235 | struct nfsd_diropargs *args) | 235 | struct nfsd_diropargs *args) |
236 | { | 236 | { |
237 | if (!(p = decode_fh(p, &args->fh)) | 237 | if (!(p = decode_fh(p, &args->fh)) |
@@ -242,7 +242,7 @@ nfssvc_decode_diropargs(struct svc_rqst *rqstp, u32 *p, | |||
242 | } | 242 | } |
243 | 243 | ||
244 | int | 244 | int |
245 | nfssvc_decode_readargs(struct svc_rqst *rqstp, u32 *p, | 245 | nfssvc_decode_readargs(struct svc_rqst *rqstp, __be32 *p, |
246 | struct nfsd_readargs *args) | 246 | struct nfsd_readargs *args) |
247 | { | 247 | { |
248 | unsigned int len; | 248 | unsigned int len; |
@@ -273,7 +273,7 @@ nfssvc_decode_readargs(struct svc_rqst *rqstp, u32 *p, | |||
273 | } | 273 | } |
274 | 274 | ||
275 | int | 275 | int |
276 | nfssvc_decode_writeargs(struct svc_rqst *rqstp, u32 *p, | 276 | nfssvc_decode_writeargs(struct svc_rqst *rqstp, __be32 *p, |
277 | struct nfsd_writeargs *args) | 277 | struct nfsd_writeargs *args) |
278 | { | 278 | { |
279 | unsigned int len; | 279 | unsigned int len; |
@@ -303,7 +303,7 @@ nfssvc_decode_writeargs(struct svc_rqst *rqstp, u32 *p, | |||
303 | } | 303 | } |
304 | 304 | ||
305 | int | 305 | int |
306 | nfssvc_decode_createargs(struct svc_rqst *rqstp, u32 *p, | 306 | nfssvc_decode_createargs(struct svc_rqst *rqstp, __be32 *p, |
307 | struct nfsd_createargs *args) | 307 | struct nfsd_createargs *args) |
308 | { | 308 | { |
309 | if (!(p = decode_fh(p, &args->fh)) | 309 | if (!(p = decode_fh(p, &args->fh)) |
@@ -315,7 +315,7 @@ nfssvc_decode_createargs(struct svc_rqst *rqstp, u32 *p, | |||
315 | } | 315 | } |
316 | 316 | ||
317 | int | 317 | int |
318 | nfssvc_decode_renameargs(struct svc_rqst *rqstp, u32 *p, | 318 | nfssvc_decode_renameargs(struct svc_rqst *rqstp, __be32 *p, |
319 | struct nfsd_renameargs *args) | 319 | struct nfsd_renameargs *args) |
320 | { | 320 | { |
321 | if (!(p = decode_fh(p, &args->ffh)) | 321 | if (!(p = decode_fh(p, &args->ffh)) |
@@ -328,7 +328,7 @@ nfssvc_decode_renameargs(struct svc_rqst *rqstp, u32 *p, | |||
328 | } | 328 | } |
329 | 329 | ||
330 | int | 330 | int |
331 | nfssvc_decode_readlinkargs(struct svc_rqst *rqstp, u32 *p, struct nfsd_readlinkargs *args) | 331 | nfssvc_decode_readlinkargs(struct svc_rqst *rqstp, __be32 *p, struct nfsd_readlinkargs *args) |
332 | { | 332 | { |
333 | if (!(p = decode_fh(p, &args->fh))) | 333 | if (!(p = decode_fh(p, &args->fh))) |
334 | return 0; | 334 | return 0; |
@@ -338,7 +338,7 @@ nfssvc_decode_readlinkargs(struct svc_rqst *rqstp, u32 *p, struct nfsd_readlinka | |||
338 | } | 338 | } |
339 | 339 | ||
340 | int | 340 | int |
341 | nfssvc_decode_linkargs(struct svc_rqst *rqstp, u32 *p, | 341 | nfssvc_decode_linkargs(struct svc_rqst *rqstp, __be32 *p, |
342 | struct nfsd_linkargs *args) | 342 | struct nfsd_linkargs *args) |
343 | { | 343 | { |
344 | if (!(p = decode_fh(p, &args->ffh)) | 344 | if (!(p = decode_fh(p, &args->ffh)) |
@@ -350,7 +350,7 @@ nfssvc_decode_linkargs(struct svc_rqst *rqstp, u32 *p, | |||
350 | } | 350 | } |
351 | 351 | ||
352 | int | 352 | int |
353 | nfssvc_decode_symlinkargs(struct svc_rqst *rqstp, u32 *p, | 353 | nfssvc_decode_symlinkargs(struct svc_rqst *rqstp, __be32 *p, |
354 | struct nfsd_symlinkargs *args) | 354 | struct nfsd_symlinkargs *args) |
355 | { | 355 | { |
356 | if (!(p = decode_fh(p, &args->ffh)) | 356 | if (!(p = decode_fh(p, &args->ffh)) |
@@ -363,7 +363,7 @@ nfssvc_decode_symlinkargs(struct svc_rqst *rqstp, u32 *p, | |||
363 | } | 363 | } |
364 | 364 | ||
365 | int | 365 | int |
366 | nfssvc_decode_readdirargs(struct svc_rqst *rqstp, u32 *p, | 366 | nfssvc_decode_readdirargs(struct svc_rqst *rqstp, __be32 *p, |
367 | struct nfsd_readdirargs *args) | 367 | struct nfsd_readdirargs *args) |
368 | { | 368 | { |
369 | if (!(p = decode_fh(p, &args->fh))) | 369 | if (!(p = decode_fh(p, &args->fh))) |
@@ -382,13 +382,13 @@ nfssvc_decode_readdirargs(struct svc_rqst *rqstp, u32 *p, | |||
382 | * XDR encode functions | 382 | * XDR encode functions |
383 | */ | 383 | */ |
384 | int | 384 | int |
385 | nfssvc_encode_void(struct svc_rqst *rqstp, u32 *p, void *dummy) | 385 | nfssvc_encode_void(struct svc_rqst *rqstp, __be32 *p, void *dummy) |
386 | { | 386 | { |
387 | return xdr_ressize_check(rqstp, p); | 387 | return xdr_ressize_check(rqstp, p); |
388 | } | 388 | } |
389 | 389 | ||
390 | int | 390 | int |
391 | nfssvc_encode_attrstat(struct svc_rqst *rqstp, u32 *p, | 391 | nfssvc_encode_attrstat(struct svc_rqst *rqstp, __be32 *p, |
392 | struct nfsd_attrstat *resp) | 392 | struct nfsd_attrstat *resp) |
393 | { | 393 | { |
394 | p = encode_fattr(rqstp, p, &resp->fh, &resp->stat); | 394 | p = encode_fattr(rqstp, p, &resp->fh, &resp->stat); |
@@ -396,7 +396,7 @@ nfssvc_encode_attrstat(struct svc_rqst *rqstp, u32 *p, | |||
396 | } | 396 | } |
397 | 397 | ||
398 | int | 398 | int |
399 | nfssvc_encode_diropres(struct svc_rqst *rqstp, u32 *p, | 399 | nfssvc_encode_diropres(struct svc_rqst *rqstp, __be32 *p, |
400 | struct nfsd_diropres *resp) | 400 | struct nfsd_diropres *resp) |
401 | { | 401 | { |
402 | p = encode_fh(p, &resp->fh); | 402 | p = encode_fh(p, &resp->fh); |
@@ -405,7 +405,7 @@ nfssvc_encode_diropres(struct svc_rqst *rqstp, u32 *p, | |||
405 | } | 405 | } |
406 | 406 | ||
407 | int | 407 | int |
408 | nfssvc_encode_readlinkres(struct svc_rqst *rqstp, u32 *p, | 408 | nfssvc_encode_readlinkres(struct svc_rqst *rqstp, __be32 *p, |
409 | struct nfsd_readlinkres *resp) | 409 | struct nfsd_readlinkres *resp) |
410 | { | 410 | { |
411 | *p++ = htonl(resp->len); | 411 | *p++ = htonl(resp->len); |
@@ -421,7 +421,7 @@ nfssvc_encode_readlinkres(struct svc_rqst *rqstp, u32 *p, | |||
421 | } | 421 | } |
422 | 422 | ||
423 | int | 423 | int |
424 | nfssvc_encode_readres(struct svc_rqst *rqstp, u32 *p, | 424 | nfssvc_encode_readres(struct svc_rqst *rqstp, __be32 *p, |
425 | struct nfsd_readres *resp) | 425 | struct nfsd_readres *resp) |
426 | { | 426 | { |
427 | p = encode_fattr(rqstp, p, &resp->fh, &resp->stat); | 427 | p = encode_fattr(rqstp, p, &resp->fh, &resp->stat); |
@@ -440,7 +440,7 @@ nfssvc_encode_readres(struct svc_rqst *rqstp, u32 *p, | |||
440 | } | 440 | } |
441 | 441 | ||
442 | int | 442 | int |
443 | nfssvc_encode_readdirres(struct svc_rqst *rqstp, u32 *p, | 443 | nfssvc_encode_readdirres(struct svc_rqst *rqstp, __be32 *p, |
444 | struct nfsd_readdirres *resp) | 444 | struct nfsd_readdirres *resp) |
445 | { | 445 | { |
446 | xdr_ressize_check(rqstp, p); | 446 | xdr_ressize_check(rqstp, p); |
@@ -453,7 +453,7 @@ nfssvc_encode_readdirres(struct svc_rqst *rqstp, u32 *p, | |||
453 | } | 453 | } |
454 | 454 | ||
455 | int | 455 | int |
456 | nfssvc_encode_statfsres(struct svc_rqst *rqstp, u32 *p, | 456 | nfssvc_encode_statfsres(struct svc_rqst *rqstp, __be32 *p, |
457 | struct nfsd_statfsres *resp) | 457 | struct nfsd_statfsres *resp) |
458 | { | 458 | { |
459 | struct kstatfs *stat = &resp->stats; | 459 | struct kstatfs *stat = &resp->stats; |
@@ -471,7 +471,7 @@ nfssvc_encode_entry(struct readdir_cd *ccd, const char *name, | |||
471 | int namlen, loff_t offset, ino_t ino, unsigned int d_type) | 471 | int namlen, loff_t offset, ino_t ino, unsigned int d_type) |
472 | { | 472 | { |
473 | struct nfsd_readdirres *cd = container_of(ccd, struct nfsd_readdirres, common); | 473 | struct nfsd_readdirres *cd = container_of(ccd, struct nfsd_readdirres, common); |
474 | u32 *p = cd->buffer; | 474 | __be32 *p = cd->buffer; |
475 | int buflen, slen; | 475 | int buflen, slen; |
476 | 476 | ||
477 | /* | 477 | /* |
@@ -497,7 +497,7 @@ nfssvc_encode_entry(struct readdir_cd *ccd, const char *name, | |||
497 | *p++ = htonl((u32) ino); /* file id */ | 497 | *p++ = htonl((u32) ino); /* file id */ |
498 | p = xdr_encode_array(p, name, namlen);/* name length & name */ | 498 | p = xdr_encode_array(p, name, namlen);/* name length & name */ |
499 | cd->offset = p; /* remember pointer */ | 499 | cd->offset = p; /* remember pointer */ |
500 | *p++ = ~(u32) 0; /* offset of next entry */ | 500 | *p++ = htonl(~0U); /* offset of next entry */ |
501 | 501 | ||
502 | cd->buflen = buflen; | 502 | cd->buflen = buflen; |
503 | cd->buffer = p; | 503 | cd->buffer = p; |
@@ -509,7 +509,7 @@ nfssvc_encode_entry(struct readdir_cd *ccd, const char *name, | |||
509 | * XDR release functions | 509 | * XDR release functions |
510 | */ | 510 | */ |
511 | int | 511 | int |
512 | nfssvc_release_fhandle(struct svc_rqst *rqstp, u32 *p, | 512 | nfssvc_release_fhandle(struct svc_rqst *rqstp, __be32 *p, |
513 | struct nfsd_fhandle *resp) | 513 | struct nfsd_fhandle *resp) |
514 | { | 514 | { |
515 | fh_put(&resp->fh); | 515 | fh_put(&resp->fh); |
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index 1141bd29e4e3..f21e917bb8ed 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c | |||
@@ -110,7 +110,7 @@ nfsd_cross_mnt(struct svc_rqst *rqstp, struct dentry **dpp, | |||
110 | struct dentry *dentry = *dpp; | 110 | struct dentry *dentry = *dpp; |
111 | struct vfsmount *mnt = mntget(exp->ex_mnt); | 111 | struct vfsmount *mnt = mntget(exp->ex_mnt); |
112 | struct dentry *mounts = dget(dentry); | 112 | struct dentry *mounts = dget(dentry); |
113 | int err = nfs_ok; | 113 | int err = 0; |
114 | 114 | ||
115 | while (follow_down(&mnt,&mounts)&&d_mountpoint(mounts)); | 115 | while (follow_down(&mnt,&mounts)&&d_mountpoint(mounts)); |
116 | 116 | ||
@@ -148,14 +148,15 @@ out: | |||
148 | * clients and is explicitly disallowed for NFSv3 | 148 | * clients and is explicitly disallowed for NFSv3 |
149 | * NeilBrown <neilb@cse.unsw.edu.au> | 149 | * NeilBrown <neilb@cse.unsw.edu.au> |
150 | */ | 150 | */ |
151 | int | 151 | __be32 |
152 | nfsd_lookup(struct svc_rqst *rqstp, struct svc_fh *fhp, const char *name, | 152 | nfsd_lookup(struct svc_rqst *rqstp, struct svc_fh *fhp, const char *name, |
153 | int len, struct svc_fh *resfh) | 153 | int len, struct svc_fh *resfh) |
154 | { | 154 | { |
155 | struct svc_export *exp; | 155 | struct svc_export *exp; |
156 | struct dentry *dparent; | 156 | struct dentry *dparent; |
157 | struct dentry *dentry; | 157 | struct dentry *dentry; |
158 | int err; | 158 | __be32 err; |
159 | int host_err; | ||
159 | 160 | ||
160 | dprintk("nfsd: nfsd_lookup(fh %s, %.*s)\n", SVCFH_fmt(fhp), len,name); | 161 | dprintk("nfsd: nfsd_lookup(fh %s, %.*s)\n", SVCFH_fmt(fhp), len,name); |
161 | 162 | ||
@@ -193,7 +194,7 @@ nfsd_lookup(struct svc_rqst *rqstp, struct svc_fh *fhp, const char *name, | |||
193 | exp2 = exp_parent(exp->ex_client, mnt, dentry, | 194 | exp2 = exp_parent(exp->ex_client, mnt, dentry, |
194 | &rqstp->rq_chandle); | 195 | &rqstp->rq_chandle); |
195 | if (IS_ERR(exp2)) { | 196 | if (IS_ERR(exp2)) { |
196 | err = PTR_ERR(exp2); | 197 | host_err = PTR_ERR(exp2); |
197 | dput(dentry); | 198 | dput(dentry); |
198 | mntput(mnt); | 199 | mntput(mnt); |
199 | goto out_nfserr; | 200 | goto out_nfserr; |
@@ -210,14 +211,14 @@ nfsd_lookup(struct svc_rqst *rqstp, struct svc_fh *fhp, const char *name, | |||
210 | } else { | 211 | } else { |
211 | fh_lock(fhp); | 212 | fh_lock(fhp); |
212 | dentry = lookup_one_len(name, dparent, len); | 213 | dentry = lookup_one_len(name, dparent, len); |
213 | err = PTR_ERR(dentry); | 214 | host_err = PTR_ERR(dentry); |
214 | if (IS_ERR(dentry)) | 215 | if (IS_ERR(dentry)) |
215 | goto out_nfserr; | 216 | goto out_nfserr; |
216 | /* | 217 | /* |
217 | * check if we have crossed a mount point ... | 218 | * check if we have crossed a mount point ... |
218 | */ | 219 | */ |
219 | if (d_mountpoint(dentry)) { | 220 | if (d_mountpoint(dentry)) { |
220 | if ((err = nfsd_cross_mnt(rqstp, &dentry, &exp))) { | 221 | if ((host_err = nfsd_cross_mnt(rqstp, &dentry, &exp))) { |
221 | dput(dentry); | 222 | dput(dentry); |
222 | goto out_nfserr; | 223 | goto out_nfserr; |
223 | } | 224 | } |
@@ -236,7 +237,7 @@ out: | |||
236 | return err; | 237 | return err; |
237 | 238 | ||
238 | out_nfserr: | 239 | out_nfserr: |
239 | err = nfserrno(err); | 240 | err = nfserrno(host_err); |
240 | goto out; | 241 | goto out; |
241 | } | 242 | } |
242 | 243 | ||
@@ -244,7 +245,7 @@ out_nfserr: | |||
244 | * Set various file attributes. | 245 | * Set various file attributes. |
245 | * N.B. After this call fhp needs an fh_put | 246 | * N.B. After this call fhp needs an fh_put |
246 | */ | 247 | */ |
247 | int | 248 | __be32 |
248 | nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, struct iattr *iap, | 249 | nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, struct iattr *iap, |
249 | int check_guard, time_t guardtime) | 250 | int check_guard, time_t guardtime) |
250 | { | 251 | { |
@@ -253,7 +254,8 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, struct iattr *iap, | |||
253 | int accmode = MAY_SATTR; | 254 | int accmode = MAY_SATTR; |
254 | int ftype = 0; | 255 | int ftype = 0; |
255 | int imode; | 256 | int imode; |
256 | int err; | 257 | __be32 err; |
258 | int host_err; | ||
257 | int size_change = 0; | 259 | int size_change = 0; |
258 | 260 | ||
259 | if (iap->ia_valid & (ATTR_ATIME | ATTR_MTIME | ATTR_SIZE)) | 261 | if (iap->ia_valid & (ATTR_ATIME | ATTR_MTIME | ATTR_SIZE)) |
@@ -319,19 +321,19 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, struct iattr *iap, | |||
319 | * If we are changing the size of the file, then | 321 | * If we are changing the size of the file, then |
320 | * we need to break all leases. | 322 | * we need to break all leases. |
321 | */ | 323 | */ |
322 | err = break_lease(inode, FMODE_WRITE | O_NONBLOCK); | 324 | host_err = break_lease(inode, FMODE_WRITE | O_NONBLOCK); |
323 | if (err == -EWOULDBLOCK) | 325 | if (host_err == -EWOULDBLOCK) |
324 | err = -ETIMEDOUT; | 326 | host_err = -ETIMEDOUT; |
325 | if (err) /* ENOMEM or EWOULDBLOCK */ | 327 | if (host_err) /* ENOMEM or EWOULDBLOCK */ |
326 | goto out_nfserr; | 328 | goto out_nfserr; |
327 | 329 | ||
328 | err = get_write_access(inode); | 330 | host_err = get_write_access(inode); |
329 | if (err) | 331 | if (host_err) |
330 | goto out_nfserr; | 332 | goto out_nfserr; |
331 | 333 | ||
332 | size_change = 1; | 334 | size_change = 1; |
333 | err = locks_verify_truncate(inode, NULL, iap->ia_size); | 335 | host_err = locks_verify_truncate(inode, NULL, iap->ia_size); |
334 | if (err) { | 336 | if (host_err) { |
335 | put_write_access(inode); | 337 | put_write_access(inode); |
336 | goto out_nfserr; | 338 | goto out_nfserr; |
337 | } | 339 | } |
@@ -357,8 +359,8 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, struct iattr *iap, | |||
357 | err = nfserr_notsync; | 359 | err = nfserr_notsync; |
358 | if (!check_guard || guardtime == inode->i_ctime.tv_sec) { | 360 | if (!check_guard || guardtime == inode->i_ctime.tv_sec) { |
359 | fh_lock(fhp); | 361 | fh_lock(fhp); |
360 | err = notify_change(dentry, iap); | 362 | host_err = notify_change(dentry, iap); |
361 | err = nfserrno(err); | 363 | err = nfserrno(host_err); |
362 | fh_unlock(fhp); | 364 | fh_unlock(fhp); |
363 | } | 365 | } |
364 | if (size_change) | 366 | if (size_change) |
@@ -370,7 +372,7 @@ out: | |||
370 | return err; | 372 | return err; |
371 | 373 | ||
372 | out_nfserr: | 374 | out_nfserr: |
373 | err = nfserrno(err); | 375 | err = nfserrno(host_err); |
374 | goto out; | 376 | goto out; |
375 | } | 377 | } |
376 | 378 | ||
@@ -420,11 +422,12 @@ out: | |||
420 | return error; | 422 | return error; |
421 | } | 423 | } |
422 | 424 | ||
423 | int | 425 | __be32 |
424 | nfsd4_set_nfs4_acl(struct svc_rqst *rqstp, struct svc_fh *fhp, | 426 | nfsd4_set_nfs4_acl(struct svc_rqst *rqstp, struct svc_fh *fhp, |
425 | struct nfs4_acl *acl) | 427 | struct nfs4_acl *acl) |
426 | { | 428 | { |
427 | int error; | 429 | __be32 error; |
430 | int host_error; | ||
428 | struct dentry *dentry; | 431 | struct dentry *dentry; |
429 | struct inode *inode; | 432 | struct inode *inode; |
430 | struct posix_acl *pacl = NULL, *dpacl = NULL; | 433 | struct posix_acl *pacl = NULL, *dpacl = NULL; |
@@ -440,20 +443,20 @@ nfsd4_set_nfs4_acl(struct svc_rqst *rqstp, struct svc_fh *fhp, | |||
440 | if (S_ISDIR(inode->i_mode)) | 443 | if (S_ISDIR(inode->i_mode)) |
441 | flags = NFS4_ACL_DIR; | 444 | flags = NFS4_ACL_DIR; |
442 | 445 | ||
443 | error = nfs4_acl_nfsv4_to_posix(acl, &pacl, &dpacl, flags); | 446 | host_error = nfs4_acl_nfsv4_to_posix(acl, &pacl, &dpacl, flags); |
444 | if (error == -EINVAL) { | 447 | if (host_error == -EINVAL) { |
445 | error = nfserr_attrnotsupp; | 448 | error = nfserr_attrnotsupp; |
446 | goto out; | 449 | goto out; |
447 | } else if (error < 0) | 450 | } else if (host_error < 0) |
448 | goto out_nfserr; | 451 | goto out_nfserr; |
449 | 452 | ||
450 | error = set_nfsv4_acl_one(dentry, pacl, POSIX_ACL_XATTR_ACCESS); | 453 | host_error = set_nfsv4_acl_one(dentry, pacl, POSIX_ACL_XATTR_ACCESS); |
451 | if (error < 0) | 454 | if (host_error < 0) |
452 | goto out_nfserr; | 455 | goto out_nfserr; |
453 | 456 | ||
454 | if (S_ISDIR(inode->i_mode)) { | 457 | if (S_ISDIR(inode->i_mode)) { |
455 | error = set_nfsv4_acl_one(dentry, dpacl, POSIX_ACL_XATTR_DEFAULT); | 458 | host_error = set_nfsv4_acl_one(dentry, dpacl, POSIX_ACL_XATTR_DEFAULT); |
456 | if (error < 0) | 459 | if (host_error < 0) |
457 | goto out_nfserr; | 460 | goto out_nfserr; |
458 | } | 461 | } |
459 | 462 | ||
@@ -464,7 +467,7 @@ out: | |||
464 | posix_acl_release(dpacl); | 467 | posix_acl_release(dpacl); |
465 | return (error); | 468 | return (error); |
466 | out_nfserr: | 469 | out_nfserr: |
467 | error = nfserrno(error); | 470 | error = nfserrno(host_error); |
468 | goto out; | 471 | goto out; |
469 | } | 472 | } |
470 | 473 | ||
@@ -571,14 +574,14 @@ static struct accessmap nfs3_anyaccess[] = { | |||
571 | { 0, 0 } | 574 | { 0, 0 } |
572 | }; | 575 | }; |
573 | 576 | ||
574 | int | 577 | __be32 |
575 | nfsd_access(struct svc_rqst *rqstp, struct svc_fh *fhp, u32 *access, u32 *supported) | 578 | nfsd_access(struct svc_rqst *rqstp, struct svc_fh *fhp, u32 *access, u32 *supported) |
576 | { | 579 | { |
577 | struct accessmap *map; | 580 | struct accessmap *map; |
578 | struct svc_export *export; | 581 | struct svc_export *export; |
579 | struct dentry *dentry; | 582 | struct dentry *dentry; |
580 | u32 query, result = 0, sresult = 0; | 583 | u32 query, result = 0, sresult = 0; |
581 | unsigned int error; | 584 | __be32 error; |
582 | 585 | ||
583 | error = fh_verify(rqstp, fhp, 0, MAY_NOP); | 586 | error = fh_verify(rqstp, fhp, 0, MAY_NOP); |
584 | if (error) | 587 | if (error) |
@@ -598,7 +601,7 @@ nfsd_access(struct svc_rqst *rqstp, struct svc_fh *fhp, u32 *access, u32 *suppor | |||
598 | query = *access; | 601 | query = *access; |
599 | for (; map->access; map++) { | 602 | for (; map->access; map++) { |
600 | if (map->access & query) { | 603 | if (map->access & query) { |
601 | unsigned int err2; | 604 | __be32 err2; |
602 | 605 | ||
603 | sresult |= map->access; | 606 | sresult |= map->access; |
604 | 607 | ||
@@ -637,13 +640,15 @@ nfsd_access(struct svc_rqst *rqstp, struct svc_fh *fhp, u32 *access, u32 *suppor | |||
637 | * The access argument indicates the type of open (read/write/lock) | 640 | * The access argument indicates the type of open (read/write/lock) |
638 | * N.B. After this call fhp needs an fh_put | 641 | * N.B. After this call fhp needs an fh_put |
639 | */ | 642 | */ |
640 | int | 643 | __be32 |
641 | nfsd_open(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, | 644 | nfsd_open(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, |
642 | int access, struct file **filp) | 645 | int access, struct file **filp) |
643 | { | 646 | { |
644 | struct dentry *dentry; | 647 | struct dentry *dentry; |
645 | struct inode *inode; | 648 | struct inode *inode; |
646 | int flags = O_RDONLY|O_LARGEFILE, err; | 649 | int flags = O_RDONLY|O_LARGEFILE; |
650 | __be32 err; | ||
651 | int host_err; | ||
647 | 652 | ||
648 | /* | 653 | /* |
649 | * If we get here, then the client has already done an "open", | 654 | * If we get here, then the client has already done an "open", |
@@ -673,10 +678,10 @@ nfsd_open(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, | |||
673 | * Check to see if there are any leases on this file. | 678 | * Check to see if there are any leases on this file. |
674 | * This may block while leases are broken. | 679 | * This may block while leases are broken. |
675 | */ | 680 | */ |
676 | err = break_lease(inode, O_NONBLOCK | ((access & MAY_WRITE) ? FMODE_WRITE : 0)); | 681 | host_err = break_lease(inode, O_NONBLOCK | ((access & MAY_WRITE) ? FMODE_WRITE : 0)); |
677 | if (err == -EWOULDBLOCK) | 682 | if (host_err == -EWOULDBLOCK) |
678 | err = -ETIMEDOUT; | 683 | host_err = -ETIMEDOUT; |
679 | if (err) /* NOMEM or WOULDBLOCK */ | 684 | if (host_err) /* NOMEM or WOULDBLOCK */ |
680 | goto out_nfserr; | 685 | goto out_nfserr; |
681 | 686 | ||
682 | if (access & MAY_WRITE) { | 687 | if (access & MAY_WRITE) { |
@@ -689,10 +694,9 @@ nfsd_open(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, | |||
689 | } | 694 | } |
690 | *filp = dentry_open(dget(dentry), mntget(fhp->fh_export->ex_mnt), flags); | 695 | *filp = dentry_open(dget(dentry), mntget(fhp->fh_export->ex_mnt), flags); |
691 | if (IS_ERR(*filp)) | 696 | if (IS_ERR(*filp)) |
692 | err = PTR_ERR(*filp); | 697 | host_err = PTR_ERR(*filp); |
693 | out_nfserr: | 698 | out_nfserr: |
694 | if (err) | 699 | err = nfserrno(host_err); |
695 | err = nfserrno(err); | ||
696 | out: | 700 | out: |
697 | return err; | 701 | return err; |
698 | } | 702 | } |
@@ -830,14 +834,15 @@ nfsd_read_actor(read_descriptor_t *desc, struct page *page, unsigned long offset | |||
830 | return size; | 834 | return size; |
831 | } | 835 | } |
832 | 836 | ||
833 | static int | 837 | static __be32 |
834 | nfsd_vfs_read(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file, | 838 | nfsd_vfs_read(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file, |
835 | loff_t offset, struct kvec *vec, int vlen, unsigned long *count) | 839 | loff_t offset, struct kvec *vec, int vlen, unsigned long *count) |
836 | { | 840 | { |
837 | struct inode *inode; | 841 | struct inode *inode; |
838 | struct raparms *ra; | 842 | struct raparms *ra; |
839 | mm_segment_t oldfs; | 843 | mm_segment_t oldfs; |
840 | int err; | 844 | __be32 err; |
845 | int host_err; | ||
841 | 846 | ||
842 | err = nfserr_perm; | 847 | err = nfserr_perm; |
843 | inode = file->f_dentry->d_inode; | 848 | inode = file->f_dentry->d_inode; |
@@ -855,12 +860,12 @@ nfsd_vfs_read(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file, | |||
855 | 860 | ||
856 | if (file->f_op->sendfile && rqstp->rq_sendfile_ok) { | 861 | if (file->f_op->sendfile && rqstp->rq_sendfile_ok) { |
857 | rqstp->rq_resused = 1; | 862 | rqstp->rq_resused = 1; |
858 | err = file->f_op->sendfile(file, &offset, *count, | 863 | host_err = file->f_op->sendfile(file, &offset, *count, |
859 | nfsd_read_actor, rqstp); | 864 | nfsd_read_actor, rqstp); |
860 | } else { | 865 | } else { |
861 | oldfs = get_fs(); | 866 | oldfs = get_fs(); |
862 | set_fs(KERNEL_DS); | 867 | set_fs(KERNEL_DS); |
863 | err = vfs_readv(file, (struct iovec __user *)vec, vlen, &offset); | 868 | host_err = vfs_readv(file, (struct iovec __user *)vec, vlen, &offset); |
864 | set_fs(oldfs); | 869 | set_fs(oldfs); |
865 | } | 870 | } |
866 | 871 | ||
@@ -874,13 +879,13 @@ nfsd_vfs_read(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file, | |||
874 | spin_unlock(&rab->pb_lock); | 879 | spin_unlock(&rab->pb_lock); |
875 | } | 880 | } |
876 | 881 | ||
877 | if (err >= 0) { | 882 | if (host_err >= 0) { |
878 | nfsdstats.io_read += err; | 883 | nfsdstats.io_read += host_err; |
879 | *count = err; | 884 | *count = host_err; |
880 | err = 0; | 885 | err = 0; |
881 | fsnotify_access(file->f_dentry); | 886 | fsnotify_access(file->f_dentry); |
882 | } else | 887 | } else |
883 | err = nfserrno(err); | 888 | err = nfserrno(host_err); |
884 | out: | 889 | out: |
885 | return err; | 890 | return err; |
886 | } | 891 | } |
@@ -895,7 +900,7 @@ static void kill_suid(struct dentry *dentry) | |||
895 | mutex_unlock(&dentry->d_inode->i_mutex); | 900 | mutex_unlock(&dentry->d_inode->i_mutex); |
896 | } | 901 | } |
897 | 902 | ||
898 | static int | 903 | static __be32 |
899 | nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file, | 904 | nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file, |
900 | loff_t offset, struct kvec *vec, int vlen, | 905 | loff_t offset, struct kvec *vec, int vlen, |
901 | unsigned long cnt, int *stablep) | 906 | unsigned long cnt, int *stablep) |
@@ -904,7 +909,8 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file, | |||
904 | struct dentry *dentry; | 909 | struct dentry *dentry; |
905 | struct inode *inode; | 910 | struct inode *inode; |
906 | mm_segment_t oldfs; | 911 | mm_segment_t oldfs; |
907 | int err = 0; | 912 | __be32 err = 0; |
913 | int host_err; | ||
908 | int stable = *stablep; | 914 | int stable = *stablep; |
909 | 915 | ||
910 | #ifdef MSNFS | 916 | #ifdef MSNFS |
@@ -940,18 +946,18 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file, | |||
940 | 946 | ||
941 | /* Write the data. */ | 947 | /* Write the data. */ |
942 | oldfs = get_fs(); set_fs(KERNEL_DS); | 948 | oldfs = get_fs(); set_fs(KERNEL_DS); |
943 | err = vfs_writev(file, (struct iovec __user *)vec, vlen, &offset); | 949 | host_err = vfs_writev(file, (struct iovec __user *)vec, vlen, &offset); |
944 | set_fs(oldfs); | 950 | set_fs(oldfs); |
945 | if (err >= 0) { | 951 | if (host_err >= 0) { |
946 | nfsdstats.io_write += cnt; | 952 | nfsdstats.io_write += cnt; |
947 | fsnotify_modify(file->f_dentry); | 953 | fsnotify_modify(file->f_dentry); |
948 | } | 954 | } |
949 | 955 | ||
950 | /* clear setuid/setgid flag after write */ | 956 | /* clear setuid/setgid flag after write */ |
951 | if (err >= 0 && (inode->i_mode & (S_ISUID | S_ISGID))) | 957 | if (host_err >= 0 && (inode->i_mode & (S_ISUID | S_ISGID))) |
952 | kill_suid(dentry); | 958 | kill_suid(dentry); |
953 | 959 | ||
954 | if (err >= 0 && stable) { | 960 | if (host_err >= 0 && stable) { |
955 | static ino_t last_ino; | 961 | static ino_t last_ino; |
956 | static dev_t last_dev; | 962 | static dev_t last_dev; |
957 | 963 | ||
@@ -977,7 +983,7 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file, | |||
977 | 983 | ||
978 | if (inode->i_state & I_DIRTY) { | 984 | if (inode->i_state & I_DIRTY) { |
979 | dprintk("nfsd: write sync %d\n", current->pid); | 985 | dprintk("nfsd: write sync %d\n", current->pid); |
980 | err=nfsd_sync(file); | 986 | host_err=nfsd_sync(file); |
981 | } | 987 | } |
982 | #if 0 | 988 | #if 0 |
983 | wake_up(&inode->i_wait); | 989 | wake_up(&inode->i_wait); |
@@ -987,11 +993,11 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file, | |||
987 | last_dev = inode->i_sb->s_dev; | 993 | last_dev = inode->i_sb->s_dev; |
988 | } | 994 | } |
989 | 995 | ||
990 | dprintk("nfsd: write complete err=%d\n", err); | 996 | dprintk("nfsd: write complete host_err=%d\n", host_err); |
991 | if (err >= 0) | 997 | if (host_err >= 0) |
992 | err = 0; | 998 | err = 0; |
993 | else | 999 | else |
994 | err = nfserrno(err); | 1000 | err = nfserrno(host_err); |
995 | out: | 1001 | out: |
996 | return err; | 1002 | return err; |
997 | } | 1003 | } |
@@ -1001,12 +1007,12 @@ out: | |||
1001 | * on entry. On return, *count contains the number of bytes actually read. | 1007 | * on entry. On return, *count contains the number of bytes actually read. |
1002 | * N.B. After this call fhp needs an fh_put | 1008 | * N.B. After this call fhp needs an fh_put |
1003 | */ | 1009 | */ |
1004 | int | 1010 | __be32 |
1005 | nfsd_read(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file, | 1011 | nfsd_read(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file, |
1006 | loff_t offset, struct kvec *vec, int vlen, | 1012 | loff_t offset, struct kvec *vec, int vlen, |
1007 | unsigned long *count) | 1013 | unsigned long *count) |
1008 | { | 1014 | { |
1009 | int err; | 1015 | __be32 err; |
1010 | 1016 | ||
1011 | if (file) { | 1017 | if (file) { |
1012 | err = nfsd_permission(fhp->fh_export, fhp->fh_dentry, | 1018 | err = nfsd_permission(fhp->fh_export, fhp->fh_dentry, |
@@ -1030,12 +1036,12 @@ out: | |||
1030 | * The stable flag requests synchronous writes. | 1036 | * The stable flag requests synchronous writes. |
1031 | * N.B. After this call fhp needs an fh_put | 1037 | * N.B. After this call fhp needs an fh_put |
1032 | */ | 1038 | */ |
1033 | int | 1039 | __be32 |
1034 | nfsd_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file, | 1040 | nfsd_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file, |
1035 | loff_t offset, struct kvec *vec, int vlen, unsigned long cnt, | 1041 | loff_t offset, struct kvec *vec, int vlen, unsigned long cnt, |
1036 | int *stablep) | 1042 | int *stablep) |
1037 | { | 1043 | { |
1038 | int err = 0; | 1044 | __be32 err = 0; |
1039 | 1045 | ||
1040 | if (file) { | 1046 | if (file) { |
1041 | err = nfsd_permission(fhp->fh_export, fhp->fh_dentry, | 1047 | err = nfsd_permission(fhp->fh_export, fhp->fh_dentry, |
@@ -1067,12 +1073,12 @@ out: | |||
1067 | * Unfortunately we cannot lock the file to make sure we return full WCC | 1073 | * Unfortunately we cannot lock the file to make sure we return full WCC |
1068 | * data to the client, as locking happens lower down in the filesystem. | 1074 | * data to the client, as locking happens lower down in the filesystem. |
1069 | */ | 1075 | */ |
1070 | int | 1076 | __be32 |
1071 | nfsd_commit(struct svc_rqst *rqstp, struct svc_fh *fhp, | 1077 | nfsd_commit(struct svc_rqst *rqstp, struct svc_fh *fhp, |
1072 | loff_t offset, unsigned long count) | 1078 | loff_t offset, unsigned long count) |
1073 | { | 1079 | { |
1074 | struct file *file; | 1080 | struct file *file; |
1075 | int err; | 1081 | __be32 err; |
1076 | 1082 | ||
1077 | if ((u64)count > ~(u64)offset) | 1083 | if ((u64)count > ~(u64)offset) |
1078 | return nfserr_inval; | 1084 | return nfserr_inval; |
@@ -1100,14 +1106,15 @@ nfsd_commit(struct svc_rqst *rqstp, struct svc_fh *fhp, | |||
1100 | * | 1106 | * |
1101 | * N.B. Every call to nfsd_create needs an fh_put for _both_ fhp and resfhp | 1107 | * N.B. Every call to nfsd_create needs an fh_put for _both_ fhp and resfhp |
1102 | */ | 1108 | */ |
1103 | int | 1109 | __be32 |
1104 | nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp, | 1110 | nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp, |
1105 | char *fname, int flen, struct iattr *iap, | 1111 | char *fname, int flen, struct iattr *iap, |
1106 | int type, dev_t rdev, struct svc_fh *resfhp) | 1112 | int type, dev_t rdev, struct svc_fh *resfhp) |
1107 | { | 1113 | { |
1108 | struct dentry *dentry, *dchild = NULL; | 1114 | struct dentry *dentry, *dchild = NULL; |
1109 | struct inode *dirp; | 1115 | struct inode *dirp; |
1110 | int err; | 1116 | __be32 err; |
1117 | int host_err; | ||
1111 | 1118 | ||
1112 | err = nfserr_perm; | 1119 | err = nfserr_perm; |
1113 | if (!flen) | 1120 | if (!flen) |
@@ -1134,7 +1141,7 @@ nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp, | |||
1134 | /* called from nfsd_proc_mkdir, or possibly nfsd3_proc_create */ | 1141 | /* called from nfsd_proc_mkdir, or possibly nfsd3_proc_create */ |
1135 | fh_lock_nested(fhp, I_MUTEX_PARENT); | 1142 | fh_lock_nested(fhp, I_MUTEX_PARENT); |
1136 | dchild = lookup_one_len(fname, dentry, flen); | 1143 | dchild = lookup_one_len(fname, dentry, flen); |
1137 | err = PTR_ERR(dchild); | 1144 | host_err = PTR_ERR(dchild); |
1138 | if (IS_ERR(dchild)) | 1145 | if (IS_ERR(dchild)) |
1139 | goto out_nfserr; | 1146 | goto out_nfserr; |
1140 | err = fh_compose(resfhp, fhp->fh_export, dchild, fhp); | 1147 | err = fh_compose(resfhp, fhp->fh_export, dchild, fhp); |
@@ -1173,22 +1180,22 @@ nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp, | |||
1173 | err = nfserr_perm; | 1180 | err = nfserr_perm; |
1174 | switch (type) { | 1181 | switch (type) { |
1175 | case S_IFREG: | 1182 | case S_IFREG: |
1176 | err = vfs_create(dirp, dchild, iap->ia_mode, NULL); | 1183 | host_err = vfs_create(dirp, dchild, iap->ia_mode, NULL); |
1177 | break; | 1184 | break; |
1178 | case S_IFDIR: | 1185 | case S_IFDIR: |
1179 | err = vfs_mkdir(dirp, dchild, iap->ia_mode); | 1186 | host_err = vfs_mkdir(dirp, dchild, iap->ia_mode); |
1180 | break; | 1187 | break; |
1181 | case S_IFCHR: | 1188 | case S_IFCHR: |
1182 | case S_IFBLK: | 1189 | case S_IFBLK: |
1183 | case S_IFIFO: | 1190 | case S_IFIFO: |
1184 | case S_IFSOCK: | 1191 | case S_IFSOCK: |
1185 | err = vfs_mknod(dirp, dchild, iap->ia_mode, rdev); | 1192 | host_err = vfs_mknod(dirp, dchild, iap->ia_mode, rdev); |
1186 | break; | 1193 | break; |
1187 | default: | 1194 | default: |
1188 | printk("nfsd: bad file type %o in nfsd_create\n", type); | 1195 | printk("nfsd: bad file type %o in nfsd_create\n", type); |
1189 | err = -EINVAL; | 1196 | host_err = -EINVAL; |
1190 | } | 1197 | } |
1191 | if (err < 0) | 1198 | if (host_err < 0) |
1192 | goto out_nfserr; | 1199 | goto out_nfserr; |
1193 | 1200 | ||
1194 | if (EX_ISSYNC(fhp->fh_export)) { | 1201 | if (EX_ISSYNC(fhp->fh_export)) { |
@@ -1203,7 +1210,7 @@ nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp, | |||
1203 | * directories via NFS. | 1210 | * directories via NFS. |
1204 | */ | 1211 | */ |
1205 | if ((iap->ia_valid &= ~(ATTR_UID|ATTR_GID|ATTR_MODE)) != 0) { | 1212 | if ((iap->ia_valid &= ~(ATTR_UID|ATTR_GID|ATTR_MODE)) != 0) { |
1206 | int err2 = nfsd_setattr(rqstp, resfhp, iap, 0, (time_t)0); | 1213 | __be32 err2 = nfsd_setattr(rqstp, resfhp, iap, 0, (time_t)0); |
1207 | if (err2) | 1214 | if (err2) |
1208 | err = err2; | 1215 | err = err2; |
1209 | } | 1216 | } |
@@ -1218,7 +1225,7 @@ out: | |||
1218 | return err; | 1225 | return err; |
1219 | 1226 | ||
1220 | out_nfserr: | 1227 | out_nfserr: |
1221 | err = nfserrno(err); | 1228 | err = nfserrno(host_err); |
1222 | goto out; | 1229 | goto out; |
1223 | } | 1230 | } |
1224 | 1231 | ||
@@ -1226,7 +1233,7 @@ out_nfserr: | |||
1226 | /* | 1233 | /* |
1227 | * NFSv3 version of nfsd_create | 1234 | * NFSv3 version of nfsd_create |
1228 | */ | 1235 | */ |
1229 | int | 1236 | __be32 |
1230 | nfsd_create_v3(struct svc_rqst *rqstp, struct svc_fh *fhp, | 1237 | nfsd_create_v3(struct svc_rqst *rqstp, struct svc_fh *fhp, |
1231 | char *fname, int flen, struct iattr *iap, | 1238 | char *fname, int flen, struct iattr *iap, |
1232 | struct svc_fh *resfhp, int createmode, u32 *verifier, | 1239 | struct svc_fh *resfhp, int createmode, u32 *verifier, |
@@ -1234,7 +1241,8 @@ nfsd_create_v3(struct svc_rqst *rqstp, struct svc_fh *fhp, | |||
1234 | { | 1241 | { |
1235 | struct dentry *dentry, *dchild = NULL; | 1242 | struct dentry *dentry, *dchild = NULL; |
1236 | struct inode *dirp; | 1243 | struct inode *dirp; |
1237 | int err; | 1244 | __be32 err; |
1245 | int host_err; | ||
1238 | __u32 v_mtime=0, v_atime=0; | 1246 | __u32 v_mtime=0, v_atime=0; |
1239 | int v_mode=0; | 1247 | int v_mode=0; |
1240 | 1248 | ||
@@ -1264,7 +1272,7 @@ nfsd_create_v3(struct svc_rqst *rqstp, struct svc_fh *fhp, | |||
1264 | * Compose the response file handle. | 1272 | * Compose the response file handle. |
1265 | */ | 1273 | */ |
1266 | dchild = lookup_one_len(fname, dentry, flen); | 1274 | dchild = lookup_one_len(fname, dentry, flen); |
1267 | err = PTR_ERR(dchild); | 1275 | host_err = PTR_ERR(dchild); |
1268 | if (IS_ERR(dchild)) | 1276 | if (IS_ERR(dchild)) |
1269 | goto out_nfserr; | 1277 | goto out_nfserr; |
1270 | 1278 | ||
@@ -1320,8 +1328,8 @@ nfsd_create_v3(struct svc_rqst *rqstp, struct svc_fh *fhp, | |||
1320 | goto out; | 1328 | goto out; |
1321 | } | 1329 | } |
1322 | 1330 | ||
1323 | err = vfs_create(dirp, dchild, iap->ia_mode, NULL); | 1331 | host_err = vfs_create(dirp, dchild, iap->ia_mode, NULL); |
1324 | if (err < 0) | 1332 | if (host_err < 0) |
1325 | goto out_nfserr; | 1333 | goto out_nfserr; |
1326 | 1334 | ||
1327 | if (EX_ISSYNC(fhp->fh_export)) { | 1335 | if (EX_ISSYNC(fhp->fh_export)) { |
@@ -1350,7 +1358,7 @@ nfsd_create_v3(struct svc_rqst *rqstp, struct svc_fh *fhp, | |||
1350 | */ | 1358 | */ |
1351 | set_attr: | 1359 | set_attr: |
1352 | if ((iap->ia_valid &= ~(ATTR_UID|ATTR_GID)) != 0) { | 1360 | if ((iap->ia_valid &= ~(ATTR_UID|ATTR_GID)) != 0) { |
1353 | int err2 = nfsd_setattr(rqstp, resfhp, iap, 0, (time_t)0); | 1361 | __be32 err2 = nfsd_setattr(rqstp, resfhp, iap, 0, (time_t)0); |
1354 | if (err2) | 1362 | if (err2) |
1355 | err = err2; | 1363 | err = err2; |
1356 | } | 1364 | } |
@@ -1368,7 +1376,7 @@ nfsd_create_v3(struct svc_rqst *rqstp, struct svc_fh *fhp, | |||
1368 | return err; | 1376 | return err; |
1369 | 1377 | ||
1370 | out_nfserr: | 1378 | out_nfserr: |
1371 | err = nfserrno(err); | 1379 | err = nfserrno(host_err); |
1372 | goto out; | 1380 | goto out; |
1373 | } | 1381 | } |
1374 | #endif /* CONFIG_NFSD_V3 */ | 1382 | #endif /* CONFIG_NFSD_V3 */ |
@@ -1378,13 +1386,14 @@ nfsd_create_v3(struct svc_rqst *rqstp, struct svc_fh *fhp, | |||
1378 | * fits into the buffer. On return, it contains the true length. | 1386 | * fits into the buffer. On return, it contains the true length. |
1379 | * N.B. After this call fhp needs an fh_put | 1387 | * N.B. After this call fhp needs an fh_put |
1380 | */ | 1388 | */ |
1381 | int | 1389 | __be32 |
1382 | nfsd_readlink(struct svc_rqst *rqstp, struct svc_fh *fhp, char *buf, int *lenp) | 1390 | nfsd_readlink(struct svc_rqst *rqstp, struct svc_fh *fhp, char *buf, int *lenp) |
1383 | { | 1391 | { |
1384 | struct dentry *dentry; | 1392 | struct dentry *dentry; |
1385 | struct inode *inode; | 1393 | struct inode *inode; |
1386 | mm_segment_t oldfs; | 1394 | mm_segment_t oldfs; |
1387 | int err; | 1395 | __be32 err; |
1396 | int host_err; | ||
1388 | 1397 | ||
1389 | err = fh_verify(rqstp, fhp, S_IFLNK, MAY_NOP); | 1398 | err = fh_verify(rqstp, fhp, S_IFLNK, MAY_NOP); |
1390 | if (err) | 1399 | if (err) |
@@ -1403,18 +1412,18 @@ nfsd_readlink(struct svc_rqst *rqstp, struct svc_fh *fhp, char *buf, int *lenp) | |||
1403 | */ | 1412 | */ |
1404 | 1413 | ||
1405 | oldfs = get_fs(); set_fs(KERNEL_DS); | 1414 | oldfs = get_fs(); set_fs(KERNEL_DS); |
1406 | err = inode->i_op->readlink(dentry, buf, *lenp); | 1415 | host_err = inode->i_op->readlink(dentry, buf, *lenp); |
1407 | set_fs(oldfs); | 1416 | set_fs(oldfs); |
1408 | 1417 | ||
1409 | if (err < 0) | 1418 | if (host_err < 0) |
1410 | goto out_nfserr; | 1419 | goto out_nfserr; |
1411 | *lenp = err; | 1420 | *lenp = host_err; |
1412 | err = 0; | 1421 | err = 0; |
1413 | out: | 1422 | out: |
1414 | return err; | 1423 | return err; |
1415 | 1424 | ||
1416 | out_nfserr: | 1425 | out_nfserr: |
1417 | err = nfserrno(err); | 1426 | err = nfserrno(host_err); |
1418 | goto out; | 1427 | goto out; |
1419 | } | 1428 | } |
1420 | 1429 | ||
@@ -1422,7 +1431,7 @@ out_nfserr: | |||
1422 | * Create a symlink and look up its inode | 1431 | * Create a symlink and look up its inode |
1423 | * N.B. After this call _both_ fhp and resfhp need an fh_put | 1432 | * N.B. After this call _both_ fhp and resfhp need an fh_put |
1424 | */ | 1433 | */ |
1425 | int | 1434 | __be32 |
1426 | nfsd_symlink(struct svc_rqst *rqstp, struct svc_fh *fhp, | 1435 | nfsd_symlink(struct svc_rqst *rqstp, struct svc_fh *fhp, |
1427 | char *fname, int flen, | 1436 | char *fname, int flen, |
1428 | char *path, int plen, | 1437 | char *path, int plen, |
@@ -1430,7 +1439,8 @@ nfsd_symlink(struct svc_rqst *rqstp, struct svc_fh *fhp, | |||
1430 | struct iattr *iap) | 1439 | struct iattr *iap) |
1431 | { | 1440 | { |
1432 | struct dentry *dentry, *dnew; | 1441 | struct dentry *dentry, *dnew; |
1433 | int err, cerr; | 1442 | __be32 err, cerr; |
1443 | int host_err; | ||
1434 | umode_t mode; | 1444 | umode_t mode; |
1435 | 1445 | ||
1436 | err = nfserr_noent; | 1446 | err = nfserr_noent; |
@@ -1446,7 +1456,7 @@ nfsd_symlink(struct svc_rqst *rqstp, struct svc_fh *fhp, | |||
1446 | fh_lock(fhp); | 1456 | fh_lock(fhp); |
1447 | dentry = fhp->fh_dentry; | 1457 | dentry = fhp->fh_dentry; |
1448 | dnew = lookup_one_len(fname, dentry, flen); | 1458 | dnew = lookup_one_len(fname, dentry, flen); |
1449 | err = PTR_ERR(dnew); | 1459 | host_err = PTR_ERR(dnew); |
1450 | if (IS_ERR(dnew)) | 1460 | if (IS_ERR(dnew)) |
1451 | goto out_nfserr; | 1461 | goto out_nfserr; |
1452 | 1462 | ||
@@ -1458,21 +1468,21 @@ nfsd_symlink(struct svc_rqst *rqstp, struct svc_fh *fhp, | |||
1458 | if (unlikely(path[plen] != 0)) { | 1468 | if (unlikely(path[plen] != 0)) { |
1459 | char *path_alloced = kmalloc(plen+1, GFP_KERNEL); | 1469 | char *path_alloced = kmalloc(plen+1, GFP_KERNEL); |
1460 | if (path_alloced == NULL) | 1470 | if (path_alloced == NULL) |
1461 | err = -ENOMEM; | 1471 | host_err = -ENOMEM; |
1462 | else { | 1472 | else { |
1463 | strncpy(path_alloced, path, plen); | 1473 | strncpy(path_alloced, path, plen); |
1464 | path_alloced[plen] = 0; | 1474 | path_alloced[plen] = 0; |
1465 | err = vfs_symlink(dentry->d_inode, dnew, path_alloced, mode); | 1475 | host_err = vfs_symlink(dentry->d_inode, dnew, path_alloced, mode); |
1466 | kfree(path_alloced); | 1476 | kfree(path_alloced); |
1467 | } | 1477 | } |
1468 | } else | 1478 | } else |
1469 | err = vfs_symlink(dentry->d_inode, dnew, path, mode); | 1479 | host_err = vfs_symlink(dentry->d_inode, dnew, path, mode); |
1470 | 1480 | ||
1471 | if (!err) | 1481 | if (!host_err) { |
1472 | if (EX_ISSYNC(fhp->fh_export)) | 1482 | if (EX_ISSYNC(fhp->fh_export)) |
1473 | err = nfsd_sync_dir(dentry); | 1483 | host_err = nfsd_sync_dir(dentry); |
1474 | if (err) | 1484 | } |
1475 | err = nfserrno(err); | 1485 | err = nfserrno(host_err); |
1476 | fh_unlock(fhp); | 1486 | fh_unlock(fhp); |
1477 | 1487 | ||
1478 | cerr = fh_compose(resfhp, fhp->fh_export, dnew, fhp); | 1488 | cerr = fh_compose(resfhp, fhp->fh_export, dnew, fhp); |
@@ -1482,7 +1492,7 @@ out: | |||
1482 | return err; | 1492 | return err; |
1483 | 1493 | ||
1484 | out_nfserr: | 1494 | out_nfserr: |
1485 | err = nfserrno(err); | 1495 | err = nfserrno(host_err); |
1486 | goto out; | 1496 | goto out; |
1487 | } | 1497 | } |
1488 | 1498 | ||
@@ -1490,13 +1500,14 @@ out_nfserr: | |||
1490 | * Create a hardlink | 1500 | * Create a hardlink |
1491 | * N.B. After this call _both_ ffhp and tfhp need an fh_put | 1501 | * N.B. After this call _both_ ffhp and tfhp need an fh_put |
1492 | */ | 1502 | */ |
1493 | int | 1503 | __be32 |
1494 | nfsd_link(struct svc_rqst *rqstp, struct svc_fh *ffhp, | 1504 | nfsd_link(struct svc_rqst *rqstp, struct svc_fh *ffhp, |
1495 | char *name, int len, struct svc_fh *tfhp) | 1505 | char *name, int len, struct svc_fh *tfhp) |
1496 | { | 1506 | { |
1497 | struct dentry *ddir, *dnew, *dold; | 1507 | struct dentry *ddir, *dnew, *dold; |
1498 | struct inode *dirp, *dest; | 1508 | struct inode *dirp, *dest; |
1499 | int err; | 1509 | __be32 err; |
1510 | int host_err; | ||
1500 | 1511 | ||
1501 | err = fh_verify(rqstp, ffhp, S_IFDIR, MAY_CREATE); | 1512 | err = fh_verify(rqstp, ffhp, S_IFDIR, MAY_CREATE); |
1502 | if (err) | 1513 | if (err) |
@@ -1517,24 +1528,25 @@ nfsd_link(struct svc_rqst *rqstp, struct svc_fh *ffhp, | |||
1517 | dirp = ddir->d_inode; | 1528 | dirp = ddir->d_inode; |
1518 | 1529 | ||
1519 | dnew = lookup_one_len(name, ddir, len); | 1530 | dnew = lookup_one_len(name, ddir, len); |
1520 | err = PTR_ERR(dnew); | 1531 | host_err = PTR_ERR(dnew); |
1521 | if (IS_ERR(dnew)) | 1532 | if (IS_ERR(dnew)) |
1522 | goto out_nfserr; | 1533 | goto out_nfserr; |
1523 | 1534 | ||
1524 | dold = tfhp->fh_dentry; | 1535 | dold = tfhp->fh_dentry; |
1525 | dest = dold->d_inode; | 1536 | dest = dold->d_inode; |
1526 | 1537 | ||
1527 | err = vfs_link(dold, dirp, dnew); | 1538 | host_err = vfs_link(dold, dirp, dnew); |
1528 | if (!err) { | 1539 | if (!host_err) { |
1529 | if (EX_ISSYNC(ffhp->fh_export)) { | 1540 | if (EX_ISSYNC(ffhp->fh_export)) { |
1530 | err = nfserrno(nfsd_sync_dir(ddir)); | 1541 | err = nfserrno(nfsd_sync_dir(ddir)); |
1531 | write_inode_now(dest, 1); | 1542 | write_inode_now(dest, 1); |
1532 | } | 1543 | } |
1544 | err = 0; | ||
1533 | } else { | 1545 | } else { |
1534 | if (err == -EXDEV && rqstp->rq_vers == 2) | 1546 | if (host_err == -EXDEV && rqstp->rq_vers == 2) |
1535 | err = nfserr_acces; | 1547 | err = nfserr_acces; |
1536 | else | 1548 | else |
1537 | err = nfserrno(err); | 1549 | err = nfserrno(host_err); |
1538 | } | 1550 | } |
1539 | 1551 | ||
1540 | dput(dnew); | 1552 | dput(dnew); |
@@ -1544,7 +1556,7 @@ out: | |||
1544 | return err; | 1556 | return err; |
1545 | 1557 | ||
1546 | out_nfserr: | 1558 | out_nfserr: |
1547 | err = nfserrno(err); | 1559 | err = nfserrno(host_err); |
1548 | goto out_unlock; | 1560 | goto out_unlock; |
1549 | } | 1561 | } |
1550 | 1562 | ||
@@ -1552,13 +1564,14 @@ out_nfserr: | |||
1552 | * Rename a file | 1564 | * Rename a file |
1553 | * N.B. After this call _both_ ffhp and tfhp need an fh_put | 1565 | * N.B. After this call _both_ ffhp and tfhp need an fh_put |
1554 | */ | 1566 | */ |
1555 | int | 1567 | __be32 |
1556 | nfsd_rename(struct svc_rqst *rqstp, struct svc_fh *ffhp, char *fname, int flen, | 1568 | nfsd_rename(struct svc_rqst *rqstp, struct svc_fh *ffhp, char *fname, int flen, |
1557 | struct svc_fh *tfhp, char *tname, int tlen) | 1569 | struct svc_fh *tfhp, char *tname, int tlen) |
1558 | { | 1570 | { |
1559 | struct dentry *fdentry, *tdentry, *odentry, *ndentry, *trap; | 1571 | struct dentry *fdentry, *tdentry, *odentry, *ndentry, *trap; |
1560 | struct inode *fdir, *tdir; | 1572 | struct inode *fdir, *tdir; |
1561 | int err; | 1573 | __be32 err; |
1574 | int host_err; | ||
1562 | 1575 | ||
1563 | err = fh_verify(rqstp, ffhp, S_IFDIR, MAY_REMOVE); | 1576 | err = fh_verify(rqstp, ffhp, S_IFDIR, MAY_REMOVE); |
1564 | if (err) | 1577 | if (err) |
@@ -1589,22 +1602,22 @@ nfsd_rename(struct svc_rqst *rqstp, struct svc_fh *ffhp, char *fname, int flen, | |||
1589 | fill_pre_wcc(tfhp); | 1602 | fill_pre_wcc(tfhp); |
1590 | 1603 | ||
1591 | odentry = lookup_one_len(fname, fdentry, flen); | 1604 | odentry = lookup_one_len(fname, fdentry, flen); |
1592 | err = PTR_ERR(odentry); | 1605 | host_err = PTR_ERR(odentry); |
1593 | if (IS_ERR(odentry)) | 1606 | if (IS_ERR(odentry)) |
1594 | goto out_nfserr; | 1607 | goto out_nfserr; |
1595 | 1608 | ||
1596 | err = -ENOENT; | 1609 | host_err = -ENOENT; |
1597 | if (!odentry->d_inode) | 1610 | if (!odentry->d_inode) |
1598 | goto out_dput_old; | 1611 | goto out_dput_old; |
1599 | err = -EINVAL; | 1612 | host_err = -EINVAL; |
1600 | if (odentry == trap) | 1613 | if (odentry == trap) |
1601 | goto out_dput_old; | 1614 | goto out_dput_old; |
1602 | 1615 | ||
1603 | ndentry = lookup_one_len(tname, tdentry, tlen); | 1616 | ndentry = lookup_one_len(tname, tdentry, tlen); |
1604 | err = PTR_ERR(ndentry); | 1617 | host_err = PTR_ERR(ndentry); |
1605 | if (IS_ERR(ndentry)) | 1618 | if (IS_ERR(ndentry)) |
1606 | goto out_dput_old; | 1619 | goto out_dput_old; |
1607 | err = -ENOTEMPTY; | 1620 | host_err = -ENOTEMPTY; |
1608 | if (ndentry == trap) | 1621 | if (ndentry == trap) |
1609 | goto out_dput_new; | 1622 | goto out_dput_new; |
1610 | 1623 | ||
@@ -1612,14 +1625,14 @@ nfsd_rename(struct svc_rqst *rqstp, struct svc_fh *ffhp, char *fname, int flen, | |||
1612 | if ((ffhp->fh_export->ex_flags & NFSEXP_MSNFS) && | 1625 | if ((ffhp->fh_export->ex_flags & NFSEXP_MSNFS) && |
1613 | ((atomic_read(&odentry->d_count) > 1) | 1626 | ((atomic_read(&odentry->d_count) > 1) |
1614 | || (atomic_read(&ndentry->d_count) > 1))) { | 1627 | || (atomic_read(&ndentry->d_count) > 1))) { |
1615 | err = -EPERM; | 1628 | host_err = -EPERM; |
1616 | } else | 1629 | } else |
1617 | #endif | 1630 | #endif |
1618 | err = vfs_rename(fdir, odentry, tdir, ndentry); | 1631 | host_err = vfs_rename(fdir, odentry, tdir, ndentry); |
1619 | if (!err && EX_ISSYNC(tfhp->fh_export)) { | 1632 | if (!host_err && EX_ISSYNC(tfhp->fh_export)) { |
1620 | err = nfsd_sync_dir(tdentry); | 1633 | host_err = nfsd_sync_dir(tdentry); |
1621 | if (!err) | 1634 | if (!host_err) |
1622 | err = nfsd_sync_dir(fdentry); | 1635 | host_err = nfsd_sync_dir(fdentry); |
1623 | } | 1636 | } |
1624 | 1637 | ||
1625 | out_dput_new: | 1638 | out_dput_new: |
@@ -1627,8 +1640,7 @@ nfsd_rename(struct svc_rqst *rqstp, struct svc_fh *ffhp, char *fname, int flen, | |||
1627 | out_dput_old: | 1640 | out_dput_old: |
1628 | dput(odentry); | 1641 | dput(odentry); |
1629 | out_nfserr: | 1642 | out_nfserr: |
1630 | if (err) | 1643 | err = nfserrno(host_err); |
1631 | err = nfserrno(err); | ||
1632 | 1644 | ||
1633 | /* we cannot reply on fh_unlock on the two filehandles, | 1645 | /* we cannot reply on fh_unlock on the two filehandles, |
1634 | * as that would do the wrong thing if the two directories | 1646 | * as that would do the wrong thing if the two directories |
@@ -1647,13 +1659,14 @@ out: | |||
1647 | * Unlink a file or directory | 1659 | * Unlink a file or directory |
1648 | * N.B. After this call fhp needs an fh_put | 1660 | * N.B. After this call fhp needs an fh_put |
1649 | */ | 1661 | */ |
1650 | int | 1662 | __be32 |
1651 | nfsd_unlink(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, | 1663 | nfsd_unlink(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, |
1652 | char *fname, int flen) | 1664 | char *fname, int flen) |
1653 | { | 1665 | { |
1654 | struct dentry *dentry, *rdentry; | 1666 | struct dentry *dentry, *rdentry; |
1655 | struct inode *dirp; | 1667 | struct inode *dirp; |
1656 | int err; | 1668 | __be32 err; |
1669 | int host_err; | ||
1657 | 1670 | ||
1658 | err = nfserr_acces; | 1671 | err = nfserr_acces; |
1659 | if (!flen || isdotent(fname, flen)) | 1672 | if (!flen || isdotent(fname, flen)) |
@@ -1667,7 +1680,7 @@ nfsd_unlink(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, | |||
1667 | dirp = dentry->d_inode; | 1680 | dirp = dentry->d_inode; |
1668 | 1681 | ||
1669 | rdentry = lookup_one_len(fname, dentry, flen); | 1682 | rdentry = lookup_one_len(fname, dentry, flen); |
1670 | err = PTR_ERR(rdentry); | 1683 | host_err = PTR_ERR(rdentry); |
1671 | if (IS_ERR(rdentry)) | 1684 | if (IS_ERR(rdentry)) |
1672 | goto out_nfserr; | 1685 | goto out_nfserr; |
1673 | 1686 | ||
@@ -1684,22 +1697,23 @@ nfsd_unlink(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, | |||
1684 | #ifdef MSNFS | 1697 | #ifdef MSNFS |
1685 | if ((fhp->fh_export->ex_flags & NFSEXP_MSNFS) && | 1698 | if ((fhp->fh_export->ex_flags & NFSEXP_MSNFS) && |
1686 | (atomic_read(&rdentry->d_count) > 1)) { | 1699 | (atomic_read(&rdentry->d_count) > 1)) { |
1687 | err = -EPERM; | 1700 | host_err = -EPERM; |
1688 | } else | 1701 | } else |
1689 | #endif | 1702 | #endif |
1690 | err = vfs_unlink(dirp, rdentry); | 1703 | host_err = vfs_unlink(dirp, rdentry); |
1691 | } else { /* It's RMDIR */ | 1704 | } else { /* It's RMDIR */ |
1692 | err = vfs_rmdir(dirp, rdentry); | 1705 | host_err = vfs_rmdir(dirp, rdentry); |
1693 | } | 1706 | } |
1694 | 1707 | ||
1695 | dput(rdentry); | 1708 | dput(rdentry); |
1696 | 1709 | ||
1697 | if (err == 0 && | 1710 | if (host_err) |
1698 | EX_ISSYNC(fhp->fh_export)) | 1711 | goto out_nfserr; |
1699 | err = nfsd_sync_dir(dentry); | 1712 | if (EX_ISSYNC(fhp->fh_export)) |
1713 | host_err = nfsd_sync_dir(dentry); | ||
1700 | 1714 | ||
1701 | out_nfserr: | 1715 | out_nfserr: |
1702 | err = nfserrno(err); | 1716 | err = nfserrno(host_err); |
1703 | out: | 1717 | out: |
1704 | return err; | 1718 | return err; |
1705 | } | 1719 | } |
@@ -1708,11 +1722,12 @@ out: | |||
1708 | * Read entries from a directory. | 1722 | * Read entries from a directory. |
1709 | * The NFSv3/4 verifier we ignore for now. | 1723 | * The NFSv3/4 verifier we ignore for now. |
1710 | */ | 1724 | */ |
1711 | int | 1725 | __be32 |
1712 | nfsd_readdir(struct svc_rqst *rqstp, struct svc_fh *fhp, loff_t *offsetp, | 1726 | nfsd_readdir(struct svc_rqst *rqstp, struct svc_fh *fhp, loff_t *offsetp, |
1713 | struct readdir_cd *cdp, encode_dent_fn func) | 1727 | struct readdir_cd *cdp, encode_dent_fn func) |
1714 | { | 1728 | { |
1715 | int err; | 1729 | __be32 err; |
1730 | int host_err; | ||
1716 | struct file *file; | 1731 | struct file *file; |
1717 | loff_t offset = *offsetp; | 1732 | loff_t offset = *offsetp; |
1718 | 1733 | ||
@@ -1734,10 +1749,10 @@ nfsd_readdir(struct svc_rqst *rqstp, struct svc_fh *fhp, loff_t *offsetp, | |||
1734 | 1749 | ||
1735 | do { | 1750 | do { |
1736 | cdp->err = nfserr_eof; /* will be cleared on successful read */ | 1751 | cdp->err = nfserr_eof; /* will be cleared on successful read */ |
1737 | err = vfs_readdir(file, (filldir_t) func, cdp); | 1752 | host_err = vfs_readdir(file, (filldir_t) func, cdp); |
1738 | } while (err >=0 && cdp->err == nfs_ok); | 1753 | } while (host_err >=0 && cdp->err == nfs_ok); |
1739 | if (err) | 1754 | if (host_err) |
1740 | err = nfserrno(err); | 1755 | err = nfserrno(host_err); |
1741 | else | 1756 | else |
1742 | err = cdp->err; | 1757 | err = cdp->err; |
1743 | *offsetp = vfs_llseek(file, 0, 1); | 1758 | *offsetp = vfs_llseek(file, 0, 1); |
@@ -1754,10 +1769,10 @@ out: | |||
1754 | * Get file system stats | 1769 | * Get file system stats |
1755 | * N.B. After this call fhp needs an fh_put | 1770 | * N.B. After this call fhp needs an fh_put |
1756 | */ | 1771 | */ |
1757 | int | 1772 | __be32 |
1758 | nfsd_statfs(struct svc_rqst *rqstp, struct svc_fh *fhp, struct kstatfs *stat) | 1773 | nfsd_statfs(struct svc_rqst *rqstp, struct svc_fh *fhp, struct kstatfs *stat) |
1759 | { | 1774 | { |
1760 | int err = fh_verify(rqstp, fhp, 0, MAY_NOP); | 1775 | __be32 err = fh_verify(rqstp, fhp, 0, MAY_NOP); |
1761 | if (!err && vfs_statfs(fhp->fh_dentry,stat)) | 1776 | if (!err && vfs_statfs(fhp->fh_dentry,stat)) |
1762 | err = nfserr_io; | 1777 | err = nfserr_io; |
1763 | return err; | 1778 | return err; |
@@ -1766,7 +1781,7 @@ nfsd_statfs(struct svc_rqst *rqstp, struct svc_fh *fhp, struct kstatfs *stat) | |||
1766 | /* | 1781 | /* |
1767 | * Check for a user's access permissions to this inode. | 1782 | * Check for a user's access permissions to this inode. |
1768 | */ | 1783 | */ |
1769 | int | 1784 | __be32 |
1770 | nfsd_permission(struct svc_export *exp, struct dentry *dentry, int acc) | 1785 | nfsd_permission(struct svc_export *exp, struct dentry *dentry, int acc) |
1771 | { | 1786 | { |
1772 | struct inode *inode = dentry->d_inode; | 1787 | struct inode *inode = dentry->d_inode; |