ioctl.c (9f30a04d768f64280dc0c40b730746e82f298d88) ioctl.c (5955102c9984fa081b2d570cfac75c97eecf8f3b)
1/*
2 * linux/fs/jfs/ioctl.c
3 *
4 * Copyright (C) 2006 Herbert Poetzl
5 * adapted from Remy Card's ext2/ioctl.c
6 */
7
8#include <linux/fs.h>

--- 82 unchanged lines hidden (view full) ---

91
92 /* Is it quota file? Do not allow user to mess with it */
93 if (IS_NOQUOTA(inode)) {
94 err = -EPERM;
95 goto setflags_out;
96 }
97
98 /* Lock against other parallel changes of flags */
1/*
2 * linux/fs/jfs/ioctl.c
3 *
4 * Copyright (C) 2006 Herbert Poetzl
5 * adapted from Remy Card's ext2/ioctl.c
6 */
7
8#include <linux/fs.h>

--- 82 unchanged lines hidden (view full) ---

91
92 /* Is it quota file? Do not allow user to mess with it */
93 if (IS_NOQUOTA(inode)) {
94 err = -EPERM;
95 goto setflags_out;
96 }
97
98 /* Lock against other parallel changes of flags */
99 mutex_lock(&inode->i_mutex);
99 inode_lock(inode);
100
101 jfs_get_inode_flags(jfs_inode);
102 oldflags = jfs_inode->mode2;
103
104 /*
105 * The IMMUTABLE and APPEND_ONLY flags can only be changed by
106 * the relevant capability.
107 */
108 if ((oldflags & JFS_IMMUTABLE_FL) ||
109 ((flags ^ oldflags) &
110 (JFS_APPEND_FL | JFS_IMMUTABLE_FL))) {
111 if (!capable(CAP_LINUX_IMMUTABLE)) {
100
101 jfs_get_inode_flags(jfs_inode);
102 oldflags = jfs_inode->mode2;
103
104 /*
105 * The IMMUTABLE and APPEND_ONLY flags can only be changed by
106 * the relevant capability.
107 */
108 if ((oldflags & JFS_IMMUTABLE_FL) ||
109 ((flags ^ oldflags) &
110 (JFS_APPEND_FL | JFS_IMMUTABLE_FL))) {
111 if (!capable(CAP_LINUX_IMMUTABLE)) {
112 mutex_unlock(&inode->i_mutex);
112 inode_unlock(inode);
113 err = -EPERM;
114 goto setflags_out;
115 }
116 }
117
118 flags = flags & JFS_FL_USER_MODIFIABLE;
119 flags |= oldflags & ~JFS_FL_USER_MODIFIABLE;
120 jfs_inode->mode2 = flags;
121
122 jfs_set_inode_flags(inode);
113 err = -EPERM;
114 goto setflags_out;
115 }
116 }
117
118 flags = flags & JFS_FL_USER_MODIFIABLE;
119 flags |= oldflags & ~JFS_FL_USER_MODIFIABLE;
120 jfs_inode->mode2 = flags;
121
122 jfs_set_inode_flags(inode);
123 mutex_unlock(&inode->i_mutex);
123 inode_unlock(inode);
124 inode->i_ctime = CURRENT_TIME_SEC;
125 mark_inode_dirty(inode);
126setflags_out:
127 mnt_drop_write_file(filp);
128 return err;
129 }
130
131 case FITRIM:

--- 55 unchanged lines hidden ---
124 inode->i_ctime = CURRENT_TIME_SEC;
125 mark_inode_dirty(inode);
126setflags_out:
127 mnt_drop_write_file(filp);
128 return err;
129 }
130
131 case FITRIM:

--- 55 unchanged lines hidden ---