From patchwork Tue May 17 14:32:08 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 9112751 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 23DCDBF29F for ; Tue, 17 May 2016 14:32:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 659E12021B for ; Tue, 17 May 2016 14:32:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 37A0B2022D for ; Tue, 17 May 2016 14:32:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932453AbcEQOcd (ORCPT ); Tue, 17 May 2016 10:32:33 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:35291 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932412AbcEQOcc (ORCPT ); Tue, 17 May 2016 10:32:32 -0400 Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id u4HEWVV8014018 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 17 May 2016 14:32:31 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0021.oracle.com (8.13.8/8.13.8) with ESMTP id u4HEWUKa024555 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 17 May 2016 14:32:31 GMT Received: from abhmp0017.oracle.com (abhmp0017.oracle.com [141.146.116.23]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id u4HEWUt9010185; Tue, 17 May 2016 14:32:30 GMT Received: from arch2.localdomain (/14.96.10.156) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 17 May 2016 07:32:29 -0700 From: Anand Jain To: fstests@vger.kernel.org Cc: linux-btrfs@vger.kernel.org, Anand Jain Subject: [PATCH 4/6] fstests: btrfs: add helper function to check if btrfs is module Date: Tue, 17 May 2016 22:32:08 +0800 Message-Id: <1463495530-425-4-git-send-email-anand.jain@oracle.com> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1463495530-425-1-git-send-email-anand.jain@oracle.com> References: <1463495530-425-1-git-send-email-anand.jain@oracle.com> X-Source-IP: userv0021.oracle.com [156.151.31.71] Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 We need btrfs to be a module so that it can unloaded and reloaded, so that we can clean up the btrfs internal in memory device list. This patch adds _require_btrfs_unloadable() and _reload_btrfs_ko() to help with the same. Signed-off-by: Anand Jain --- common/rc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/common/rc b/common/rc index f2b39ddbee0c..a9391b4cbf57 100644 --- a/common/rc +++ b/common/rc @@ -1403,6 +1403,18 @@ _supported_os() _notrun "not suitable for this OS: $HOSTOS" } +_require_btrfs_unloadable() +{ + modprobe -r btrfs || _notrun "btrfs unloadable" + modprobe btrfs || _notrun "Can't load btrfs" +} + +_reload_btrfs_ko() +{ + modprobe -r btrfs || _fail "btrfs unload failed" + modprobe btrfs || _fail "btrfs load failed" +} + # this test needs a scratch partition - check we're ok & unmount it # No post-test check of the device is required. e.g. the test intentionally # finishes the test with the filesystem in a corrupt state