From patchwork Thu Jan 2 22:05:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 234582 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C5EC2C3276E for ; Thu, 2 Jan 2020 22:49:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8EFA020866 for ; Thu, 2 Jan 2020 22:49:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578005344; bh=eBj3zebOOUYoWjFTVIh6KdupIP+SGfAub9H2UCBOmD4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=i+TfyBWlFNRyB/TBWCU6OTje86QtOOBMfq/UG9/L2chp88A6B2Z37XtTYvjf5SFO4 ayejVH4yHqYDiIv/iLH1GVTVgOUwXD/WUUEsyBYNfS7FGvQqDFlWEzSNR1IIKOVgSN LFZhLSIIlz2VeCVrv603DyZ8pAI9ZhqKgqSRGIJI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729713AbgABWtD (ORCPT ); Thu, 2 Jan 2020 17:49:03 -0500 Received: from mail.kernel.org ([198.145.29.99]:55566 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728936AbgABW1T (ORCPT ); Thu, 2 Jan 2020 17:27:19 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 34D9B21835; Thu, 2 Jan 2020 22:27:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578004038; bh=eBj3zebOOUYoWjFTVIh6KdupIP+SGfAub9H2UCBOmD4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vhaaypLDEiAJzsln0560BtK4ivnmUxUTyQZLSapnzc87dx1ecT0SE3Ov2wxSsJsi7 qZZXYXbZmdCOiCVIZ/1qerLkjLCPW0oiP+BOiXfhqutE+gUkK/9ZmssWAOGelFWm2T 9aDplqybHxlB+PvIX3i8YZMFxXCwcVT4Q9MhHaKo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Filipe Manana , Johannes Thumshirn , Josef Bacik , David Sterba Subject: [PATCH 4.9 003/171] btrfs: handle ENOENT in btrfs_uuid_tree_iterate Date: Thu, 2 Jan 2020 23:05:34 +0100 Message-Id: <20200102220547.376342956@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200102220546.960200039@linuxfoundation.org> References: <20200102220546.960200039@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Josef Bacik commit 714cd3e8cba6841220dce9063a7388a81de03825 upstream. If we get an -ENOENT back from btrfs_uuid_iter_rem when iterating the uuid tree we'll just continue and do btrfs_next_item(). However we've done a btrfs_release_path() at this point and no longer have a valid path. So increment the key and go back and do a normal search. CC: stable@vger.kernel.org # 4.4+ Reviewed-by: Filipe Manana Reviewed-by: Johannes Thumshirn Signed-off-by: Josef Bacik Reviewed-by: David Sterba Signed-off-by: David Sterba Signed-off-by: Greg Kroah-Hartman --- fs/btrfs/uuid-tree.c | 2 ++ 1 file changed, 2 insertions(+) --- a/fs/btrfs/uuid-tree.c +++ b/fs/btrfs/uuid-tree.c @@ -335,6 +335,8 @@ again_search_slot: } if (ret < 0 && ret != -ENOENT) goto out; + key.offset++; + goto again_search_slot; } item_size -= sizeof(subid_le); offset += sizeof(subid_le);