From patchwork Fri Jun 3 15:06:59 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Artem Bityutskiy X-Patchwork-Id: 98595 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 2BA0DB6FB0 for ; Sat, 4 Jun 2011 01:11:26 +1000 (EST) Received: from canuck.infradead.org ([2001:4978:20e::1]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QSW1r-0008GS-L1; Fri, 03 Jun 2011 15:11:15 +0000 Received: from localhost ([127.0.0.1] helo=canuck.infradead.org) by canuck.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1QSW1r-0001EI-C6; Fri, 03 Jun 2011 15:11:15 +0000 Received: from mail-ew0-f49.google.com ([209.85.215.49]) by canuck.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QSW1o-0001Dz-1s for linux-mtd@lists.infradead.org; Fri, 03 Jun 2011 15:11:12 +0000 Received: by ewy3 with SMTP id 3so883796ewy.36 for ; Fri, 03 Jun 2011 08:11:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:subject:from:reply-to:to:in-reply-to:references :content-type:date:message-id:mime-version:x-mailer :content-transfer-encoding; bh=7TXEaW6AIT1M8Xg9FG2WLKygjjzN33KwBCk0sPVZIKc=; b=xfYCHKwuohc6N7DEXBXtDFq8g7HvSo+Nf0+BNR8CdYxk4o1c/8MxlJ/aY36mAe2boI 6mPAXkFFWaqE8IKcfR3TbE05XTHIJnMTCJDQMtTyW9EpvkizpCVQcO6hFYn1g0brryx5 FpX8ib+SAiw645ryLPoG93zTwXSH0FQJ5V548= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=subject:from:reply-to:to:in-reply-to:references:content-type:date :message-id:mime-version:x-mailer:content-transfer-encoding; b=pRD3JBSNJDaChN01SZKZSIzwvWRdrmSX0bS7HleC8cp+dJ/wFwsH9KWykA+1MsIgag 3let3ekZeBn2ANOSW3JGuxr6AdYj8qYzJuPVOMlHqGa3eGlPc112OnnPAM5xBC49qBOc oEKyvqBdnS3pMRHB/TzZ/B3JyTiiJW90F9ego= Received: by 10.14.3.208 with SMTP id 56mr808221eeh.41.1307113868566; Fri, 03 Jun 2011 08:11:08 -0700 (PDT) Received: from ?IPv6:::1? (shutemov.name [188.40.19.243]) by mx.google.com with ESMTPS id s48sm1194174eeb.16.2011.06.03.08.11.06 (version=SSLv3 cipher=OTHER); Fri, 03 Jun 2011 08:11:07 -0700 (PDT) Subject: Re: [PATCH 05/10] UBIFS: fix shrinker object count reports From: Artem Bityutskiy To: linux-mtd@lists.infradead.org In-Reply-To: <1307111413.3069.5.camel@localhost> References: <1307109001-19761-1-git-send-email-dedekind1@gmail.com> <1307109001-19761-6-git-send-email-dedekind1@gmail.com> <1307108926.3069.0.camel@localhost> <1307111413.3069.5.camel@localhost> Date: Fri, 03 Jun 2011 18:06:59 +0300 Message-ID: <1307113619.3069.14.camel@localhost> Mime-Version: 1.0 X-Mailer: Evolution 2.32.2 (2.32.2-1.fc14) X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20110603_111112_393433_F1A1F1A6 X-CRM114-Status: GOOD ( 16.45 ) X-Spam-Score: 1.4 (+) X-Spam-Report: SpamAssassin version 3.3.1 on canuck.infradead.org summary: Content analysis details: (1.4 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.215.49 listed in list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is freemail (dedekind1[at]gmail.com) 2.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit (dedekind1[at]gmail.com) -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.0 RFC_ABUSE_POST Both abuse and postmaster missing on sender domain 0.0 T_TO_NO_BRKTS_FREEMAIL T_TO_NO_BRKTS_FREEMAIL X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: dedekind1@gmail.com List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-mtd-bounces@lists.infradead.org Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org So, From cf610bf4199770420629d3bc273494bd27ad6c1d Mon Sep 17 00:00:00 2001 From: Artem Bityutskiy Date: Tue, 31 May 2011 07:03:21 +0300 Subject: [PATCH] UBIFS: fix shrinker object count reports Sometimes VM asks the shrinker to return amount of objects it can shrink, and we return the ubifs_clean_zn_cnt in that case. However, it is possible that this counter is negative for a short period of time, due to the way UBIFS TNC code updates it. And I can observe the following warnings sometimes: shrink_slab: ubifs_shrinker+0x0/0x2b7 [ubifs] negative objects to delete nr=-8541616642706119788 This patch makes sure UBIFS never returns negative count of objects. Signed-off-by: Artem Bityutskiy Cc: stable@kernel.org --- fs/ubifs/shrinker.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/fs/ubifs/shrinker.c b/fs/ubifs/shrinker.c index ca953a9..9e1d056 100644 --- a/fs/ubifs/shrinker.c +++ b/fs/ubifs/shrinker.c @@ -284,7 +284,11 @@ int ubifs_shrinker(struct shrinker *shrink, struct shrink_control *sc) long clean_zn_cnt = atomic_long_read(&ubifs_clean_zn_cnt); if (nr == 0) - return clean_zn_cnt; + /* + * Due to the way UBIFS updates the clean znode counter it may + * temporarily be negative. + */ + return clean_zn_cnt >= 0 ? clean_zn_cnt : 1; if (!clean_zn_cnt) { /*