linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Hugh Dickins <hughd@google.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Christoph Hellwig <hch@infradead.org>, Jan Kara <jack@suse.cz>,
	William Kucharski <william.kucharski@oracle.com>,
	linux-fsdevel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH next 2/3] shmem: Fix data loss when folio truncated
Date: Fri, 7 Jan 2022 15:53:03 +0000	[thread overview]
Message-ID: <Ydhh39A92g7Xe1df@casper.infradead.org> (raw)
In-Reply-To: <24d53dac-d58d-6bb9-82af-c472922e4a31@google.com>

On Sun, Jan 02, 2022 at 05:34:05PM -0800, Hugh Dickins wrote:
> xfstests generic 098 214 263 286 412 used to pass on huge tmpfs (well,
> three of those _require_odirect, enabled by a shmem_direct_IO() stub),
> but still fail even with the partial_end fix.
> 
> generic/098 output mismatch shows actual data loss:
>     --- tests/generic/098.out
>     +++ /home/hughd/xfstests/results//generic/098.out.bad
>     @@ -4,9 +4,7 @@
>      wrote 32768/32768 bytes at offset 262144
>      XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
>      File content after remount:
>     -0000000 aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa aa
>     -*
>     -0400000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>     +0000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>     ...

generic/098 is passing for me ;-(  I'm using 'always' for THPs.
I'll have to try harder.  Regardless, I think your fix is good ...

> +static struct folio *shmem_get_partial_folio(struct inode *inode, pgoff_t index)

Love the better calling convention.

> +	folio = __filemap_get_folio(inode->i_mapping, index,
> +					FGP_ENTRY | FGP_LOCK, 0);
> +	if (!folio || !xa_is_value(folio))
> +		return folio;

That first '!folio' is redundant.  xa_is_value(NULL) is false.


  reply	other threads:[~2022-01-07 15:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-03  1:34 [PATCH next 2/3] shmem: Fix data loss when folio truncated Hugh Dickins
2022-01-07 15:53 ` Matthew Wilcox [this message]
2022-01-08 17:12   ` Hugh Dickins
2022-01-08 21:25     ` Matthew Wilcox

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=Ydhh39A92g7Xe1df@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=hch@infradead.org \
    --cc=hughd@google.com \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=william.kucharski@oracle.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;
as well as URLs for NNTP newsgroup(s).