Don't change mtime/ctime/atime to local time on read/write. Rather
invalidate file attributes, so next stat() will force a GETATTR call.
Bug reported by Ben Grimm.
Signed-off-by: Miklos Szeredi <[email protected]>
diff -rup linux-2.6.13-rc3-mm3/fs/fuse/dir.c linux-fuse/fs/fuse/dir.c
--- linux-2.6.13-rc3-mm3/fs/fuse/dir.c 2005-07-29 10:56:57.000000000 +0200
+++ linux-fuse/fs/fuse/dir.c 2005-07-29 10:36:59.000000000 +0200
@@ -552,6 +552,7 @@ static int fuse_readdir(struct file *fil
filldir);
__free_page(page);
+ fuse_invalidate_attr(inode); /* atime changed */
return err;
}
@@ -585,6 +586,7 @@ static char *read_link(struct dentry *de
link[req->out.args[0].size] = '\0';
out:
fuse_put_request(fc, req);
+ fuse_invalidate_attr(inode); /* atime changed */
return link;
}
diff -rup linux-2.6.13-rc3-mm3/fs/fuse/file.c linux-fuse/fs/fuse/file.c
--- linux-2.6.13-rc3-mm3/fs/fuse/file.c 2005-07-29 10:56:57.000000000 +0200
+++ linux-fuse/fs/fuse/file.c 2005-07-29 10:36:59.000000000 +0200
@@ -240,6 +240,7 @@ static int fuse_readpage(struct file *fi
fuse_put_request(fc, req);
if (!err)
SetPageUptodate(page);
+ fuse_invalidate_attr(inode); /* atime changed */
out:
unlock_page(page);
return err;
@@ -308,6 +309,7 @@ static int fuse_readpages(struct file *f
if (!err && data.req->num_pages)
err = fuse_send_readpages(data.req, file, inode);
fuse_put_request(fc, data.req);
+ fuse_invalidate_attr(inode); /* atime changed */
return err;
}
@@ -376,8 +378,8 @@ static int fuse_commit_write(struct file
clear_page_dirty(page);
SetPageUptodate(page);
}
- } else if (err == -EINTR || err == -EIO)
- fuse_invalidate_attr(inode);
+ }
+ fuse_invalidate_attr(inode);
return err;
}
@@ -469,8 +471,8 @@ static ssize_t fuse_direct_io(struct fil
if (write && pos > i_size_read(inode))
i_size_write(inode, pos);
*ppos = pos;
- } else if (write && (res == -EINTR || res == -EIO))
- fuse_invalidate_attr(inode);
+ }
+ fuse_invalidate_attr(inode);
return res;
}
diff -rup linux-2.6.13-rc3-mm3/fs/fuse/inode.c linux-fuse/fs/fuse/inode.c
--- linux-2.6.13-rc3-mm3/fs/fuse/inode.c 2005-07-29 11:01:10.000000000 +0200
+++ linux-fuse/fs/fuse/inode.c 2005-07-29 10:36:59.000000000 +0200
@@ -169,6 +173,7 @@ struct inode *fuse_iget(struct super_blo
return NULL;
if ((inode->i_state & I_NEW)) {
+ inode->i_flags |= S_NOATIME|S_NOCMTIME;
inode->i_generation = generation;
inode->i_data.backing_dev_info = &fc->bdi;
fuse_init_inode(inode, attr);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
|
|