These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / fs / xfs / xfs_ioctl.c
index 87f67c6..d42738d 100644 (file)
@@ -40,6 +40,7 @@
 #include "xfs_symlink.h"
 #include "xfs_trans.h"
 #include "xfs_pnfs.h"
+#include "xfs_acl.h"
 
 #include <linux/capability.h>
 #include <linux/dcache.h>
@@ -336,7 +337,7 @@ xfs_set_dmattrs(
        tp = xfs_trans_alloc(mp, XFS_TRANS_SET_DMATTRS);
        error = xfs_trans_reserve(tp, &M_RES(mp)->tr_ichange, 0, 0);
        if (error) {
-               xfs_trans_cancel(tp, 0);
+               xfs_trans_cancel(tp);
                return error;
        }
        xfs_ilock(ip, XFS_ILOCK_EXCL);
@@ -346,7 +347,7 @@ xfs_set_dmattrs(
        ip->i_d.di_dmstate  = state;
 
        xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
-       error = xfs_trans_commit(tp, 0);
+       error = xfs_trans_commit(tp);
 
        return error;
 }
@@ -411,7 +412,7 @@ xfs_attrlist_by_handle(
        if (copy_from_user(&al_hreq, arg, sizeof(xfs_fsop_attrlist_handlereq_t)))
                return -EFAULT;
        if (al_hreq.buflen < sizeof(struct attrlist) ||
-           al_hreq.buflen > XATTR_LIST_MAX)
+           al_hreq.buflen > XFS_XATTR_LIST_MAX)
                return -EINVAL;
 
        /*
@@ -455,7 +456,7 @@ xfs_attrmulti_attr_get(
        unsigned char           *kbuf;
        int                     error = -EFAULT;
 
-       if (*len > XATTR_SIZE_MAX)
+       if (*len > XFS_XATTR_SIZE_MAX)
                return -EINVAL;
        kbuf = kmem_zalloc_large(*len, KM_SLEEP);
        if (!kbuf)
@@ -482,17 +483,22 @@ xfs_attrmulti_attr_set(
        __uint32_t              flags)
 {
        unsigned char           *kbuf;
+       int                     error;
 
        if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
                return -EPERM;
-       if (len > XATTR_SIZE_MAX)
+       if (len > XFS_XATTR_SIZE_MAX)
                return -EINVAL;
 
        kbuf = memdup_user(ubuf, len);
        if (IS_ERR(kbuf))
                return PTR_ERR(kbuf);
 
-       return xfs_attr_set(XFS_I(inode), name, kbuf, len, flags);
+       error = xfs_attr_set(XFS_I(inode), name, kbuf, len, flags);
+       if (!error)
+               xfs_forget_acl(inode, name, flags);
+       kfree(kbuf);
+       return error;
 }
 
 int
@@ -501,9 +507,14 @@ xfs_attrmulti_attr_remove(
        unsigned char           *name,
        __uint32_t              flags)
 {
+       int                     error;
+
        if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
                return -EPERM;
-       return xfs_attr_remove(XFS_I(inode), name, flags);
+       error = xfs_attr_remove(XFS_I(inode), name, flags);
+       if (!error)
+               xfs_forget_acl(inode, name, flags);
+       return error;
 }
 
 STATIC int
@@ -1028,7 +1039,7 @@ xfs_ioctl_setattr_xflags(
        xfs_diflags_to_linux(ip);
        xfs_trans_ichgtime(tp, ip, XFS_ICHGTIME_CHG);
        xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
-       XFS_STATS_INC(xs_ig_attrchg);
+       XFS_STATS_INC(mp, xs_ig_attrchg);
        return 0;
 }
 
@@ -1076,7 +1087,7 @@ xfs_ioctl_setattr_get_trans(
        return tp;
 
 out_cancel:
-       xfs_trans_cancel(tp, 0);
+       xfs_trans_cancel(tp);
        return ERR_PTR(error);
 }
 
@@ -1253,7 +1264,7 @@ xfs_ioctl_setattr(
        else
                ip->i_d.di_extsize = 0;
 
-       code = xfs_trans_commit(tp, 0);
+       code = xfs_trans_commit(tp);
 
        /*
         * Release any dquot(s) the inode had kept before chown.
@@ -1265,7 +1276,7 @@ xfs_ioctl_setattr(
        return code;
 
 error_trans_cancel:
-       xfs_trans_cancel(tp, 0);
+       xfs_trans_cancel(tp);
 error_free_dquots:
        xfs_qm_dqrele(udqp);
        xfs_qm_dqrele(pdqp);
@@ -1338,11 +1349,11 @@ xfs_ioc_setxflags(
 
        error = xfs_ioctl_setattr_xflags(tp, ip, &fa);
        if (error) {
-               xfs_trans_cancel(tp, 0);
+               xfs_trans_cancel(tp);
                goto out_drop_write;
        }
 
-       error = xfs_trans_commit(tp, 0);
+       error = xfs_trans_commit(tp);
 out_drop_write:
        mnt_drop_write_file(filp);
        return error;