Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp5526784rwr; Mon, 24 Apr 2023 05:42:13 -0700 (PDT) X-Google-Smtp-Source: AKy350b0HhoP92gVC6zvkwl2YaLX3llUdM4OC/MRdO+IAO19szyePD7ZgSDHMDlzccNpk1j9Ep3h X-Received: by 2002:a17:902:d48e:b0:1a2:8770:bb17 with SMTP id c14-20020a170902d48e00b001a28770bb17mr16866713plg.9.1682340132744; Mon, 24 Apr 2023 05:42:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682340132; cv=none; d=google.com; s=arc-20160816; b=V09cFKs5/yqywNbfYSH/I8L/zT5qct0mFtRmNiKSGoVFTNUV6N5CYA/8oiwYMt7ft7 Un+6vVGedfoGbU36ea0IyDMOa6Yrz8VIIVQb6QPojuwZZCwSPTPOjiAHKXQkERop5/Fw mBoy6z2eRiJMsGKAOo+fjGu+1dOb11hqjEZule1fcNwxQFTvmNp3aFdrpiTTXQ7upne5 a6hCSTL3TTcOG3k9sNOeor0CsCkT5Hlev2Vh3D6sQltO5K27zxPpSPiNLhXEVro5LMu5 TsqGh5rZwW/P0H9R7SXZeFCDtHjstNGZlgVekQT0fPOW6HJYifwVF7BPsMHMgLGQaRg2 9R0g== 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 :message-id:date:subject:cc:to:from; bh=r9quIsCD+smK/DcPMcI6zHHJe6P4tbqxnLlYeh+6S3Q=; b=dFNW74vnrC3FwiR+qNy4IZ1DIR1zPYWzazaLu8oGgdFyVvJPmvctgpLsnG8opTbkOK 5Rjczefq7JjqhMjom4CO732nTAj36U0euQF7/79SochqR5S9kIIDGrP61uFsoRi+x43g TQk3mHrvTjCiKGG/QcAJasr38PlrcZSL3IoQuSz4yrRF39e3xybTA+DUOb/0iMPhM8UW OWMYDuRe4XJY0ZFoj2Mu+1niCM8fUBOQsFWPcsKOQr+MxoGFO4N3SRFo+3zG2qjZpcGV hWQqfvE2mbgtyGjzBhIeYMZ+1cB57z0p3PNLuZ3WZ63DPq6Q+z/J0c8FAPLWf76yPrwP /Bhg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u11-20020a170902e5cb00b001a6559684a5si11838769plf.514.2023.04.24.05.42.01; Mon, 24 Apr 2023 05:42:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231603AbjDXMdD (ORCPT + 99 others); Mon, 24 Apr 2023 08:33:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230499AbjDXMdC (ORCPT ); Mon, 24 Apr 2023 08:33:02 -0400 Received: from out30-112.freemail.mail.aliyun.com (out30-112.freemail.mail.aliyun.com [115.124.30.112]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 438FF30C5; Mon, 24 Apr 2023 05:32:55 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R781e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046059;MF=jefflexu@linux.alibaba.com;NM=1;PH=DS;RN=5;SR=0;TI=SMTPD_---0VguiHQo_1682339570; Received: from localhost(mailfrom:jefflexu@linux.alibaba.com fp:SMTPD_---0VguiHQo_1682339570) by smtp.aliyun-inc.com; Mon, 24 Apr 2023 20:32:51 +0800 From: Jingbo Xu To: miklos@szeredi.hu, vgoyal@redhat.com, linux-fsdevel@vger.kernel.org Cc: gerry@linux.alibaba.com, linux-kernel@vger.kernel.org Subject: [PATCH] fuse: fix return value of inode_inline_reclaim_one_dmap in error path Date: Mon, 24 Apr 2023 20:32:50 +0800 Message-Id: <20230424123250.125404-1-jefflexu@linux.alibaba.com> X-Mailer: git-send-email 2.19.1.6.gb485710b MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When range already got reclaimed by somebody else, return NULL so that the caller could retry to allocate or reclaim another range, instead of mistakenly returning the range already got reclaimed and reused by others. Reported-by: Liu Jiang Fixes: 9a752d18c85a ("virtiofs: add logic to free up a memory range") Signed-off-by: Jingbo Xu --- fs/fuse/dax.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/fuse/dax.c b/fs/fuse/dax.c index 8e74f278a3f6..59aadfd89ee5 100644 --- a/fs/fuse/dax.c +++ b/fs/fuse/dax.c @@ -985,6 +985,7 @@ inode_inline_reclaim_one_dmap(struct fuse_conn_dax *fcd, struct inode *inode, node = interval_tree_iter_first(&fi->dax->tree, start_idx, start_idx); /* Range already got reclaimed by somebody else */ if (!node) { + dmap = NULL; if (retry) *retry = true; goto out_write_dmap_sem; -- 2.19.1.6.gb485710b