Received: by 2002:a05:6500:1b45:b0:1f5:f2ab:c469 with SMTP id cz5csp106043lqb; Tue, 16 Apr 2024 10:00:18 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW5s0gyeTt2xN6dOOgRfMRl8FNhkV3Lo04WRwblaA0+HbCB2M4w2O3Qi8TCSmgQnpWeIimUhSU9eSKdvvV+0cWB+JXeXLeE1WZR5cQbow== X-Google-Smtp-Source: AGHT+IF54pXuRNGhS4ILS3DdtnPkzt+i7yPb9gueUzIC+cDjgL2aRGSBcGCUwTPomgFP2Q2g1bLA X-Received: by 2002:a17:90a:f507:b0:2a2:bc9d:f44f with SMTP id cs7-20020a17090af50700b002a2bc9df44fmr10731054pjb.13.1713286817674; Tue, 16 Apr 2024 10:00:17 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713286817; cv=pass; d=google.com; s=arc-20160816; b=dF5wDTJrXfOeAMt8RPfMDDa+ggZFekzmHfkM8NmNXrMk2rrw+W45E9/3YoeYFDJpdp DEHEYGn74oq4CSY7oVY6qJki2Oplgyb7t20Qxx2NRnimWBoOmn75sEjyX2uukgnVvdFx mihQNtVEuQG7Ibw0E5tDNsPPPBHOvzngvv5y9/U+g5mUWe8KAP1pzJprUtm024NTTDo0 TzvbQYyd0IDpq2168MFPcm+bL6WZ9NYcp8CVEsgmVIRYnQPFsWTZVgOap+eUNG7yzUpS WT0xSh0mZmNk3f4yzZ9R/oiRjs8QCSqz3KuvdSeVkL8yZa7moboypj2JXw3wpStRVkLN JPog== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:content-id:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:subject:cc:to:references :in-reply-to:from:organization:dkim-signature; bh=ACuK1BwAPedfa6Ho4auLQQiF3JZp7pyLXmhg4dg7VCQ=; fh=RmrgwBvlBsoHJiC3CToLMKynJ+P6a81botJaW0tIHgg=; b=huw7hiJCXsALqnvrmPeaeFv38Bl7ppOnkzneJ/pXWgJcLYwcigwgA0Lz92+wqQPy6+ Itk1ZuD5LRM0MRBYF86ruODsNMXTnCVdtuQJ6SJvyQMFS7lkGMmqUSzicvd93jy3DivH 9PHAwkkKigRkVAfYzNjsPyxNSjFZr7A85LmbV4Zllna7fjC6q2EVXIul8n4HMqU9/np0 7uo5noxJNSEphYs0hWvbOnRuzIX0eB/2Ap40V6dtAmB0T1g1V0NKu0jQJOovaUGy6obQ cirZYTP/3Yggo/id8b3qWD3sNL0+tbEN2XdnLckEUxJlRVJtYGZbpCkVuxbphiZy2TL/ HB2A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=PIXy075l; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-147269-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-147269-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id lx4-20020a17090b4b0400b002a204803722si12753202pjb.85.2024.04.16.10.00.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Apr 2024 10:00:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-147269-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=PIXy075l; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-147269-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-147269-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 8B5EEB2282E for ; Tue, 16 Apr 2024 16:59:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AF25B131BD3; Tue, 16 Apr 2024 16:58:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="PIXy075l" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 9A45F43AA5 for ; Tue, 16 Apr 2024 16:58:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713286734; cv=none; b=nssBWhPrph2jYwpMy474mv9WRhK5icBVJAflykZPIjv6U6MU4HSjmpWyfTJbPdHLjrnczJdr8y6e3ds945rpu/zJRpm/ko/Os7htrA7fBGQzclkVnyClqRuoCgmEo6rccdm0Y9AtYiGGWd0y/QEbG6VckGx5LvAHpwby+1IKsv8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713286734; c=relaxed/simple; bh=opPCA+XHxeV0l/Z0FrPaAC14zh+S8xVA6FNWxr5aA8w=; h=From:In-Reply-To:References:To:Cc:Subject:MIME-Version: Content-Type:Date:Message-ID; b=DzFhcKcFh9av3hklgIWk2wE7p44KqjTP9RHGqvwzP64RbAa07nD5QYXyOWvuvp+egdOEr58bCppYkM6AWdi6l+UaV+VP0dWT47LkPPRPSzEfNFiHoRSt5a2YSXdhCVBFTCC8C6+BLFfyCeqbV4z/q2v/PLghws8NZXUQ/Iz8jk0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=PIXy075l; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1713286732; 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=ACuK1BwAPedfa6Ho4auLQQiF3JZp7pyLXmhg4dg7VCQ=; b=PIXy075lXq05oo2BlaaFbFgHxXQ04dZ4B8FqCP91kT3NRVMkUl3eZZ8uFQx0wvsVKdq48S gfXnJxQInGopSwLGtukIdQ/EeawsVo7bM3BctXoIwy69KUZsWdXgoXXq0NKhcX2kPzR3tz 4qpb4o0itwCCuGgLZwopiFBntBcXzy4= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-135-B2DbH90MP86kOa52DZy_Jg-1; Tue, 16 Apr 2024 12:58:49 -0400 X-MC-Unique: B2DbH90MP86kOa52DZy_Jg-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7F11180591B; Tue, 16 Apr 2024 16:58:48 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.42.28.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 796A12124E4D; Tue, 16 Apr 2024 16:58:47 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells In-Reply-To: <14e66691a65e3d05d3d8d50e74dfb366@manguebit.com> References: <14e66691a65e3d05d3d8d50e74dfb366@manguebit.com> <3756406.1712244064@warthog.procyon.org.uk> To: Paulo Alcantara Cc: dhowells@redhat.com, Steve French , 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 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2713339.1713286722.1@warthog.procyon.org.uk> Date: Tue, 16 Apr 2024 17:58:42 +0100 Message-ID: <2713340.1713286722@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.6 Paulo Alcantara wrote: > 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. cifs_get_tcon() is used from more than one place and I'm not sure the second place (__cifs_construct_tcon()) actually wants a cookie. I'm not sure what that path is for. Could all the (re)setting up being done in cifs_mount_get_tcon() be pushed back into cifs_get_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. Maybe? What does a tcon *actually* represent? I note that in cifs_match_super(), it's not the only criterion matched upon - so you can, at least in apparent theory, get different superblocks for the same tcon anyway. This suggests that the tcon might not be the best place for the fscache volume cookie as you can have multiple inodes wishing to use the same file cookie if there are multiple mounts mounting the same tcon but, say, with different mount parameters. I'm not sure what the right way around this is. The root of the problem is coherency management. If we make a change to an inode on one mounted superblock and this bounces a change notification over to the server that then pokes an inode in another mounted superblock on the same machine and causes it to be invalidated, you lose your local cache if both inodes refer to the same fscache cookie. Remember: fscache does not do this for you! It's just a facility by which which data can be stored and retrieved. The netfs is responsible for telling it when to invalidate and handling coherency. That said, it might be possible to time-share a cookie on cifs with leases, but the local superblocks would have to know about each other - in which case, why are they separate superblocks? David