From: Henrique Carvalho <henrique.carvalho@suse.com>
To: Bharath SM <bharathsm.hsk@gmail.com>
Cc: linux-cifs@vger.kernel.org, smfrench@gmail.com, pc@manguebit.com,
sprasad@microsoft.com, paul@darkrain42.org,
Bharath SM <bharathsm@microsoft.com>
Subject: Re: [PATCH 2/2] smb: invalidate and close cached directory when creating child entries
Date: Wed, 2 Jul 2025 13:55:47 -0300 [thread overview]
Message-ID: <aGVkk8LT_RSwElO1@precision> (raw)
In-Reply-To: <20250630185303.12087-1-bharathsm@microsoft.com>
Hi Bharath,
On Tue, Jul 01, 2025 at 12:23:03AM +0530, Bharath SM wrote:
> @@ -190,6 +190,7 @@ static int cifs_do_create(struct inode *inode, struct dentry *direntry, unsigned
> int disposition;
> struct TCP_Server_Info *server = tcon->ses->server;
> struct cifs_open_parms oparms;
> + struct cached_fid *parent_cfid = NULL;
> int rdwr_for_fscache = 0;
> __le32 lease_flags = 0;
>
> @@ -313,10 +314,10 @@ static int cifs_do_create(struct inode *inode, struct dentry *direntry, unsigned
> if (!tcon->unix_ext && (mode & S_IWUGO) == 0)
> create_options |= CREATE_OPTION_READONLY;
>
> +
> retry_open:
> if (tcon->cfids && direntry->d_parent && server->dialect >= SMB30_PROT_ID) {
> - struct cached_fid *parent_cfid;
> -
> + parent_cfid = NULL;
I believe setting to NULL here is unnecessary, no?
> spin_lock(&tcon->cfids->cfid_list_lock);
> list_for_each_entry(parent_cfid, &tcon->cfids->entries, entry) {
> if (parent_cfid->dentry == direntry->d_parent) {
> @@ -327,6 +328,7 @@ static int cifs_do_create(struct inode *inode, struct dentry *direntry, unsigned
> memcpy(fid->parent_lease_key,
> parent_cfid->fid.lease_key,
> SMB2_LEASE_KEY_SIZE);
> + parent_cfid->dirents.is_valid = false;
Shouldn't we set dirents.is_valid to false only after the open is
successful?
> }
> break;
> }
> @@ -355,6 +357,10 @@ static int cifs_do_create(struct inode *inode, struct dentry *direntry, unsigned
> }
> goto out;
> }
> +
> + if (parent_cfid && !parent_cfid->dirents.is_valid)
> + close_cached_dir(parent_cfid);
> +
> if (rdwr_for_fscache == 2)
> cifs_invalidate_cache(inode, FSCACHE_INVAL_DIO_WRITE);
>
Apart from the above,
Reviewed-by: Henrique Carvalho <henrique.carvalho@suse.com>
next prev parent reply other threads:[~2025-07-02 16:58 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-30 18:53 [PATCH 2/2] smb: invalidate and close cached directory when creating child entries Bharath SM
2025-07-02 11:32 ` Dan Carpenter
2025-07-02 16:55 ` Henrique Carvalho [this message]
2025-07-02 20:31 ` Enzo Matsumiya
2025-07-03 5:55 ` Steve French
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=aGVkk8LT_RSwElO1@precision \
--to=henrique.carvalho@suse.com \
--cc=bharathsm.hsk@gmail.com \
--cc=bharathsm@microsoft.com \
--cc=linux-cifs@vger.kernel.org \
--cc=paul@darkrain42.org \
--cc=pc@manguebit.com \
--cc=smfrench@gmail.com \
--cc=sprasad@microsoft.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox