linux-cifs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] cifs: revalidate mapping when we open files for SMB1 POSIX
@ 2021-03-25  6:26 Ronnie Sahlberg
  2021-03-25 15:34 ` Paulo Alcantara
  0 siblings, 1 reply; 5+ messages in thread
From: Ronnie Sahlberg @ 2021-03-25  6:26 UTC (permalink / raw)
  To: linux-cifs; +Cc: Steve French

RHBZ: 1933527

Under SMB1 + POSIX, if an inode is reused on a server after we have read and
cached a part of a file, when we then open the new file with the
re-cycled inode there is a chance that we may serve the old data out of cache
to the application.
This only happens for SMB1 (deprecated) and when posix are used.
The simplest solution to avoid this race is to force a revalidate
on smb1-posix open.

 Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
---
 fs/cifs/file.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index 26de4329d161..042e24aad410 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -165,6 +165,7 @@ int cifs_posix_open(char *full_path, struct inode **pinode,
 			goto posix_open_ret;
 		}
 	} else {
+		cifs_revalidate_mapping(*pinode);
 		cifs_fattr_to_inode(*pinode, &fattr);
 	}
 
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] cifs: revalidate mapping when we open files for SMB1 POSIX
  2021-03-25  6:26 [PATCH] cifs: revalidate mapping when we open files for SMB1 POSIX Ronnie Sahlberg
@ 2021-03-25 15:34 ` Paulo Alcantara
  2021-03-25 15:42   ` Steve French
  0 siblings, 1 reply; 5+ messages in thread
From: Paulo Alcantara @ 2021-03-25 15:34 UTC (permalink / raw)
  To: Ronnie Sahlberg, linux-cifs; +Cc: Steve French

Ronnie Sahlberg <lsahlber@redhat.com> writes:

> RHBZ: 1933527
>
> Under SMB1 + POSIX, if an inode is reused on a server after we have read and
> cached a part of a file, when we then open the new file with the
> re-cycled inode there is a chance that we may serve the old data out of cache
> to the application.
> This only happens for SMB1 (deprecated) and when posix are used.
> The simplest solution to avoid this race is to force a revalidate
> on smb1-posix open.
>
>  Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
> ---
>  fs/cifs/file.c | 1 +
>  1 file changed, 1 insertion(+)

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] cifs: revalidate mapping when we open files for SMB1 POSIX
  2021-03-25 15:34 ` Paulo Alcantara
@ 2021-03-25 15:42   ` Steve French
  0 siblings, 0 replies; 5+ messages in thread
From: Steve French @ 2021-03-25 15:42 UTC (permalink / raw)
  To: Paulo Alcantara; +Cc: Ronnie Sahlberg, linux-cifs

merged into cifs-2.6.git for-next

On Thu, Mar 25, 2021 at 10:34 AM Paulo Alcantara <pc@cjr.nz> wrote:
>
> Ronnie Sahlberg <lsahlber@redhat.com> writes:
>
> > RHBZ: 1933527
> >
> > Under SMB1 + POSIX, if an inode is reused on a server after we have read and
> > cached a part of a file, when we then open the new file with the
> > re-cycled inode there is a chance that we may serve the old data out of cache
> > to the application.
> > This only happens for SMB1 (deprecated) and when posix are used.
> > The simplest solution to avoid this race is to force a revalidate
> > on smb1-posix open.
> >
> >  Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
> > ---
> >  fs/cifs/file.c | 1 +
> >  1 file changed, 1 insertion(+)
>
> Reviewed-by: Paulo Alcantara (SUSE) <pc@cjr.nz>



-- 
Thanks,

Steve

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] cifs: revalidate mapping when we open files for SMB1 POSIX
@ 2021-03-25  6:14 Ronnie Sahlberg
  0 siblings, 0 replies; 5+ messages in thread
From: Ronnie Sahlberg @ 2021-03-25  6:14 UTC (permalink / raw)
  To: linux-cifs; +Cc: Steve French

RHBZ: 1933527

We have seen read cache surviving across close to open under
SMB1 POSIX.

Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
---
 fs/cifs/file.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index 26de4329d161..042e24aad410 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -165,6 +165,7 @@ int cifs_posix_open(char *full_path, struct inode **pinode,
 			goto posix_open_ret;
 		}
 	} else {
+		cifs_revalidate_mapping(*pinode);
 		cifs_fattr_to_inode(*pinode, &fattr);
 	}
 
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH] cifs: revalidate mapping when we open files for SMB1 POSIX
@ 2021-03-25  5:23 Ronnie Sahlberg
  0 siblings, 0 replies; 5+ messages in thread
From: Ronnie Sahlberg @ 2021-03-25  5:23 UTC (permalink / raw)
  To: linux-cifs; +Cc: Steve French

From: root <root@localhost.localdomain>

RHBZ: 1933527

We have seen read cashe surviving across close to open under
SMB1 POSIX.

Signed-off-by: root <root@localhost.localdomain>
---
 fs/cifs/file.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index 26de4329d161..042e24aad410 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -165,6 +165,7 @@ int cifs_posix_open(char *full_path, struct inode **pinode,
 			goto posix_open_ret;
 		}
 	} else {
+		cifs_revalidate_mapping(*pinode);
 		cifs_fattr_to_inode(*pinode, &fattr);
 	}
 
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-03-25 15:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-25  6:26 [PATCH] cifs: revalidate mapping when we open files for SMB1 POSIX Ronnie Sahlberg
2021-03-25 15:34 ` Paulo Alcantara
2021-03-25 15:42   ` Steve French
  -- strict thread matches above, loose matches on Subject: below --
2021-03-25  6:14 Ronnie Sahlberg
2021-03-25  5:23 Ronnie Sahlberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).