Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp725803lqe; Sun, 7 Apr 2024 00:32:39 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUvXB185JdKwTmKGrMTIJa2jp+ZWh1ZAXGXwTCSwZFc9oibP6CGCYPi4nuwuWi/x1QRFFN6169bTKbz3uLz/sca2nQiJUNh40E3RAAzRA== X-Google-Smtp-Source: AGHT+IE+DlzyuEZRpjsKqcGQtq8BvqZPqVcNPqSf9wClCELN73USM9urz9+aBlFWM7v6Hy5TnMr/ X-Received: by 2002:a05:6a00:8c3:b0:6ea:a274:cdf8 with SMTP id s3-20020a056a0008c300b006eaa274cdf8mr7437807pfu.29.1712475159162; Sun, 07 Apr 2024 00:32:39 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712475159; cv=pass; d=google.com; s=arc-20160816; b=d3kOzaR2jCOy07CHJeAaYki+Ioi5AqSO6LqFtcV3+3qDSyrEDy+rxMkykYcR+dQwot +5vNOx7JmhGAIVb5hODR6W3X+ELiw7aw8t09tORIvVgT8y1iPxWZ+VA+7mhxKj3qJy01 cJu8OPDB/gZyLeCZrbqF5Zt+qjvmrG9jrG07QKTBouxGB13Cm5KsX0NXPWnhf4/qlq/E mqPl8TNy3dpu88mIFHm9ekxaCeoO9KSzpEoM0SdTX29tEdkzN9T2XrvF/iTr/unWcIPS DilMZZawunhFs4pcXvH3EeHb7iCwLWPPmHYgHt6gRYw1JkNTPWCcLYElJnuh2nacH0LD DC+w== 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:message-id:date:subject:cc:to :from:dkim-signature; bh=tBQuJFva3CDONX6aSnJ4T1Rq/A0oUPD6CGXiGTU/Q/w=; fh=mr1hDX1uia4q9T8WBXqJsAx12cYMr6BJk3OFWNfVyfQ=; b=PAPSngMgWvuzDdOuqE3vUa93lSv3l9uJJ1R69HIqfF+fN4hVYT/pbkVLtt+nO9WSD4 snT/pix+8arPBjqUX9etZ+vw22m8qTQeAa7e3hqeINCLvcernKVL+mWlgm7cl/gy+ZXk OeAbME2BlWvdyIP2+hStZAMgdxyLC37Y4nUz26eILQ84q6iOFsOjhC7B5RFqaiwgaR79 HoONW99qy00aeNXzoCIz8R1EJJL1OMEa0+LhBjAFkaXzaCZvwtqCq31S1CCjDlCBC1Aq aPDnibkjZdr9U1XUwMehqxJBbHZEOUKlb/k4jZ+U2yCPqBvPJQcj96X+yB/JIulqBDZu fsiQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=S6+sgDLC; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-134224-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-134224-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id j30-20020a634a5e000000b005dc892988e1si4256395pgl.509.2024.04.07.00.32.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 07 Apr 2024 00:32:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-134224-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=S6+sgDLC; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-134224-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-134224-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id E7D24B22268 for ; Sun, 7 Apr 2024 07:31:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C989C10A22; Sun, 7 Apr 2024 07:31:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="S6+sgDLC" 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 ED3DECA7A; Sun, 7 Apr 2024 07:31:38 +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=1712475099; cv=none; b=jDvrwSz1EtGGvjwCTMEA4b9IJdsKg64JiVPorbnV6FvZGOw4NZPruFIWn9EzILXtc0+e65OppNgQnK3s1ilKuG9SjFZmqW2Ujm+xDrB/y7dDRrzmBZ604r4ic2WnnM6mLx08wNgoREuEETHv3QCUfQtjdkqXrzNm4Au8Oep/fTU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712475099; c=relaxed/simple; bh=2/0x+pGO2mDSJuLq4AV+U67ydy3QJW8qPn5DR/tXu7M=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=MAcYQ2a9wKKYabHV4j6L4WV/85X8PNDF63D0lJAmysxX0ZLCjj5IL+QpS4V0J9X4Z+3FwxN2axzucL6O/j7m4tgZURig0dZ+eW99wGGc0ClZFZiOQlCZR+Awjr/jDRM4hapg7eZF5hzMME0Jb/FMuSIiYKxW8o3tbbD8QLmDKLs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=S6+sgDLC; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2F0A1C433F1; Sun, 7 Apr 2024 07:31:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712475098; bh=2/0x+pGO2mDSJuLq4AV+U67ydy3QJW8qPn5DR/tXu7M=; h=From:To:Cc:Subject:Date:From; b=S6+sgDLCxBKN2cW/PAEpm26hBflmn3XI7Qb1NH7Rhtu25Ci/Rv894J2SwVy2Q2Pc8 f2099vC2pcgsDAawlDh/xlnbFRJqXn6VE+wZ0emqYgPYZuWkjBaGEIwRL1OlS6tgXR c7H1OD5Vk4mm3siSlysuA9QJeM5n3qwl789MtZXKKPRX6nzePmSSvN0vHpoOLiUSWB eJ932kj2wH1j/nuWR+/LC5P5ThMuW+Fs/i4jFLp2YrJ3r9cRVWTLXUO/NVlnU95oNV cYmNVqARd8aZHjSh1JF/SsXasKoETWWYEvHti/4XumVLeEVuU8zwisEOSrWlACKaJw zkDNu0Iizfc3w== From: Chao Yu To: jack@suse.com Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Chao Yu Subject: [PATCH] quota: don't let mark_dquot_dirty() fail silently Date: Sun, 7 Apr 2024 15:31:28 +0800 Message-Id: <20240407073128.3489785-1-chao@kernel.org> X-Mailer: git-send-email 2.40.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit mark_dquot_dirty() will callback to specified filesystem function, it may fail due to any reasons, however, no caller will check return value of mark_dquot_dirty(), so, it may fail silently, let's print one line message for such case. Signed-off-by: Chao Yu --- fs/quota/dquot.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c index dacbee455c03..c5df7863942a 100644 --- a/fs/quota/dquot.c +++ b/fs/quota/dquot.c @@ -399,21 +399,20 @@ int dquot_mark_dquot_dirty(struct dquot *dquot) EXPORT_SYMBOL(dquot_mark_dquot_dirty); /* Dirtify all the dquots - this can block when journalling */ -static inline int mark_all_dquot_dirty(struct dquot __rcu * const *dquots) +static inline void mark_all_dquot_dirty(struct dquot __rcu * const *dquots) { - int ret, err, cnt; + int ret, cnt; struct dquot *dquot; - ret = err = 0; for (cnt = 0; cnt < MAXQUOTAS; cnt++) { dquot = srcu_dereference(dquots[cnt], &dquot_srcu); - if (dquot) - /* Even in case of error we have to continue */ - ret = mark_dquot_dirty(dquot); - if (!err) - err = ret; + if (!dquot) + continue; + ret = mark_dquot_dirty(dquot); + if (ret < 0) + quota_error(dquot->dq_sb, + "mark_all_dquot_dirty fails, ret: %d", ret); } - return err; } static inline void dqput_all(struct dquot **dquot) @@ -2725,6 +2724,7 @@ static int do_set_dqblk(struct dquot *dquot, struct qc_dqblk *di) { struct mem_dqblk *dm = &dquot->dq_dqb; int check_blim = 0, check_ilim = 0; + int ret; struct mem_dqinfo *dqi = &sb_dqopt(dquot->dq_sb)->info[dquot->dq_id.type]; if (di->d_fieldmask & ~VFS_QC_MASK) @@ -2807,7 +2807,10 @@ static int do_set_dqblk(struct dquot *dquot, struct qc_dqblk *di) else set_bit(DQ_FAKE_B, &dquot->dq_flags); spin_unlock(&dquot->dq_dqb_lock); - mark_dquot_dirty(dquot); + ret = mark_dquot_dirty(dquot); + if (ret < 0) + quota_error(dquot->dq_sb, + "mark_dquot_dirty fails, ret: %d", ret); return 0; } -- 2.40.1