diff options
Diffstat (limited to 'fs/nfsd')
-rw-r--r-- | fs/nfsd/nfsproc.c | 37 |
1 files changed, 30 insertions, 7 deletions
diff --git a/fs/nfsd/nfsproc.c b/fs/nfsd/nfsproc.c index 0aa1b9603d7f..3e6b75cd90fd 100644 --- a/fs/nfsd/nfsproc.c +++ b/fs/nfsd/nfsproc.c | |||
@@ -36,6 +36,22 @@ nfsd_proc_null(struct svc_rqst *rqstp, void *argp, void *resp) | |||
36 | return nfs_ok; | 36 | return nfs_ok; |
37 | } | 37 | } |
38 | 38 | ||
39 | static int | ||
40 | nfsd_return_attrs(int err, struct nfsd_attrstat *resp) | ||
41 | { | ||
42 | if (err) return err; | ||
43 | return nfserrno(vfs_getattr(resp->fh.fh_export->ex_mnt, | ||
44 | resp->fh.fh_dentry, | ||
45 | &resp->stat)); | ||
46 | } | ||
47 | static int | ||
48 | nfsd_return_dirop(int err, struct nfsd_diropres *resp) | ||
49 | { | ||
50 | if (err) return err; | ||
51 | return nfserrno(vfs_getattr(resp->fh.fh_export->ex_mnt, | ||
52 | resp->fh.fh_dentry, | ||
53 | &resp->stat)); | ||
54 | } | ||
39 | /* | 55 | /* |
40 | * Get a file's attributes | 56 | * Get a file's attributes |
41 | * N.B. After this call resp->fh needs an fh_put | 57 | * N.B. After this call resp->fh needs an fh_put |
@@ -44,10 +60,12 @@ static int | |||
44 | nfsd_proc_getattr(struct svc_rqst *rqstp, struct nfsd_fhandle *argp, | 60 | nfsd_proc_getattr(struct svc_rqst *rqstp, struct nfsd_fhandle *argp, |
45 | struct nfsd_attrstat *resp) | 61 | struct nfsd_attrstat *resp) |
46 | { | 62 | { |
63 | int nfserr; | ||
47 | dprintk("nfsd: GETATTR %s\n", SVCFH_fmt(&argp->fh)); | 64 | dprintk("nfsd: GETATTR %s\n", SVCFH_fmt(&argp->fh)); |
48 | 65 | ||
49 | fh_copy(&resp->fh, &argp->fh); | 66 | fh_copy(&resp->fh, &argp->fh); |
50 | return fh_verify(rqstp, &resp->fh, 0, MAY_NOP); | 67 | nfserr = fh_verify(rqstp, &resp->fh, 0, MAY_NOP); |
68 | return nfsd_return_attrs(nfserr, resp); | ||
51 | } | 69 | } |
52 | 70 | ||
53 | /* | 71 | /* |
@@ -58,12 +76,14 @@ static int | |||
58 | nfsd_proc_setattr(struct svc_rqst *rqstp, struct nfsd_sattrargs *argp, | 76 | nfsd_proc_setattr(struct svc_rqst *rqstp, struct nfsd_sattrargs *argp, |
59 | struct nfsd_attrstat *resp) | 77 | struct nfsd_attrstat *resp) |
60 | { | 78 | { |
79 | int nfserr; | ||
61 | dprintk("nfsd: SETATTR %s, valid=%x, size=%ld\n", | 80 | dprintk("nfsd: SETATTR %s, valid=%x, size=%ld\n", |
62 | SVCFH_fmt(&argp->fh), | 81 | SVCFH_fmt(&argp->fh), |
63 | argp->attrs.ia_valid, (long) argp->attrs.ia_size); | 82 | argp->attrs.ia_valid, (long) argp->attrs.ia_size); |
64 | 83 | ||
65 | fh_copy(&resp->fh, &argp->fh); | 84 | fh_copy(&resp->fh, &argp->fh); |
66 | return nfsd_setattr(rqstp, &resp->fh, &argp->attrs,0, (time_t)0); | 85 | nfserr = nfsd_setattr(rqstp, &resp->fh, &argp->attrs,0, (time_t)0); |
86 | return nfsd_return_attrs(nfserr, resp); | ||
67 | } | 87 | } |
68 | 88 | ||
69 | /* | 89 | /* |
@@ -86,7 +106,7 @@ nfsd_proc_lookup(struct svc_rqst *rqstp, struct nfsd_diropargs *argp, | |||
86 | &resp->fh); | 106 | &resp->fh); |
87 | 107 | ||
88 | fh_put(&argp->fh); | 108 | fh_put(&argp->fh); |
89 | return nfserr; | 109 | return nfsd_return_dirop(nfserr, resp); |
90 | } | 110 | } |
91 | 111 | ||
92 | /* | 112 | /* |
@@ -142,7 +162,10 @@ nfsd_proc_read(struct svc_rqst *rqstp, struct nfsd_readargs *argp, | |||
142 | argp->vec, argp->vlen, | 162 | argp->vec, argp->vlen, |
143 | &resp->count); | 163 | &resp->count); |
144 | 164 | ||
145 | return nfserr; | 165 | if (nfserr) return nfserr; |
166 | return nfserrno(vfs_getattr(resp->fh.fh_export->ex_mnt, | ||
167 | resp->fh.fh_dentry, | ||
168 | &resp->stat)); | ||
146 | } | 169 | } |
147 | 170 | ||
148 | /* | 171 | /* |
@@ -165,7 +188,7 @@ nfsd_proc_write(struct svc_rqst *rqstp, struct nfsd_writeargs *argp, | |||
165 | argp->vec, argp->vlen, | 188 | argp->vec, argp->vlen, |
166 | argp->len, | 189 | argp->len, |
167 | &stable); | 190 | &stable); |
168 | return nfserr; | 191 | return nfsd_return_attrs(nfserr, resp); |
169 | } | 192 | } |
170 | 193 | ||
171 | /* | 194 | /* |
@@ -322,7 +345,7 @@ out_unlock: | |||
322 | 345 | ||
323 | done: | 346 | done: |
324 | fh_put(dirfhp); | 347 | fh_put(dirfhp); |
325 | return nfserr; | 348 | return nfsd_return_dirop(nfserr, resp); |
326 | } | 349 | } |
327 | 350 | ||
328 | static int | 351 | static int |
@@ -425,7 +448,7 @@ nfsd_proc_mkdir(struct svc_rqst *rqstp, struct nfsd_createargs *argp, | |||
425 | nfserr = nfsd_create(rqstp, &argp->fh, argp->name, argp->len, | 448 | nfserr = nfsd_create(rqstp, &argp->fh, argp->name, argp->len, |
426 | &argp->attrs, S_IFDIR, 0, &resp->fh); | 449 | &argp->attrs, S_IFDIR, 0, &resp->fh); |
427 | fh_put(&argp->fh); | 450 | fh_put(&argp->fh); |
428 | return nfserr; | 451 | return nfsd_return_dirop(nfserr, resp); |
429 | } | 452 | } |
430 | 453 | ||
431 | /* | 454 | /* |