[PATCH] loop sendfile retval

From: Hugh Dickins (hugh@veritas.com)
Date: Mon Nov 11 2002 - 11:38:13 EST


Buffer I/O error on device loop: its use of sendfile is (trivially)
broken - retval is usually count done, only an error when negative.
Nearby spinlocking clearly bogus, delete instead of remarking on it.

Hugh

--- 2.5.47/drivers/block/loop.c Mon Nov 11 12:34:14 2002
+++ linux/drivers/block/loop.c Mon Nov 11 15:44:33 2002
@@ -304,21 +304,16 @@
 {
         struct lo_read_data cookie;
         struct file *file;
- int error;
+ int retval;
 
         cookie.lo = lo;
         cookie.data = kmap(bvec->bv_page) + bvec->bv_offset;
         cookie.bsize = bsize;
-
- /* umm, what does this lock actually try to protect? */
- spin_lock_irq(&lo->lo_lock);
         file = lo->lo_backing_file;
- spin_unlock_irq(&lo->lo_lock);
-
- error = file->f_op->sendfile(file, &pos, bvec->bv_len,
+ retval = file->f_op->sendfile(file, &pos, bvec->bv_len,
                         lo_read_actor, &cookie);
         kunmap(bvec->bv_page);
- return error;
+ return (retval < 0)? retval: 0;
 }
 
 static int

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Fri Nov 15 2002 - 22:00:22 EST