From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andreas Gruenbacher Date: Fri, 30 Oct 2020 22:51:43 +0100 Subject: [Cluster-devel] [PATCH 08/17] gfs2: When looking for blocks to allocate, don't clamp at free blocks In-Reply-To: <20201030215152.1567790-1-agruenba@redhat.com> References: <20201030215152.1567790-1-agruenba@redhat.com> Message-ID: <20201030215152.1567790-9-agruenba@redhat.com> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit When looking for blocks to allocate, don't limit the number of blocks we are looking for by the number of available blocks: this defeats the following check if enough blocks are still available, and it will lead to nonsensical "0-block allocations" when a resource group is out of free blocks. Fixes: ff7f4cb46116 ("GFS2: Consolidate free block searching functions") Signed-off-by: Andreas Gruenbacher --- fs/gfs2/rgrp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c index 89357107103a..5f72ae9677a7 100644 --- a/fs/gfs2/rgrp.c +++ b/fs/gfs2/rgrp.c @@ -1567,7 +1567,7 @@ static void rg_mblk_search(struct gfs2_rgrpd *rgd, struct gfs2_inode *ip, extlen = 1; else { extlen = max_t(u32, atomic_read(&ip->i_sizehint), ap->target); - extlen = clamp(extlen, (u32)RGRP_RSRV_MINBLKS, free_blocks); + extlen = max_t(u32, extlen, RGRP_RSRV_MINBLKS); } if ((rgd->rd_free_clone < rgd->rd_reserved) || (free_blocks < extlen)) return; -- 2.26.2