Received: by 2002:ab2:7855:0:b0:1f9:5764:f03e with SMTP id m21csp108538lqp; Tue, 21 May 2024 21:06:52 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWQTLBQpAcj/vHOwEm3MyH0tKpldsYN082znx9u0St8AzKEronIc2m6SLD73dsHXXEMtmHjU3I0dCwrC6EiNsDZI1XG9BIACwrO9Naejw== X-Google-Smtp-Source: AGHT+IFLnYk9uRR85oay1BK57F0wYSSg5A9+AwZjhB1+sHojsA//3DonXuXX/RqcDQKzyLCWr+II X-Received: by 2002:a17:906:9597:b0:a59:8786:3850 with SMTP id a640c23a62f3a-a6228171ac5mr31018666b.72.1716350811851; Tue, 21 May 2024 21:06:51 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716350811; cv=pass; d=google.com; s=arc-20160816; b=reLlZROjNmyS5kTYR+/nUDRCwTTqkBv6l2EArwlhkyGb+8Unz6q5dJrDys3Hz9Qq+p RrqifyzqymxWBk2kyn3bKeuP9IuS318V4qFDGaFwDAV1GGOUWQmqioqa7oS9MqbBB42e 5EGEzYyGzRRNUdq58Xuyk/lRXlXxDcLoZFDTP86qe2ue+kyt+Z5hidHB9V038gj409Ch mpQdXfdNrco6ODvIvSUC/qnaM1RlTfEEVzdgW2gpp9LjiB2bKtDPF14kPv7y5bkQ0Ava 7NWy8wp15zEi3lNLKp7Ll179Z5KbE33hzrpx1c7FBgQsvz3ChKRTKocbpDm7e4uY6QsB atDA== 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=dfpuzL54LAMf7GQmHoqmub+qZCPWKUPNTVFHnj8Vxqk=; b=EQ0bU9phVzkVJLUQcpTh7L1ChrHbgoCfmnXncnTd0wWMJ6IpS1rOPAVoIED916s+DB T832KVw9cm2tWzYSgAZIxqAe+SGv8cgeQOoqabuj/3Y1Nwwp0lXF2jyhauxLRmrN5KWh o4YqrCmVri1gxsFgTBmqdzrlwn/iHB/YSLWi69y6uF1B1lCkDSNdpcDD9vrMhKKvplw8 E4BbrWFWBTAcEMIe4EylN9Npt10CfU9cUlbKdK5BeQrVnKE9nIWvepQU10/Uv15eFXMt jTrdYdjA5y06XK4dpcYCN+5hkF+svsgWV9NOBKQwBgSmX93OKzrmmGMmN0fmDFSzHV4W MgbA==; 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-185753-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-185753-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a5a17ba4fc7si1475576466b.646.2024.05.21.21.06.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 May 2024 21:06:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-185753-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huaweicloud.com); spf=pass (google.com: domain of linux-kernel+bounces-185753-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-185753-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 9258E1F23532 for ; Wed, 22 May 2024 04:06:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4788279B9C; Wed, 22 May 2024 04:06:04 +0000 (UTC) Received: from dggsgout11.his.huawei.com (unknown [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 14EE473189; Wed, 22 May 2024 04:06:01 +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=1716350763; cv=none; b=F+t6IzXvCWMWS/xPzslGSFoEM2UxtCCxPS56jY3q7MGYmpvyrUa+WEM2iP1h5PeGoo0kpWm5SIACQzuCTqAUb9q0jPF7odqN6c7ua98HwkPxKIKdPnhnEfLMIKkKY0jSMsnRYqlM18anjtd9Fg1JJEfCwLeXGKmV6bhjvugQP8A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716350763; c=relaxed/simple; bh=EaeMvtcrAfCUa9GeEeBHxpnpWMww9yf+oayv9Ypac7o=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=cpMYA+a+eZeXRRoRhwhkyjH3WWfGLLUpVGB0edj9O5FW5yKUXL2z/ZwXGc4zjIkDjRUxwrCHf+TrUsksLaFrTKcspL6tGc4C+AxXsKFKQQe8S14qyqkAhFOXhuVKoHXjzyy7JE4nd0XxmLQ8W42uMI1ylZlCwPavpVnoD9DIHkU= 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.235]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4Vkd583Rrkz4f3lg7; Wed, 22 May 2024 12:05:48 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.112]) by mail.maildlp.com (Postfix) with ESMTP id EE3F91A154C; Wed, 22 May 2024 12:05:58 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.104.67]) by APP1 (Coremail) with SMTP id cCh0CgBHZQ4ib01ms1VYNQ--.24441S8; Wed, 22 May 2024 12:05:58 +0800 (CST) From: libaokun@huaweicloud.com To: netfs@lists.linux.dev, dhowells@redhat.com, jlayton@kernel.org Cc: hsiangkao@linux.alibaba.com, jefflexu@linux.alibaba.com, zhujia.zj@bytedance.com, linux-erofs@lists.ozlabs.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, libaokun@huaweicloud.com, yangerkun@huawei.com, houtao1@huawei.com, yukuai3@huawei.com, wozizhi@huawei.com, Baokun Li Subject: [PATCH RESEND 4/5] cachefiles: correct the return value of cachefiles_check_volume_xattr() Date: Wed, 22 May 2024 19:59:10 +0800 Message-Id: <20240522115911.2403021-5-libaokun@huaweicloud.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240522115911.2403021-1-libaokun@huaweicloud.com> References: <20240522115911.2403021-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:cCh0CgBHZQ4ib01ms1VYNQ--.24441S8 X-Coremail-Antispam: 1UD129KBjvdXoWrZFyrAFW5Cw4xuw4kZF13urg_yoWkZwc_uF 9xAF4UZrs3Gr48JrsrAa42qrWSqr1UCwn8Jr1Yva13tws8KrW5XFWDtr9xAr17Wr4DK3Wq kryxZF13Xr9FgjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUbmkFF20E14v26rWj6s0DM7CY07I20VC2zVCF04k26cxKx2IYs7xG 6rWj6s0DM7CIcVAFz4kK6r1j6r18M280x2IEY4vEnII2IxkI6r1a6r45M28IrcIa0xkI8V A2jI8067AKxVWUAVCq3wA2048vs2IY020Ec7CjxVAFwI0_Xr0E3s1l8cAvFVAK0II2c7xJ M28CjxkF64kEwVA0rcxSw2x7M28EF7xvwVC0I7IYx2IY67AKxVW7JVWDJwA2z4x0Y4vE2I x0cI8IcVCY1x0267AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK 6I8E87Iv6xkF7I0E14v26rxl6s0DM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4 xI64kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r1j6r18McIj6I8E87Iv67AKxVWUJVW8 JwAm72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41lF7I21c0EjII2zVCS5cI20V AGYxC7M4IIrI8v6xkF7I0E8cxan2IY04v7M4kE6xkIj40Ew7xC0wCF04k20xvY0x0EwIxG rwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E14v26r1j6r18MI8I3I0E7480Y4 vE14v26r106r1rMI8E67AF67kF1VAFwI0_Jw0_GFylIxkGc2Ij64vIr41lIxAIcVC0I7IY x2IY67AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Cr0_Gr1UMIIF0xvE42xK8V AvwI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVW8JVWxJwCI42IY6I8E87Iv6xkF7I0E 14v26r4UJVWxJrUvcSsGvfC2KfnxnUUI43ZEXa7sREMKZDUUUUU== 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