Received: by 10.192.165.148 with SMTP id m20csp3555482imm; Mon, 30 Apr 2018 02:13:25 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqj+uO9Gz5i3EcP2kFqUd4L1vwc2Z0Bq+9Eoo96VE89l2IRS7TleCUaHN5zYnH1UY4iGRwX X-Received: by 10.98.247.19 with SMTP id h19mr1631323pfi.165.1525079605482; Mon, 30 Apr 2018 02:13:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525079605; cv=none; d=google.com; s=arc-20160816; b=JmodBed4OdPMUek4tPuseGnbtkTemlI5AYiDLaCx0yq9y2XbZxKROXS6jR5LfvWGCH UeENtmKnJirNB1QOl4k0o6YcWU7isInpscOALRV0Ec+K5f51GaY7H5KjDlZy57DCr3fO +aAWAp8w2KSEqtEV9120BoVYeTe+s8Y/NMpoo4PJjVkMcsLb25JmDY2Ag+Sz4vicgg3C lHsp6azudmsEVb9QtpDG7PaiIKpsz7B+kcsuNGYq/hGnVecjDOgthg27tc/PQ+OVJSbW epZYzrn5sDTH5ClmV5ZYt6jOTY/waxMPTqccAFgLxkjVDqu9BwFGRKEf2iVW8cJxP3XK 1l4A== 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=hEIINiprQuwFnASdWCKWFbxMfI1pymGb52Cm0yI1jkpWMEXM8HqV3+MXCMAhWRxFxB OV1MXLR4OVzJ8KpMYvh37QnB4BgCg00pXje9p2+x+ibP255htlHyWdH23XRAwu+LyLRg 6xsITsqXjh0CTMEgzo++Va4rGZJzWm8gCQ+VUpdKCIrQe7nEklQ6OL98rfoinc3HtUxG ZcRggJuogdAD/3GxFasKi0sd3/6C3YZnxZRGV1pq388uCz6vwNOHZPXVT9XPsaSC8URs oyiR8TOBV1SbNZW+TRnmciXz2waV/zZgmsDMa0vzfbUZyZZ42Dw21r/ztECUy55Tv7jS F41g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@javigon-com.20150623.gappssmtp.com header.s=20150623 header.b=o93s9RIL; 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 65-v6si7039762plb.301.2018.04.30.02.13.11; Mon, 30 Apr 2018 02:13:25 -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=o93s9RIL; 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 S1753930AbeD3JMW (ORCPT + 99 others); Mon, 30 Apr 2018 05:12:22 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:36176 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752566AbeD3JKW (ORCPT ); Mon, 30 Apr 2018 05:10:22 -0400 Received: by mail-wm0-f67.google.com with SMTP id n10so13025991wmc.1 for ; Mon, 30 Apr 2018 02:10:21 -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=o93s9RILN6hNvh3Ny7KaVGlGZs91u9j9WgRaUnYJqhys6n9enN5MG84NuPRMVK7EfU S2QM9KOp8Bs9bp8sa6yEJVWbo6n2F79YeuVP7ZtvTGd06ftLRkfUpngO4sbmpFD0xRvl 2vKnwAoWCE+R/Sf+VY1pusPGraraFDLg1NVed0c7fggBWlUMSHOBIV5UidrzHTLjDrul wnp3VGcMv/EoZCVlRxy+NZeH08XcAaBztZbSKkmmLoYwmsJpF1qnCi6vYH1UZUl6skpw O8+6XnOFyFtQ/LfRFHGH6Oumo5BTx3bnQMEScrYNBcEeDhwSW/4ZzGxO/hleGYaANhru R7wA== 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=MYdhi9fOVJaldYqgk8iOQPc37WMeLapzPp6Kf0LJBzLxoBk+ebLkcp9db/PMRmSyjt 6MX29SOAwtKZO5RVWjDj/5RQNtcmp0KFjYVC0/NcP/G71vAsbhmnitdCVYsG9iJqQ+2Z rQFPC6OaIrXOr8PreGl80nvgOjafX2ovFLM6LKdeH0Ql0FvUzVYLsmHwsD+abLvMRQ7c r8s+B9bMjv9kGOm3aB/8hiESV5ClQWyTtCERvyxwZ8OuBredoWp7rtzedYi02AH9N8SO ryuOOtf6JMdCZgqDgKa/epkPYY/bU8nfp24jMb21fIXc+JgTSzoQzyMk7HcnGrWFpDun javw== X-Gm-Message-State: ALQs6tDwbY3ga137xvLJVok6Md39dUTMqgZiriNoIjgjWZ2Or2mPmseY q7ZIvJ5KuX/HngHWWYIcz7twLA== X-Received: by 2002:a50:b6e2:: with SMTP id f31-v6mr15670825ede.23.1525079420935; Mon, 30 Apr 2018 02:10:20 -0700 (PDT) Received: from uhalley.cnexlabs.com (6164211-cl69.boa.fiberby.dk. [193.106.164.211]) by smtp.gmail.com with ESMTPSA id b56-v6sm2108638edd.85.2018.04.30.02.10.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 30 Apr 2018 02:10:20 -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, 30 Apr 2018 11:10:03 +0200 Message-Id: <1525079409-6588-6-git-send-email-javier@cnexlabs.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1525079409-6588-1-git-send-email-javier@cnexlabs.com> References: <1525079409-6588-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