Commit e412bdb1 authored by Steven Whitehouse's avatar Steven Whitehouse

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: default avatarSteven Whitehouse <swhiteho@redhat.com>
parent 24b977b5
...@@ -1296,6 +1296,7 @@ fail: ...@@ -1296,6 +1296,7 @@ fail:
int gfs2_xattr_acl_chmod(struct gfs2_inode *ip, struct iattr *attr, char *data) int gfs2_xattr_acl_chmod(struct gfs2_inode *ip, struct iattr *attr, char *data)
{ {
struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
struct gfs2_ea_location el; struct gfs2_ea_location el;
struct buffer_head *dibh; struct buffer_head *dibh;
int error; int error;
...@@ -1305,16 +1306,17 @@ int gfs2_xattr_acl_chmod(struct gfs2_inode *ip, struct iattr *attr, char *data) ...@@ -1305,16 +1306,17 @@ int gfs2_xattr_acl_chmod(struct gfs2_inode *ip, struct iattr *attr, char *data)
return error; return error;
if (GFS2_EA_IS_STUFFED(el.el_ea)) { if (GFS2_EA_IS_STUFFED(el.el_ea)) {
error = gfs2_trans_begin(GFS2_SB(&ip->i_inode), RES_DINODE + RES_EATTR, 0); error = gfs2_trans_begin(sdp, RES_DINODE + RES_EATTR, 0);
if (error) if (error == 0) {
return error; gfs2_trans_add_bh(ip->i_gl, el.el_bh, 1);
memcpy(GFS2_EA2DATA(el.el_ea), data,
gfs2_trans_add_bh(ip->i_gl, el.el_bh, 1); GFS2_EA_DATA_LEN(el.el_ea));
memcpy(GFS2_EA2DATA(el.el_ea), data, }
GFS2_EA_DATA_LEN(el.el_ea)); } else {
} else
error = ea_acl_chmod_unstuffed(ip, el.el_ea, data); error = ea_acl_chmod_unstuffed(ip, el.el_ea, data);
}
brelse(el.el_bh);
if (error) if (error)
return error; return error;
...@@ -1327,8 +1329,7 @@ int gfs2_xattr_acl_chmod(struct gfs2_inode *ip, struct iattr *attr, char *data) ...@@ -1327,8 +1329,7 @@ int gfs2_xattr_acl_chmod(struct gfs2_inode *ip, struct iattr *attr, char *data)
brelse(dibh); brelse(dibh);
} }
gfs2_trans_end(GFS2_SB(&ip->i_inode)); gfs2_trans_end(sdp);
return error; return error;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment