posix_acl: Clear SGID bit when setting file permissions
[linux-2.6-microblaze.git] / fs / orangefs / acl.c
index 28f2195..7a37544 100644 (file)
@@ -73,14 +73,11 @@ int orangefs_set_acl(struct inode *inode, struct posix_acl *acl, int type)
        case ACL_TYPE_ACCESS:
                name = XATTR_NAME_POSIX_ACL_ACCESS;
                if (acl) {
-                       umode_t mode = inode->i_mode;
-                       /*
-                        * can we represent this with the traditional file
-                        * mode permission bits?
-                        */
-                       error = posix_acl_equiv_mode(acl, &mode);
-                       if (error < 0) {
-                               gossip_err("%s: posix_acl_equiv_mode err: %d\n",
+                       umode_t mode;
+
+                       error = posix_acl_update_mode(inode, &mode, &acl);
+                       if (error) {
+                               gossip_err("%s: posix_acl_update_mode err: %d\n",
                                           __func__,
                                           error);
                                return error;
@@ -90,8 +87,6 @@ int orangefs_set_acl(struct inode *inode, struct posix_acl *acl, int type)
                                SetModeFlag(orangefs_inode);
                        inode->i_mode = mode;
                        mark_inode_dirty_sync(inode);
-                       if (error == 0)
-                               acl = NULL;
                }
                break;
        case ACL_TYPE_DEFAULT: