Skip to content

Commit

Permalink
[PATCH] fuse: don't update file times
Browse files Browse the repository at this point in the history
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]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
szmi authored and Linus Torvalds committed Sep 9, 2005
1 parent 45323fb commit b36c31b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 2 additions & 0 deletions fs/fuse/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,7 @@ static int fuse_readdir(struct file *file, void *dstbuf, filldir_t filldir)
filldir);

__free_page(page);
fuse_invalidate_attr(inode); /* atime changed */
return err;
}

Expand Down Expand Up @@ -585,6 +586,7 @@ static char *read_link(struct dentry *dentry)
link[req->out.args[0].size] = '\0';
out:
fuse_put_request(fc, req);
fuse_invalidate_attr(inode); /* atime changed */
return link;
}

Expand Down
10 changes: 6 additions & 4 deletions fs/fuse/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ static int fuse_readpage(struct file *file, struct page *page)
fuse_put_request(fc, req);
if (!err)
SetPageUptodate(page);
fuse_invalidate_attr(inode); /* atime changed */
out:
unlock_page(page);
return err;
Expand Down Expand Up @@ -312,6 +313,7 @@ static int fuse_readpages(struct file *file, struct address_space *mapping,
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;
}

Expand Down Expand Up @@ -380,8 +382,8 @@ static int fuse_commit_write(struct file *file, struct page *page,
clear_page_dirty(page);
SetPageUptodate(page);
}
} else if (err == -EINTR || err == -EIO)
fuse_invalidate_attr(inode);
}
fuse_invalidate_attr(inode);
return err;
}

Expand Down Expand Up @@ -473,8 +475,8 @@ static ssize_t fuse_direct_io(struct file *file, const char __user *buf,
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;
}
Expand Down
1 change: 1 addition & 0 deletions fs/fuse/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ struct inode *fuse_iget(struct super_block *sb, unsigned long nodeid,
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);
Expand Down

0 comments on commit b36c31b

Please sign in to comment.