Received: by 10.223.185.116 with SMTP id b49csp8019368wrg; Thu, 1 Mar 2018 15:34:52 -0800 (PST) X-Google-Smtp-Source: AG47ELub09MteXK33gjabTu36ZiulwJbHrnZdOzBqwD/FqFJQv4uc2VGzmecYo6e4J85Fwju5/Xi X-Received: by 10.99.153.1 with SMTP id d1mr2899587pge.338.1519947291947; Thu, 01 Mar 2018 15:34:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519947291; cv=none; d=google.com; s=arc-20160816; b=Hb0pDWjhtQMD4TWutRSl1kfTDDuLCZBxjahs9nieHlNN6/KSRxcuEKJehj5Ms25c79 jVlr4jWxUSfXsnGll6ypH07T7USIzvQCFg0BJ/teItBSDCFEJayuV6BPsxEBOYXv0Mni JKaogTX06Tn3iBZ9bOf6KYYh0jUSHDSGLIsmleWxtbj75umeQtRhEAAzbsodLac1e5Uw iHIePmcVALhb+N/N2w3AL/YgQav5MJDGLSdg4s0VYHC/DOk/M6ybofpUk83UB9vqVn+U hL2l4QA4O6mLcUL3B3/GoQLwpaVQ6sOL6G+onTFqSzmyi8d8rbX3PaxiZbplp9Z80Kdl 4AKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:cc:subject:date:to :from:arc-authentication-results; bh=M6QbPuLwzydgHOlGzLCM7xKJ0PtovmPYXfd/5agbH5I=; b=bJC5+FYSUlC8WLWDz8NV5/U+9A1kcHi0IgqgCvldlJ01Sc2vi9cASFnqg1qIiTvEY7 1u0q6khP02Q3d3sbvtGw5owWtOlNReb9cv0hzp6uBW+Ufm551rNegYKvMydNUhN8Eg7J kRid4exsP5jAb9C53fF8JjzjGOsj87RcsY/OsEztn5m76YjamaaTc9E+r6SLbo6eA+b5 FBFUzjzTPKhcQaTTCuXZCHr4Btkh5MX2Hozzp2Tt78UjNNep/HGPFRO39gDepZsdneT8 wFQylT6ykl5f7U1+HOeKV/7Au1K5Fyn60sqPVYoplvMUiC8U5XIMItcKakqBtiwADk1k EaPg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s190si2987150pgc.510.2018.03.01.15.34.36; Thu, 01 Mar 2018 15:34:51 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1163218AbeCAXcb (ORCPT + 99 others); Thu, 1 Mar 2018 18:32:31 -0500 Received: from mx2.suse.de ([195.135.220.15]:54110 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1163007AbeCAXc2 (ORCPT ); Thu, 1 Mar 2018 18:32:28 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 13502B46E; Thu, 1 Mar 2018 23:32:27 +0000 (UTC) From: NeilBrown To: Oleg Drokin , Greg Kroah-Hartman , James Simmons , Andreas Dilger Date: Fri, 02 Mar 2018 10:31:25 +1100 Subject: [PATCH 02/17] staging: lustre: fix bug in osc_enter_cache_try Cc: Linux Kernel Mailing List , Lustre Development List Message-ID: <151994708510.7628.7308229784516417641.stgit@noble> In-Reply-To: <151994679573.7628.1024109499321778846.stgit@noble> References: <151994679573.7628.1024109499321778846.stgit@noble> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The lustre-release patch commit bdc5bb52c554 ("LU-4933 osc: Automatically increase the max_dirty_mb") changed - if (cli->cl_dirty + PAGE_CACHE_SIZE <= cli->cl_dirty_max && + if (cli->cl_dirty_pages < cli->cl_dirty_max_pages && When this patch landed in Linux a couple of years later, it landed as - if (cli->cl_dirty + PAGE_SIZE <= cli->cl_dirty_max && + if (cli->cl_dirty_pages <= cli->cl_dirty_max_pages && which is clearly different ('<=' vs '<'), and allows cl_dirty_pages to increase beyond cl_dirty_max_pages - which causes a latter assertion to fails. Fixes: 3147b268400a ("staging: lustre: osc: Automatically increase the max_dirty_mb") Signed-off-by: NeilBrown --- drivers/staging/lustre/lustre/include/obd.h | 2 +- drivers/staging/lustre/lustre/osc/osc_cache.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/obd.h b/drivers/staging/lustre/lustre/include/obd.h index 4368f4e9f208..f1233ca7d337 100644 --- a/drivers/staging/lustre/lustre/include/obd.h +++ b/drivers/staging/lustre/lustre/include/obd.h @@ -191,7 +191,7 @@ struct client_obd { struct sptlrpc_flavor cl_flvr_mgc; /* fixed flavor of mgc->mgs */ /* the grant values are protected by loi_list_lock below */ - unsigned long cl_dirty_pages; /* all _dirty_ in pahges */ + unsigned long cl_dirty_pages; /* all _dirty_ in pages */ unsigned long cl_dirty_max_pages; /* allowed w/o rpc */ unsigned long cl_dirty_transit; /* dirty synchronous */ unsigned long cl_avail_grant; /* bytes of credit for ost */ diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c index 1c70a504ee89..459503727ce3 100644 --- a/drivers/staging/lustre/lustre/osc/osc_cache.c +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c @@ -1529,7 +1529,7 @@ static int osc_enter_cache_try(struct client_obd *cli, if (rc < 0) return 0; - if (cli->cl_dirty_pages <= cli->cl_dirty_max_pages && + if (cli->cl_dirty_pages < cli->cl_dirty_max_pages && atomic_long_read(&obd_dirty_pages) + 1 <= obd_max_dirty_pages) { osc_consume_write_grant(cli, &oap->oap_brw_page); if (transient) {