diff options
Diffstat (limited to 'fs/attr.c')
-rw-r--r-- | fs/attr.c | 23 |
1 files changed, 13 insertions, 10 deletions
@@ -41,8 +41,8 @@ int inode_change_ok(struct inode *inode, struct iattr *attr) if ((current->fsuid != inode->i_uid) && !fsuser()) goto error; /* Also check the setgid bit! */ - if (!fsuser() && !in_group_p((ia_valid & ATTR_GID) ? attr->ia_gid : - inode->i_gid)) + if (!in_group_p((ia_valid & ATTR_GID) ? attr->ia_gid : + inode->i_gid) && !fsuser()) attr->ia_mode &= ~S_ISGID; } @@ -75,14 +75,15 @@ void inode_setattr(struct inode * inode, struct iattr * attr) inode->i_ctime = attr->ia_ctime; if (ia_valid & ATTR_MODE) { inode->i_mode = attr->ia_mode; - if (!fsuser() && !in_group_p(inode->i_gid)) + if (!in_group_p(inode->i_gid) && !fsuser()) inode->i_mode &= ~S_ISGID; } mark_inode_dirty(inode); } -int notify_change(struct inode * inode, struct iattr * attr) +int notify_change(struct dentry * dentry, struct iattr * attr) { + struct inode *inode = dentry->d_inode; int error; time_t now = CURRENT_TIME; unsigned int ia_valid = attr->ia_valid; @@ -93,11 +94,13 @@ int notify_change(struct inode * inode, struct iattr * attr) if (!(ia_valid & ATTR_MTIME_SET)) attr->ia_mtime = now; - if (inode->i_sb && inode->i_sb->s_op && inode->i_sb->s_op->notify_change) - return inode->i_sb->s_op->notify_change(inode, attr); - - error = inode_change_ok(inode, attr); - if (!error) - inode_setattr(inode, attr); + if (inode->i_sb && inode->i_sb->s_op && + inode->i_sb->s_op->notify_change) + error = inode->i_sb->s_op->notify_change(dentry, attr); + else { + error = inode_change_ok(inode, attr); + if (!error) + inode_setattr(inode, attr); + } return error; } |