From patchwork Tue Dec 1 23:58:46 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 7742221 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 4B68D9F30B for ; Tue, 1 Dec 2015 23:59:17 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5F4E7206EF for ; Tue, 1 Dec 2015 23:59:16 +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 4CDC9205FA for ; Tue, 1 Dec 2015 23:59:15 +0000 (UTC) Received: from ml01.vlan14.01.org (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 40F3D1A201B; Tue, 1 Dec 2015 15:59:15 -0800 (PST) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by ml01.01.org (Postfix) with ESMTP id 76AAB1A201B for ; Tue, 1 Dec 2015 15:59:14 -0800 (PST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga102.jf.intel.com with ESMTP; 01 Dec 2015 15:59:14 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,370,1444719600"; d="scan'208";a="610944540" Received: from dwillia2-desk3.jf.intel.com ([10.54.39.136]) by FMSMGA003.fm.intel.com with ESMTP; 01 Dec 2015 15:59:14 -0800 Subject: [PATCH 2/3] xfs: handle shutdown notifications From: Dan Williams To: linux-fsdevel@vger.kernel.org Date: Tue, 01 Dec 2015 15:58:46 -0800 Message-ID: <20151201235846.36836.1476.stgit@dwillia2-desk3.jf.intel.com> In-Reply-To: <20151201235836.36836.90416.stgit@dwillia2-desk3.jf.intel.com> References: <20151201235836.36836.90416.stgit@dwillia2-desk3.jf.intel.com> User-Agent: StGit/0.17.1-9-g687f MIME-Version: 1.0 Cc: linux-block@vger.kernel.org, xfs@oss.sgi.com, Dave Chinner , linux-nvdimm@lists.01.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=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, T_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 Force a filesystem shutdown when the backing device is known to be dead. I.e. blk_queue_enter() permanently returns -ENODEV. Cc: xfs@oss.sgi.com Suggested-by: Dave Chinner Signed-off-by: Dan Williams --- fs/block_dev.c | 3 ++- fs/xfs/xfs_super.c | 9 +++++++++ include/linux/fs.h | 2 ++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/fs/block_dev.c b/fs/block_dev.c index 39989e990df9..dfe9a53a7c53 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c @@ -1802,7 +1802,7 @@ int __invalidate_device(struct block_device *bdev, bool kill_dirty) } EXPORT_SYMBOL(__invalidate_device); -static void generic_bdi_gone(struct super_block *sb) +void generic_bdi_gone(struct super_block *sb) { struct inode *inode, *_inode = NULL; @@ -1828,6 +1828,7 @@ static void generic_bdi_gone(struct super_block *sb) spin_unlock(&sb->s_inode_list_lock); iput(_inode); } +EXPORT_SYMBOL(generic_bdi_gone); void shutdown_partition(struct gendisk *disk, int partno) { diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c index 36bd8825bfb0..63c36508e9db 100644 --- a/fs/xfs/xfs_super.c +++ b/fs/xfs/xfs_super.c @@ -1618,6 +1618,14 @@ xfs_fs_free_cached_objects( return xfs_reclaim_inodes_nr(XFS_M(sb), sc->nr_to_scan); } +static void +xfs_fs_bdi_gone( + struct super_block *sb) +{ + xfs_force_shutdown(XFS_M(sb), SHUTDOWN_DEVICE_REQ); + generic_bdi_gone(sb); +} + static const struct super_operations xfs_super_operations = { .alloc_inode = xfs_fs_alloc_inode, .destroy_inode = xfs_fs_destroy_inode, @@ -1632,6 +1640,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, + .bdi_gone = xfs_fs_bdi_gone, }; static struct file_system_type xfs_fs_type = { diff --git a/include/linux/fs.h b/include/linux/fs.h index 0e201ed38045..b1e8e049e4b8 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -2265,6 +2265,7 @@ extern struct super_block *freeze_bdev(struct block_device *); extern void emergency_thaw_all(void); extern int thaw_bdev(struct block_device *bdev, struct super_block *sb); extern int fsync_bdev(struct block_device *); +extern void generic_bdi_gone(struct super_block *sb); extern struct super_block *blockdev_superblock; @@ -2277,6 +2278,7 @@ static inline void bd_forget(struct inode *inode) {} static inline int sync_blockdev(struct block_device *bdev) { return 0; } static inline void kill_bdev(struct block_device *bdev) {} static inline void invalidate_bdev(struct block_device *bdev) {} +static inline void generic_bdi_gone(struct super_block *sb) {} static inline struct super_block *freeze_bdev(struct block_device *sb) {