All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Chris Mason <clm@fb.com>,
	Dave Chinner <dchinner@redhat.com>,
	Brian Foster <bfoster@redhat.com>, Christoph Hellwig <hch@lst.de>,
	Dave Chinner <david@fromorbit.com>
Subject: [PATCH 3.10 54/71] xfs: dont zero partial page cache pages during O_DIRECT write
Date: Mon, 15 Sep 2014 12:26:52 -0700	[thread overview]
Message-ID: <20140915192640.497378402@linuxfoundation.org> (raw)
In-Reply-To: <20140915192638.702282534@linuxfoundation.org>

3.10-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Chris Mason <clm@fb.com>

commit 85e584da3212140ee80fd047f9058bbee0bc00d5 upstream.

xfs is using truncate_pagecache_range to invalidate the page cache
during DIO reads.  This is different from the other filesystems who
only invalidate pages during DIO writes.

truncate_pagecache_range is meant to be used when we are freeing the
underlying data structs from disk, so it will zero any partial
ranges in the page.  This means a DIO read can zero out part of the
page cache page, and it is possible the page will stay in cache.

buffered reads will find an up to date page with zeros instead of
the data actually on disk.

This patch fixes things by using invalidate_inode_pages2_range
instead.  It preserves the page cache invalidation, but won't zero
any pages.

[dchinner: catch error and warn if it fails. Comment.]

Signed-off-by: Chris Mason <clm@fb.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/xfs/xfs_file.c |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

--- a/fs/xfs/xfs_file.c
+++ b/fs/xfs/xfs_file.c
@@ -298,7 +298,16 @@ xfs_file_aio_read(
 				xfs_rw_iunlock(ip, XFS_IOLOCK_EXCL);
 				return ret;
 			}
-			truncate_pagecache_range(VFS_I(ip), pos, -1);
+
+			/*
+			 * Invalidate whole pages. This can return an error if
+			 * we fail to invalidate a page, but this should never
+			 * happen on XFS. Warn if it does fail.
+			 */
+			ret = invalidate_inode_pages2_range(VFS_I(ip)->i_mapping,
+						pos >> PAGE_CACHE_SHIFT, -1);
+			WARN_ON_ONCE(ret);
+			ret = 0;
 		}
 		xfs_rw_ilock_demote(ip, XFS_IOLOCK_EXCL);
 	}



  parent reply	other threads:[~2014-09-15 19:56 UTC|newest]

