Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp1384145lqe; Mon, 8 Apr 2024 07:31:14 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVrmTiwL11E5KCCWuE7mpINJeptuYsDQ9/StaQqet5q99ZMGrolc7u67iA4w+nFsPIoO6bGHxx4Aa66HJsJKhdFZK0e4dlNQdsKE5Kzzw== X-Google-Smtp-Source: AGHT+IES10L8vcqg0QYL3weAyqAkjgeSeSAgomx8ANupTYIimyYAjv1D+4b/jBZ47ynzGOKDFTVP X-Received: by 2002:a05:620a:4687:b0:78d:661e:6b32 with SMTP id bq7-20020a05620a468700b0078d661e6b32mr3654949qkb.74.1712586674307; Mon, 08 Apr 2024 07:31:14 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712586674; cv=pass; d=google.com; s=arc-20160816; b=oe/c0/RBcw430AEmaNwqKy/IxCi0vXF1yGJLcgPmkOO7CVeWVfKopO2nzipe47t36A 4aTNUQGypSVRURjnBwaM+jWafkl75injSaDXJhriqINHT5SljGAUXCezbN13aIPN119E VGapSuqEkGUr4slyyDXTs5pQKuL63SDdgFRUCMQuzC0nJpfFGGHKm190A7pNc0cwcpML YzG2Kd28Dy5KwjKjGLypWRjT8zYj7pwFOwvtyABT9SQapYjm5h8LD/8RXinksabhdY0t bm2u55TCCXK3NRdtrQGBiqr4oTb45TZ1zDR/+0EJZqziVx8mC4PCnQk7xa4gG8snpzI4 y35A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature:dkim-signature:dkim-signature :dkim-signature; bh=zn/qWfU1LE05R6zzlgfcSN5haYke/pTO+J4746Gv9mo=; fh=JeNeH5/cnhXsF6p9vDIqnNEF8ZRD6JNu+9PihzR4Up0=; b=QHuCAvElbFwKFeto2ePpnzadw0csb3PI6qeY5989ip+PedAqqTAz5hXjtJHO9Igpqz AH4cllVhNISft8rzTHTurCTwiskD0daSM5MIR4RJ6Tl5Z1pbJMMmh6Y9KttE6Ze/Rebe C+uWeXm5EvlcxyEHTDJ6WA6e258+UBrLLGY9I8oG6yP6qmyGko8TWWrROOMyYxKSOvue +9H8bkogL5WsXbZ2EApSR59YU8IaSJqyd9XcnE3OqSCNb/4Bvo05O3i0Cji4YScagSI1 lnJi3AzY8SNCf3pmaPkOcuvhpqU985UlIIehX4V6YFXYv6L46BiSbp73azUWU4mEH4hE uMfQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=n2PEwkJo; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=n2PEwkJo; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; arc=pass (i=1 spf=pass spfdomain=suse.cz dkim=pass dkdomain=suse.cz dkim=pass dkdomain=suse.cz); spf=pass (google.com: domain of linux-kernel+bounces-135520-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-135520-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id bs7-20020a05620a470700b0078d54355829si4222081qkb.525.2024.04.08.07.31.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Apr 2024 07:31:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-135520-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=n2PEwkJo; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=n2PEwkJo; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; arc=pass (i=1 spf=pass spfdomain=suse.cz dkim=pass dkdomain=suse.cz dkim=pass dkdomain=suse.cz); spf=pass (google.com: domain of linux-kernel+bounces-135520-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-135520-linux.lists.archive=gmail.com@vger.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 ny.mirrors.kernel.org (Postfix) with ESMTPS id F3A2F1C21542 for ; Mon, 8 Apr 2024 14:31:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7334313B593; Mon, 8 Apr 2024 14:30:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b="n2PEwkJo"; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="x3AnvYBI"; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b="n2PEwkJo"; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="x3AnvYBI" Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8161713B594; Mon, 8 Apr 2024 14:30:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712586651; cv=none; b=NL+U8IOQMy1a0TOalLoxCjigFefTKBvHj1kdWeSrIC47qWngNOoE8QXFHQAbpVAPf2b2ddu5Q0OEjcCcxQsYTzi55I3BPNHXa8ZDAMf9aUPhqYi8ocOq1B7+NeeTX2mNMlLSmChqoMXs+pStcFa6304uHWSQ/piOM6XVWMpfxII= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712586651; c=relaxed/simple; bh=Re4ozZr4CHJHzufgoZx5yfogXY8vgcdxYpMPuHB77VI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Rm4VsFmkYe/VqqOB5tZBYfIv37pvsfXHk/53d6XWzh8jAkX9+zy+Ygdq/C5Hex+MsbK/F4fiUB3TqQH2WjhAoW5jGzGpkuqcaDHcQBqPWEHirlIsTkkbJ/DA5RHvhAj5RH6oS2UdsDT/xZ4ltIvAfN0TBUK/GciOyNqR+IPDtwM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz; spf=pass smtp.mailfrom=suse.cz; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b=n2PEwkJo; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b=x3AnvYBI; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b=n2PEwkJo; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b=x3AnvYBI; arc=none smtp.client-ip=195.135.223.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.cz Received: from imap2.dmz-prg2.suse.org (imap2.dmz-prg2.suse.org [10.150.64.98]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 95BD9203D1; Mon, 8 Apr 2024 14:30:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1712586647; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=zn/qWfU1LE05R6zzlgfcSN5haYke/pTO+J4746Gv9mo=; b=n2PEwkJoZtm1iK07eyggjA7Kqoq15r7fKlEqTDvD/JZSOVAc6rivsnp7W2DSsHOuekfnsH 4zgFflJPpRtYq4KwKvBE6p7xnL0O3w86+/l/wwY9KPkS2CBXcM/k6qPgON1qSe5LuTZNCC ilg2lTg/qpC2dKhOIxmjxrB4dkrRfmU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1712586647; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=zn/qWfU1LE05R6zzlgfcSN5haYke/pTO+J4746Gv9mo=; b=x3AnvYBIROEdOj1Us8VkbtucD98rhb5N3jcwpGYuI2OrqLs0kXEJKxeVmuV7IuZ98ekVZw 84xOclvqxuf1TECg== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1712586647; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=zn/qWfU1LE05R6zzlgfcSN5haYke/pTO+J4746Gv9mo=; b=n2PEwkJoZtm1iK07eyggjA7Kqoq15r7fKlEqTDvD/JZSOVAc6rivsnp7W2DSsHOuekfnsH 4zgFflJPpRtYq4KwKvBE6p7xnL0O3w86+/l/wwY9KPkS2CBXcM/k6qPgON1qSe5LuTZNCC ilg2lTg/qpC2dKhOIxmjxrB4dkrRfmU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1712586647; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=zn/qWfU1LE05R6zzlgfcSN5haYke/pTO+J4746Gv9mo=; b=x3AnvYBIROEdOj1Us8VkbtucD98rhb5N3jcwpGYuI2OrqLs0kXEJKxeVmuV7IuZ98ekVZw 84xOclvqxuf1TECg== Received: from imap2.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap2.dmz-prg2.suse.org (Postfix) with ESMTPS id 8A2B91332F; Mon, 8 Apr 2024 14:30:47 +0000 (UTC) Received: from dovecot-director2.suse.de ([10.150.64.162]) by imap2.dmz-prg2.suse.org with ESMTPSA id h3S0IZf/E2Y8cAAAn2gu4w (envelope-from ); Mon, 08 Apr 2024 14:30:47 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id 2CB4AA0814; Mon, 8 Apr 2024 16:30:43 +0200 (CEST) Date: Mon, 8 Apr 2024 16:30:43 +0200 From: Jan Kara To: Chao Yu Cc: jack@suse.com, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] quota: don't let mark_dquot_dirty() fail silently Message-ID: <20240408143043.65yowy2yvf46weab@quack3> References: <20240407073128.3489785-1-chao@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240407073128.3489785-1-chao@kernel.org> X-Spam-Level: X-Spamd-Result: default: False [-3.77 / 50.00]; BAYES_HAM(-2.97)[99.86%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_RHS_NOT_FQDN(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; MISSING_XM_UA(0.00)[]; TO_DN_SOME(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; FROM_HAS_DN(0.00)[]; DKIM_SIGNED(0.00)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCVD_TLS_LAST(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap2.dmz-prg2.suse.org:helo,imap2.dmz-prg2.suse.org:rdns,suse.com:email] X-Spam-Score: -3.77 X-Spam-Flag: NO On Sun 07-04-24 15:31:28, 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); Do you have any practical case you care about? Because in practice the filesystem will usually report if there's some catastrophic error (and the errors from ->mark_dirty() all mean the filesystem is in unhealthy state). So this message just adds to the noise in the error log - and e.g. if the disk goes bad so we cannot write, we could spew a lot of messages like this. > } > - 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); Here, we can propagate the error back to userspace, which is probably better than spamming the logs. Honza -- Jan Kara SUSE Labs, CR