All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Aurélien Aptel" <aaptel@suse.com>
To: Muhammad Usama Anjum <musamaanjum@gmail.com>,
	Steve French <sfrench@samba.org>,
	Ronnie Sahlberg <lsahlber@redhat.com>,
	"open list:COMMON INTERNET FILE SYSTEM CLIENT (CIFS)" 
	<linux-cifs@vger.kernel.org>,
	open list <linux-kernel@vger.kernel.org>
Cc: musamaanjum@gmail.com, kernel-janitors@vger.kernel.org,
	dan.carpenter@oracle.com, colin.king@canonical.com
Subject: Re: [PATCH v2] cifs: remove unnecessary copies of tcon->crfid.fid
Date: Sat, 17 Apr 2021 12:53:37 +0200	[thread overview]
Message-ID: <8735vp18su.fsf@suse.com> (raw)
In-Reply-To: <20210415152409.GA2286719@LEGION>

Hi,

This is better I think.

Muhammad Usama Anjum <musamaanjum@gmail.com> 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 == SMB2_OPLOCK_LEVEL_LEASE) {
> +		/*
> +		 * caller expects this func to set the fid in crfid to valid
> +		 * 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 <lsahlber@redhat.com>
    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élien 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ürnberg, DE
GF: Felix Imendörffer, Mary Higgins, Sri Rasiah HRB 247165 (AG München)


  reply	other threads:[~2021-04-17 10:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-15 15:24 [PATCH v2] cifs: remove unnecessary copies of tcon->crfid.fid Muhammad Usama Anjum
2021-04-17 10:53 ` Aurélien Aptel [this message]
2021-04-19 23:39   ` Steve French
2021-04-28 16:12     ` Muhammad Usama Anjum

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8735vp18su.fsf@suse.com \
    --to=aaptel@suse.com \
    --cc=colin.king@canonical.com \
    --cc=dan.carpenter@oracle.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-cifs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lsahlber@redhat.com \
    --cc=musamaanjum@gmail.com \
    --cc=sfrench@samba.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.