From patchwork Fri Jun 1 13:04:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Matias Bjorling X-Patchwork-Id: 10443385 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 55391601D3 for ; Fri, 1 Jun 2018 13:08:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 491DE28B68 for ; Fri, 1 Jun 2018 13:08:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3DD1528B89; Fri, 1 Jun 2018 13:08:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EC57328B68 for ; Fri, 1 Jun 2018 13:08:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751964AbeFANIg (ORCPT ); Fri, 1 Jun 2018 09:08:36 -0400 Received: from mail-lf0-f66.google.com ([209.85.215.66]:46761 "EHLO mail-lf0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751948AbeFANEv (ORCPT ); Fri, 1 Jun 2018 09:04:51 -0400 Received: by mail-lf0-f66.google.com with SMTP id j13-v6so10293497lfb.13 for ; Fri, 01 Jun 2018 06:04:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lightnvm-io.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=p0AIvoXah78yyIRs00luZh0VCJIOLB6Ra8FSqLfmT8I=; b=eT+HYxwwI2B5Joh+4EPFDlZiqPzTG4ARXw+j6WlUfeQ/7wsKG6NS2Lv+fHUa596MVC xtWkhylnq3544SQTDxXBrNoKWoULzuBkojR1SEhTn9HLVXQDnkgECuguEnKl8eNeqJ1a K0VG4VkaKTghQRKhhN8C1Mq22MKqMbs09YfGUXdv5c7XCNKi6nlW83idhyy4vsVGLueA Gqx2gxjizDnGgbN20yesyhADqHmxXT+fDkO/i/jJZUlS/L8sOrlnrKbqu2+3QoB7mH60 SeCbWOA7a5jMxZhclJnUsiAC7GYcFRcNeyyxEiJW+At7BPbrrgN1ZwAdwofcjdZOU/OD g5BQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=p0AIvoXah78yyIRs00luZh0VCJIOLB6Ra8FSqLfmT8I=; b=NMq/ljGDKDQOK6T5MZWgh0lLRmQFp2JCkH9CDgKCljTXEpvD7meZGIG0l34A8tbVJf mvp+Cs3NrB5PtA6OwAjxDY2PZj0clWvsndz+uzmiMxkGFJx5h+FRKWOFpijDdj4y4+v3 y5FTCRqHPEhTKBL2JitJgt98DTAV5pLhXv+McNrtEqWSjpFeMsq4UhmXNe1q/3njYpLH +C5wQxxg9attQpWsO13TdMgtpu5K6qF/hH2neM0HzH4S8+Pf3CfJcY0TZ0uxAogESzaa pJ1JSDEtS5jGS2+EiY5IE0a5y7iN4FMP2KmfX8MgfL9SkqDlm57Z54EjKPx4RtdcChe2 W8Ng== X-Gm-Message-State: ALKqPwfVetZcs0RNFfDRKpd57e5Qpna7MYfVlw1vYOyZoirgDrvcYSmF O3xaXfrPaWiQZo60oNtoD2Fs4g== X-Google-Smtp-Source: ADUXVKKzJZIBT+WEQ4QBoIG0YCzzL4B1AQDlthVvHc/41+yGvux999oRRceSv5g5fW9pdGwP8mj1iA== X-Received: by 2002:a19:949d:: with SMTP id o29-v6mr7205108lfk.56.1527858289669; Fri, 01 Jun 2018 06:04:49 -0700 (PDT) Received: from Macroninja.cnexlabs.com (95-166-82-66-cable.dk.customer.tdc.net. [95.166.82.66]) by smtp.gmail.com with ESMTPSA id g5-v6sm303161lje.21.2018.06.01.06.04.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 01 Jun 2018 06:04:48 -0700 (PDT) From: =?UTF-8?q?Matias=20Bj=C3=B8rling?= To: axboe@fb.com Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, javier@cnexlabs.com, igor.j.konopko@intel.com, marcin.dziegielewski@intel.com, =?UTF-8?q?Javier=20Gonz=C3=A1lez?= , =?UTF-8?q?Matias=20Bj=C3=B8rling?= Subject: [GIT PULL 05/18] lightnvm: pblk: warn in case of corrupted write buffer Date: Fri, 1 Jun 2018 15:04:19 +0200 Message-Id: <20180601130432.30866-6-mb@lightnvm.io> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180601130432.30866-1-mb@lightnvm.io> References: <20180601130432.30866-1-mb@lightnvm.io> MIME-Version: 1.0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Javier González When cleaning up buffer entries as we wrap up, their state should be "completed". If any of the entries is in "submitted" state, it means that something bad has happened. Trigger a warning immediately instead of waiting for the state flag to eventually be updated, thus hiding the issue. Signed-off-by: Javier González Signed-off-by: Matias Bjørling --- drivers/lightnvm/pblk-rb.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/lightnvm/pblk-rb.c b/drivers/lightnvm/pblk-rb.c index 52fdd85dbc97..58946ffebe81 100644 --- a/drivers/lightnvm/pblk-rb.c +++ b/drivers/lightnvm/pblk-rb.c @@ -142,10 +142,9 @@ static void clean_wctx(struct pblk_w_ctx *w_ctx) { int flags; -try: flags = READ_ONCE(w_ctx->flags); - if (!(flags & PBLK_SUBMITTED_ENTRY)) - goto try; + WARN_ONCE(!(flags & PBLK_SUBMITTED_ENTRY), + "pblk: overwriting unsubmitted data\n"); /* Release flags on context. Protect from writes and reads */ smp_store_release(&w_ctx->flags, PBLK_WRITABLE_ENTRY);