Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1879904pxb; Fri, 5 Mar 2021 01:45:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJxMMwrsJzvzOOJub1ZqEEAQFJBIxIWguYHFcbBFOC/rUKgKpt336YeFoR21eCRFbPQiEGHh X-Received: by 2002:aa7:d44a:: with SMTP id q10mr8223013edr.278.1614937549696; Fri, 05 Mar 2021 01:45:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614937549; cv=none; d=google.com; s=arc-20160816; b=Y5FCuVvGNE477emv/7osLNWRKozF+DyGqJD34LqJQAMR/0zwg9Z5LXLpTi3Rm/vKlm bFIlX+dXUlrEwfpiCtRHmyyDlhSWiOk8vNBeKdhVzJwib0bm+lAM1/l4UDXw1z5v3rB0 kqrUcCzWaptXteurkfjnPGfpPTRPJ0+LBV5uA+ZwADC/8EerQL6QMP+RDf5H4XbRDLhv DSCJfmtUF2lszmEZM9Jij/wfeeXZei43RLFYIPJkn7iQYOk07wqx0HNfunutc0hPNP9H Z1PF+WEYYPDMRTF8MhpNA0J1KwzsSJ1T8xOUnHEKBm/lbbIuNTMkfn47u7VDgSAtkJB/ xbkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from :dkim-signature; bh=myXEvGngLyw0rSdRs2pyTmkG4KiSVGWXGtBSKeFf77c=; b=uEX+EnBsE5EqlWW3r9JsO8w4HYYtaNzIIfGihatESxYAMD8Qwf2F5vlVxSdGdXEgLN RMZv+eKqVy2z6UWsdrQnshJ2pM+6v/yW6iKjRg+E9AVdrTX67tbkNK9JDPFSn28UDB5p ZlH6mnM7XT6/iF9/lttpEpyLfMDIQpo+gJr5tQAfLbNsTBX98CEycav+kAulxn84eU1A Lmec/4ONP2ES8pyPUL7V3BnHrtSaAauI3+K9iFWnbWBBmpuTgwf2M3jiueP6UT6hK6ZH 6o8NiFZTVWflyjX0yY+q/Jq8OcGH6zK6pdhuHodmhogmoVr+0PfZufLh6pH0JDbzmK1Z gY9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=a9Qy1lSh; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id jl16si1024479ejc.330.2021.03.05.01.45.26; Fri, 05 Mar 2021 01:45:49 -0800 (PST) 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=@gmail.com header.s=20161025 header.b=a9Qy1lSh; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229562AbhCEJoa (ORCPT + 99 others); Fri, 5 Mar 2021 04:44:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229494AbhCEJoA (ORCPT ); Fri, 5 Mar 2021 04:44:00 -0500 Received: from mail-pg1-x531.google.com (mail-pg1-x531.google.com [IPv6:2607:f8b0:4864:20::531]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B193FC061574; Fri, 5 Mar 2021 01:44:00 -0800 (PST) Received: by mail-pg1-x531.google.com with SMTP id t26so994208pgv.3; Fri, 05 Mar 2021 01:44:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=myXEvGngLyw0rSdRs2pyTmkG4KiSVGWXGtBSKeFf77c=; b=a9Qy1lShvEdwL5fcKgoBZqEuhU2arR/7RHUuKxhdo03LhyhGS0L2fdKGtaUKZ01JS+ yeKeJEATMH6hostfjhH4Ux0L+DCNR1phOR/gHsbgOpMnCDd8tOb9Tt1qS0SIhML/BJSE c8xHateOqYF6OafcfiXBAEAY0sfLTSqLTDL0T87t9+GjNAR4Z8cxI/nIWE3Itpz4IUN1 zQx1cGAFbQ4yeEAKMOMn654l0xRCNbbDh2Az+mqRRdTLC6ezgxlzoCfCs5MJuAO95A1f 2LeWVChHCPgpqp2jS4GZDs9ttME/RXp7NtBAocWhOpZ99YQ848xHjc/CrdRZj5aT+1CS xVlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=myXEvGngLyw0rSdRs2pyTmkG4KiSVGWXGtBSKeFf77c=; b=FmnThHtT3NJunx7bW9foyL+Af1K3R+pcnog1ohQf/VDM6OKDUsABcL7wICGtT3nx86 Rr92FtI7ne8IB2rcNogwfAyDMly7a1ptID2UoR/+DgMtdYDUIJ/84Hd95w0aUBTBMjp+ C7wqtMuqMEtMsn3VePI2k1gs015oiJQxGjcXPlqI33wenvgGkHQ/m1gv0M3Nhpkjkp9n 1g4mLclPjvZElXCdViXKge5HE1rc9UvFTaeN1XRX0TwFSVBjltKCYlOMLsCqZ0I/eC5n ySh0NDvxG9kvKW3jdVaUx5CuDyjBAveSGfnfApuaN4kL9RIHiu6qpMEghmFi4dxzIOfj 7dFA== X-Gm-Message-State: AOAM530s9cylKbunM9tUwDTB2+qtUunsYywV/SeXZO9nTys78bbRVBb2 sObhVxjezrVS8dEOtHo/jRY= X-Received: by 2002:aa7:9342:0:b029:1ee:8893:8554 with SMTP id 2-20020aa793420000b02901ee88938554mr8357111pfn.2.1614937440360; Fri, 05 Mar 2021 01:44:00 -0800 (PST) Received: from localhost.localdomain ([45.135.186.129]) by smtp.gmail.com with ESMTPSA id c193sm2136793pfc.180.2021.03.05.01.43.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Mar 2021 01:43:59 -0800 (PST) From: Jia-Ju Bai To: clm@fb.com, josef@toxicpanda.com, dsterba@suse.com Cc: linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org, Jia-Ju Bai Subject: [PATCH] fs: btrfs: fix error return code of btrfs_recover_relocation() Date: Fri, 5 Mar 2021 01:43:53 -0800 Message-Id: <20210305094353.13511-1-baijiaju1990@gmail.com> X-Mailer: git-send-email 2.17.1 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When the list of reloc_roots is empty, no error return code of btrfs_recover_relocation() is assigned. To fix this bug, err is assigned with -ENOENT as error return code. Reported-by: TOTE Robot Signed-off-by: Jia-Ju Bai --- fs/btrfs/relocation.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c index 232d5da7b7be..631b672a852f 100644 --- a/fs/btrfs/relocation.c +++ b/fs/btrfs/relocation.c @@ -3817,8 +3817,10 @@ int btrfs_recover_relocation(struct btrfs_root *root) } btrfs_release_path(path); - if (list_empty(&reloc_roots)) + if (list_empty(&reloc_roots)) { + err = -ENOENT; goto out; + } rc = alloc_reloc_control(fs_info); if (!rc) { -- 2.17.1