Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2509594imm; Mon, 28 May 2018 09:25:24 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKlMOL6v4Cg/wZX8hf+wwhtPv6Sh+nCmTtdmRsC+mjTQzH77TiMw7yZTI4/sgHEqCcEmKJ1 X-Received: by 2002:a62:249b:: with SMTP id k27-v6mr8642077pfk.143.1527524723987; Mon, 28 May 2018 09:25:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527524723; cv=none; d=google.com; s=arc-20160816; b=Xhr+f6BqshEf+x6HWE5XwUa3Nd6mdw8gcMTyjBOaAvpieJRji3waGQKD0WnKJKc8IY 4KWPemKAx4S6OroMB1ZoWPNTQ0gKqEwK35/aFUJI6Ii1oixNJgAu8OWTUrXpGRJIdTVS bv8uo0CkObQlVIOdwRZrprjmUSWcA3VEbm3A+KWSZxX8vjQhmZ/B1nslSb8k12B9zji5 CYNeHmfdojN5RaM3NrHJnY+9cG7GRe5vKFf2lZQowY2v5Y5N630mR1QyS/xdjWSOyZhf rgna47r5ybyrQ/SGNW3n+6jgRy28uSwpB16txvZ0gSV8cAUmYgtO0dpoCNnw4/cr/YKy Vpdw== 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=aqs1l2HsNF9bZ1avEvCZGRdQ6pog9eTindbtnP2wHy8=; b=c/1sLMjfMxYzJYM3LBWPjML1heayOoM6/5+DxPJMVtuXPsz+dEREfpSg1no/GYVr+D /d01ADCFtDZv/1YWFPtKGEDARrURr754zIx7ugbOALErWySoZO8HMwMd/NRBVfFIq2w1 KMh+K/Om4sh8ofm3XLuoisowqWa1vtrSdKuvrlz9EoXtAczGBHzOp213aG2lFOPCux4b avY+3h9N1iGZANJkLnO+8rktTUdzb2HgyLfn44w4GagylPPhEXY4awSIwB6zE+e6oWEU CBi4KHhMgfwJoh2Ek2CYg+LSdfosMdXDEFp0b13oVDLgKMaNE9Hk5NK6EF8bYc2ixhqO itKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=eGFt0+8C; 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 k185-v6si30068591pfc.361.2018.05.28.09.25.09; Mon, 28 May 2018 09:25:23 -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=eGFt0+8C; 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 S1425322AbeE1QYq (ORCPT + 99 others); Mon, 28 May 2018 12:24:46 -0400 Received: from mail.kernel.org ([198.145.29.99]:59058 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964857AbeE1KKv (ORCPT ); Mon, 28 May 2018 06:10:51 -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 A4B79208B4; Mon, 28 May 2018 10:10:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527502251; bh=aKwVKERbYUzmaDEm3ehq/M1YzFzO9jJ/hpGbTJTJVmQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eGFt0+8CSvU/hXu0NhjCdUhK2ahxn+GyeWyEakph5mTVPAS0ygqTtuptHB3eh+CYU eql7BmEj/x0C35xWR05UENGx7avFL0B7z5pLIqIinGG51s8Yj4esN4OCQgdenKoU7l ADEBe4Pl6FnOvl6vRFOn1ksGpej5E8LYM3lBT7LY= 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 3.18 118/185] Btrfs: bail out on error during replay_dir_deletes Date: Mon, 28 May 2018 12:02:39 +0200 Message-Id: <20180528100102.174583249@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180528100050.700971285@linuxfoundation.org> References: <20180528100050.700971285@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 3.18-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 @@ -1983,8 +1983,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]);