Skip to content

Commit

Permalink
fuse: move fuse_invalidate_attr() into fuse_update_ctime()
Browse files Browse the repository at this point in the history
Logically it belongs there since attributes are invalidated due to the
updated ctime.  This is a cleanup and should not change behavior.

Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
  • Loading branch information
Miklos Szeredi committed Oct 22, 2021
1 parent b5d9758 commit 371e8fd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
9 changes: 2 additions & 7 deletions fs/fuse/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -747,6 +747,7 @@ void fuse_flush_time_update(struct inode *inode)

void fuse_update_ctime(struct inode *inode)
{
fuse_invalidate_attr(inode);
if (!IS_NOCMTIME(inode)) {
inode->i_ctime = current_time(inode);
mark_inode_dirty_sync(inode);
Expand Down Expand Up @@ -784,7 +785,6 @@ static int fuse_unlink(struct inode *dir, struct dentry *entry)
if (inode->i_nlink > 0)
drop_nlink(inode);
spin_unlock(&fi->lock);
fuse_invalidate_attr(inode);
fuse_dir_changed(dir);
fuse_invalidate_entry_cache(entry);
fuse_update_ctime(inode);
Expand Down Expand Up @@ -841,21 +841,17 @@ static int fuse_rename_common(struct inode *olddir, struct dentry *oldent,
err = fuse_simple_request(fm, &args);
if (!err) {
/* ctime changes */
fuse_invalidate_attr(d_inode(oldent));
fuse_update_ctime(d_inode(oldent));

if (flags & RENAME_EXCHANGE) {
fuse_invalidate_attr(d_inode(newent));
if (flags & RENAME_EXCHANGE)
fuse_update_ctime(d_inode(newent));
}

fuse_dir_changed(olddir);
if (olddir != newdir)
fuse_dir_changed(newdir);

/* newent will end up negative */
if (!(flags & RENAME_EXCHANGE) && d_really_is_positive(newent)) {
fuse_invalidate_attr(d_inode(newent));
fuse_invalidate_entry_cache(newent);
fuse_update_ctime(d_inode(newent));
}
Expand Down Expand Up @@ -938,7 +934,6 @@ static int fuse_link(struct dentry *entry, struct inode *newdir,
if (likely(inode->i_nlink < UINT_MAX))
inc_nlink(inode);
spin_unlock(&fi->lock);
fuse_invalidate_attr(inode);
fuse_update_ctime(inode);
} else if (err == -EINTR) {
fuse_invalidate_attr(inode);
Expand Down
10 changes: 4 additions & 6 deletions fs/fuse/xattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,9 @@ int fuse_setxattr(struct inode *inode, const char *name, const void *value,
fm->fc->no_setxattr = 1;
err = -EOPNOTSUPP;
}
if (!err) {
fuse_invalidate_attr(inode);
if (!err)
fuse_update_ctime(inode);
}

return err;
}

Expand Down Expand Up @@ -173,10 +172,9 @@ int fuse_removexattr(struct inode *inode, const char *name)
fm->fc->no_removexattr = 1;
err = -EOPNOTSUPP;
}
if (!err) {
fuse_invalidate_attr(inode);
if (!err)
fuse_update_ctime(inode);
}

return err;
}

Expand Down

0 comments on commit 371e8fd

Please sign in to comment.