diff options
author | Steven Whitehouse <swhiteho@redhat.com> | 2009-12-21 08:55:28 -0500 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2010-01-08 08:42:59 -0500 |
commit | e412bdb1260d13ec5e7b90b537fec2179d6f8989 (patch) | |
tree | cf0a89cfefd556c414c5b4a1f47b71ad7218865a /fs | |
parent | 24b977b5fdea09bf356428870d32c09a275c8a3e (diff) |
GFS2: Fix gfs2_xattr_acl_chmod()
The ref counting for the bh returned by gfs2_ea_find() was
wrong. This patch ensures that we always drop the ref count
to that bh correctly.
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/gfs2/xattr.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/fs/gfs2/xattr.c b/fs/gfs2/xattr.c index 8a04108e0c22..c2ebdf2c01d4 100644 --- a/fs/gfs2/xattr.c +++ b/fs/gfs2/xattr.c | |||
@@ -1296,6 +1296,7 @@ fail: | |||
1296 | 1296 | ||
1297 | int gfs2_xattr_acl_chmod(struct gfs2_inode *ip, struct iattr *attr, char *data) | 1297 | int gfs2_xattr_acl_chmod(struct gfs2_inode *ip, struct iattr *attr, char *data) |
1298 | { | 1298 | { |
1299 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); | ||
1299 | struct gfs2_ea_location el; | 1300 | struct gfs2_ea_location el; |
1300 | struct buffer_head *dibh; | 1301 | struct buffer_head *dibh; |
1301 | int error; | 1302 | int error; |
@@ -1305,16 +1306,17 @@ int gfs2_xattr_acl_chmod(struct gfs2_inode *ip, struct iattr *attr, char *data) | |||
1305 | return error; | 1306 | return error; |
1306 | 1307 | ||
1307 | if (GFS2_EA_IS_STUFFED(el.el_ea)) { | 1308 | if (GFS2_EA_IS_STUFFED(el.el_ea)) { |
1308 | error = gfs2_trans_begin(GFS2_SB(&ip->i_inode), RES_DINODE + RES_EATTR, 0); | 1309 | error = gfs2_trans_begin(sdp, RES_DINODE + RES_EATTR, 0); |
1309 | if (error) | 1310 | if (error == 0) { |
1310 | return error; | 1311 | gfs2_trans_add_bh(ip->i_gl, el.el_bh, 1); |
1311 | 1312 | memcpy(GFS2_EA2DATA(el.el_ea), data, | |
1312 | gfs2_trans_add_bh(ip->i_gl, el.el_bh, 1); | 1313 | GFS2_EA_DATA_LEN(el.el_ea)); |
1313 | memcpy(GFS2_EA2DATA(el.el_ea), data, | 1314 | } |
1314 | GFS2_EA_DATA_LEN(el.el_ea)); | 1315 | } else { |
1315 | } else | ||
1316 | error = ea_acl_chmod_unstuffed(ip, el.el_ea, data); | 1316 | error = ea_acl_chmod_unstuffed(ip, el.el_ea, data); |
1317 | } | ||
1317 | 1318 | ||
1319 | brelse(el.el_bh); | ||
1318 | if (error) | 1320 | if (error) |
1319 | return error; | 1321 | return error; |
1320 | 1322 | ||
@@ -1327,8 +1329,7 @@ int gfs2_xattr_acl_chmod(struct gfs2_inode *ip, struct iattr *attr, char *data) | |||
1327 | brelse(dibh); | 1329 | brelse(dibh); |
1328 | } | 1330 | } |
1329 | 1331 | ||
1330 | gfs2_trans_end(GFS2_SB(&ip->i_inode)); | 1332 | gfs2_trans_end(sdp); |
1331 | |||
1332 | return error; | 1333 | return error; |
1333 | } | 1334 | } |
1334 | 1335 | ||