linux-handle-short-reads-gracefully-20040504
authorNathan Neulinger <nneul@umr.edu>
Tue, 4 May 2004 10:31:55 +0000 (10:31 +0000)
committerNickolai Zeldovich <kolya@mit.edu>
Tue, 4 May 2004 10:31:55 +0000 (10:31 +0000)
break out of the read loop with EIO if we've reached EOF,
rather than looping forever hoping the file will grow.

src/afs/LINUX/osi_misc.c

index 135429b..8a62d08 100644 (file)
@@ -198,6 +198,13 @@ osi_file_uio_rdwr(struct osi_file *osifile, uio_t * uiop, int rw)
        if (code < 0) {
            code = -code;
            break;
+       } else if (code == 0) {
+           /*
+            * This is bad -- we can't read any more data from the
+            * file, but we have no good way of signaling a partial
+            * read either.
+           code = EIO;
+           break;
        }
 
        iov->iov_base += code;