Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp174842lqd; Tue, 23 Apr 2024 20:37:38 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVITDLlv7evE7xzqj+cW10c12617DEUKNf/ZAFI5K9swzVF1k573htLhhRFWHZnBIjax621tHk8Reto4/gLo3WjeuIKCzp5BlifR3Oe8A== X-Google-Smtp-Source: AGHT+IEPilbbg/FtCSpanz7OtoWxb8Kn1IZvmubw3ZYSO2KGnJ6VY6a6KGG5ABxiubP4TnfirrZz X-Received: by 2002:a17:906:d288:b0:a52:1bba:7458 with SMTP id ay8-20020a170906d28800b00a521bba7458mr4395245ejb.0.1713929858659; Tue, 23 Apr 2024 20:37:38 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713929858; cv=pass; d=google.com; s=arc-20160816; b=LJ9fWlUOC9bZU+A6koiYQnyiSWK0iyohhgYfRYD/Y7jExjm9GOg0GKuYu+N0U56ET0 V3nAas62XCktyAz0saCTGl6ib6Il9Clw9wADdMXCl/KJaPZsc5QZwjjuU8f2KfY3TupV UqirrvvZ3mKvFc3PhFAvmhTOBejd81Fw7tPIm5sb7CRq0f5Ou71gjqYqAEpfM+ZbuMaV 6iO5U1YZebfj3G4gYyayi9mL4FwWD0JOdO8hEA7YGfO5LyUbsifaj91qJLdZLT31GwPm /eZz3h1u0ivNaU+A15R3IoWitdrgQvbZ7Tu1ajUMaXJVdeVw6LvKFj8aWDVM2Q+CHlET SUFg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=AwFzLelCMhaNpMIGoDp9+1M1VpohfFkIeXR7rFBTtfY=; fh=3CsaseL1DGH+EMXcTH0kn5GO4vnHCl+kF9eyofb3vLk=; b=mbRp14PsimD6pP7HnEQcFGQ0In3bKbjGRw8e6cQDRk4z2hNptBangoD9QfqGfS0XSF B51aCWIjCB9Zq7j4wLhERTwCtGT9vOG+uIANJB0tbWStwIDdiNk8qCOBJbf14dW+IWMk HNgsGFRass7zeynYoqXrbafktPROsiPbG/wS/BTKJ9Y2uooFKE9Prh8aY/MmaUy7pPe5 AP0j6OzK58aNBvAjOsC66N7Dah7nh86C0jPc1aKoVS6e881jsZH/Iy8Olu/pW0S9TvJA 6q6VYIJzNmLQzOpCgxjg1V2Ebm1AE99vgu49fGnEyCmJKTPNpQVn81cMrFnelwBjEPb3 hEbA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huaweicloud.com); spf=pass (google.com: domain of linux-kernel+bounces-156219-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-156219-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id mf22-20020a170906cb9600b00a51d3658a7asi7811440ejb.594.2024.04.23.20.37.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 20:37:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-156219-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huaweicloud.com); spf=pass (google.com: domain of linux-kernel+bounces-156219-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-156219-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 3E45B1F22B8A for ; Wed, 24 Apr 2024 03:37:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F2F66143C70; Wed, 24 Apr 2024 03:36:54 +0000 (UTC) Received: from dggsgout11.his.huawei.com (dggsgout11.his.huawei.com [45.249.212.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DA09213B2BF; Wed, 24 Apr 2024 03:36:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713929814; cv=none; b=dZGGPirYitNUfii7vDLTkLZr2AACJXRpb2yz/hXxUiR14bQhCMFuS2YPfy/9mEmhY27aCNu09Ok5LgWYQT8KcSOyf77cA9JCrdZW4tYv8d8cyTg2MFz1MnZijq2mxynIZLz+RZdFhnj9WElVucqTBcB3tc29iBmMSthaCxu3VtM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713929814; c=relaxed/simple; bh=EaeMvtcrAfCUa9GeEeBHxpnpWMww9yf+oayv9Ypac7o=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=pQwcHJkg5SdD3fSBciMU6/3VWODIICpSAzCGt+2sABgumGUgDMZ7dQJJSjvPK8qoR6l9R6uuuHdzYiWHcu5EAlphxOvUUVbPxBWgUYifJfhHoytbXGLHQMyDhrWSm+Xk21xDf1wrIylnOIUwbhDL8iyr8jW91oUbUiyIrU04agE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com; spf=pass smtp.mailfrom=huaweicloud.com; arc=none smtp.client-ip=45.249.212.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huaweicloud.com Received: from mail.maildlp.com (unknown [172.19.163.216]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4VPPmY0Spnz4f3l8C; Wed, 24 Apr 2024 11:36:45 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.112]) by mail.maildlp.com (Postfix) with ESMTP id E0E751A10C7; Wed, 24 Apr 2024 11:36:49 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.104.67]) by APP1 (Coremail) with SMTP id cCh0CgBHZQ5Nfihmarc3Kw--.25590S8; Wed, 24 Apr 2024 11:36:49 +0800 (CST) From: libaokun@huaweicloud.com To: netfs@lists.linux.dev Cc: dhowells@redhat.com, jlayton@kernel.org, linux-cachefs@redhat.com, linux-erofs@lists.ozlabs.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, libaokun@huaweicloud.com, Baokun Li Subject: [PATCH 4/5] cachefiles: correct the return value of cachefiles_check_volume_xattr() Date: Wed, 24 Apr 2024 11:27:31 +0800 Message-Id: <20240424032732.2711487-5-libaokun@huaweicloud.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240424032732.2711487-1-libaokun@huaweicloud.com> References: <20240424032732.2711487-1-libaokun@huaweicloud.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID:cCh0CgBHZQ5Nfihmarc3Kw--.25590S8 X-Coremail-Antispam: 1UD129KBjvdXoWrZFyrAFW5Cw4xuw4kZF13urg_yoWkZwc_uF 9xAF4UZrs3Gr48JrsrAa42qrWSqr1UCwn8Jr1Yva13tws8KrW5XFWDtr9xAr17Wr4DK3Wq kryxZF13Xr9FgjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUbPAFF20E14v26rWj6s0DM7CY07I20VC2zVCF04k26cxKx2IYs7xG 6r1F6r1fM7CIcVAFz4kK6r1j6r18M28IrcIa0xkI8VA2jI8067AKxVWUAVCq3wA2048vs2 IY020Ec7CjxVAFwI0_Xr0E3s1l8cAvFVAK0II2c7xJM28CjxkF64kEwVA0rcxSw2x7M28E F7xvwVC0I7IYx2IY67AKxVW7JVWDJwA2z4x0Y4vE2Ix0cI8IcVCY1x0267AKxVW8Jr0_Cr 1UM28EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK6I8E87Iv6xkF7I0E14v26rxl6s0D M2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6xIIjx v20xvE14v26r1j6r18McIj6I8E87Iv67AKxVWUJVW8JwAm72CE4IkC6x0Yz7v_Jr0_Gr1l F7xvr2IYc2Ij64vIr41lF7I21c0EjII2zVCS5cI20VAGYxC7M4IIrI8v6xkF7I0E8cxan2 IY04v7M4kE6xkIj40Ew7xC0wCY1x0264kExVAvwVAq07x20xyl42xK82IYc2Ij64vIr41l 4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x8GjcxK67 AKxVWUGVWUWwC2zVAF1VAY17CE14v26r1q6r43MIIYrxkI7VAKI48JMIIF0xvE2Ix0cI8I cVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2IY6xkF7I0E14v26F4j6r4UJwCI42IY6xAIw20EY4 v20xvaj40_Jr0_JF4lIxAIcVC2z280aVAFwI0_Jr0_Gr1lIxAIcVC2z280aVCY1x0267AK xVW8JVW8JrUvcSsGvfC2KfnxnUUI43ZEXa7VUUpVbPUUUUU== X-CM-SenderInfo: 5olet0hnxqqx5xdzvxpfor3voofrz/ From: Baokun Li In cachefiles_check_volume_xattr(), the error returned by vfs_getxattr is not passed to ret, so it ends up returning -ESTALE, which leads to an endless loop as follows: cachefiles_acquire_volume retry: cachefiles_check_volume_xattr // return -ESTALE cachefiles_bury_object // EIO causes rename failure goto retry; So pass the error code to ret when xlen < 0 to avoid the above problem. Fixes: 32e150037dce ("fscache, cachefiles: Store the volume coherency data") Signed-off-by: Baokun Li --- fs/cachefiles/xattr.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/cachefiles/xattr.c b/fs/cachefiles/xattr.c index bcb6173943ee..20e4a4391090 100644 --- a/fs/cachefiles/xattr.c +++ b/fs/cachefiles/xattr.c @@ -252,6 +252,7 @@ int cachefiles_check_volume_xattr(struct cachefiles_volume *volume) xlen = vfs_getxattr(&nop_mnt_idmap, dentry, cachefiles_xattr_cache, buf, len); if (xlen != len) { if (xlen < 0) { + ret = xlen; trace_cachefiles_vfs_error(NULL, d_inode(dentry), xlen, cachefiles_trace_getxattr_error); if (xlen == -EIO) -- 2.39.2