linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: David Howells <dhowells@redhat.com>
Cc: sfrench@samba.org, linux-cifs@vger.kernel.org,
	lsahlber@redhat.com, jlayton@kernel.org, dchinner@redhat.com,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	samba-technical@lists.samba.org
Subject: Re: [PATCH 3/5] smb3: fix temporary data corruption in collapse range
Date: Tue, 23 Aug 2022 15:07:57 +0100	[thread overview]
Message-ID: <YwTfPRDq04/DGTVT@casper.infradead.org> (raw)
In-Reply-To: <166126006184.548536.12909933168251738646.stgit@warthog.procyon.org.uk>

On Tue, Aug 23, 2022 at 02:07:41PM +0100, David Howells wrote:
>  
> +	filemap_invalidate_lock(inode->i_mapping);
>  	filemap_write_and_wait(inode->i_mapping);
> +	truncate_pagecache_range(inode, off, old_eof);

It's a bit odd to writeback the entire file but then truncate only part
of it.  XFS does the same part:

        error = filemap_write_and_wait_range(inode->i_mapping, start, end);
        if (error)
                return error;
        truncate_pagecache_range(inode, start, end);

... and presumably, you'd also want the error check?

>  	rc = smb2_copychunk_range(xid, cfile, cfile, off + len,
> -				  i_size_read(inode) - off - len, off);
> +				  old_eof - off - len, off);

  reply	other threads:[~2022-08-23 17:04 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-23 13:07 [PATCH 0/5] smb3: Fix missing locks and invalidation in fallocate David Howells
2022-08-23 13:07 ` [PATCH 1/5] smb3: Move the flush out of smb2_copychunk_range() into its callers David Howells
2022-08-29  5:06   ` Steve French
2022-08-29 16:56     ` Steve French
2022-08-23 13:07 ` [PATCH 2/5] smb3: missing inode locks in zero range David Howells
2022-08-23 13:07 ` [PATCH 3/5] smb3: fix temporary data corruption in collapse range David Howells
2022-08-23 14:07   ` Matthew Wilcox [this message]
2022-08-23 14:14   ` David Howells
2022-08-23 14:17   ` David Howells
2022-08-23 13:07 ` [PATCH 4/5] smb3: missing inode locks in punch hole David Howells
2022-08-23 13:07 ` [PATCH 5/5] smb3: fix temporary data corruption in insert range David Howells
2022-08-24  5:58   ` 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=YwTfPRDq04/DGTVT@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=dchinner@redhat.com \
    --cc=dhowells@redhat.com \
    --cc=jlayton@kernel.org \
    --cc=linux-cifs@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lsahlber@redhat.com \
    --cc=samba-technical@lists.samba.org \
    --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 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).