Thread overview: 74+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-15 19:25 [PATCH 3.10 00/71] 3.10.55-stable review Greg Kroah-Hartman
2014-09-15 19:25 ` [PATCH 3.10 01/71] media: xc5000: Fix get_frequency() Greg Kroah-Hartman
2014-09-15 19:26 ` [PATCH 3.10 02/71] media: xc4000: " Greg Kroah-Hartman
2014-09-15 19:26 ` [PATCH 3.10 03/71] media: au0828: Only alt setting logic when needed Greg Kroah-Hartman
2014-09-15 19:26 ` [PATCH 3.10 05/71] iommu/amd: Fix cleanup_domain for mass device removal Greg Kroah-Hartman
2014-09-15 19:26 ` [PATCH 3.10 06/71] spi: orion: fix incorrect handling of cell-index DT property Greg Kroah-Hartman
2014-09-15 19:26 ` [PATCH 3.10 07/71] spi: omap2-mcspi: Configure hardware when slave driver changes mode Greg Kroah-Hartman
2014-09-15 19:26 ` [PATCH 3.10 08/71] firmware: Do not use WARN_ON(!spin_is_locked()) Greg Kroah-Hartman
2014-09-15 19:26 ` [PATCH 3.10 09/71] tpm: missing tpm_chip_put in tpm_get_random() Greg Kroah-Hartman
2014-09-15 19:26 ` [PATCH 3.10 10/71] CAPABILITIES: remove undefined caps from all processes Greg Kroah-Hartman
2014-09-15 19:26 ` [PATCH 3.10 11/71] kernel/smp.c:on_each_cpu_cond(): fix warning in fallback path Greg Kroah-Hartman
2014-09-15 19:26 ` [PATCH 3.10 12/71] mfd: omap-usb-host: Fix improper mask use Greg Kroah-Hartman
2014-09-15 19:26 ` [PATCH 3.10 13/71] regulator: arizona-ldo1: remove bypass functionality Greg Kroah-Hartman
2014-09-15 19:26 ` [PATCH 3.10 14/71] powerpc/mm/numa: Fix break placement Greg Kroah-Hartman
2014-09-15 19:26 ` [PATCH 3.10 15/71] powerpc/mm: Use read barrier when creating real_pte Greg Kroah-Hartman
2014-09-15 19:26 ` [PATCH 3.10 16/71] powerpc/pseries: Failure on removing device node Greg Kroah-Hartman
2014-09-15 19:26 ` [PATCH 3.10 17/71] Drivers: scsi: storvsc: Implement a eh_timed_out handler Greg Kroah-Hartman
2014-09-15 19:26 ` [PATCH 3.10 18/71] drivers: scsi: storvsc: Correctly handle TEST_UNIT_READY failure Greg Kroah-Hartman
2014-09-15 19:26 ` [PATCH 3.10 19/71] MIPS: GIC: Prevent array overrun Greg Kroah-Hartman
2014-09-15 19:26 ` [PATCH 3.10 20/71] MIPS: Prevent user from setting FCSR cause bits Greg Kroah-Hartman
2014-09-15 19:26 ` [PATCH 3.10 21/71] MIPS: tlbex: Fix a missing statement for HUGETLB Greg Kroah-Hartman
2014-09-15 19:26 ` [PATCH 3.10 22/71] MIPS: Remove BUG_ON(!is_fpu_owner()) in do_ade() Greg Kroah-Hartman
2014-09-15 19:26 ` [PATCH 3.10 23/71] MIPS: asm/reg.h: Make 32- and 64-bit definitions available at the same time Greg Kroah-Hartman
2014-09-15 19:26 ` [PATCH 3.10 24/71] MIPS: Cleanup flags in syscall flags handlers Greg Kroah-Hartman
2014-09-15 19:26 ` [PATCH 3.10 25/71] MIPS: asm: thread_info: Add _TIF_SECCOMP flag Greg Kroah-Hartman
2014-09-15 19:26 ` [PATCH 3.10 26/71] MIPS: OCTEON: make get_system_type() thread-safe Greg Kroah-Hartman
2014-09-15 19:26 ` [PATCH 3.10 27/71] MIPS: Fix accessing to per-cpu data when flushing the cache Greg Kroah-Hartman
2014-09-15 19:26 ` [PATCH 3.10 28/71] openrisc: Rework signal handling Greg Kroah-Hartman
2014-09-15 19:26 ` [PATCH 3.10 29/71] ASoC: pcm: fix dpcm_path_put in dpcm runtime update Greg Kroah-Hartman
2014-09-15 19:26 ` [PATCH 3.10 30/71] ASoC: wm_adsp: Add missing MODULE_LICENSE Greg Kroah-Hartman
2014-09-15 19:26 ` [PATCH 3.10 31/71] ASoC: samsung: Correct I2S DAI suspend/resume ops Greg Kroah-Hartman
2014-09-15 19:26 ` [PATCH 3.10 32/71] ASoC: max98090: Fix missing free_irq Greg Kroah-Hartman
2014-09-15 19:26 ` [PATCH 3.10 33/71] ASoC: pxa-ssp: drop SNDRV_PCM_FMTBIT_S24_LE Greg Kroah-Hartman
2014-09-15 19:26 ` [PATCH 3.10 34/71] bfa: Fix undefined bit shift on big-endian architectures with 32-bit DMA address Greg Kroah-Hartman
2014-09-15 19:26 ` [PATCH 3.10 35/71] ACPICA: Utilities: Fix memory leak in acpi_ut_copy_iobject_to_iobject Greg Kroah-Hartman
2014-09-15 19:26 ` [PATCH 3.10 36/71] ACPI: Run fixed event device notifications in process context Greg Kroah-Hartman
2014-09-15 19:26 ` [PATCH 3.10 37/71] ACPI / cpuidle: fix deadlock between cpuidle_lock and cpu_hotplug.lock Greg Kroah-Hartman
2014-09-15 19:26 ` [PATCH 3.10 38/71] ring-buffer: Always reset iterator to reader page Greg Kroah-Hartman
2014-09-15 19:26 ` [PATCH 3.10 39/71] ring-buffer: Up rb_iter_peek() loop count to 3 Greg Kroah-Hartman
2014-09-15 19:26 ` [PATCH 3.10 40/71] mnt: Only change user settable mount flags in remount Greg Kroah-Hartman
2014-09-15 19:26 ` [PATCH 3.10 41/71] mnt: Move the test for MNT_LOCK_READONLY from change_mount_flags into do_remount Greg Kroah-Hartman
2014-09-15 19:26 ` [PATCH 3.10 42/71] mnt: Correct permission checks in do_remount Greg Kroah-Hartman
2014-09-15 19:26 ` [PATCH 3.10 43/71] mnt: Change the default remount atime from relatime to the existing value Greg Kroah-Hartman
2014-09-15 19:26 ` [PATCH 3.10 44/71] mnt: Add tests for unprivileged remount cases that have found to be faulty Greg Kroah-Hartman
2014-09-15 19:26 ` [PATCH 3.10 45/71] Bluetooth: never linger on process exit Greg Kroah-Hartman
2014-09-15 19:26 ` [PATCH 3.10 46/71] Bluetooth: Avoid use of session socket after the session gets freed Greg Kroah-Hartman
2014-09-15 19:26 ` [PATCH 3.10 47/71] md/raid6: avoid data corruption during recovery of double-degraded RAID6 Greg Kroah-Hartman
2014-09-15 19:26 ` [PATCH 3.10 48/71] md/raid10: fix memory leak when reshaping a RAID10 Greg Kroah-Hartman
2014-09-15 19:26 ` [PATCH 3.10 49/71] md/raid10: Fix memory leak when raid10 reshape completes Greg Kroah-Hartman
2014-09-15 19:26 ` [PATCH 3.10 50/71] RDMA/iwcm: Use a default listen backlog if needed Greg Kroah-Hartman
2014-09-15 19:26 ` [PATCH 3.10 51/71] xfs: quotacheck leaves dquot buffers without verifiers Greg Kroah-Hartman
2014-09-15 19:26 ` [PATCH 3.10 52/71] xfs: dont dirty buffers beyond EOF Greg Kroah-Hartman
2014-09-15 19:26 ` [PATCH 3.10 53/71] xfs: dont zero partial page cache pages during O_DIRECT writes Greg Kroah-Hartman
2014-09-15 19:26 ` Greg Kroah-Hartman [this message]
2014-09-15 19:26 ` [PATCH 3.10 55/71] md/raid1,raid10: always abort recover on write error Greg Kroah-Hartman
2014-09-15 19:26 ` [PATCH 3.10 56/71] libceph: set last_piece in ceph_msg_data_pages_cursor_init() correctly Greg Kroah-Hartman
2014-09-15 19:26 ` [PATCH 3.10 57/71] libceph: add process_one_ticket() helper Greg Kroah-Hartman
2014-09-15 19:26 ` [PATCH 3.10 58/71] libceph: do not hard code max auth ticket len Greg Kroah-Hartman
2014-09-15 19:26 ` [PATCH 3.10 59/71] CIFS: Fix STATUS_CANNOT_DELETE error mapping for SMB2 Greg Kroah-Hartman
2014-09-15 19:26 ` [PATCH 3.10 60/71] CIFS: Fix async reading on reconnects Greg Kroah-Hartman
2014-09-15 19:26 ` [PATCH 3.10 61/71] CIFS: Possible null ptr deref in SMB2_tcon Greg Kroah-Hartman
2014-09-15 19:27 ` [PATCH 3.10 62/71] CIFS: Fix wrong directory attributes after rename Greg Kroah-Hartman
2014-09-15 19:27 ` [PATCH 3.10 63/71] CIFS: Fix wrong filename length for SMB2 Greg Kroah-Hartman
2014-09-15 19:27 ` [PATCH 3.10 64/71] CIFS: Fix wrong restart readdir for SMB1 Greg Kroah-Hartman
2014-09-15 19:27 ` [PATCH 3.10 65/71] mtd/ftl: fix the double free of the buffers allocated in build_maps() Greg Kroah-Hartman
2014-09-15 19:27 ` [PATCH 3.10 66/71] mtd: nand: omap: Fix 1-bit Hamming code scheme, omap_calculate_ecc() Greg Kroah-Hartman
2014-09-15 19:27 ` [PATCH 3.10 67/71] blkcg: dont call into policy draining if root_blkg is already gone Greg Kroah-Hartman
2014-09-15 19:27 ` [PATCH 3.10 68/71] IB/srp: Fix deadlock between host removal and multipathd Greg Kroah-Hartman
2014-09-15 19:27 ` [PATCH 3.10 69/71] dcache.c: get rid of pointless macros Greg Kroah-Hartman
2014-09-15 19:27 ` [PATCH 3.10 70/71] vfs: fix bad hashing of dentries Greg Kroah-Hartman
2014-09-15 19:27 ` [PATCH 3.10 71/71] tpm: Provide a generic means to override the chip returned timeouts Greg Kroah-Hartman
2014-09-16  1:53 ` [PATCH 3.10 00/71] 3.10.55-stable review Guenter Roeck
2014-09-16 18:04   ` Greg Kroah-Hartman
2014-09-16 18:42 ` Shuah Khan

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=20140915192640.497378402@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=bfoster@redhat.com \
    --cc=clm@fb.com \
    --cc=david@fromorbit.com \
    --cc=dchinner@redhat.com \
    --cc=hch@lst.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.