diff options
author | Bob Peterson <rpeterso@redhat.com> | 2013-11-06 10:58:00 -0500 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2014-01-03 04:57:31 -0500 |
commit | 1330edbeaf304703052fb583dd660b96309e4536 (patch) | |
tree | ed15177cde85caba12da64d7596b7c27377a0a7a | |
parent | 5ce13431dd3365d5dd4f3890394dac59b687c0ed (diff) |
GFS2: Drop inadequate rgrps from the reservation tree
This is just basically a resend of a patch I posted earlier.
It didn't change from its original, except in diff offsets, etc:
This patch fixes a bug in the GFS2 block allocation code. The problem
starts if a process already has a multi-block reservation, but for
some reason, another process disqualifies it from further allocations.
For example, the other process might set on the GFS2_RDF_ERROR bit.
The process holding the reservation jumps to label skip_rgrp, but
that label comes after the code that removes the reservation from the
tree. Therefore, the no longer usable reservation is not removed from
the rgrp's reservations tree; it's lost. Eventually, the lost reservation
causes the count of reserved blocks to get off, and eventually that
causes a BUG_ON(rs->rs_rbm.rgd->rd_reserved < rs->rs_free) to trigger.
This patch moves the call to after label skip_rgrp so that the
disqualified reservation is properly removed from the tree, thus keeping
the rgrp rd_reserved count sane.
Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
-rw-r--r-- | fs/gfs2/rgrp.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c index 809fecd82970..1ccf89ab42b6 100644 --- a/fs/gfs2/rgrp.c +++ b/fs/gfs2/rgrp.c | |||
@@ -1944,15 +1944,16 @@ int gfs2_inplace_reserve(struct gfs2_inode *ip, const struct gfs2_alloc_parms *a | |||
1944 | return 0; | 1944 | return 0; |
1945 | } | 1945 | } |
1946 | 1946 | ||
1947 | /* Drop reservation, if we couldn't use reserved rgrp */ | ||
1948 | if (gfs2_rs_active(rs)) | ||
1949 | gfs2_rs_deltree(rs); | ||
1950 | check_rgrp: | 1947 | check_rgrp: |
1951 | /* Check for unlinked inodes which can be reclaimed */ | 1948 | /* Check for unlinked inodes which can be reclaimed */ |
1952 | if (rs->rs_rbm.rgd->rd_flags & GFS2_RDF_CHECK) | 1949 | if (rs->rs_rbm.rgd->rd_flags & GFS2_RDF_CHECK) |
1953 | try_rgrp_unlink(rs->rs_rbm.rgd, &last_unlinked, | 1950 | try_rgrp_unlink(rs->rs_rbm.rgd, &last_unlinked, |
1954 | ip->i_no_addr); | 1951 | ip->i_no_addr); |
1955 | skip_rgrp: | 1952 | skip_rgrp: |
1953 | /* Drop reservation, if we couldn't use reserved rgrp */ | ||
1954 | if (gfs2_rs_active(rs)) | ||
1955 | gfs2_rs_deltree(rs); | ||
1956 | |||
1956 | /* Unlock rgrp if required */ | 1957 | /* Unlock rgrp if required */ |
1957 | if (!rg_locked) | 1958 | if (!rg_locked) |
1958 | gfs2_glock_dq_uninit(&rs->rs_rgd_gh); | 1959 | gfs2_glock_dq_uninit(&rs->rs_rgd_gh); |