Commit ff1b89f3 authored by Miklos Szeredi's avatar Miklos Szeredi

fuse: honor AT_STATX_DONT_SYNC

The description of this flag says "Don't sync attributes with the server".
In other words: always use the attributes cached in the kernel and don't
send network or local messages to refresh the attributes.
Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
parent 73f03c2b
...@@ -924,12 +924,13 @@ static int fuse_do_getattr(struct inode *inode, struct kstat *stat, ...@@ -924,12 +924,13 @@ static int fuse_do_getattr(struct inode *inode, struct kstat *stat,
} }
static int fuse_update_get_attr(struct inode *inode, struct file *file, static int fuse_update_get_attr(struct inode *inode, struct file *file,
struct kstat *stat) struct kstat *stat, unsigned int flags)
{ {
struct fuse_inode *fi = get_fuse_inode(inode); struct fuse_inode *fi = get_fuse_inode(inode);
int err = 0; int err = 0;
if (time_before64(fi->i_time, get_jiffies_64())) { if (!(flags & AT_STATX_DONT_SYNC) &&
time_before64(fi->i_time, get_jiffies_64())) {
forget_all_cached_acls(inode); forget_all_cached_acls(inode);
err = fuse_do_getattr(inode, stat, file); err = fuse_do_getattr(inode, stat, file);
} else if (stat) { } else if (stat) {
...@@ -943,7 +944,7 @@ static int fuse_update_get_attr(struct inode *inode, struct file *file, ...@@ -943,7 +944,7 @@ static int fuse_update_get_attr(struct inode *inode, struct file *file,
int fuse_update_attributes(struct inode *inode, struct file *file) int fuse_update_attributes(struct inode *inode, struct file *file)
{ {
return fuse_update_get_attr(inode, file, NULL); return fuse_update_get_attr(inode, file, NULL, 0);
} }
int fuse_reverse_inval_entry(struct super_block *sb, u64 parent_nodeid, int fuse_reverse_inval_entry(struct super_block *sb, u64 parent_nodeid,
...@@ -1794,7 +1795,7 @@ static int fuse_getattr(const struct path *path, struct kstat *stat, ...@@ -1794,7 +1795,7 @@ static int fuse_getattr(const struct path *path, struct kstat *stat,
if (!fuse_allow_current_process(fc)) if (!fuse_allow_current_process(fc))
return -EACCES; return -EACCES;
return fuse_update_get_attr(inode, NULL, stat); return fuse_update_get_attr(inode, NULL, stat, flags);
} }
static const struct inode_operations fuse_dir_inode_operations = { static const struct inode_operations fuse_dir_inode_operations = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment