Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp1794844lqe; Mon, 8 Apr 2024 23:40:43 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXalDALXEWyZKwhpudIzGH3VhVTwVTOQy1dN/k5hlQAJqneMfs527GRSROdXY3AZJBcGTKbwym9BV3vXZ0K4nJIndCz92Ct0Qa4pr3gUg== X-Google-Smtp-Source: AGHT+IE0UUey3pfLKvzoW/f7lweGPuvCIUzcJrBOTVgD+63xlByhTo16JMsBn0qUPJzvt1Fcaeau X-Received: by 2002:a05:6a21:4887:b0:1a7:a4c1:7c7a with SMTP id av7-20020a056a21488700b001a7a4c17c7amr1816894pzc.32.1712644842864; Mon, 08 Apr 2024 23:40:42 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712644842; cv=pass; d=google.com; s=arc-20160816; b=Lp7gvWOKml2SPgI2U4L4TmdYYYhpjDgZEOHInmXazONRGWIWW4ZVCfGkAOJmvrRQd+ l4MkHGNFVCeBIG/MTsTbKvcO5DzRTZe0+Ndn1LtCIWit0oS9tHjrD2zaZTgqXBi8Tb5f IANyfPWgW7TTvzt7BT4YcxwQyTKvN0IhhKRSBKc8DHSP2HN4zjeVE0RSOa6F01D7Wo+F yNUROsR6b3bGuBbvAEJrswY0Gx/f1v5npoW6EBJ9vZvzDwSZ85dR1N10MfxXofuMErJ5 mLHe5F0nENyvk5936fWIhjs2e8YPgFG1y7EhJcWScWfzH0s2b6vVNpH9JQuKpDZ/dfch c44w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=CpfP6sb7cHFyPFClXPHBH324DuRBf/quWshQRlnBl/4=; fh=zxKT9G/9thD8NdUDbWuRzRiqDJPvmLHAy/mhpbLeBUE=; b=a3LRWhKO43cRxjJye85kX5IB3C90Ss1gYfitoK2Z68fjc8bBmTa3SanLqgvwi+kGNr 1O5pXzccueORBcgSmnEtagOUMem0VAYyIGFE/ucASu8F2XVdmfiTeAjEWU4B/I19sK1s yp4ljeZsZWKgb8InT/h3aAm4fghcLNWQC4YB6qTv+3GdduewqjpM3ge5ZU3erSmu5E/X 2MfjvjaNExbjchYJGtftdGk9Uj/V6cPYmH44CDpuwQTM9vVx7mLBhPP4e2A+DmlmjTnb 5EYIyWdXXF31wlztlzLokBYjLBhsQQ8BciCZiyY5s8aUGj4eWEkA6ThMCVBv027XI6IF xoZQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-136306-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-136306-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id r9-20020a170902c60900b001dd6e237b9csi7434050plr.421.2024.04.08.23.40.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Apr 2024 23:40:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-136306-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-136306-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-136306-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com 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 89D9A286E68 for ; Tue, 9 Apr 2024 06:31:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A4B7842046; Tue, 9 Apr 2024 06:31:20 +0000 (UTC) Received: from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191]) (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 D4AF91773A; Tue, 9 Apr 2024 06:31:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.191 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712644280; cv=none; b=VetG4MihlOdQpOzbk/xMzO9VNYAEkVyupGvH1ImN9ar0ROhI9XNv4GrOZ2HiLLg8IPSLZdqlzzI4Kzw3LFoAmHlfBVBOk+IugGOeG6ooyftbDGI6KUv3I2MqTv2bQVe9+AC/Zhr1MHx45sGNFpFygUmLtxdgzT5ePEoOg1bKQas= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712644280; c=relaxed/simple; bh=URqtiEJVdrnUgHUx9SUvz6al5BcQ5UgCH5Yi0/qKvuE=; h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From: In-Reply-To:Content-Type; b=UZy5ZCSMYTjw1EIch6BhofefKNINv2RyWAP9Ply+cEWZYc1KRRXAGqQxAHLJ/9G8w5kCQ7ncqxr0H89kyUsX+tAAtBFXwWIihp/mFTjCINCzKj6LKNK2nL8RGX7jMMACGj2/7C9CwBlgCJMZT9UhJTJsc4ZurXjSZfTtWAQ3QC4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.191 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.163.17]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4VDGKy4qgGz1GGV5; Tue, 9 Apr 2024 14:30:30 +0800 (CST) Received: from canpemm500009.china.huawei.com (unknown [7.192.105.203]) by mail.maildlp.com (Postfix) with ESMTPS id 7AB341A0172; Tue, 9 Apr 2024 14:31:15 +0800 (CST) Received: from [10.108.234.194] (10.108.234.194) by canpemm500009.china.huawei.com (7.192.105.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Tue, 9 Apr 2024 14:31:15 +0800 Message-ID: Date: Tue, 9 Apr 2024 14:31:14 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] quota: don't let mark_dquot_dirty() fail silently To: Chao Yu , CC: , References: <20240407073128.3489785-1-chao@kernel.org> Content-Language: en-US From: "wangjianjian (C)" In-Reply-To: <20240407073128.3489785-1-chao@kernel.org> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To canpemm500009.china.huawei.com (7.192.105.203) On 2024/4/7 15:31, Chao Yu wrote: > 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); Here it overwrite previous error. > + if (ret < 0) > + quota_error(dquot->dq_sb, > + "mark_dquot_dirty fails, ret: %d", ret); > > return 0; > } -- Regards