diff options
author | Steven Whitehouse <swhiteho@redhat.com> | 2009-11-06 06:10:51 -0500 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2009-12-03 06:57:41 -0500 |
commit | 2c77634965ee28c8b4790ffb5e83dd5ff7ac8988 (patch) | |
tree | d8b32167ae8cdeca4be7977ee416359f9c9f5543 /fs/gfs2 | |
parent | 1579343a73e32b5886e186e8f3e4db85e420ed3f (diff) |
GFS2: Locking order fix in gfs2_check_blk_state
In some cases we already have the rindex lock when
we enter this function.
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2')
-rw-r--r-- | fs/gfs2/rgrp.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c index 8f1cfb02a6cb..0608f490c295 100644 --- a/fs/gfs2/rgrp.c +++ b/fs/gfs2/rgrp.c | |||
@@ -1710,11 +1710,16 @@ int gfs2_check_blk_type(struct gfs2_sbd *sdp, u64 no_addr, unsigned int type) | |||
1710 | { | 1710 | { |
1711 | struct gfs2_rgrpd *rgd; | 1711 | struct gfs2_rgrpd *rgd; |
1712 | struct gfs2_holder ri_gh, rgd_gh; | 1712 | struct gfs2_holder ri_gh, rgd_gh; |
1713 | struct gfs2_inode *ip = GFS2_I(sdp->sd_rindex); | ||
1714 | int ri_locked = 0; | ||
1713 | int error; | 1715 | int error; |
1714 | 1716 | ||
1715 | error = gfs2_rindex_hold(sdp, &ri_gh); | 1717 | if (!gfs2_glock_is_locked_by_me(ip->i_gl)) { |
1716 | if (error) | 1718 | error = gfs2_rindex_hold(sdp, &ri_gh); |
1717 | goto fail; | 1719 | if (error) |
1720 | goto fail; | ||
1721 | ri_locked = 1; | ||
1722 | } | ||
1718 | 1723 | ||
1719 | error = -EINVAL; | 1724 | error = -EINVAL; |
1720 | rgd = gfs2_blk2rgrpd(sdp, no_addr); | 1725 | rgd = gfs2_blk2rgrpd(sdp, no_addr); |
@@ -1730,7 +1735,8 @@ int gfs2_check_blk_type(struct gfs2_sbd *sdp, u64 no_addr, unsigned int type) | |||
1730 | 1735 | ||
1731 | gfs2_glock_dq_uninit(&rgd_gh); | 1736 | gfs2_glock_dq_uninit(&rgd_gh); |
1732 | fail_rindex: | 1737 | fail_rindex: |
1733 | gfs2_glock_dq_uninit(&ri_gh); | 1738 | if (ri_locked) |
1739 | gfs2_glock_dq_uninit(&ri_gh); | ||
1734 | fail: | 1740 | fail: |
1735 | return error; | 1741 | return error; |
1736 | } | 1742 | } |