diff options
author | Jan Harkes <jaharkes@cs.cmu.edu> | 2007-07-19 04:48:48 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-19 13:04:48 -0400 |
commit | 970648eb03cca7d7405f9a3a5d3fe29929e48aa6 (patch) | |
tree | 17553f81097b3a29214c9b9535609fc45b6f98bf /fs | |
parent | 37461e1957e6262278342a0c1a78e46996b7ff88 (diff) |
coda: ignore returned values when upcalls return errors
Venus returns an ENOENT error on open, so we shouldn't try to grab the
filehandle for the returned fd.
Signed-off-by: Jan Harkes <jaharkes@cs.cmu.edu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/coda/upcall.c | 59 |
1 files changed, 27 insertions, 32 deletions
diff --git a/fs/coda/upcall.c b/fs/coda/upcall.c index 330de7dbdcf8..097dbb2fd6f5 100644 --- a/fs/coda/upcall.c +++ b/fs/coda/upcall.c | |||
@@ -84,12 +84,8 @@ int venus_rootfid(struct super_block *sb, struct CodaFid *fidp) | |||
84 | UPARG(CODA_ROOT); | 84 | UPARG(CODA_ROOT); |
85 | 85 | ||
86 | error = coda_upcall(coda_sbp(sb), insize, &outsize, inp); | 86 | error = coda_upcall(coda_sbp(sb), insize, &outsize, inp); |
87 | 87 | if (!error) | |
88 | if (error) { | ||
89 | printk("coda_get_rootfid: error %d\n", error); | ||
90 | } else { | ||
91 | *fidp = outp->coda_root.VFid; | 88 | *fidp = outp->coda_root.VFid; |
92 | } | ||
93 | 89 | ||
94 | CODA_FREE(inp, insize); | 90 | CODA_FREE(inp, insize); |
95 | return error; | 91 | return error; |
@@ -106,9 +102,9 @@ int venus_getattr(struct super_block *sb, struct CodaFid *fid, | |||
106 | UPARG(CODA_GETATTR); | 102 | UPARG(CODA_GETATTR); |
107 | inp->coda_getattr.VFid = *fid; | 103 | inp->coda_getattr.VFid = *fid; |
108 | 104 | ||
109 | error = coda_upcall(coda_sbp(sb), insize, &outsize, inp); | 105 | error = coda_upcall(coda_sbp(sb), insize, &outsize, inp); |
110 | 106 | if (!error) | |
111 | *attr = outp->coda_getattr.attr; | 107 | *attr = outp->coda_getattr.attr; |
112 | 108 | ||
113 | CODA_FREE(inp, insize); | 109 | CODA_FREE(inp, insize); |
114 | return error; | 110 | return error; |
@@ -153,10 +149,11 @@ int venus_lookup(struct super_block *sb, struct CodaFid *fid, | |||
153 | memcpy((char *)(inp) + offset, name, length); | 149 | memcpy((char *)(inp) + offset, name, length); |
154 | *((char *)inp + offset + length) = '\0'; | 150 | *((char *)inp + offset + length) = '\0'; |
155 | 151 | ||
156 | error = coda_upcall(coda_sbp(sb), insize, &outsize, inp); | 152 | error = coda_upcall(coda_sbp(sb), insize, &outsize, inp); |
157 | 153 | if (!error) { | |
158 | *resfid = outp->coda_lookup.VFid; | 154 | *resfid = outp->coda_lookup.VFid; |
159 | *type = outp->coda_lookup.vtype; | 155 | *type = outp->coda_lookup.vtype; |
156 | } | ||
160 | 157 | ||
161 | CODA_FREE(inp, insize); | 158 | CODA_FREE(inp, insize); |
162 | return error; | 159 | return error; |
@@ -278,11 +275,12 @@ int venus_mkdir(struct super_block *sb, struct CodaFid *dirfid, | |||
278 | /* Venus must get null terminated string */ | 275 | /* Venus must get null terminated string */ |
279 | memcpy((char *)(inp) + offset, name, length); | 276 | memcpy((char *)(inp) + offset, name, length); |
280 | *((char *)inp + offset + length) = '\0'; | 277 | *((char *)inp + offset + length) = '\0'; |
281 | |||
282 | error = coda_upcall(coda_sbp(sb), insize, &outsize, inp); | ||
283 | 278 | ||
284 | *attrs = outp->coda_mkdir.attr; | 279 | error = coda_upcall(coda_sbp(sb), insize, &outsize, inp); |
285 | *newfid = outp->coda_mkdir.VFid; | 280 | if (!error) { |
281 | *attrs = outp->coda_mkdir.attr; | ||
282 | *newfid = outp->coda_mkdir.VFid; | ||
283 | } | ||
286 | 284 | ||
287 | CODA_FREE(inp, insize); | 285 | CODA_FREE(inp, insize); |
288 | return error; | 286 | return error; |
@@ -348,11 +346,12 @@ int venus_create(struct super_block *sb, struct CodaFid *dirfid, | |||
348 | /* Venus must get null terminated string */ | 346 | /* Venus must get null terminated string */ |
349 | memcpy((char *)(inp) + offset, name, length); | 347 | memcpy((char *)(inp) + offset, name, length); |
350 | *((char *)inp + offset + length) = '\0'; | 348 | *((char *)inp + offset + length) = '\0'; |
351 | |||
352 | error = coda_upcall(coda_sbp(sb), insize, &outsize, inp); | ||
353 | 349 | ||
354 | *attrs = outp->coda_create.attr; | 350 | error = coda_upcall(coda_sbp(sb), insize, &outsize, inp); |
355 | *newfid = outp->coda_create.VFid; | 351 | if (!error) { |
352 | *attrs = outp->coda_create.attr; | ||
353 | *newfid = outp->coda_create.VFid; | ||
354 | } | ||
356 | 355 | ||
357 | CODA_FREE(inp, insize); | 356 | CODA_FREE(inp, insize); |
358 | return error; | 357 | return error; |
@@ -417,19 +416,18 @@ int venus_readlink(struct super_block *sb, struct CodaFid *fid, | |||
417 | UPARG(CODA_READLINK); | 416 | UPARG(CODA_READLINK); |
418 | 417 | ||
419 | inp->coda_readlink.VFid = *fid; | 418 | inp->coda_readlink.VFid = *fid; |
420 | 419 | ||
421 | error = coda_upcall(coda_sbp(sb), insize, &outsize, inp); | 420 | error = coda_upcall(coda_sbp(sb), insize, &outsize, inp); |
422 | 421 | if (!error) { | |
423 | if (! error) { | 422 | retlen = outp->coda_readlink.count; |
424 | retlen = outp->coda_readlink.count; | ||
425 | if ( retlen > *length ) | 423 | if ( retlen > *length ) |
426 | retlen = *length; | 424 | retlen = *length; |
427 | *length = retlen; | 425 | *length = retlen; |
428 | result = (char *)outp + (long)outp->coda_readlink.data; | 426 | result = (char *)outp + (long)outp->coda_readlink.data; |
429 | memcpy(buffer, result, retlen); | 427 | memcpy(buffer, result, retlen); |
430 | *(buffer + retlen) = '\0'; | 428 | *(buffer + retlen) = '\0'; |
431 | } | 429 | } |
432 | 430 | ||
433 | CODA_FREE(inp, insize); | 431 | CODA_FREE(inp, insize); |
434 | return error; | 432 | return error; |
435 | } | 433 | } |
@@ -617,16 +615,13 @@ int venus_statfs(struct dentry *dentry, struct kstatfs *sfs) | |||
617 | insize = max_t(unsigned int, INSIZE(statfs), OUTSIZE(statfs)); | 615 | insize = max_t(unsigned int, INSIZE(statfs), OUTSIZE(statfs)); |
618 | UPARG(CODA_STATFS); | 616 | UPARG(CODA_STATFS); |
619 | 617 | ||
620 | error = coda_upcall(coda_sbp(dentry->d_sb), insize, &outsize, inp); | 618 | error = coda_upcall(coda_sbp(dentry->d_sb), insize, &outsize, inp); |
621 | 619 | if (!error) { | |
622 | if (!error) { | ||
623 | sfs->f_blocks = outp->coda_statfs.stat.f_blocks; | 620 | sfs->f_blocks = outp->coda_statfs.stat.f_blocks; |
624 | sfs->f_bfree = outp->coda_statfs.stat.f_bfree; | 621 | sfs->f_bfree = outp->coda_statfs.stat.f_bfree; |
625 | sfs->f_bavail = outp->coda_statfs.stat.f_bavail; | 622 | sfs->f_bavail = outp->coda_statfs.stat.f_bavail; |
626 | sfs->f_files = outp->coda_statfs.stat.f_files; | 623 | sfs->f_files = outp->coda_statfs.stat.f_files; |
627 | sfs->f_ffree = outp->coda_statfs.stat.f_ffree; | 624 | sfs->f_ffree = outp->coda_statfs.stat.f_ffree; |
628 | } else { | ||
629 | printk("coda_statfs: Venus returns: %d\n", error); | ||
630 | } | 625 | } |
631 | 626 | ||
632 | CODA_FREE(inp, insize); | 627 | CODA_FREE(inp, insize); |