Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
[firefly-linux-kernel-4.4.55.git] / fs / hfsplus / ioctl.c
index ac807073c453451dae6621ea84fa1b902400759b..0624ce4e07022e3f047683a70cbbf1cdad6ff174 100644 (file)
@@ -76,7 +76,7 @@ static int hfsplus_ioctl_setflags(struct file *file, int __user *user_flags)
 {
        struct inode *inode = file_inode(file);
        struct hfsplus_inode_info *hip = HFSPLUS_I(inode);
-       unsigned int flags;
+       unsigned int flags, new_fl = 0;
        int err = 0;
 
        err = mnt_want_write_file(file);
@@ -110,14 +110,12 @@ static int hfsplus_ioctl_setflags(struct file *file, int __user *user_flags)
        }
 
        if (flags & FS_IMMUTABLE_FL)
-               inode->i_flags |= S_IMMUTABLE;
-       else
-               inode->i_flags &= ~S_IMMUTABLE;
+               new_fl |= S_IMMUTABLE;
 
        if (flags & FS_APPEND_FL)
-               inode->i_flags |= S_APPEND;
-       else
-               inode->i_flags &= ~S_APPEND;
+               new_fl |= S_APPEND;
+
+       inode_set_flags(inode, new_fl, S_IMMUTABLE | S_APPEND);
 
        if (flags & FS_NODUMP_FL)
                hip->userflags |= HFSPLUS_FLG_NODUMP;