hc
2024-05-10 10ebd8556b7990499c896a550e3d416b444211e6
kernel/fs/orangefs/acl.c
....@@ -122,6 +122,8 @@
122122 struct iattr iattr;
123123 int rc;
124124
125
+ memset(&iattr, 0, sizeof iattr);
126
+
125127 if (type == ACL_TYPE_ACCESS && acl) {
126128 /*
127129 * posix_acl_update_mode checks to see if the permissions
....@@ -138,18 +140,17 @@
138140 return error;
139141 }
140142
141
- if (acl) {
142
- rc = __orangefs_set_acl(inode, acl, type);
143
- } else {
143
+ if (inode->i_mode != iattr.ia_mode)
144144 iattr.ia_valid = ATTR_MODE;
145
- rc = orangefs_inode_setattr(inode, &iattr);
146
- }
147145
148
- return rc;
149
-
150
- } else {
151
- return -EINVAL;
152146 }
147
+
148
+ rc = __orangefs_set_acl(inode, acl, type);
149
+
150
+ if (!rc && (iattr.ia_valid == ATTR_MODE))
151
+ rc = __orangefs_setattr(inode, &iattr);
152
+
153
+ return rc;
153154 }
154155
155156 int orangefs_init_acl(struct inode *inode, struct inode *dir)
....@@ -167,12 +168,16 @@
167168 error = __orangefs_set_acl(inode, default_acl,
168169 ACL_TYPE_DEFAULT);
169170 posix_acl_release(default_acl);
171
+ } else {
172
+ inode->i_default_acl = NULL;
170173 }
171174
172175 if (acl) {
173176 if (!error)
174177 error = __orangefs_set_acl(inode, acl, ACL_TYPE_ACCESS);
175178 posix_acl_release(acl);
179
+ } else {
180
+ inode->i_acl = NULL;
176181 }
177182
178183 /* If mode of the inode was changed, then do a forcible ->setattr */
....@@ -181,7 +186,7 @@
181186 inode->i_mode = mode;
182187 iattr.ia_mode = mode;
183188 iattr.ia_valid |= ATTR_MODE;
184
- orangefs_inode_setattr(inode, &iattr);
189
+ __orangefs_setattr(inode, &iattr);
185190 }
186191
187192 return error;