Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1101624pxa; Thu, 20 Aug 2020 02:29:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyKRn6iIcy4HJvr039t3nO5OgKEj0wZHKsl0kjsho5E87CmTKbHcNBfqTiRJ9i+hgxK851U X-Received: by 2002:a17:906:4f8f:: with SMTP id o15mr2297538eju.220.1597915770930; Thu, 20 Aug 2020 02:29:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597915770; cv=none; d=google.com; s=arc-20160816; b=DO3FQ1INsblqi28WBIQL6oaXcJ4bIewdZ/eK0FMjK7+xL+EF7cx7hPFyZbDk8krZY7 UOs5ntjCAz9/+thuAxRoQOAKMrCj/sbVj8peEeDJ7xwYS8aonyJPF6auUYXIONDD6EmC zqzsc8uo/6roXPM0Xqvxlk2FdQ08I0BtyHdTxp8fZ3zCWNGABuTXKhvWNq1W6Bd3iiqu 7L5yCwh1PRDR2vPhhU/FYe6wco/dvwLhxEg6SquMZQNZLnkRSPzSt9kHIfbiOC53eU+x gRS40fud5E0xVoRl7jXEhMoBu2rh2kwmdZFdyGEs0CU4T19YtQ0L458jOyeo59AEmjDY djMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=6Jpgy+ZrBPmf4gi1bUFotLTTEFozGq6P9Io0n//x5nw=; b=PBIPf3mM1wcsrXn//8Thpj1mJ0RLMT8WBXGx1yJxgZ9unUgZIZuhqVs2p3AJ93fMCB YfwEafao82sR4klzN1yW81bNIIuucALhkSlUsFJzGgVmJ13UqWFprVBar9hpT7XCyF/Y YKd5sCkxImIx38jXhYwjsOJvK9jsTWn7k3s9aMOsrFX9khh0lr5gUdbdqPsRg5UaDNB4 gr4gZNP8mkJmYQHxy2ykkrk3eKGQgl8dOWKQUJPrQ+0EWD7WFzYyRxNiEyWL7+/FI16p +Ga0KBUshCabmMhjQQO7f+++2Vr6E5afZqOfqX7XALOHEzUd4t0pG9UchBnaVLIgQm5/ Z0Xg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=SElX8l4P; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w6si821387ejb.150.2020.08.20.02.29.06; Thu, 20 Aug 2020 02:29:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=SElX8l4P; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727949AbgHTJ17 (ORCPT + 99 others); Thu, 20 Aug 2020 05:27:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:34832 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727936AbgHTJ04 (ORCPT ); Thu, 20 Aug 2020 05:26:56 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1367322D2C; Thu, 20 Aug 2020 09:26:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597915615; bh=qJmEpL7tQCrTn65OLAj/uvcxZFClayXp+iHkQUQEPGA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SElX8l4P0ygjJRsOue7LR99wPuglwvyOqANe5RQ2mV/l3gpwqc8CmeXCmAqGLpAEi 1X6TXyRgu4g8qMQc/n3rcLiYB6P8Q+Yze6Z76JkkZaAVedAchi+dVKVDzWaGZlno1m srJYnuL/C0ihMRe0GyvdkBos6vjlwtgfg2l77W7Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mikulas Patocka , Jan Kara Subject: [PATCH 5.8 076/232] ext2: fix missing percpu_counter_inc Date: Thu, 20 Aug 2020 11:18:47 +0200 Message-Id: <20200820091616.491366598@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200820091612.692383444@linuxfoundation.org> References: <20200820091612.692383444@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mikulas Patocka commit bc2fbaa4d3808aef82dd1064a8e61c16549fe956 upstream. sbi->s_freeinodes_counter is only decreased by the ext2 code, it is never increased. This patch fixes it. Note that sbi->s_freeinodes_counter is only used in the algorithm that tries to find the group for new allocations, so this bug is not easily visible (the only visibility is that the group finding algorithm selects inoptinal result). Link: https://lore.kernel.org/r/alpine.LRH.2.02.2004201538300.19436@file01.intranet.prod.int.rdu2.redhat.com Signed-off-by: Mikulas Patocka Cc: stable@vger.kernel.org Signed-off-by: Jan Kara Signed-off-by: Greg Kroah-Hartman --- fs/ext2/ialloc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/fs/ext2/ialloc.c +++ b/fs/ext2/ialloc.c @@ -80,6 +80,7 @@ static void ext2_release_inode(struct su if (dir) le16_add_cpu(&desc->bg_used_dirs_count, -1); spin_unlock(sb_bgl_lock(EXT2_SB(sb), group)); + percpu_counter_inc(&EXT2_SB(sb)->s_freeinodes_counter); if (dir) percpu_counter_dec(&EXT2_SB(sb)->s_dirs_counter); mark_buffer_dirty(bh); @@ -528,7 +529,7 @@ got: goto fail; } - percpu_counter_add(&sbi->s_freeinodes_counter, -1); + percpu_counter_dec(&sbi->s_freeinodes_counter); if (S_ISDIR(mode)) percpu_counter_inc(&sbi->s_dirs_counter);