{"id":2227565,"url":"http://patchwork.ozlabs.org/api/1.2/patches/2227565/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-cifs-client/patch/20260423222209.3054909-4-dhowells@redhat.com/","project":{"id":12,"url":"http://patchwork.ozlabs.org/api/1.2/projects/12/?format=json","name":"Linux CIFS Client","link_name":"linux-cifs-client","list_id":"linux-cifs.vger.kernel.org","list_email":"linux-cifs@vger.kernel.org","web_url":"","scm_url":"","webscm_url":"","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20260423222209.3054909-4-dhowells@redhat.com>","list_archive_url":null,"date":"2026-04-23T22:22:06","name":"[3/4] afs: Fix afs_get_link() to take validate_lock around afs_read_single()","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"e283b1bec39c92e283419b506382aaf1b6ff4758","submitter":{"id":59,"url":"http://patchwork.ozlabs.org/api/1.2/people/59/?format=json","name":"David Howells","email":"dhowells@redhat.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linux-cifs-client/patch/20260423222209.3054909-4-dhowells@redhat.com/mbox/","series":[{"id":501258,"url":"http://patchwork.ozlabs.org/api/1.2/series/501258/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-cifs-client/list/?series=501258","date":"2026-04-23T22:22:03","name":"netfs: Yet further miscellaneous fixes","version":1,"mbox":"http://patchwork.ozlabs.org/series/501258/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2227565/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2227565/checks/","tags":{},"related":[],"headers":{"Return-Path":"\n <linux-cifs+bounces-11071-incoming=patchwork.ozlabs.org@vger.kernel.org>","X-Original-To":["incoming@patchwork.ozlabs.org","linux-cifs@vger.kernel.org"],"Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=G5uc/idx;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=172.234.253.10; helo=sea.lore.kernel.org;\n envelope-from=linux-cifs+bounces-11071-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)","smtp.subspace.kernel.org;\n\tdkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com\n header.b=\"G5uc/idx\"","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=170.10.133.124","smtp.subspace.kernel.org;\n dmarc=pass (p=quarantine dis=none) header.from=redhat.com","smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=redhat.com"],"Received":["from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g1rHw26trz1y2d\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 24 Apr 2026 08:25:00 +1000 (AEST)","from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sea.lore.kernel.org (Postfix) with ESMTP id A45E6306497C\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 23 Apr 2026 22:22:42 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 42B6C37F8DC;\n\tThu, 23 Apr 2026 22:22:42 +0000 (UTC)","from us-smtp-delivery-124.mimecast.com\n (us-smtp-delivery-124.mimecast.com [170.10.133.124])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id D1CEA2E06EA\n\tfor <linux-cifs@vger.kernel.org>; Thu, 23 Apr 2026 22:22:40 +0000 (UTC)","from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com\n (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by\n relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,\n cipher=TLS_AES_256_GCM_SHA384) id us-mta-20-6mRXVomyPvGKAhZHmx0xIA-1; Thu,\n 23 Apr 2026 18:22:37 -0400","from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com\n (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n\t(No client certificate requested)\n\tby mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS\n id BC47C1956095;\n\tThu, 23 Apr 2026 22:22:35 +0000 (UTC)","from warthog.procyon.org.com (unknown [10.44.48.17])\n\tby mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP\n id 2CCFF19560AB;\n\tThu, 23 Apr 2026 22:22:31 +0000 (UTC)"],"ARC-Seal":"i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1776982962; cv=none;\n b=pWJTrzRZQi+lOyabw6x4+4EX2HOyUpO6zqPTQErJGj+AmP/tWTiIa1WjsMDlBy6MQTQktuXhhXqigRxofw5MNGn8zasaYLN6A5aCg6+iiygQbrXZ4KKkLbD8O1lCS1cPp8qmopNjJnsL62wmlrjX9OgnNjxmxQxNbxeYT7VON9s=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1776982962; c=relaxed/simple;\n\tbh=3aYouAujFzp76xqqlG9o4vknZZvSlVMk3kOrrxli+y8=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=meTJRJwC5NW4GN2koPMbSX3GtoAG1COCz+tJbSUb4k5WdWqSthHl9XeofIMJru2JNbdTUwT2SpjjIgmXlDYelVfo5a32W+NP+mzIIfTpx3R4Hx1yEyToF2AiDTHDuLfMZjGbzPUqI+5Q0C+NVU2y7Iuscb2x5Rms9m4HsJmG8eI=","ARC-Authentication-Results":"i=1; smtp.subspace.kernel.org;\n dmarc=pass (p=quarantine dis=none) header.from=redhat.com;\n spf=pass smtp.mailfrom=redhat.com;\n dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com\n header.b=G5uc/idx; arc=none smtp.client-ip=170.10.133.124","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1776982959;\n\th=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n\t to:to:cc:cc:mime-version:mime-version:\n\t content-transfer-encoding:content-transfer-encoding:\n\t in-reply-to:in-reply-to:references:references;\n\tbh=CEaZFT1kA2C9fmI8tLKUXOafS9Zq2QwNR5SdFuG0lEc=;\n\tb=G5uc/idxSx/apvBFFLOh1X2M/IEPV55jvoMl8SLbcMuZ0L1pNww627qP0gY+64wxbYzghw\n\tXUMo1uqdW4S2RwlGqQyWXR1KpWBMNwqg02v35+p3jXm1YtE/NUkFu0FEPH/Q6QciUc9tjQ\n\tvG6pAyRlAjSXoPsknZ4FBlYM7UEJWW4=","X-MC-Unique":"6mRXVomyPvGKAhZHmx0xIA-1","X-Mimecast-MFC-AGG-ID":"6mRXVomyPvGKAhZHmx0xIA_1776982956","From":"David Howells <dhowells@redhat.com>","To":"Christian Brauner <christian@brauner.io>","Cc":"David Howells <dhowells@redhat.com>,\n\tPaulo Alcantara <pc@manguebit.org>,\n\tnetfs@lists.linux.dev,\n\tlinux-afs@lists.infradead.org,\n\tlinux-cifs@vger.kernel.org,\n\tceph-devel@vger.kernel.org,\n\tlinux-fsdevel@vger.kernel.org,\n\tlinux-kernel@vger.kernel.org,\n\tMarc Dionne <marc.dionne@auristor.com>","Subject":"[PATCH 3/4] afs: Fix afs_get_link() to take validate_lock around\n afs_read_single()","Date":"Thu, 23 Apr 2026 23:22:06 +0100","Message-ID":"<20260423222209.3054909-4-dhowells@redhat.com>","In-Reply-To":"<20260423222209.3054909-1-dhowells@redhat.com>","References":"<20260423222209.3054909-1-dhowells@redhat.com>","Precedence":"bulk","X-Mailing-List":"linux-cifs@vger.kernel.org","List-Id":"<linux-cifs.vger.kernel.org>","List-Subscribe":"<mailto:linux-cifs+subscribe@vger.kernel.org>","List-Unsubscribe":"<mailto:linux-cifs+unsubscribe@vger.kernel.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","X-Scanned-By":"MIMEDefang 3.0 on 10.30.177.12"},"content":"Fix afs_get_link() to take the validate_lock around afs_read_single() to\nprevent races between multiple ->get_link() calls.\n\nFixes: eae9e78951bb (\"afs: Use netfslib for symlinks, allowing them to be cached\")\nCloses: https://sashiko.dev/#/patchset/20260326104544.509518-1-dhowells%40redhat.com\nSigned-off-by: David Howells <dhowells@redhat.com>\ncc: Marc Dionne <marc.dionne@auristor.com>\ncc: linux-afs@lists.infradead.org\ncc: linux-fsdevel@vger.kernel.org\n---\n fs/afs/inode.c | 17 +++++++++++++----\n 1 file changed, 13 insertions(+), 4 deletions(-)","diff":"diff --git a/fs/afs/inode.c b/fs/afs/inode.c\nindex 06e25e1b12df..5207c4a003f6 100644\n--- a/fs/afs/inode.c\n+++ b/fs/afs/inode.c\n@@ -78,10 +78,19 @@ const char *afs_get_link(struct dentry *dentry, struct inode *inode,\n \t\tgoto good;\n \n fetch:\n-\tret = afs_read_single(vnode, NULL);\n-\tif (ret < 0)\n-\t\treturn ERR_PTR(ret);\n-\tset_bit(AFS_VNODE_DIR_READ, &vnode->flags);\n+\tif (down_write_killable(&vnode->validate_lock) < 0)\n+\t\treturn ERR_PTR(-ERESTARTSYS);\n+\tif (test_and_clear_bit(AFS_VNODE_ZAP_DATA, &vnode->flags) ||\n+\t    !test_bit(AFS_VNODE_DIR_READ, &vnode->flags)) {\n+\t\tret = afs_read_single(vnode, NULL);\n+\t\tif (ret < 0) {\n+\t\t\tup_write(&vnode->validate_lock);\n+\t\t\treturn ERR_PTR(ret);\n+\t\t}\n+\t\tset_bit(AFS_VNODE_DIR_READ, &vnode->flags);\n+\t}\n+\n+\tup_write(&vnode->validate_lock);\n \n good:\n \tfolio = folioq_folio(vnode->directory, 0);\n","prefixes":["3/4"]}