summaryrefslogtreecommitdiffstats
path: root/fs/fuse/dir.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/fuse/dir.c')
-rw-r--r--fs/fuse/dir.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index d572c900bb0f..54d638f9ba1c 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -405,7 +405,8 @@ static struct dentry *fuse_lookup(struct inode *dir, struct dentry *entry,
405 else 405 else
406 fuse_invalidate_entry_cache(entry); 406 fuse_invalidate_entry_cache(entry);
407 407
408 fuse_advise_use_readdirplus(dir); 408 if (inode)
409 fuse_advise_use_readdirplus(dir);
409 return newent; 410 return newent;
410 411
411 out_iput: 412 out_iput:
@@ -1521,6 +1522,19 @@ int fuse_do_setattr(struct dentry *dentry, struct iattr *attr,
1521 is_truncate = true; 1522 is_truncate = true;
1522 } 1523 }
1523 1524
1525 /* Flush dirty data/metadata before non-truncate SETATTR */
1526 if (is_wb && S_ISREG(inode->i_mode) &&
1527 attr->ia_valid &
1528 (ATTR_MODE | ATTR_UID | ATTR_GID | ATTR_MTIME_SET |
1529 ATTR_TIMES_SET)) {
1530 err = write_inode_now(inode, true);
1531 if (err)
1532 return err;
1533
1534 fuse_set_nowrite(inode);
1535 fuse_release_nowrite(inode);
1536 }
1537
1524 if (is_truncate) { 1538 if (is_truncate) {
1525 fuse_set_nowrite(inode); 1539 fuse_set_nowrite(inode);
1526 set_bit(FUSE_I_SIZE_UNSTABLE, &fi->state); 1540 set_bit(FUSE_I_SIZE_UNSTABLE, &fi->state);