Received: by 10.192.165.156 with SMTP id m28csp466957imm; Mon, 16 Apr 2018 03:29:19 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+B/+4dVJFVXT7oGxuJ7LqqHIN9/pq3AH01Sl9en32nUxJHVUsZoMkxxoqHfKPOD4Tj+RRf X-Received: by 10.99.175.6 with SMTP id w6mr12094416pge.186.1523874559595; Mon, 16 Apr 2018 03:29:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523874559; cv=none; d=google.com; s=arc-20160816; b=G9dVpKpmBxGaBYXP2vxRUEaO7BlpoOozZijfCQaFN8Q7bS9gdkriTyNMMNfLWIPs4z G5zwFpNjXicRr0eB31FeGpVySvNKom3HacWCaEp+kwN174nCsO86fOgiR9pcZCRJoVRX NmYJhCF+zW+KnIh+1GlEWKxG2eMSMCwFNAuKYfXlKoRClrreFE+rk9tV6riYdTKG7937 x1dtOHDmGi1tod4HVsdXPObjsCFbZXcNK4XFMiHsGMCF9+gu/HYBsBHbKEg4PhVC7IXj GqP+qgDrMciy1AZYP20XLMVi1p89y+UqmOW1eNEXUSnsbFkMQpM0z1cUCmjCu95sIxUn SbZw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=1i3L7z77EYR7Rvn4GeUoETVBfEAUSyMd2gVxiBFDpMw=; b=zzMSbpQrIcbHOnOwoLFinhe3rOmmfRVHDcAT0mFGJTIv4u8/KP8OjmgmedBQvAnKmv 4lFLVxa5t3C8DIsC6DY/SYMB/gqG6jsgZ0zHLfQgZWU8E5CIenhFUM/Y8OIpWbe5WvTv ziL0ADdWSV828buSZaJQbN19d+UPdgX1iKTFBJyMD8sMDEIpow+jBzoaFn7Q7EnAcO/f pcTxcJrwslsBT6iC9vTC/DQ2wwNUz9/QegzOOBFJ0SIuDg6xHdbObgYG0bsc32LBtU7M A1XlDbRe5kXzxu7IL7Aay83e2s44bA1IzGkH1qZrreGQt1qSI1uEJVMuhFLPArQ33kQj ec3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@javigon-com.20150623.gappssmtp.com header.s=20150623 header.b=a9gFkk80; 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 z1si9562339pge.271.2018.04.16.03.29.05; Mon, 16 Apr 2018 03:29:19 -0700 (PDT) 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; dkim=pass header.i=@javigon-com.20150623.gappssmtp.com header.s=20150623 header.b=a9gFkk80; 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 S1754785AbeDPK1e (ORCPT + 99 others); Mon, 16 Apr 2018 06:27:34 -0400 Received: from mail-wr0-f195.google.com ([209.85.128.195]:41567 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753639AbeDPKZq (ORCPT ); Mon, 16 Apr 2018 06:25:46 -0400 Received: by mail-wr0-f195.google.com with SMTP id v24so7381039wra.8 for ; Mon, 16 Apr 2018 03:25:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=javigon-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=1i3L7z77EYR7Rvn4GeUoETVBfEAUSyMd2gVxiBFDpMw=; b=a9gFkk80vgulUseS3n1V33qCyt+i8qVH2j4Sgnaeq1pXexR62/36ahRMGp0lSEob1E 9HqqhqkVSK828KvPvvUn77b/OOj0s37O+zy8I1u1ddW8Cc9v6mAumxP4xVhY3IeIY9pE dTQdBn4GsWk29dXz9GyInnV/S5jwUF+O3Tztmeh/Qw/+xEB7mNsM242ajYKvZWzg+xXE NpJPsIikKgx0hUwux/SPu9SsvABB1RS9e58lVdjUc/YgsAQdkTxTPws78AdiMU/JMWwH cL/k4QCQ6IkUahoWMEqqoLukblYNeO1vFa5YGPROQTG2vS3Sx5HBZingYpSwzUNpSYuu /8vw== 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=1i3L7z77EYR7Rvn4GeUoETVBfEAUSyMd2gVxiBFDpMw=; b=bOqMB9k9rvrhdoPREPAyp6oHjk05tLsJN/tnPoinKxi1Fq26i5geq0k4xio6JY96FF tWqO6UbxCw88KdMuojTMLsiBdTAuOMQ9CMqoYR8I8zOq1GA+ElGgrleNuZ1rB2M97H5r fiTvZmOwtK3Fngp+pnI3vl5QsUXkTN0McjbRzAO6BkyBbDx23PDJ+iS7jUHIN+nPhQYW gqJk2a1hZ+ib7wt5e8aJIkN3XUwj6DbXssDqssfhgbb4nKO/9olIGeKei6hdsmz1vXle pow/gwx/JrwjlGq7JlAMq6UiKxwcL7RkIbhGYQ6xbZAYGAKiUxEgGzHp/IWdqSj6SKV+ 2+hg== X-Gm-Message-State: ALQs6tBeKys3kJkwisN6iSeUdBIcCWqETkIi+rowyER6va+7sc4R2Eci tvrLLriJvCS52RDtIqhaoSZAzaXl X-Received: by 10.80.213.206 with SMTP id g14mr3133270edj.253.1523874345163; Mon, 16 Apr 2018 03:25:45 -0700 (PDT) Received: from uhalley.cnexlabs.com (6164211-cl69.boa.fiberby.dk. [193.106.164.211]) by smtp.gmail.com with ESMTPSA id q11sm4250074edj.2.2018.04.16.03.25.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 16 Apr 2018 03:25:44 -0700 (PDT) From: "=?UTF-8?q?Javier=20Gonz=C3=A1lez?=" X-Google-Original-From: =?UTF-8?q?Javier=20Gonz=C3=A1lez?= To: mb@lightnvm.io Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, =?UTF-8?q?Javier=20Gonz=C3=A1lez?= Subject: [PATCH 05/11] lightnvm: pblk: warn in case of corrupted write buffer Date: Mon, 16 Apr 2018 12:25:26 +0200 Message-Id: <1523874332-6272-6-git-send-email-javier@cnexlabs.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1523874332-6272-1-git-send-email-javier@cnexlabs.com> References: <1523874332-6272-1-git-send-email-javier@cnexlabs.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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 7a632913475f..024a366a995c 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); -- 2.7.4