]>
Commit | Line | Data |
---|---|---|
47f38bc9 GKH |
1 | From foo@baz Fri Sep 21 09:36:02 CEST 2018 |
2 | From: Bob Peterson <rpeterso@redhat.com> | |
3 | Date: Mon, 18 Jun 2018 13:24:13 -0500 | |
4 | Subject: gfs2: Don't reject a supposedly full bitmap if we have blocks reserved | |
5 | ||
6 | From: Bob Peterson <rpeterso@redhat.com> | |
7 | ||
8 | [ Upstream commit e79e0e1428188b24c3b57309ffa54a33c4ae40c4 ] | |
9 | ||
10 | Before this patch, you could get into situations like this: | |
11 | ||
12 | 1. Process 1 searches for X free blocks, finds them, makes a reservation | |
13 | 2. Process 2 searches for free blocks in the same rgrp, but now the | |
14 | bitmap is full because process 1's reservation is skipped over. | |
15 | So it marks the bitmap as GBF_FULL. | |
16 | 3. Process 1 tries to allocate blocks from its own reservation, but | |
17 | since the GBF_FULL bit is set, it skips over the rgrp and searches | |
18 | elsewhere, thus not using its own reservation. | |
19 | ||
20 | This patch adds an additional check to allow processes to use their | |
21 | own reservations. | |
22 | ||
23 | Signed-off-by: Bob Peterson <rpeterso@redhat.com> | |
24 | Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com> | |
25 | Signed-off-by: Sasha Levin <alexander.levin@microsoft.com> | |
26 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
27 | --- | |
28 | fs/gfs2/rgrp.c | 3 ++- | |
29 | 1 file changed, 2 insertions(+), 1 deletion(-) | |
30 | ||
31 | --- a/fs/gfs2/rgrp.c | |
32 | +++ b/fs/gfs2/rgrp.c | |
33 | @@ -1675,7 +1675,8 @@ static int gfs2_rbm_find(struct gfs2_rbm | |
34 | ||
35 | while(1) { | |
36 | bi = rbm_bi(rbm); | |
37 | - if (test_bit(GBF_FULL, &bi->bi_flags) && | |
38 | + if ((ip == NULL || !gfs2_rs_active(&ip->i_res)) && | |
39 | + test_bit(GBF_FULL, &bi->bi_flags) && | |
40 | (state == GFS2_BLKST_FREE)) | |
41 | goto next_bitmap; | |
42 |