From patchwork Fri Jan 8 00:43:26 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 7981361 Return-Path: X-Original-To: patchwork-linux-nvdimm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id A11BE9F1CC for ; Fri, 8 Jan 2016 00:43:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CAE6420142 for ; Fri, 8 Jan 2016 00:43:54 +0000 (UTC) Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D99A6200E1 for ; Fri, 8 Jan 2016 00:43:53 +0000 (UTC) Received: from ml01.vlan14.01.org (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id D16C01A21A1; Thu, 7 Jan 2016 16:43:53 -0800 (PST) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by ml01.01.org (Postfix) with ESMTP id 9BE4B1A21A1 for ; Thu, 7 Jan 2016 16:43:52 -0800 (PST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga101.jf.intel.com with ESMTP; 07 Jan 2016 16:43:52 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,535,1444719600"; d="scan'208";a="888714071" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.136]) by fmsmga002.fm.intel.com with ESMTP; 07 Jan 2016 16:43:53 -0800 Subject: [PATCH v3 5/5] block, xfs: implement 'force_failure' notifications From: Dan Williams To: xfs@oss.sgi.com Date: Thu, 07 Jan 2016 16:43:26 -0800 Message-ID: <20160108004326.36061.50916.stgit@dwillia2-desk3.amr.corp.intel.com> In-Reply-To: <20160108004254.36061.32864.stgit@dwillia2-desk3.amr.corp.intel.com> References: <20160108004254.36061.32864.stgit@dwillia2-desk3.amr.corp.intel.com> User-Agent: StGit/0.17.1-9-g687f MIME-Version: 1.0 Cc: Jens Axboe , linux-nvdimm@lists.01.org, Dave Chinner , linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, Alexander Viro , Jan Kara , linux-fsdevel@vger.kernel.org X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Introduce a new super operation, 'force_failure', that is invoked by force_failure_partition() when the block device is dead. This unambiguously communicates to a filesystem that i/o errors are permanent and no recovery effort will succeed. 'force_failure' simply becomes another exceptional event that can trigger xfs_force_shutdown(). Cc: Jan Kara Cc: Jens Axboe Cc: Alexander Viro Suggested-by: Dave Chinner Signed-off-by: Dan Williams --- block/genhd.c | 2 +- fs/block_dev.c | 5 ++++- fs/xfs/xfs_super.c | 8 ++++++++ include/linux/fs.h | 1 + 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/block/genhd.c b/block/genhd.c index ac0d12c4f895..45f9f123013b 100644 --- a/block/genhd.c +++ b/block/genhd.c @@ -717,7 +717,7 @@ void del_gendisk_queue(struct gendisk *disk) blk_cleanup_queue(disk->queue); - /* pass2 the queue is dead, halt dax */ + /* pass2 the queue is dead, halt dax, and halt fs operations */ disk_part_iter_init(&piter, disk, DISK_PITER_INCL_EMPTY | DISK_PITER_REVERSE); for_each_part(part, &piter) { diff --git a/fs/block_dev.c b/fs/block_dev.c index 9cff33b6baab..a9c07910481c 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c @@ -1812,7 +1812,10 @@ void force_failure_partition(struct gendisk *disk, int partno) if (!sb) goto out; - unmap_dax_inodes(sb); + if (sb->s_op->force_failure) + sb->s_op->force_failure(sb); + else + unmap_dax_inodes(sb); drop_super(sb); out: bdput(bdev); diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c index 36bd8825bfb0..e1113ac2e342 100644 --- a/fs/xfs/xfs_super.c +++ b/fs/xfs/xfs_super.c @@ -1618,6 +1618,13 @@ xfs_fs_free_cached_objects( return xfs_reclaim_inodes_nr(XFS_M(sb), sc->nr_to_scan); } +static void +xfs_fs_force_failure( + struct super_block *sb) +{ + xfs_force_shutdown(XFS_M(sb), SHUTDOWN_DEVICE_REQ); +} + static const struct super_operations xfs_super_operations = { .alloc_inode = xfs_fs_alloc_inode, .destroy_inode = xfs_fs_destroy_inode, @@ -1632,6 +1639,7 @@ static const struct super_operations xfs_super_operations = { .show_options = xfs_fs_show_options, .nr_cached_objects = xfs_fs_nr_cached_objects, .free_cached_objects = xfs_fs_free_cached_objects, + .force_failure = xfs_fs_force_failure, }; static struct file_system_type xfs_fs_type = { diff --git a/include/linux/fs.h b/include/linux/fs.h index a0d55199e628..bfd9bb7b529d 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -1713,6 +1713,7 @@ struct super_operations { struct shrink_control *); long (*free_cached_objects)(struct super_block *, struct shrink_control *); + void (*force_failure)(struct super_block *); }; /*