linux-cifs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steve French <smfrench@gmail.com>
To: CIFS <linux-cifs@vger.kernel.org>
Subject: Fwd: [PATCH] cifs: revalidate mapping when doing direct writes
Date: Mon, 12 Sep 2022 00:32:54 -0500	[thread overview]
Message-ID: <CAH2r5mvnZ+6T840kZ5y6bY_SdvWT1DAbQaDUVdtrkPPu-rCMTw@mail.gmail.com> (raw)
In-Reply-To: <CAH2r5mvh5_XbVxu0idZgt5A=zEr=4k7DF8Omf4VZOdrgCNkOfA@mail.gmail.com>

---------- Forwarded message ---------
From: Steve French <smfrench@gmail.com>
Date: Mon, Sep 12, 2022 at 12:30 AM
Subject: Re: [PATCH] cifs: revalidate mapping when doing direct writes
To: Ronnie Sahlberg <lsahlber@redhat.com>
Cc: linux-cifs <linux-cifs@vger.kernel.org>, Ronnie Sahlberg
<lsahlber@redhat.com>


added cc:stable and tentatively merged into cifs-2.6.git for-next
pending testing

Also let me know if you think this could address any long standing
xfstest failures

On Sun, Sep 11, 2022 at 10:05 PM Ronnie Sahlberg <lsahlber@redhat.com> wrote:
>
> Kernel bugzilla: 216301
>
> When doing direct writes we need to also invalidate the mapping in case
> we have a cached copy of the affected page(s) in memory or else
> subsequent reads of the data might return the old/stale content
> before we wrote an update to the server.
>
> Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
> ---
>  fs/cifs/file.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/fs/cifs/file.c b/fs/cifs/file.c
> index fa738adc031f..6f38b134a346 100644
> --- a/fs/cifs/file.c
> +++ b/fs/cifs/file.c
> @@ -3575,6 +3575,9 @@ static ssize_t __cifs_writev(
>
>  ssize_t cifs_direct_writev(struct kiocb *iocb, struct iov_iter *from)
>  {
> +       struct file *file = iocb->ki_filp;
> +
> +       cifs_revalidate_mapping(file->f_inode);
>         return __cifs_writev(iocb, from, true);
>  }
>
> --
> 2.35.3
>


-- 
Thanks,

Steve


-- 
Thanks,

Steve

  parent reply	other threads:[~2022-09-12  5:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-12  3:04 Cifs: fix kbz 216301: return corrupt/stale file content Ronnie Sahlberg
2022-09-12  3:04 ` [PATCH] cifs: revalidate mapping when doing direct writes Ronnie Sahlberg
     [not found]   ` <CAH2r5mvh5_XbVxu0idZgt5A=zEr=4k7DF8Omf4VZOdrgCNkOfA@mail.gmail.com>
2022-09-12  5:32     ` Steve French [this message]
2022-09-12 15:57   ` Paulo Alcantara

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=CAH2r5mvnZ+6T840kZ5y6bY_SdvWT1DAbQaDUVdtrkPPu-rCMTw@mail.gmail.com \
    --to=smfrench@gmail.com \
    --cc=linux-cifs@vger.kernel.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 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).