Received: by 2002:ab2:7a55:0:b0:1f4:4a7d:290d with SMTP id u21csp146662lqp; Thu, 4 Apr 2024 09:08:54 -0700 (PDT) X-Forwarded-Encrypted: i=4; AJvYcCUHVSJycDWXpYTK1qZwyYtGkQzobb2p1HUCtdPIY6x1RjJiNZvp4bJAQMMDs4RcbQpBmOXesJ+nsG4IPeHhX5SC0mx176ACzg8M4O5WAA== X-Google-Smtp-Source: AGHT+IFuWmvww+cEYl45WO3d8mZ2d/ZlJ6q+Fr71x5pGNJ816fDjWFde3Oq83YFwDxlYJWu4wfvT X-Received: by 2002:a05:6512:239f:b0:515:d4bc:1c08 with SMTP id c31-20020a056512239f00b00515d4bc1c08mr2888753lfv.38.1712246934510; Thu, 04 Apr 2024 09:08:54 -0700 (PDT) ARC-Seal: i=3; a=rsa-sha256; t=1712246934; cv=pass; d=google.com; s=arc-20160816; b=bD3pw0zVNRKCH8LIV37qGnPVDSjvJMcQG7lQ8i9OemoLsUWahGXnKcDsewYLvZ54MC ApAHBVLEgdl9iU/XnT+zFbrJPQheSzcT7+2Gqu7foIiCRBNnbIn8pkF8sOm8ME3TyT1C W2ckhgQqi8BeOYneB4ROiVEVUwMB3SPVkZtECYH6h+5bDRfIxi/3Uelpi1cKj3q1pjK2 Um7GMReRRzyy8MUuC7P6WUwUyxxY8Jatmf6gNrgGJ7pGJfa3VPygx+xPvVdZpKiA1mqS 4T1GrQ5haF91+lT5G287Skw9YpuOgusfSH5SsZ9XeVjvzuI1/ZMoxsr38czRV2Jq2EKe g+xQ== ARC-Message-Signature: i=3; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :date:references:in-reply-to:subject:cc:to:from:dkim-signature :message-id; bh=/VfdAcUgMKKdIImznXQCsjzxihOdEcjXVNKwK2JA30Q=; fh=BjSTdEToqVmLrYBL+wQOG+4pYBVafwTf556J+M0FeL0=; b=KBX+CIY9zCAoS/DDNpmQrP+gW2/Trv+rpIcCG6YOEITnCkemNi//yV4KyjlimmMqJJ YbkC5BILBTSwBWLX2I7BJpFCB/u9mbPjqrwEZcqxV3j7nsNH0yiERgiX7p5V5iMO3GWI 3bj5BqAoPfJ3JTYOpk4Z+YXi5PFz0FvXX50rbPraaOkAMczMhBLSmdYDJHsSUeAs+1iP V7Q0edm5lIN2krG9N6mweDAOfIMLTvlsie+0zCUE9ri5ldtVaCw1Es/MMrH+Y4zlsGYH ZCZ1PXQbcy/Gwc2gORCSRVltZue7wQo7j1/NsYfw9OVNQDhgrELaQ6B4vRHbb2yp3O5/ Gi9g==; dara=google.com ARC-Authentication-Results: i=3; mx.google.com; dkim=pass header.i=@manguebit.com header.s=dkim header.b=KlqV4cg0; arc=pass (i=2 spf=pass spfdomain=manguebit.com dkim=pass dkdomain=manguebit.com dmarc=pass fromdomain=manguebit.com); spf=pass (google.com: domain of linux-kernel+bounces-131794-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-131794-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=manguebit.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id t2-20020a170906a10200b00a469e80a73esi7834924ejy.1037.2024.04.04.09.08.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Apr 2024 09:08:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-131794-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; dkim=pass header.i=@manguebit.com header.s=dkim header.b=KlqV4cg0; arc=pass (i=2 spf=pass spfdomain=manguebit.com dkim=pass dkdomain=manguebit.com dmarc=pass fromdomain=manguebit.com); spf=pass (google.com: domain of linux-kernel+bounces-131794-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-131794-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=manguebit.com 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 33DEE1F21E8B for ; Thu, 4 Apr 2024 16:08:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CD0C312EBE8; Thu, 4 Apr 2024 16:07:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=manguebit.com header.i=@manguebit.com header.b="KlqV4cg0" Received: from mx.manguebit.com (mx.manguebit.com [167.235.159.17]) (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 A33F912E1E8; Thu, 4 Apr 2024 16:07:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=167.235.159.17 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712246856; cv=pass; b=RpvX8g4Uy/jTAtyMf2DJjXpDgC/jj4uFEWDLnsJcD89FvAy965Pj+FEinjUQLcNrpoh31ghaZ94O2d/6OPFOHZGzMO9MjjntZ+IooPP1deG+bP6sHsUh/4D/HTFqIxF/EOkHYrk4u/Ib/5ro4L2N/TTt0zbJ/+MICtRKfTZmVVQ= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712246856; c=relaxed/simple; bh=LUFWgRFtjQZ49bnS25rMZ1qtgXnfmx0q15Zi6FSjpy8=; h=Message-ID:From:To:Cc:Subject:In-Reply-To:References:Date: MIME-Version:Content-Type; b=pnSCn6RM2DzaGK6Rqu/azCdHXHPOlXQgvuvjvLxfGG5CDnJE4WW1n748wyLlIxqn6fYJBBAzU/pndOLPB3xkqtV4e+Uc0Rx1Vp6dHuGlM89Stj7FAp/rGsRi5YIAZ0DfXqkrCbRsRrk0DYzH+KLrzwVuEvihvL4V5U2XCwXqPB8= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=manguebit.com; spf=pass smtp.mailfrom=manguebit.com; dkim=pass (2048-bit key) header.d=manguebit.com header.i=@manguebit.com header.b=KlqV4cg0; arc=pass smtp.client-ip=167.235.159.17 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=manguebit.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=manguebit.com Message-ID: <14e66691a65e3d05d3d8d50e74dfb366@manguebit.com> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=manguebit.com; s=dkim; t=1712246847; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=/VfdAcUgMKKdIImznXQCsjzxihOdEcjXVNKwK2JA30Q=; b=KlqV4cg0zu0RMjPJ2+96XschbtCo+vwr0mHQpil0K68WGDUrHUMZ12SFTM9S1BaqjjBIx/ EDwshMfEnj5+HudcR88Pd+PoK/32C0K5LZYosj9cm9gcnrosLu0R9G/tfchMknldVhDt6C wuzB1TfYgNcugCcGsMWhys6ABmzuh2SSMKXAP6/0v/ZjS9tcvwofC5gmlaHAYEl1pI46nf oQt/iOC7WOWRjJUqZDhSXkpNQ5jxexKcvgpwPS0WVgUrWI/A0nSPpKEMOjq4YQELdGJSIS yWikbG8PAoFVM7LNXaOMp23uO7cRJomjSxHn2R1dfCpOjwD7pJSkWZGaNWsFyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=manguebit.com; s=dkim; t=1712246847; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/VfdAcUgMKKdIImznXQCsjzxihOdEcjXVNKwK2JA30Q=; b=qzPWneXaxl526HZlYSdO9k7llZr6l9jznC3EaHDXdORExty5mLPf16WNWkEbAU3d8oczwA GFdn6D/faaCebfoZuASOIBhvfLwOcOfGFx2QoEanuQjqkwjoWPTUVXIw2MXi7ZiTsW8ER4 FrGQxnWyzA+GA1xPOe6PRGpbSJNshzYrrinxQnNEJJ9rzWRLcYAKJjyQb87nqZPDWDq+JW lwlJh/PF6Nie3bu90aLsh+lmC90Jp9QU4Kome9fs+MW+TlrZr+92xseh9NpB0VcpkZAoHN Y3VmyIzi6zdbAdPKIVbbuOI/O+z/dMpJmriIn9aTCIsvzL2otGjovY1SByWZZQ== ARC-Authentication-Results: i=1; ORIGINATING; auth=pass smtp.mailfrom=pc@manguebit.com ARC-Seal: i=1; s=dkim; d=manguebit.com; t=1712246847; a=rsa-sha256; cv=none; b=Mv6xhiXFLzmVYcG110KOH5zMR9BCpHlX2HcZQJrkSUrOb0RFTLgNEdwWkSM6GO9KyvSNN+ NXZRug3ua6MyoAAqSiG0+mO4sqqp29ZdTpqnLuqQNxktp/X5wRyUM+dgdxbF7KKebbmM02 o1Uor6zQz7E5UrLWo5n8QJmKdxrb2SsqoKkHiUj9COBabZc+f4s+j6XMoEJe3+jWBEv1fF ElmeqtFCNr1tQfdxk1vrecvJbGL0cmI8wzZB2Lvjpb3NY/3tOcpAHPXMpErPSVzpllMgYb bCOLcgs5tc0Iehr+Ppzngf3z1zCZ9hTDEtsn95S4BzSv7+iE9SA4zF2dYFq+Ag== From: Paulo Alcantara To: David Howells , Steve French Cc: dhowells@redhat.com, Shyam Prasad N , linux-cifs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] cifs: Fix reacquisition of volume cookie on still-live connection In-Reply-To: <3756406.1712244064@warthog.procyon.org.uk> References: <3756406.1712244064@warthog.procyon.org.uk> Date: Thu, 04 Apr 2024 13:07:24 -0300 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain Hi Dave, David Howells writes: > During mount, cifs_mount_get_tcon() gets a tcon resource connection record > and then attaches an fscache volume cookie to it. However, it does this > irrespective of whether or not the tcon returned from cifs_get_tcon() is a > new record or one that's already in use. This leads to a warning about a > volume cookie collision and a leaked volume cookie because tcon->fscache > gets reset. > > Fix this be adding a mutex and a "we've already tried this" flag and only > doing it once for the lifetime of the tcon. Can't we just move the cookie acquisition to cifs_get_tcon() before it gets added to list @ses->tcon_list. This way we'll guarantee that the cookie is set only once for the new tcon. Besides, do we want to share a tcon with two different superblocks that have 'fsc' and 'nofsc', respectively? If not, it would be better to fix match_tcon() as well to handle such case. > [!] Note: Looking at cifs_mount_get_tcon(), a more general solution may > actually be required. Reacquiring the volume cookie isn't the only thing > that function does: it also partially reinitialises the tcon record without > any locking - which may cause live filesystem ops already using the tcon > through a previous mount to malfunction. Agreed.