| .. | .. | 
|---|
| 122 | 122 | struct iattr iattr; | 
|---|
| 123 | 123 | int rc; | 
|---|
| 124 | 124 |  | 
|---|
|  | 125 | +	memset(&iattr, 0, sizeof iattr); | 
|---|
|  | 126 | + | 
|---|
| 125 | 127 | if (type == ACL_TYPE_ACCESS && acl) { | 
|---|
| 126 | 128 | /* | 
|---|
| 127 | 129 | * posix_acl_update_mode checks to see if the permissions | 
|---|
| .. | .. | 
|---|
| 138 | 140 | return error; | 
|---|
| 139 | 141 | } | 
|---|
| 140 | 142 |  | 
|---|
| 141 |  | -		if (acl) { | 
|---|
| 142 |  | -			rc = __orangefs_set_acl(inode, acl, type); | 
|---|
| 143 |  | -		} else { | 
|---|
|  | 143 | +		if (inode->i_mode != iattr.ia_mode) | 
|---|
| 144 | 144 | iattr.ia_valid = ATTR_MODE; | 
|---|
| 145 |  | -			rc = orangefs_inode_setattr(inode, &iattr); | 
|---|
| 146 |  | -		} | 
|---|
| 147 | 145 |  | 
|---|
| 148 |  | -		return rc; | 
|---|
| 149 |  | - | 
|---|
| 150 |  | -	} else { | 
|---|
| 151 |  | -		return -EINVAL; | 
|---|
| 152 | 146 | } | 
|---|
|  | 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; | 
|---|
| 153 | 154 | } | 
|---|
| 154 | 155 |  | 
|---|
| 155 | 156 | int orangefs_init_acl(struct inode *inode, struct inode *dir) | 
|---|
| .. | .. | 
|---|
| 167 | 168 | error = __orangefs_set_acl(inode, default_acl, | 
|---|
| 168 | 169 | ACL_TYPE_DEFAULT); | 
|---|
| 169 | 170 | posix_acl_release(default_acl); | 
|---|
|  | 171 | +	} else { | 
|---|
|  | 172 | +		inode->i_default_acl = NULL; | 
|---|
| 170 | 173 | } | 
|---|
| 171 | 174 |  | 
|---|
| 172 | 175 | if (acl) { | 
|---|
| 173 | 176 | if (!error) | 
|---|
| 174 | 177 | error = __orangefs_set_acl(inode, acl, ACL_TYPE_ACCESS); | 
|---|
| 175 | 178 | posix_acl_release(acl); | 
|---|
|  | 179 | +	} else { | 
|---|
|  | 180 | +		inode->i_acl = NULL; | 
|---|
| 176 | 181 | } | 
|---|
| 177 | 182 |  | 
|---|
| 178 | 183 | /* If mode of the inode was changed, then do a forcible ->setattr */ | 
|---|
| .. | .. | 
|---|
| 181 | 186 | inode->i_mode = mode; | 
|---|
| 182 | 187 | iattr.ia_mode = mode; | 
|---|
| 183 | 188 | iattr.ia_valid |= ATTR_MODE; | 
|---|
| 184 |  | -		orangefs_inode_setattr(inode, &iattr); | 
|---|
|  | 189 | +		__orangefs_setattr(inode, &iattr); | 
|---|
| 185 | 190 | } | 
|---|
| 186 | 191 |  | 
|---|
| 187 | 192 | return error; | 
|---|