Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 70757
b: refs/heads/master
c: ebc14c4
h: refs/heads/master
i:
  70755: 3351dfe
v: v3
  • Loading branch information
Miklos Szeredi authored and Linus Torvalds committed Oct 17, 2007
1 parent 8a70dfe commit 066ac19
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 3 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: 244f6385c2891e366a7de5f6746ccc257efd8952
refs/heads/master: ebc14c4dbeb56195950058db9aa32de06c22de0d
4 changes: 3 additions & 1 deletion trunk/fs/fuse/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -1054,8 +1054,10 @@ static int fuse_getattr(struct vfsmount *mnt, struct dentry *entry,
if (fi->i_time < get_jiffies_64())
err = fuse_do_getattr(inode);

if (!err)
if (!err) {
generic_fillattr(inode, stat);
stat->mode = fi->orig_i_mode;
}

return err;
}
Expand Down
4 changes: 4 additions & 0 deletions trunk/fs/fuse/fuse_i.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ struct fuse_inode {

/** Time in jiffies until the file attributes are valid */
u64 i_time;

/** The sticky bit in inode->i_mode may have been removed, so
preserve the original mode */
mode_t orig_i_mode;
};

/** FUSE specific file data */
Expand Down
12 changes: 11 additions & 1 deletion trunk/fs/fuse/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,11 @@ static void fuse_truncate(struct address_space *mapping, loff_t offset)
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;

inode->i_ino = attr->ino;
inode->i_mode = (inode->i_mode & S_IFMT) + (attr->mode & 07777);
inode->i_mode = (inode->i_mode & S_IFMT) | (attr->mode & 07777);
inode->i_nlink = attr->nlink;
inode->i_uid = attr->uid;
inode->i_gid = attr->gid;
Expand All @@ -135,6 +136,15 @@ void fuse_change_attributes(struct inode *inode, struct fuse_attr *attr)
inode->i_ctime.tv_sec = attr->ctime;
inode->i_ctime.tv_nsec = attr->ctimensec;

/*
* Don't set the sticky bit in i_mode, unless we want the VFS
* to check permissions. This prevents failures due to the
* check in may_delete().
*/
fi->orig_i_mode = inode->i_mode;
if (!(fc->flags & FUSE_DEFAULT_PERMISSIONS))
inode->i_mode &= ~S_ISVTX;

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

0 comments on commit 066ac19

Please sign in to comment.