Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2872711pxb; Mon, 19 Apr 2021 16:40:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJztcGnQfbcBhrJRkgIEc7M4jRNC52e4N7fGQbV67G954Qsc3etOSdeDPYZMmsnrw4gI1kjx X-Received: by 2002:a17:90a:6385:: with SMTP id f5mr1679078pjj.212.1618875630434; Mon, 19 Apr 2021 16:40:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618875630; cv=none; d=google.com; s=arc-20160816; b=0NSR3mgzNuh8cGz8pg9FI2SA6ElQjm3jnJrlh6i/wVszdfjza0hFiV38UAaS+8jed/ mIiWpBs12odomP0E51ihXer3dYPEvVNr/Qa9S0Q9YPQ5YuzytbKihJdwyKQbVK3OExU0 wEw4N4NlbJsEEx/w4jUec0z+MBguGn+blkNj/ggntRYXfwPYHLwmGt+HiVaKAvZQXvOL IstPAollcfriJoDn3Rqm+2F9FcnWdf9qFE/1xNsoR7qf65A5iWD5RF0S5Fvrr07AJqkS tF5b0CQA5vIelj7ShORWAalBNXcBYVf3pd/fLuDBRBfjBvz3aGCP7J2iLJkAp7hP8KJl 3G7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=LfEpz0iSjiNDbPXawTwLPZzoSRuzzKGOxdOGebsOX3c=; b=Hm6xymNygq59tqascffD1VFWOupAnyGv9jFOLRQPEXLH+7tQADt4kQljMrryPcfCiw JyBtspil8HT7XD8ZrxXOihkuyB8cL8HdZN7AA3t4fHVlGs0PTAIUqe+7cIsMNmY13ls0 Eq9nOQ16XGtvy6fTvsUfexO7J+UvjkMP8ejQQtcoH0bz4qd+WUiNDOFRLc2rVO9r1DAM BzxuEraAu2rGRvQlNdD8TsZgJXPOxppCXMcuk7bYn+jz3O1C9An4x0nP2oMMkO2HCYLc K7cJnZaKK0Y5/Yrm+yXBRPzLawrm6jXLvVr567PAiblhqjFVm9uGpnwQg22lT9s4Xv2H G1oQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=OZJ2dq2q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s13si17207650pfu.219.2021.04.19.16.40.16; Mon, 19 Apr 2021 16:40:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=OZJ2dq2q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231572AbhDSXkP (ORCPT + 99 others); Mon, 19 Apr 2021 19:40:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54584 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229842AbhDSXkO (ORCPT ); Mon, 19 Apr 2021 19:40:14 -0400 Received: from mail-lj1-x230.google.com (mail-lj1-x230.google.com [IPv6:2a00:1450:4864:20::230]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 99CF3C06174A; Mon, 19 Apr 2021 16:39:42 -0700 (PDT) Received: by mail-lj1-x230.google.com with SMTP id z8so41355969ljm.12; Mon, 19 Apr 2021 16:39:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=LfEpz0iSjiNDbPXawTwLPZzoSRuzzKGOxdOGebsOX3c=; b=OZJ2dq2qJ5uj4GxBGsnYxJZ0yMig951/JM5Yx8zlFk5Ker01MAUc003nNQt+po7kRO debCIwjD1HJqCkzEIVAWep2IarzX+nzs/P8lhCNblHpS5gnfmFx6G1GZgGC68AZ81gdf 9WKGDRkeQXEGZnmOA3EUTeCV/W2o5LqtaA0VCuUjQe+eKn8//52l2mBqHM/v1H5uIDCj 7egCMZbOs2OL9Kqt/H/cugtDgZKITs57StunHsMH5/LGyWUYQX1M35bAQQOMceldKpQT HAkSumSoVHkp5sTZxIcGoUEXjFcjll1DqkSnrOFdG5QOCabCcWZI1QvFpd0xuZXa6YiT u1Ag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=LfEpz0iSjiNDbPXawTwLPZzoSRuzzKGOxdOGebsOX3c=; b=EdQGrfy8zKahsJxlRQR1zlc7HMuWNZwIDEZVmXsoOk0XZSS5UjbJdULDK4cZk/SpTn 0stAWa/JNgDEIyLZ8RWm9nf5M173iDrsxj4hxABeW/gV/KBP5wJ8YMoXZWqo09jz8UhS 40bLdryrGe7Oe/7FDbaaG6sPUxJsPC20p/kbtj7rROzSKDmG9gPsZjDRR/rZy0LMdSC6 zQ/L2EAjIejdYuceOcDS0QcQB5XbBlHD4G7rr3Sf9TikfLnQLSqksOWUTR9McZGenY4y sJRxIQA491Se0vxYJTtER/DP7kH/C5iO12OseCuNy5Nzv2dCmpzzzRICyUCxxPymlYeY M7dw== X-Gm-Message-State: AOAM532KB7BVEEcKVduULUKVeLoDBi+o+GYbh+0lWh02Ys5ZAI9y8I0d RYyTmLl2BLAi/ttdC96DzaWZmcxHNpto42iny04= X-Received: by 2002:a2e:b8d2:: with SMTP id s18mr12849213ljp.148.1618875577658; Mon, 19 Apr 2021 16:39:37 -0700 (PDT) MIME-Version: 1.0 References: <20210415152409.GA2286719@LEGION> <8735vp18su.fsf@suse.com> In-Reply-To: <8735vp18su.fsf@suse.com> From: Steve French Date: Mon, 19 Apr 2021 18:39:26 -0500 Message-ID: Subject: Re: [PATCH v2] cifs: remove unnecessary copies of tcon->crfid.fid To: =?UTF-8?Q?Aur=C3=A9lien_Aptel?= Cc: Muhammad Usama Anjum , Steve French , Ronnie Sahlberg , "open list:COMMON INTERNET FILE SYSTEM CLIENT (CIFS)" , open list , kernel-janitors , Dan Carpenter , Colin King Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org I changed the comment to + /* + * See commit 2f94a3125b87. Increment the refcount when we + * get a lease for root, release it if lease break occurs + */ and added Aurelien's Reviewed-by. Let me know if you see any additional problems. On Sat, Apr 17, 2021 at 5:54 AM Aur=C3=A9lien Aptel wrote= : > > Hi, > > This is better I think. > > Muhammad Usama Anjum writes: > > @@ -894,6 +891,10 @@ int open_cached_dir(unsigned int xid, struct cifs_= tcon *tcon, > > > > /* BB TBD check to see if oplock level check can be removed below= */ > > if (o_rsp->OplockLevel =3D=3D SMB2_OPLOCK_LEVEL_LEASE) { > > + /* > > + * caller expects this func to set the fid in crfid to va= lid > > + * cached root, so increment the refcount. > > + */ > > This comment is misleading. crfid variable doesn't exist anymore, and > the kref_get() here is because of this commit: > > commit 2f94a3125b87 > Author: Ronnie Sahlberg > Date: Thu Mar 28 11:20:02 2019 +1000 > > cifs: fix kref underflow in close_shroot() > > [...] > --> This extra get() is only used to hold the structure until we get = a lease > --> break from the server at which point we will kref_put() it during= lease > --> processing. > [...] > > > > When we queue a lease break, we usually get() the cifsFileInfo, but if > that cifsFileInfo is backed by a cached_fid, the cached_fid isn't > bumped. That commit was probably a work around for that. > > @Ronnie : > > struct cached_fid is starting to look very much like struct > cifsFileInfo. I wonder why we couldn't use it, along with > find_writable_file()/find_readable_file() to handle the caching. > > Alternatively, make cifsFileInfo use cached_fid (perhaps renaming it in > the process, I don't know) > > Because I suspect a lot more issues will come up regarding cached_fid > refcount and cifsFileInfo refcount going out of sync otherwise. > > Cheers, > -- > Aur=C3=A9lien Aptel / SUSE Labs Samba Team > GPG: 1839 CB5F 9F5B FB9B AA97 8C99 03C8 A49B 521B D5D3 > SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 N=C3=BCrnberg,= DE > GF: Felix Imend=C3=B6rffer, Mary Higgins, Sri Rasiah HRB 247165 (AG M=C3= =BCnchen) > --=20 Thanks, Steve