lkml.org 
[lkml]   [2002]   [Nov]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] loop sendfile retval
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/

\
 
 \ /
  Last update: 2005-03-22 13:30    [from the cache]
©2003-2011 Jasper Spaans