Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2476388pxj; Mon, 10 May 2021 04:02:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwZnLwvBhnoQgYbzx9utxYqPePMoAfJ2j1ecKeoiffAEBJBbC/Cp3HYEwQ5WJ1tq1t0/mgf X-Received: by 2002:a17:906:2510:: with SMTP id i16mr25032184ejb.488.1620644570022; Mon, 10 May 2021 04:02:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620644570; cv=none; d=google.com; s=arc-20160816; b=b/MFgVHsUNcZ3azBA5qKTWAFsZtT7AHKzgtxtQ8hgC6nfWI/bPUbrmJYZErvuKhdnp iS4bHfTBy6E4eDTv/wp53fchSOb2ZUeAZiWlArgu98rhIq+Q9Wu+kJuBDT0MWvsJsNtt tpsvJr6ACdKAle6c6BSC+FTTOI+n5Dd4D12jipBwETqZEWNRJFVk9UIFw7uBca2GHRTf mJZbAPVELbF9j8G4MjZgBzdyQo7BaNCZnGB6Y3dSkgwMyU6aOJO+OxjR6nQMxk6ubMXm eIxwziBVvriTaIYM1MywHUmyrLMzeCRpALa0esz2daU8QWqBG79wZW+L4ZZ7pUbwzZ0k zWDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=XP/gYEKCbcaze/EOmO9jH+gH6xW1BBkIuTQVHuWxZVs=; b=f5tWmO3CdItuAkfm/x8Tw6qw6gwzlrIP0gcGAmdm8gpypkEabeMhFGA6olxzB61qos zx7Q7lLrRRVhOQ6ePItEIZQLRnWJoWAF402CODov/qhYDlm3XAWfkGphzfDWE7R9FnqK dTeEaYJvLr9Y7FtqC/G3OcmBj1lifQNJQrXLe6+jjgiai4YvGeKUFC5KSHp8o7vjBZtw gSa2PJntr2OoqEggqhahf4o+xl7Tz0n6P9rd+0oetpgQoNtFfhplkfbSzw2VwZISrVxv sg2Dx/ciiVBsZLPpBHVrmMR5FnhrWQEm4fTZUsMvnLm4DjtXlLVjrI4poa91xQtf5wqq FXvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RagjF6vL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i22si13462977edc.52.2021.05.10.04.02.23; Mon, 10 May 2021 04:02:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RagjF6vL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235572AbhEJLB3 (ORCPT + 99 others); Mon, 10 May 2021 07:01:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:59362 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233294AbhEJKpf (ORCPT ); Mon, 10 May 2021 06:45:35 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id BEA38613C2; Mon, 10 May 2021 10:35:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620642937; bh=5YXYSn+hpC4FUwSVM1/MHtUPlNJiKdBBVXST7gXI2ns=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RagjF6vLoRtpO9DAO8JJBk8uhrjM+7uj+BdjOXw0QakhSSiVUS11Bcxrb2mfN5MU4 G0hQfRhsJPdkkGApp0l7Zje2rkjgll9FLnnUHrTKkYxtyInVUx0CukfcBUWK74n5HM q7CpvycEstVhMsDd8+RLnDHHD05S9PmZT+jjHFlU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Qu Wenruo , Josef Bacik , David Sterba , Sasha Levin Subject: [PATCH 5.10 111/299] btrfs: do proper error handling in btrfs_update_reloc_root Date: Mon, 10 May 2021 12:18:28 +0200 Message-Id: <20210510102008.619315213@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210510102004.821838356@linuxfoundation.org> References: <20210510102004.821838356@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Josef Bacik [ Upstream commit 592fbcd50c99b8adf999a2a54f9245caff333139 ] We call btrfs_update_root in btrfs_update_reloc_root, which can fail for all sorts of reasons, including IO errors. Instead of panicing the box lets return the error, now that all callers properly handle those errors. Reviewed-by: Qu Wenruo Signed-off-by: Josef Bacik Reviewed-by: David Sterba Signed-off-by: David Sterba Signed-off-by: Sasha Levin --- fs/btrfs/relocation.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c index 575604ebea44..b3368cfccabf 100644 --- a/fs/btrfs/relocation.c +++ b/fs/btrfs/relocation.c @@ -897,7 +897,7 @@ int btrfs_update_reloc_root(struct btrfs_trans_handle *trans, int ret; if (!have_reloc_root(root)) - goto out; + return 0; reloc_root = root->reloc_root; root_item = &reloc_root->root_item; @@ -930,10 +930,8 @@ int btrfs_update_reloc_root(struct btrfs_trans_handle *trans, ret = btrfs_update_root(trans, fs_info->tree_root, &reloc_root->root_key, root_item); - BUG_ON(ret); btrfs_put_root(reloc_root); -out: - return 0; + return ret; } /* -- 2.30.2