From patchwork Mon Dec 4 04:43:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Jain X-Patchwork-Id: 10089783 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9FF4960327 for ; Mon, 4 Dec 2017 08:20:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9064B28697 for ; Mon, 4 Dec 2017 08:20:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 82FDD28757; Mon, 4 Dec 2017 08:20:47 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham 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 1DDAF28710 for ; Mon, 4 Dec 2017 08:20:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753598AbdLDIUp (ORCPT ); Mon, 4 Dec 2017 03:20:45 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:56528 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753591AbdLDIUn (ORCPT ); Mon, 4 Dec 2017 03:20:43 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.21/8.16.0.21) with SMTP id vB44geBH158027 for ; Mon, 4 Dec 2017 04:42:41 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id; s=corp-2017-10-26; bh=B34lzJ9ip5+RTZAYgCaot0NZTJ85ooCc1JaC4Y2w0XU=; b=fIqoFjhysX7vnUWEDyth5+5SMbJ5q4wWr38Pa98xMSRh5eURHDZspISLV94tD3IWIP/K LBh8nC7cI1EcF5Thn69UOCLMAzYQDX+5cCrZ5axfm/IbFnChVqJMHhwelYetgfNKmptt cPCiSEH2n8WBvwdDZYVjcSGQw5oIUowsFMn7jeekpgfirA1BFtRydc6is79YPf4rYMzF OaWf0ExGO0BhHLsIC7ZYlU9r42MtY4c/+ziEmkpHYjPx0nMw/f2gu7YQOMUB0WsryhaB 6fyljv7u7cLB+OO/+nIi2HDOg/ZZNxietK4XeF08maeRIhkvT/iZBOdDrPlOmppGEc0N ag== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp2120.oracle.com with ESMTP id 2ekpeu9yk6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 04 Dec 2017 04:42:41 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id vB44gexn021523 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 4 Dec 2017 04:42:40 GMT Received: from abhmp0018.oracle.com (abhmp0018.oracle.com [141.146.116.24]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id vB44ge6W020918 for ; Mon, 4 Dec 2017 04:42:40 GMT Received: from tp.sg.oracle.com (/10.186.50.132) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sun, 03 Dec 2017 20:42:40 -0800 From: Anand Jain To: linux-btrfs@vger.kernel.org Subject: [PATCH] btrfs: fix inconsistency during missing device rejoin Date: Mon, 4 Dec 2017 12:43:06 +0800 Message-Id: <20171204044306.8083-1-anand.jain@oracle.com> X-Mailer: git-send-email 2.15.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8734 signatures=668637 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1712040069 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When device is missing its not necessary that btrfs_device::name is null or the path is different when it reappears. Its possible that device can go missing after its been scanned where neither of btrfs_device::name == NULL OR btrfs_device::name != reappear_dev_path, is true. So just check for btrfs_device::dev_state.missing. Thanks. Signed-off-by: Anand Jain --- fs/btrfs/volumes.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index aa0c1d9ce1f5..2f76a125d181 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -715,7 +715,8 @@ static noinline int device_list_add(const char *path, ret = 1; device->fs_devices = fs_devices; - } else if (!device->name || strcmp(device->name->str, path)) { + } else if (!device->name || strcmp(device->name->str, path) || + test_bit(BTRFS_DEV_STATE_MISSING, &device->dev_state)) { /* * When FS is already mounted. * 1. If you are here and if the device->name is NULL that