Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2634570lqp; Mon, 25 Mar 2024 05:13:53 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUnNgeh2dM9x7xCIwf1XT8M7W0+4L21GW7pI4SvIFUZ0fgA2XcibTY1SBd24nb/nB2pn+8FeL2fFRG9MLzSQOoEyfNw4TkzeepvPGvvCw== X-Google-Smtp-Source: AGHT+IHnwOGAQpB5QYatALDMEnzH782B3JeKonHFZBWvqC5Go8XjR3TEV912xwAqaM07VsHrbWcg X-Received: by 2002:a05:6a00:398f:b0:6e6:946b:a983 with SMTP id fi15-20020a056a00398f00b006e6946ba983mr7407790pfb.10.1711368833454; Mon, 25 Mar 2024 05:13:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711368833; cv=pass; d=google.com; s=arc-20160816; b=KYpBq5KjVaHpIvnm/ZIF+lpuKII1e1ykNP7O3NdwWAv4gijVY6gmyTHtw5e6Ee5izh 3neEiRma+JhcheBGfqsC2wbzutpTaNjosn8eDUwCwmdRLhdSRAKX7XAUjX+GlKYebzWH Pn9DI279N3fX6k+p96ciR6CNvr+PxtfW8iyidUowMriWbnqdvXGXtuTLSN47IcfKkz62 lg1wAZEJVX2a2ZhoE6WP/4YTg5YncS8mPD7FyMNFvMzrmHN2mGXKuWmcYDRr9VgicAGm noEKltA3NpmTfIWje0KuHLtBwLwQNNylC0xpysL9p040ComF7C1qCcBPuLx1KAjASdFX ynBg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=u6nsXcelcuspSr0LjhxzxupWOE4n7xcPaaC2L9QgY9o=; fh=YBH/eleH8Y9AhvDKhhsPTR/V7c9Kt6ouiUHpciibTJs=; b=pULxcCG1HWN3EW9e+sfCS199YnLj9yl/HJfj7VDXr614kl8Z3HaPfti2/uvI2cbPS9 HHOMUwVwdqLqcvPPubkWHM64NhjzRA+173h3WK7UGL0Fz3AbpO00PMYOt4wLI81FkpsI Shm5LfxE101jbovlWqopq+aYt4UxuiP4F60ftj5wvzsVDGLwYSDg3cJE1QeODFWzewNU Pok90xRVYquysRYvuhWAsrhqXRScx3kold4XfKUfxBbF4pObXYDukj1XU3gE2XBSiS4q P+63ImrP5ZVYud87bJqbXMKbdEn7o7+ZG0LEne2MlFu0JrNUStlIld7aGwZSmiAPaivT B3dA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=E4QB37Ry; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-116333-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-116333-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id j18-20020aa78d12000000b006ea872d1b12si4958799pfe.390.2024.03.25.05.13.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 05:13:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-116333-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=E4QB37Ry; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-116333-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-116333-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id E81222C2370 for ; Mon, 25 Mar 2024 12:06:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C86C0296BDB; Mon, 25 Mar 2024 03:41:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="E4QB37Ry" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9C752296BB1; Sun, 24 Mar 2024 23:52:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324323; cv=none; b=JsxhaTJJY0q0AGnOmJgmBdAjjG0vIkXRa35POt2bR/fcBzKW7dzX/7VOyxqUjBPeRKpZCOZi84+SS54X1LAd67GFVj0Qzw7Pca+ojTOa/Ei8KvtsFVWTwKyNJPTvq487uC0ZTYkX7vxyJvwY9ssHaKaDO3iw6Tyxoj1Y1KFZZrA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324323; c=relaxed/simple; bh=vFwkb/ECA43oJr9FZc50G4ViBhPU2rPobIrvVl1aWxQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=s984+d8ol0QZez2qyDku5HgacWM8XrnoVtFRa0k4tyXC2V6ijR0WzfeoQ5iCToezrrtrA8QgQAkhhhZ4+lBxbhrYFZMWu5TYsKvPIP8fi26WAWVQ23P+gbwRr0JEHVLu+RzStTnSVqIVX7Ij4UyyrLN/vZXDKcBWgRxitbZL1yg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=E4QB37Ry; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 91D74C433C7; Sun, 24 Mar 2024 23:52:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711324323; bh=vFwkb/ECA43oJr9FZc50G4ViBhPU2rPobIrvVl1aWxQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E4QB37Ry6yrpDepTTiXZdUfKFqp7VZHp4xDFoubKjiaQmtyv9RKm77Xov/cJrC3P1 IPTld1V2DL2QbwvFcMejsRaN/p5HCDqY01bywR8yxDN3mCIs4LP9E6z6to0PYIZUV9 PLJHfOFz4GWPVDTwFocg9IDk4qNOHu57kn5au7hou14UE+pnQ5BMYlRHPk8eKkR6td DFGJBDI/Db19+qOOEeYumQfIsEN5PKDE0fMFgvxluXbNLHrWJWiD8r0WDHesH6llJU eM6b5RI20LBvlXXBlEU8PQN550Gx+2fAx7lY77VE8dAXg0SB25Qzcl5NTeMyIdRhYU Gu1UXF+ewwWVQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Chengguang Xu , Jan Kara , Sasha Levin Subject: [PATCH 4.19 094/148] quota: check time limit when back out space/inode change Date: Sun, 24 Mar 2024 19:49:18 -0400 Message-ID: <20240324235012.1356413-95-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324235012.1356413-1-sashal@kernel.org> References: <20240324235012.1356413-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Chengguang Xu [ Upstream commit 632a9f3acd6687376cbb0b178df6048e19cbacc9 ] When we fail from allocating inode/space, we back out the change we already did. In a special case which has exceeded soft limit by the change, we should also check time limit and reset it properly. Signed-off-by: Chengguang Xu Signed-off-by: Jan Kara Stable-dep-of: 179b8c97ebf6 ("quota: Fix rcu annotations of inode dquot pointers") Signed-off-by: Sasha Levin --- fs/quota/dquot.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c index b55d91d3d87c2..895636fd655f6 100644 --- a/fs/quota/dquot.c +++ b/fs/quota/dquot.c @@ -1760,13 +1760,11 @@ int __dquot_alloc_space(struct inode *inode, qsize_t number, int flags) if (!dquots[cnt]) continue; spin_lock(&dquots[cnt]->dq_dqb_lock); - if (reserve) { - dquots[cnt]->dq_dqb.dqb_rsvspace -= - number; - } else { - dquots[cnt]->dq_dqb.dqb_curspace -= - number; - } + if (reserve) + dquot_free_reserved_space(dquots[cnt], + number); + else + dquot_decr_space(dquots[cnt], number); spin_unlock(&dquots[cnt]->dq_dqb_lock); } spin_unlock(&inode->i_lock); @@ -1817,7 +1815,7 @@ int dquot_alloc_inode(struct inode *inode) continue; /* Back out changes we already did */ spin_lock(&dquots[cnt]->dq_dqb_lock); - dquots[cnt]->dq_dqb.dqb_curinodes--; + dquot_decr_inodes(dquots[cnt], 1); spin_unlock(&dquots[cnt]->dq_dqb_lock); } goto warn_put_all; -- 2.43.0