aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2
diff options
context:
space:
mode:
authorDarrick J. Wong <darrick.wong@oracle.com>2019-07-01 11:25:34 -0400
committerDarrick J. Wong <darrick.wong@oracle.com>2019-07-01 11:25:34 -0400
commit5aca284210ce827f780ea2f4f9c6ab8d6e2d6648 (patch)
tree485c43c3dd95105dccf7fcc32934112a76ea2129 /fs/ocfs2
parentd1fdb6d8f6a4109a4263176c84b899076a5f8008 (diff)
vfs: create a generic checking and prep function for FS_IOC_SETFLAGS
Create a generic function to check incoming FS_IOC_SETFLAGS flag values and later prepare the inode for updates so that we can standardize the implementations that follow ext4's flag values. Note that the efivarfs implementation no longer fails a no-op SETFLAGS without CAP_LINUX_IMMUTABLE since that's the behavior in ext*. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Jan Kara <jack@suse.cz> Reviewed-by: Christoph Hellwig <hch@lst.de> Acked-by: David Sterba <dsterba@suse.com> Reviewed-by: Bob Peterson <rpeterso@redhat.com>
Diffstat (limited to 'fs/ocfs2')
-rw-r--r--fs/ocfs2/ioctl.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/fs/ocfs2/ioctl.c b/fs/ocfs2/ioctl.c
index 994726ada857..d6f7b299eb23 100644
--- a/fs/ocfs2/ioctl.c
+++ b/fs/ocfs2/ioctl.c
@@ -106,16 +106,9 @@ static int ocfs2_set_inode_attr(struct inode *inode, unsigned flags,
106 flags = flags & mask; 106 flags = flags & mask;
107 flags |= oldflags & ~mask; 107 flags |= oldflags & ~mask;
108 108
109 /* 109 status = vfs_ioc_setflags_prepare(inode, oldflags, flags);
110 * The IMMUTABLE and APPEND_ONLY flags can only be changed by 110 if (status)
111 * the relevant capability. 111 goto bail_unlock;
112 */
113 status = -EPERM;
114 if ((oldflags & OCFS2_IMMUTABLE_FL) || ((flags ^ oldflags) &
115 (OCFS2_APPEND_FL | OCFS2_IMMUTABLE_FL))) {
116 if (!capable(CAP_LINUX_IMMUTABLE))
117 goto bail_unlock;
118 }
119 112
120 handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS); 113 handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS);
121 if (IS_ERR(handle)) { 114 if (IS_ERR(handle)) {