]> Zhao Yanbai Git Server - minix.git/commitdiff
Fix another bug related to trying i/o more than once
authorBen Gras <ben@minix3.org>
Wed, 28 Jun 2006 12:20:30 +0000 (12:20 +0000)
committerBen Gras <ben@minix3.org>
Wed, 28 Jun 2006 12:20:30 +0000 (12:20 +0000)
servers/fs/device.c

index 4c08530559f6fa06fc73597d2ba8a4b3db2bcb51..914fd233b6815eabef088d5ed512d5c3182a3887 100644 (file)
@@ -177,6 +177,7 @@ off_t *pos;
        int access = 0, size;
        int j;
        iovec_t *v;
+       static iovec_t new_iovec[NR_IOREQS];
 
        /* Number of grants allocated in vector I/O. */
        *vec_grants = 0;
@@ -204,9 +205,9 @@ off_t *pos;
                        /* Change to safe op. */
                        *op = *op == DEV_GATHER ? DEV_GATHER_S : DEV_SCATTER_S;
 
-                       /* Grant access to i/o vector. */
+                       /* Grant access to my new i/o vector. */
                        if((*gid = cpf_grant_direct(driver, (vir_bytes)
-                         buf, bytes * sizeof(iovec_t),
+                         new_iovec, bytes * sizeof(iovec_t),
                          CPF_READ | CPF_WRITE)) < 0) {
                                panic(__FILE__,
                                "cpf_grant_direct of vector failed", NO_NUM);
@@ -214,7 +215,7 @@ off_t *pos;
                        v = (iovec_t *) buf;
                        /* Grant access to i/o buffers. */
                        for(j = 0; j < bytes; j++) {
-                          gids[j] = v[j].iov_addr =
+                          new_iovec[j].iov_addr = gids[j] =
                             cpf_grant_direct(driver, (vir_bytes)
                             v[j].iov_addr, v[j].iov_size,
                             *op == DEV_GATHER_S ? CPF_WRITE : CPF_READ);
@@ -222,6 +223,7 @@ off_t *pos;
                                panic(__FILE__, "grant to iovec buf failed",
                                 NO_NUM);
                           }
+                          new_iovec[j].iov_size = v[j].iov_size;
                           (*vec_grants)++;
                        }
                        break;