fix large read bug
authorMiklos Szeredi <miklos@szeredi.hu>
Tue, 6 Jul 2004 18:37:37 +0000 (18:37 +0000)
committerMiklos Szeredi <miklos@szeredi.hu>
Tue, 6 Jul 2004 18:37:37 +0000 (18:37 +0000)
ChangeLog
kernel/file.c

index 2c9298701b16380d3461bbe9a4700f7e5fefab79..37ebbdcc60a6514cb5e717049ce23d77fcbd7cd5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,9 @@
        if FORGET was received earlier than the last RELEASE (bug found
        with the LTP test-suite)
 
+       * Fix file corruption in case of bigread option. (bug found with
+       LTP)
+
        * Minor fix in read:  print debug info even if read size is zero
 
 2004-07-04  Miklos Szeredi <mszeredi@inf.bme.hu>
index 13c96ae17b2cecb435c8127a40fa948284ed1462..eaed13e061b9518cd39016eebf53f669dd6bdc99 100644 (file)
@@ -321,8 +321,12 @@ static ssize_t fuse_file_read(struct file *filp, char *buf,
        struct inode *inode = mapping->host;
        struct fuse_conn *fc = INO_FC(inode);
 
-       if(fc->flags & FUSE_LARGE_READ)
+       if(fc->flags & FUSE_LARGE_READ) {
+               /* Don't allow this to get mixed up with writes */
+               down(&inode->i_sem);
                fuse_file_bigread(mapping, inode, *ppos, count);
+               up(&inode->i_sem);
+       }
 
        return generic_file_read(filp, buf, count, ppos);
 }