]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.9.129/gfs2-don-t-reject-a-supposedly-full-bitmap-if-we-have-blocks-reserved.patch
4.14-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.9.129 / gfs2-don-t-reject-a-supposedly-full-bitmap-if-we-have-blocks-reserved.patch
CommitLineData
47f38bc9
GKH
1From foo@baz Fri Sep 21 09:36:02 CEST 2018
2From: Bob Peterson <rpeterso@redhat.com>
3Date: Mon, 18 Jun 2018 13:24:13 -0500
4Subject: gfs2: Don't reject a supposedly full bitmap if we have blocks reserved
5
6From: Bob Peterson <rpeterso@redhat.com>
7
8[ Upstream commit e79e0e1428188b24c3b57309ffa54a33c4ae40c4 ]
9
10Before this patch, you could get into situations like this:
11
121. Process 1 searches for X free blocks, finds them, makes a reservation
132. 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.
163. 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
20This patch adds an additional check to allow processes to use their
21own reservations.
22
23Signed-off-by: Bob Peterson <rpeterso@redhat.com>
24Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
25Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
26Signed-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