From patchwork Sat Apr 6 03:14:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qu Wenruo X-Patchwork-Id: 10888055 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D98BA1708 for ; Sat, 6 Apr 2019 03:14:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C9D71288BA for ; Sat, 6 Apr 2019 03:14:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BE099286F6; Sat, 6 Apr 2019 03:14:37 +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,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 6C678288BA for ; Sat, 6 Apr 2019 03:14:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726388AbfDFDOc (ORCPT ); Fri, 5 Apr 2019 23:14:32 -0400 Received: from mx2.suse.de ([195.135.220.15]:58988 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725973AbfDFDOc (ORCPT ); Fri, 5 Apr 2019 23:14:32 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id CE5DBAFCF; Sat, 6 Apr 2019 03:14:30 +0000 (UTC) From: Qu Wenruo To: linux-btrfs@vger.kernel.org, linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [PATCH 1/2] block: Add new BLK_STS_SELFTEST status Date: Sat, 6 Apr 2019 11:14:25 +0800 Message-Id: <20190406031426.22436-1-wqu@suse.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP There are a lot of end_io hooks which can do some self test at read/write time. Normally such selftest should return -EUCLEAN to indicate something unexpected. However there is no BLK_STS_* bit for that, this makes every selftest error to be interpreted to EIO, which lowers the severity. This patch will add a new BLK_STS_SELFTEST, to allow the error from endio to be passed to filesystem. Signed-off-by: Qu Wenruo --- block/blk-core.c | 1 + include/linux/blk_types.h | 3 +++ 2 files changed, 4 insertions(+) diff --git a/block/blk-core.c b/block/blk-core.c index 4673ebe42255..66967642a5ef 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -135,6 +135,7 @@ static const struct { [BLK_STS_RESOURCE] = { -ENOMEM, "kernel resource" }, [BLK_STS_DEV_RESOURCE] = { -EBUSY, "device resource" }, [BLK_STS_AGAIN] = { -EAGAIN, "nonblocking retry" }, + [BLK_STS_SELFTEST] = { -EUCLEAN, "filesystem selftest" }, /* device mapper special case, should not leak out: */ [BLK_STS_DM_REQUEUE] = { -EREMCHG, "dm internal retry" }, diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h index 791fee35df88..5bba24c3753c 100644 --- a/include/linux/blk_types.h +++ b/include/linux/blk_types.h @@ -63,6 +63,9 @@ typedef u8 __bitwise blk_status_t; */ #define BLK_STS_DEV_RESOURCE ((__force blk_status_t)13) +/* Filesystem selftest error */ +#define BLK_STS_SELFTEST ((__force blk_status_t)14) + /** * blk_path_error - returns true if error may be path related * @error: status the request was completed with From patchwork Sat Apr 6 03:14:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qu Wenruo X-Patchwork-Id: 10888061 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 42F5946E2 for ; Sat, 6 Apr 2019 03:14:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2F2B3286F6 for ; Sat, 6 Apr 2019 03:14:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 230B228821; Sat, 6 Apr 2019 03:14:38 +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,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 D76E1289BF for ; Sat, 6 Apr 2019 03:14:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726425AbfDFDOf (ORCPT ); Fri, 5 Apr 2019 23:14:35 -0400 Received: from mx2.suse.de ([195.135.220.15]:58994 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725973AbfDFDOf (ORCPT ); Fri, 5 Apr 2019 23:14:35 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 819D6AFCF; Sat, 6 Apr 2019 03:14:33 +0000 (UTC) From: Qu Wenruo To: linux-btrfs@vger.kernel.org, linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [PATCH 2/2] btrfs: Add error string for EUCLEAN Date: Sat, 6 Apr 2019 11:14:26 +0800 Message-Id: <20190406031426.22436-2-wqu@suse.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190406031426.22436-1-wqu@suse.com> References: <20190406031426.22436-1-wqu@suse.com> MIME-Version: 1.0 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Since we're going to support write time tree checker, it's possible that transaction get aborted due to tree-checker, also due to new BLK_STS_SELFTEST bit, we can distinguish real EIO error and EUCLEAN error. Now add error string for EUCLEAN too. Signed-off-by: Qu Wenruo --- fs/btrfs/super.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 120e4340792a..a4cbbd7861d3 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c @@ -86,6 +86,9 @@ const char *btrfs_decode_error(int errno) case -ENOENT: errstr = "No such entry"; break; + case -EUCLEAN: + errstr = "Selftest failure"; + break; } return errstr;