Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2206182imm; Mon, 28 May 2018 03:57:22 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrrw7tN2IdXt/ydldz/PAhZRaLKEELrmtrXZhX6grNLiNH9jCmGtEdsZvZUf2TIxUMMlci8 X-Received: by 2002:a65:648a:: with SMTP id e10-v6mr10273836pgv.34.1527505042332; Mon, 28 May 2018 03:57:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527505042; cv=none; d=google.com; s=arc-20160816; b=qfm0oE2T+nSKLzBF56iOZu+oEIj/Mi/3T3axWdXXJlNu/1KN84apeJpIdXqg40tZas 69fddm/taMfTElG8ubgVkLuoyVCyQuxAk7jxYxyVUZ6xV8X9hP1y/EOJU7Aj/3lgnqmD Z/Y9Z5TJRtI0BfmO5JjPDaYbbaERQXMnTlbSzDShoiKjdKjNH/2KiA5mKwhOkJ22JOIr kzgBk+SRiX5yW9ek0CZicpxJ1F/KfC35HGv0V9x6mqgA6iOozIgQIUjyVplllO/AStFd ZFdQ0XZI52O6VzP4DqeEBylMmbAocaK7/+Ysn9medUqPQQd7XUfA7YuVuzDdkaimIVGL uwAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=NO8cBiley1kfma4ETbweFp6fTB5urjvDA0xsMK1FxXE=; b=s6mbIXCZxfCndZmX1Iahl3iOlWQFuCyzdaJEz8t1dwPlP0f0ArI72p976PMNS2OtBL nZkW54FJ9At7c2pSeMQPlr7SvyoblpIAcEekiVA2mDLoGXk5+tMOG9RYxdvK9osaJotH oQvDgHXCmZKELVs30PXh7bRk+DUR+obIgOOxD4TRgcvm8voHHtBo7d4/Yy8leYyzcCMK 4e8eiAKEAZzrAQpCvzBPq7blxE+dYfpSgrozlLEqPmtCHJIPxGruIYK4V9feajmIDEVN oPGUbq2ASmIshi0LfYfOFzevhcXvmPxQOLXVFCqO3Z6GorKOmSFLXElsNYpFh/dEfGSR iCsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=FZqzre07; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o73-v6si30014985pfg.327.2018.05.28.03.57.07; Mon, 28 May 2018 03:57:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=FZqzre07; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1164252AbeE1K4z (ORCPT + 99 others); Mon, 28 May 2018 06:56:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:44966 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1164543AbeE1K4j (ORCPT ); Mon, 28 May 2018 06:56:39 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (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 429A2208A2; Mon, 28 May 2018 10:56:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527504998; bh=oXUPPwTjs2Wp9/yDzFfxatLUBuP2ifI4WLQ9MgFiPzM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FZqzre077TnZqdQmX4qZFivOjCEu8Cvct+bv7VaB9XBpyZ5SXLM3xIG9FL+B5NrsK q692IB60bk+7MPHNQ3fIkfhG6G3Fw0/dJ5nL/BXqi2SjRBNE6m9RtfwEGp+6Mk1qL1 SlPWZeY105WZyqW1AnDgjbgKpiT5fK52PJ8Y14Mk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nikolay Borisov , Liu Bo , David Sterba , Sasha Levin Subject: [PATCH 4.14 338/496] Btrfs: bail out on error during replay_dir_deletes Date: Mon, 28 May 2018 12:02:03 +0200 Message-Id: <20180528100334.067680104@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180528100319.498712256@linuxfoundation.org> References: <20180528100319.498712256@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Liu Bo [ Upstream commit b98def7ca6e152ee55e36863dddf6f41f12d1dc6 ] If errors were returned by btrfs_next_leaf(), replay_dir_deletes needs to bail out, otherwise @ret would be forced to be 0 after 'break;' and the caller won't be aware of it. Fixes: e02119d5a7b4 ("Btrfs: Add a write ahead tree log to optimize synchronous operations") Reviewed-by: Nikolay Borisov Signed-off-by: Liu Bo Signed-off-by: David Sterba Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- fs/btrfs/tree-log.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c @@ -2272,8 +2272,10 @@ again: nritems = btrfs_header_nritems(path->nodes[0]); if (path->slots[0] >= nritems) { ret = btrfs_next_leaf(root, path); - if (ret) + if (ret == 1) break; + else if (ret < 0) + goto out; } btrfs_item_key_to_cpu(path->nodes[0], &found_key, path->slots[0]);