summaryrefslogtreecommitdiff
path: root/fs/orangefs/inode.c
diff options
context:
space:
mode:
authorChristian Brauner <brauner@kernel.org>2022-11-13 00:36:42 +0300
committerChristian Brauner (Microsoft) <brauner@kernel.org>2022-11-13 12:27:52 +0300
commite40df4281b86d5f7c1615dd9eda597675340a8d3 (patch)
tree0bdc81c2b072f095ed0d9cf00e3fc5155a7658a7 /fs/orangefs/inode.c
parent5b52aebef8954cadff29918bb61d7fdc7be07837 (diff)
downloadlinux-e40df4281b86d5f7c1615dd9eda597675340a8d3.tar.xz
orangefs: fix mode handling
In 4053d2500beb ("orangefs: rework posix acl handling when creating new filesystem objects") we tried to precalculate the correct mode when creating a new inode. However, this leads to regressions when creating new filesystem objects. Even if we precalculate the mode we still need to call __orangefs_setattr() to perform additional checks and we also need to update the mode of ACL_TYPE_ACCESS acls set on the inode. The patch referenced above regressed that. Restore that part of the old behavior and remove the mode precalculation as it doesn't get us anything anymore. Fixes: 4053d2500beb ("orangefs: rework posix acl handling when creating new filesystem objects") Reported-by: Mike Marshall <hubcap@omnibond.com> Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>
Diffstat (limited to 'fs/orangefs/inode.c')
-rw-r--r--fs/orangefs/inode.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/fs/orangefs/inode.c b/fs/orangefs/inode.c
index 8974b0fbf00d..3d65accfae17 100644
--- a/fs/orangefs/inode.c
+++ b/fs/orangefs/inode.c
@@ -1131,7 +1131,7 @@ struct inode *orangefs_new_inode(struct super_block *sb, struct inode *dir,
orangefs_set_inode(inode, ref);
inode->i_ino = hash; /* needed for stat etc */
- error = __orangefs_inode_getattr(inode, mode, ORANGEFS_GETATTR_NEW);
+ error = orangefs_inode_getattr(inode, ORANGEFS_GETATTR_NEW);
if (error)
goto out_iput;
@@ -1158,6 +1158,15 @@ struct inode *orangefs_new_inode(struct super_block *sb, struct inode *dir,
gossip_debug(GOSSIP_INODE_DEBUG,
"Initializing ACL's for inode %pU\n",
get_khandle_from_ino(inode));
+ if (mode != inode->i_mode) {
+ struct iattr iattr = {
+ .ia_mode = mode,
+ .ia_valid = ATTR_MODE,
+ };
+ inode->i_mode = mode;
+ __orangefs_setattr(inode, &iattr);
+ __posix_acl_chmod(&acl, GFP_KERNEL, inode->i_mode);
+ }
posix_acl_release(acl);
posix_acl_release(default_acl);
return inode;