@@ -277,7 +277,7 @@ static int v9fs_xattr_set_acl(const struct xattr_handler *handler,
case ACL_TYPE_ACCESS:
if (acl) {
umode_t mode = inode->i_mode;
- retval = posix_acl_equiv_mode(acl, &mode);
+ retval = posix_acl_equiv_mode(inode, acl, &mode);
if (retval < 0)
goto err_out;
else {
@@ -80,7 +80,7 @@ static int __btrfs_set_acl(struct btrfs_trans_handle *trans,
case ACL_TYPE_ACCESS:
name = XATTR_NAME_POSIX_ACL_ACCESS;
if (acl) {
- ret = posix_acl_equiv_mode(acl, &inode->i_mode);
+ ret = posix_acl_equiv_mode(inode, acl, &inode->i_mode);
if (ret < 0)
return ret;
if (ret == 0)
@@ -95,7 +95,7 @@ int ceph_set_acl(struct inode *inode, struct posix_acl *acl, int type)
case ACL_TYPE_ACCESS:
name = XATTR_NAME_POSIX_ACL_ACCESS;
if (acl) {
- ret = posix_acl_equiv_mode(acl, &new_mode);
+ ret = posix_acl_equiv_mode(inode, acl, &new_mode);
if (ret < 0)
goto out;
if (ret == 0)
@@ -167,7 +167,7 @@ int ceph_pre_init_acls(struct inode *dir, umode_t *mode,
return err;
if (acl) {
- int ret = posix_acl_equiv_mode(acl, mode);
+ int ret = posix_acl_equiv_mode(dir, acl, mode);
if (ret < 0)
goto out_err;
if (ret == 0) {
@@ -190,7 +190,8 @@ ext2_set_acl(struct inode *inode, struct posix_acl *acl, int type)
case ACL_TYPE_ACCESS:
name_index = EXT2_XATTR_INDEX_POSIX_ACL_ACCESS;
if (acl) {
- error = posix_acl_equiv_mode(acl, &inode->i_mode);
+ error = posix_acl_equiv_mode(inode, acl,
+ &inode->i_mode);
if (error < 0)
return error;
else {
@@ -193,7 +193,8 @@ __ext4_set_acl(handle_t *handle, struct inode *inode, int type,
case ACL_TYPE_ACCESS:
name_index = EXT4_XATTR_INDEX_POSIX_ACL_ACCESS;
if (acl) {
- error = posix_acl_equiv_mode(acl, &inode->i_mode);
+ error = posix_acl_equiv_mode(inode, acl,
+ &inode->i_mode);
if (error < 0)
return error;
else {
@@ -211,7 +211,8 @@ static int __f2fs_set_acl(struct inode *inode, int type,
case ACL_TYPE_ACCESS:
name_index = F2FS_XATTR_INDEX_POSIX_ACL_ACCESS;
if (acl) {
- error = posix_acl_equiv_mode(acl, &inode->i_mode);
+ error = posix_acl_equiv_mode(inode, acl,
+ &inode->i_mode);
if (error < 0)
return error;
set_acl_inode(fi, inode->i_mode);
@@ -92,7 +92,7 @@ int __gfs2_set_acl(struct inode *inode, struct posix_acl *acl, int type)
if (type == ACL_TYPE_ACCESS) {
umode_t mode = inode->i_mode;
- error = posix_acl_equiv_mode(acl, &mode);
+ error = posix_acl_equiv_mode(inode, acl, &mode);
if (error < 0)
return error;
@@ -65,7 +65,7 @@ int hfsplus_set_posix_acl(struct inode *inode, struct posix_acl *acl,
case ACL_TYPE_ACCESS:
xattr_name = XATTR_NAME_POSIX_ACL_ACCESS;
if (acl) {
- err = posix_acl_equiv_mode(acl, &inode->i_mode);
+ err = posix_acl_equiv_mode(inode, acl, &inode->i_mode);
if (err < 0)
return err;
}
@@ -234,7 +234,7 @@ int jffs2_set_acl(struct inode *inode, struct posix_acl *acl, int type)
xprefix = JFFS2_XPREFIX_ACL_ACCESS;
if (acl) {
umode_t mode = inode->i_mode;
- rc = posix_acl_equiv_mode(acl, &mode);
+ rc = posix_acl_equiv_mode(inode, acl, &mode);
if (rc < 0)
return rc;
if (inode->i_mode != mode) {
@@ -78,7 +78,7 @@ static int __jfs_set_acl(tid_t tid, struct inode *inode, int type,
case ACL_TYPE_ACCESS:
ea_name = XATTR_NAME_POSIX_ACL_ACCESS;
if (acl) {
- rc = posix_acl_equiv_mode(acl, &inode->i_mode);
+ rc = posix_acl_equiv_mode(inode, acl, &inode->i_mode);
if (rc < 0)
return rc;
inode->i_ctime = CURRENT_TIME;
@@ -118,7 +118,7 @@ struct posix_acl *nfs3_get_acl(struct inode *inode, int type)
}
if (res.acl_access != NULL) {
- if ((posix_acl_equiv_mode(res.acl_access, NULL) == 0) ||
+ if ((posix_acl_equiv_mode(inode, res.acl_access, NULL) == 0) ||
res.acl_access->a_count == 0) {
posix_acl_release(res.acl_access);
res.acl_access = NULL;
@@ -242,7 +242,7 @@ int ocfs2_set_acl(handle_t *handle,
name_index = OCFS2_XATTR_INDEX_POSIX_ACL_ACCESS;
if (acl) {
umode_t mode = inode->i_mode;
- ret = posix_acl_equiv_mode(acl, &mode);
+ ret = posix_acl_equiv_mode(inode, acl, &mode);
if (ret < 0)
return ret;
@@ -81,7 +81,7 @@ int orangefs_set_acl(struct inode *inode, struct posix_acl *acl, int type)
* can we represent this with the traditional file
* mode permission bits?
*/
- error = posix_acl_equiv_mode(acl, &mode);
+ error = posix_acl_equiv_mode(inode, acl, &mode);
if (error < 0) {
gossip_err("%s: posix_acl_equiv_mode err: %d\n",
__func__,
@@ -274,7 +274,8 @@ EXPORT_SYMBOL(posix_acl_valid);
* file mode permission bits, or else 1. Returns -E... on error.
*/
int
-posix_acl_equiv_mode(const struct posix_acl *acl, umode_t *mode_p)
+posix_acl_equiv_mode(struct inode *inode, const struct posix_acl *acl,
+ umode_t *mode_p)
{
const struct posix_acl_entry *pa, *pe;
umode_t mode = 0;
@@ -886,7 +887,7 @@ int simple_set_acl(struct inode *inode, struct posix_acl *acl, int type)
int error;
if (type == ACL_TYPE_ACCESS) {
- error = posix_acl_equiv_mode(acl, &inode->i_mode);
+ error = posix_acl_equiv_mode(inode, acl, &inode->i_mode);
if (error < 0)
return 0;
if (error == 0)
@@ -242,7 +242,8 @@ __reiserfs_set_acl(struct reiserfs_transaction_handle *th, struct inode *inode,
case ACL_TYPE_ACCESS:
name = XATTR_NAME_POSIX_ACL_ACCESS;
if (acl) {
- error = posix_acl_equiv_mode(acl, &inode->i_mode);
+ error = posix_acl_equiv_mode(inode, acl,
+ &inode->i_mode);
if (error < 0)
return error;
else {
@@ -258,7 +258,7 @@ xfs_set_acl(struct inode *inode, struct posix_acl *acl, int type)
if (type == ACL_TYPE_ACCESS) {
umode_t mode = inode->i_mode;
- error = posix_acl_equiv_mode(acl, &mode);
+ error = posix_acl_equiv_mode(inode, acl, &mode);
if (error <= 0) {
acl = NULL;
@@ -84,7 +84,7 @@ extern struct posix_acl *posix_acl_alloc(int, gfp_t);
extern int posix_acl_valid(const struct posix_acl *);
extern int posix_acl_permission(struct inode *, const struct posix_acl *, int);
extern struct posix_acl *posix_acl_from_mode(umode_t, gfp_t);
-extern int posix_acl_equiv_mode(const struct posix_acl *, umode_t *);
+extern int posix_acl_equiv_mode(struct inode *inode, const struct posix_acl *, umode_t *);
extern int __posix_acl_create(struct posix_acl **, gfp_t, umode_t *);
extern int __posix_acl_chmod(struct posix_acl **, gfp_t, umode_t);
To decide whether we need to clear SGID bit we need to know inode the acl belongs to. Pass it as an argument to posix_acl_equiv_mode(). Signed-off-by: Jan Kara <jack@suse.cz> --- fs/9p/acl.c | 2 +- fs/btrfs/acl.c | 2 +- fs/ceph/acl.c | 4 ++-- fs/ext2/acl.c | 3 ++- fs/ext4/acl.c | 3 ++- fs/f2fs/acl.c | 3 ++- fs/gfs2/acl.c | 2 +- fs/hfsplus/posix_acl.c | 2 +- fs/jffs2/acl.c | 2 +- fs/jfs/acl.c | 2 +- fs/nfs/nfs3acl.c | 2 +- fs/ocfs2/acl.c | 2 +- fs/orangefs/acl.c | 2 +- fs/posix_acl.c | 5 +++-- fs/reiserfs/xattr_acl.c | 3 ++- fs/xfs/xfs_acl.c | 2 +- include/linux/posix_acl.h | 2 +- 17 files changed, 24 insertions(+), 19 deletions(-) See patch 2/2 for more detailed explanation why this is necessary...