aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/acl.c
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2009-09-29 07:40:19 -0400
committerSteven Whitehouse <swhiteho@redhat.com>2009-12-03 06:45:54 -0500
commit69dca42464962d8d0989b7e09877ba644c9cba66 (patch)
tree83ab9a2054781750239ec3b9f9db921166a39160 /fs/gfs2/acl.c
parentc65f7fb5342ecb8cb85e9b676327b3a43a5a4735 (diff)
GFS2: Use gfs2_set_mode() instead of munge_mode()
These two functions do the same thing, so lets only use one of them. Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/acl.c')
-rw-r--r--fs/gfs2/acl.c46
1 files changed, 11 insertions, 35 deletions
diff --git a/fs/gfs2/acl.c b/fs/gfs2/acl.c
index 2168da121647..1be314837d31 100644
--- a/fs/gfs2/acl.c
+++ b/fs/gfs2/acl.c
@@ -104,29 +104,20 @@ int gfs2_check_acl(struct inode *inode, int mask)
104 return -EAGAIN; 104 return -EAGAIN;
105} 105}
106 106
107static int munge_mode(struct gfs2_inode *ip, mode_t mode) 107static int gfs2_set_mode(struct inode *inode, mode_t mode)
108{ 108{
109 struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); 109 int error = 0;
110 struct buffer_head *dibh;
111 int error;
112 110
113 error = gfs2_trans_begin(sdp, RES_DINODE, 0); 111 if (mode != inode->i_mode) {
114 if (error) 112 struct iattr iattr;
115 return error;
116 113
117 error = gfs2_meta_inode_buffer(ip, &dibh); 114 iattr.ia_valid = ATTR_MODE;
118 if (!error) { 115 iattr.ia_mode = mode;
119 gfs2_assert_withdraw(sdp,
120 (ip->i_inode.i_mode & S_IFMT) == (mode & S_IFMT));
121 ip->i_inode.i_mode = mode;
122 gfs2_trans_add_bh(ip->i_gl, dibh, 1);
123 gfs2_dinode_out(ip, dibh->b_data);
124 brelse(dibh);
125 }
126 116
127 gfs2_trans_end(sdp); 117 error = gfs2_setattr_simple(GFS2_I(inode), &iattr);
118 }
128 119
129 return 0; 120 return error;
130} 121}
131 122
132int gfs2_acl_create(struct gfs2_inode *dip, struct gfs2_inode *ip) 123int gfs2_acl_create(struct gfs2_inode *dip, struct gfs2_inode *ip)
@@ -151,7 +142,7 @@ int gfs2_acl_create(struct gfs2_inode *dip, struct gfs2_inode *ip)
151 if (!acl) { 142 if (!acl) {
152 mode &= ~current_umask(); 143 mode &= ~current_umask();
153 if (mode != ip->i_inode.i_mode) 144 if (mode != ip->i_inode.i_mode)
154 error = munge_mode(ip, mode); 145 error = gfs2_set_mode(&ip->i_inode, mode);
155 return error; 146 return error;
156 } 147 }
157 148
@@ -181,7 +172,7 @@ int gfs2_acl_create(struct gfs2_inode *dip, struct gfs2_inode *ip)
181 if (error) 172 if (error)
182 goto out; 173 goto out;
183munge: 174munge:
184 error = munge_mode(ip, mode); 175 error = gfs2_set_mode(&ip->i_inode, mode);
185out: 176out:
186 posix_acl_release(acl); 177 posix_acl_release(acl);
187 kfree(data); 178 kfree(data);
@@ -244,21 +235,6 @@ static int gfs2_xattr_system_get(struct inode *inode, const char *name,
244 return gfs2_xattr_get(inode, GFS2_EATYPE_SYS, name, buffer, size); 235 return gfs2_xattr_get(inode, GFS2_EATYPE_SYS, name, buffer, size);
245} 236}
246 237
247static int gfs2_set_mode(struct inode *inode, mode_t mode)
248{
249 int error = 0;
250
251 if (mode != inode->i_mode) {
252 struct iattr iattr;
253
254 iattr.ia_valid = ATTR_MODE;
255 iattr.ia_mode = mode;
256
257 error = gfs2_setattr_simple(GFS2_I(inode), &iattr);
258 }
259
260 return error;
261}
262 238
263static int gfs2_xattr_system_set(struct inode *inode, const char *name, 239static int gfs2_xattr_system_set(struct inode *inode, const char *name,
264 const void *value, size_t size, int flags) 240 const void *value, size_t size, int flags)