Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 321679
b: refs/heads/master
c: eed2179
h: refs/heads/master
i:
  321677: a498498
  321675: fb9ac02
  321671: 5003416
  321663: a7b5d5d
v: v3
  • Loading branch information
Brian Foster authored and Miklos Szeredi committed Jul 18, 2012
1 parent 0acd706 commit d797f11
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 72d0d248ca8232dbd30d35b42d0d86e39b3e322b
refs/heads/master: eed2179efe1aac145bf6d54b925b750976380fa6
27 changes: 24 additions & 3 deletions trunk/fs/fuse/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,22 +197,43 @@ void fuse_change_attributes(struct inode *inode, struct fuse_attr *attr,
struct fuse_conn *fc = get_fuse_conn(inode);
struct fuse_inode *fi = get_fuse_inode(inode);
loff_t oldsize;
struct timespec old_mtime;

spin_lock(&fc->lock);
if (attr_version != 0 && fi->attr_version > attr_version) {
spin_unlock(&fc->lock);
return;
}

old_mtime = inode->i_mtime;
fuse_change_attributes_common(inode, attr, attr_valid);

oldsize = inode->i_size;
i_size_write(inode, attr->size);
spin_unlock(&fc->lock);

if (S_ISREG(inode->i_mode) && oldsize != attr->size) {
truncate_pagecache(inode, oldsize, attr->size);
invalidate_inode_pages2(inode->i_mapping);
if (S_ISREG(inode->i_mode)) {
bool inval = false;

if (oldsize != attr->size) {
truncate_pagecache(inode, oldsize, attr->size);
inval = true;
} else if (fc->auto_inval_data) {
struct timespec new_mtime = {
.tv_sec = attr->mtime,
.tv_nsec = attr->mtimensec,
};

/*
* Auto inval mode also checks and invalidates if mtime
* has changed.
*/
if (!timespec_equal(&old_mtime, &new_mtime))
inval = true;
}

if (inval)
invalidate_inode_pages2(inode->i_mapping);
}
}

Expand Down

0 comments on commit d797f11

Please sign in to comment.