From patchwork Mon May 28 08:58:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Matias Bjorling X-Patchwork-Id: 10430181 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 6177A60249 for ; Mon, 28 May 2018 09:05:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5352228BE1 for ; Mon, 28 May 2018 09:05:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 47EAC28BE5; Mon, 28 May 2018 09:05:44 +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=ham 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 DB5A028BE1 for ; Mon, 28 May 2018 09:05:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933366AbeE1JFm (ORCPT ); Mon, 28 May 2018 05:05:42 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:55306 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754163AbeE1I65 (ORCPT ); Mon, 28 May 2018 04:58:57 -0400 Received: by mail-wm0-f65.google.com with SMTP id a8-v6so30124473wmg.5 for ; Mon, 28 May 2018 01:58:56 -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=yrljAzdET6QmlwZEexPCIgRIyG/+0wh7FqKTnZYAnjGbiHxHPFZbHGIDBYsuye+//W 7+aHt30j18KPs+wWIUbH1ZkMkmtInoSBXB4N251M6BxWv5NB0BDwsMfBwr8u9ZLwnN8J LLgnavNuvS9QWl72allJ/Qm1eRYZ/KXCv1MdJlhIvfciMbuGEZuEPvduNrudF104R4Ak UFUQGdK4Cuwdsp8yDeCrAkV871se/2oRURdjH3o7MCaSLYW3j6CMlVfx+HFwYT9eQ1uL iue98fUwJk4PPU8ENAoLw3bT9QshsyP1VaeQ8NaZdym9GXd94bfUKp0hMkj8DQ7QU7Gm E0ig== 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=GqfIcfktZO47OKFbCK9FuOJB9jdC47Go7RsS8ImoqgKrB+t8WgcyPeva/8zV1tzvDz ChjImKlcmERlR9fq3m35mjakbpUUymJeej6XHwptqw8EDzq5/luZgkJFQypa+10r0XxM k1IaMoU/9dizLuVNOmmL/ebUbBFcurzF07lynKVS5ct6MPWgIJm5heb+Is01EKQ94pKC K6JUDKuGWeMiUs196vzNdLp0hpB/xsT+d2EuW+xd8H3vj5NbJvElyrtSVghF2B2vSdUJ +qSHBMviqKb+Gd1RGN5mYwtW/xJ6eKnWw2qumeYZC8wGiDYyvdf4XCl3riwNr4CYO0UP xydw== X-Gm-Message-State: ALKqPwdwH4ahgurNckdKOPEqU1/jRr7QNzTK8h3qdCmKLV9xjDcwepXZ VB0pm2UdPl9l0mHm8ILyOI+fPw== X-Google-Smtp-Source: AB8JxZosHQkwg1HRK4Jv2nQXsIH90XmG2D/KXSP67HyH48qB5GcgK1jjkre+opZBydZHebeoB26pyw== X-Received: by 2002:a2e:9f06:: with SMTP id u6-v6mr7787002ljk.42.1527497935920; Mon, 28 May 2018 01:58:55 -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 u2-v6sm5777848lji.4.2018.05.28.01.58.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 28 May 2018 01:58:55 -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, =?UTF-8?q?Javier=20Gonz=C3=A1lez?= , =?UTF-8?q?Javier=20Gonz=C3=A1lez?= , =?UTF-8?q?Matias=20Bj=C3=B8rling?= Subject: [GIT PULL 05/20] lightnvm: pblk: warn in case of corrupted write buffer Date: Mon, 28 May 2018 10:58:26 +0200 Message-Id: <20180528085841.26684-6-mb@lightnvm.io> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180528085841.26684-1-mb@lightnvm.io> References: <20180528085841.26684-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);