diff mbox series

[2/9] cifs: Do not use tcon->cfid directly, use the cfid we get from open_cached_dir

Message ID 20220809021156.3086869-3-lsahlber@redhat.com (mailing list archive)
State New, archived
Headers show
Series [1/9] cifs: Move cached-dir functions into a separate file | expand

Commit Message

Ronnie Sahlberg Aug. 9, 2022, 2:11 a.m. UTC
They are the same right now but tcon-> will later point to a different
type of struct containing a list of cfids.

Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
---
 fs/cifs/smb2inode.c | 4 ++--
 fs/cifs/smb2pdu.c   | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

Comments

Steve French Aug. 9, 2022, 4:22 a.m. UTC | #1
This looks harmless if it makes future patches easier

On Mon, Aug 8, 2022 at 9:12 PM Ronnie Sahlberg <lsahlber@redhat.com> wrote:
>
> They are the same right now but tcon-> will later point to a different
> type of struct containing a list of cfids.
>
> Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
> ---
>  fs/cifs/smb2inode.c | 4 ++--
>  fs/cifs/smb2pdu.c   | 2 +-
>  2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/fs/cifs/smb2inode.c b/fs/cifs/smb2inode.c
> index f6f9fc3f2e2d..09f01f70e020 100644
> --- a/fs/cifs/smb2inode.c
> +++ b/fs/cifs/smb2inode.c
> @@ -519,9 +519,9 @@ smb2_query_path_info(const unsigned int xid, struct cifs_tcon *tcon,
>                 rc = open_cached_dir(xid, tcon, full_path, cifs_sb, &cfid);
>         /* If it is a root and its handle is cached then use it */
>         if (!rc) {
> -               if (tcon->cfid.file_all_info_is_valid) {
> +               if (cfid->file_all_info_is_valid) {
>                         move_smb2_info_to_cifs(data,
> -                                              &tcon->cfid.file_all_info);
> +                                              &cfid->file_all_info);
>                 } else {
>                         rc = SMB2_query_info(xid, tcon,
>                                              cfid->fid->persistent_fid,
> diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
> index 9ee1b6225619..5dbd2cac470c 100644
> --- a/fs/cifs/smb2pdu.c
> +++ b/fs/cifs/smb2pdu.c
> @@ -1979,7 +1979,7 @@ SMB2_tdis(const unsigned int xid, struct cifs_tcon *tcon)
>         }
>         spin_unlock(&ses->chan_lock);
>
> -       close_cached_dir_lease(&tcon->cfid);
> +       invalidate_all_cached_dirs(tcon);
>
>         rc = smb2_plain_req_init(SMB2_TREE_DISCONNECT, tcon, ses->server,
>                                  (void **) &req,
> --
> 2.35.3
>
Paulo Alcantara Aug. 11, 2022, 1:03 p.m. UTC | #2
Ronnie Sahlberg <lsahlber@redhat.com> writes:

> They are the same right now but tcon-> will later point to a different
> type of struct containing a list of cfids.
>
> Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
> ---
>  fs/cifs/smb2inode.c | 4 ++--
>  fs/cifs/smb2pdu.c   | 2 +-
>  2 files changed, 3 insertions(+), 3 deletions(-)

Reviewed-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
diff mbox series

Patch

diff --git a/fs/cifs/smb2inode.c b/fs/cifs/smb2inode.c
index f6f9fc3f2e2d..09f01f70e020 100644
--- a/fs/cifs/smb2inode.c
+++ b/fs/cifs/smb2inode.c
@@ -519,9 +519,9 @@  smb2_query_path_info(const unsigned int xid, struct cifs_tcon *tcon,
 		rc = open_cached_dir(xid, tcon, full_path, cifs_sb, &cfid);
 	/* If it is a root and its handle is cached then use it */
 	if (!rc) {
-		if (tcon->cfid.file_all_info_is_valid) {
+		if (cfid->file_all_info_is_valid) {
 			move_smb2_info_to_cifs(data,
-					       &tcon->cfid.file_all_info);
+					       &cfid->file_all_info);
 		} else {
 			rc = SMB2_query_info(xid, tcon,
 					     cfid->fid->persistent_fid,
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index 9ee1b6225619..5dbd2cac470c 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -1979,7 +1979,7 @@  SMB2_tdis(const unsigned int xid, struct cifs_tcon *tcon)
 	}
 	spin_unlock(&ses->chan_lock);
 
-	close_cached_dir_lease(&tcon->cfid);
+	invalidate_all_cached_dirs(tcon);
 
 	rc = smb2_plain_req_init(SMB2_TREE_DISCONNECT, tcon, ses->server,
 				 (void **) &req,