mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Luis Henriques <luis.henriques@canonical.com>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org,
	kernel-team@lists.ubuntu.com
Cc: Jan Kara <jack@suse.cz>, Luis Henriques <luis.henriques@canonical.com>
Subject: [PATCH 3.5 02/88] writeback: Fix data corruption on NFS
Date: Fri,  7 Feb 2014 11:21:59 +0000	[thread overview]
Message-ID: <1391772205-22239-3-git-send-email-luis.henriques@canonical.com> (raw)
In-Reply-To: <1391772205-22239-1-git-send-email-luis.henriques@canonical.com>

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

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

From: Jan Kara <jack@suse.cz>

commit f9b0e058cbd04ada76b13afffa7e1df830543c24 upstream.

Commit 4f8ad655dbc8 "writeback: Refactor writeback_single_inode()" added
a condition to skip clean inode. However this is wrong in WB_SYNC_ALL
mode because there we also want to wait for outstanding writeback on
possibly clean inode. This was causing occasional data corruption issues
on NFS because it uses sync_inode() to make sure all outstanding writes
are flushed to the server before truncating the inode and with
sync_inode() returning prematurely file was sometimes extended back
by an outstanding write after it was truncated.

So modify the test to also check for pages under writeback in
WB_SYNC_ALL mode.

Fixes: 4f8ad655dbc82cf05d2edc11e66b78a42d38bf93
Reported-and-tested-by: Dan Duval <dan.duval@oracle.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/fs-writeback.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
index bf7e15d..554aeb7 100644
--- a/fs/fs-writeback.c
+++ b/fs/fs-writeback.c
@@ -523,13 +523,16 @@ writeback_single_inode(struct inode *inode, struct bdi_writeback *wb,
 	}
 	WARN_ON(inode->i_state & I_SYNC);
 	/*
-	 * Skip inode if it is clean. We don't want to mess with writeback
-	 * lists in this function since flusher thread may be doing for example
-	 * sync in parallel and if we move the inode, it could get skipped. So
-	 * here we make sure inode is on some writeback list and leave it there
-	 * unless we have completely cleaned the inode.
+	 * Skip inode if it is clean and we have no outstanding writeback in
+	 * WB_SYNC_ALL mode. We don't want to mess with writeback lists in this
+	 * function since flusher thread may be doing for example sync in
+	 * parallel and if we move the inode, it could get skipped. So here we
+	 * make sure inode is on some writeback list and leave it there unless
+	 * we have completely cleaned the inode.
 	 */
-	if (!(inode->i_state & I_DIRTY))
+	if (!(inode->i_state & I_DIRTY) &&
+	    (wbc->sync_mode != WB_SYNC_ALL ||
+	     !mapping_tagged(inode->i_mapping, PAGECACHE_TAG_WRITEBACK)))
 		goto out;
 	inode->i_state |= I_SYNC;
 	spin_unlock(&inode->i_lock);
-- 
1.8.3.2


  parent reply	other threads:[~2014-02-07 11:24 UTC|newest]

Thread overview: 91+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-07 11:21 [3.5.y.z extended stable] Linux 3.5.7.30 stable review Luis Henriques
2014-02-07 11:21 ` [PATCH 3.5 01/88] ext4: fix deadlock when writing in ENOSPC conditions Luis Henriques
2014-02-07 11:21 ` Luis Henriques [this message]
2014-02-07 11:22 ` [PATCH 3.5 03/88] md/raid5: Fix possible confusion when multiple write errors occur Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 04/88] md/raid10: fix two bugs in handling of known-bad-blocks Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 05/88] md/raid10: fix bug when raid10 recovery fails to recover a block Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 06/88] hwmon: (coretemp) Fix truncated name of alarm attributes Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 07/88] nilfs2: fix segctor bug that causes file system corruption Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 08/88] mm: fix crash when using XFS on loopback Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 09/88] vfs: In d_path don't call d_dname on a mount point Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 10/88] perf/x86/amd/ibs: Fix waking up from S3 for AMD family 10h Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 11/88] staging: comedi: 8255_pci: fix for newer PCI-DIO48H Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 12/88] mm/memory-failure.c: recheck PageHuge() after hugetlb page migrate successfully Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 13/88] serial: amba-pl011: use port lock to guard control register access Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 14/88] rtlwifi: rtl8192cu: Fix W=1 build warning Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 15/88] rtlwifi: rtl8192cu: Add new firmware Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 16/88] rtlwifi: Set the link state Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 17/88] rtlwifi: rtl8192c: Add new definitions in the dm_common header Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 18/88] rtlwifi: rtl8192cu: Fix some code in RF handling Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 19/88] NFSv4: OPEN must handle the NFS4ERR_IO return code correctly Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 20/88] parport: parport_pc: remove double PCI ID for NetMos Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 21/88] staging: vt6656: [BUG] BBvUpdatePreEDThreshold Always set sensitivity on bScanning Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 22/88] [SCSI] bfa: Chinook quad port 16G FC HBA claim issue Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 23/88] usb: option: add new zte 3g modem pids to option driver Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 24/88] [media] dib8000: make 32 bits read atomic Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 25/88] serial: add support for 200 v3 series Titan card Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 26/88] usb: xhci: Check for XHCI_PLAT in xhci_cleanup_msix() Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 27/88] x86/efi: Fix off-by-one bug in EFI Boot Services reservation Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 28/88] perf kvm: Fix kvm report without guestmount Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 29/88] mtd: mxc_nand: remove duplicated ecc_stats counting Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 30/88] xen/pvhvm: If xen_platform_pci=0 is set don't blow up (v4) Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 31/88] USB: serial: add support for iBall 3.5G connect usb modem Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 32/88] USB: Nokia 502 is an unusual device Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 33/88] USB: cypress_m8: fix ring-indicator detection and reporting Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 34/88] ALSA: rme9652: fix a missing comma in channel_map_9636_ds[] Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 35/88] sunrpc: Fix infinite loop in RPC state machine Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 36/88] spidev: fix hang when transfer_one_message fails Luis Henriques
2014-02-07 18:17   ` Daniel Santos
2014-02-07 18:37     ` Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 37/88] dm thin: initialize dm_thin_new_mapping returned by get_next_mapping Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 38/88] SELinux: Fix memory leak upon loading policy Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 39/88] drm/radeon: warn users when hw_i2c is enabled (v2) Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 40/88] USB: ftdi_sio: added CS5 quirk for broken smartcard readers Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 41/88] serial: 8250: enable UART_BUG_NOMSR for Tegra Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 42/88] dm: wait until embedded kobject is released before destroying a device Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 43/88] dm space map common: make sure new space is used during extend Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 44/88] ASoC: adau1701: Fix ADAU1701_SEROCTL_WORD_LEN_16 constant Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 45/88] radeon/pm: Guard access to rdev->pm.power_state array Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 46/88] drm/radeon: skip colorbuffer checking if COLOR_INFO.FORMAT is set to INVALID Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 47/88] staging: r8712u: Set device type to wlan Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 48/88] ALSA: Enable CONFIG_ZONE_DMA for smaller PCI DMA masks Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 49/88] mmc: atmel-mci: fix timeout errors in SDIO mode when using DMA Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 50/88] rtlwifi: rtl8192cu: Add new device ID Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 51/88] mwifiex: add missing endian conversion for fw_tsf Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 52/88] b43: Fix lockdep splat Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 53/88] b43: Fix unload oops if firmware is not available Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 54/88] b43legacy: " Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 55/88] nfs4.1: properly handle ENOTSUP in SECINFO_NO_NAME Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 56/88] audit: correct a type mismatch in audit_syscall_exit() Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 57/88] md/raid5: fix long-standing problem with bitmap handling on write failure Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 58/88] drm/radeon: set the full cache bit for fences on r7xx+ Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 59/88] hp_accel: Add a new PnP ID HPQ6007 for new HP laptops Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 60/88] intel-iommu: fix off-by-one in pagetable freeing Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 61/88] fuse: fix pipe_buf_operations Luis Henriques
2014-02-07 11:22 ` [PATCH 3.5 62/88] drm/cirrus: correct register values for 16bpp Luis Henriques
2014-02-07 11:23 ` [PATCH 3.5 63/88] IB/qib: Fix QP check when looping back to/from QP1 Luis Henriques
2014-02-07 11:23 ` [PATCH 3.5 64/88] ore: Fix wrong math in allocation of per device BIO Luis Henriques
2014-02-07 11:23 ` [PATCH 3.5 65/88] b43: fix the wrong assignment of status.freq in b43_rx() Luis Henriques
2014-02-07 11:23 ` [PATCH 3.5 66/88] KVM: PPC: e500: Fix bad address type in deliver_tlb_misss() Luis Henriques
2014-02-07 11:23 ` [PATCH 3.5 67/88] Btrfs: handle EAGAIN case properly in btrfs_drop_snapshot() Luis Henriques
2014-02-07 11:23 ` [PATCH 3.5 68/88] ACPI / init: Flag use of ACPI and ACPI idioms for power supplies to regulator API Luis Henriques
2014-02-07 11:23 ` [PATCH 3.5 69/88] powerpc: Make sure "cache" directory is removed when offlining cpu Luis Henriques
2014-02-07 11:23 ` [PATCH 3.5 70/88] drm/radeon/DCE4+: clear bios scratch dpms bit (v2) Luis Henriques
2014-02-07 11:23 ` [PATCH 3.5 71/88] mm/page-writeback.c: fix dirty_balance_reserve subtraction from dirtyable memory Luis Henriques
2014-02-07 11:23 ` [PATCH 3.5 72/88] target/iscsi: Fix network portal creation race Luis Henriques
2014-02-07 11:23 ` [PATCH 3.5 73/88] mm, oom: base root bonus on current usage Luis Henriques
2014-02-07 11:23 ` [PATCH 3.5 74/88] x86, x32: Correct invalid use of user timespec in the kernel Luis Henriques
2014-02-07 11:23 ` [PATCH 3.5 75/88] alpha: fix broken network checksum Luis Henriques
2014-02-07 11:23 ` [PATCH 3.5 76/88] ARM: at91: smc: bug fix in sam9_smc_cs_read() Luis Henriques
2014-02-07 11:23 ` [PATCH 3.5 77/88] KVM: s390: fix diagnose code extraction Luis Henriques
2014-02-07 11:23 ` [PATCH 3.5 78/88] e752x_edac: Fix pci_dev usage count Luis Henriques
2014-02-07 11:23 ` [PATCH 3.5 79/88] lib/decompressors: fix "no limit" output buffer length Luis Henriques
2014-02-07 11:23 ` [PATCH 3.5 80/88] bnx2x: fix DMA unmapping of TSO split BDs Luis Henriques
2014-02-07 11:23 ` [PATCH 3.5 81/88] inet_diag: fix inet_diag_dump_icsk() timewait socket state logic Luis Henriques
2014-02-07 11:23 ` [PATCH 3.5 82/88] net: avoid reference counter overflows on fib_rules in multicast forwarding Luis Henriques
2014-02-07 11:23 ` [PATCH 3.5 83/88] net,via-rhine: Fix tx_timeout handling Luis Henriques
2014-02-07 11:23 ` [PATCH 3.5 84/88] mm: hugetlbfs: fix hugetlbfs optimization Luis Henriques
2014-02-07 11:23 ` [PATCH 3.5 85/88] usb: core: get config and string descriptors for unauthorized devices Luis Henriques
2014-02-07 11:23 ` [PATCH 3.5 86/88] tty/serial: at91: Handle shutdown more safely Luis Henriques
2014-02-07 11:23 ` [PATCH 3.5 87/88] slub: Fix calculation of cpu slabs Luis Henriques
2014-02-07 11:23 ` [PATCH 3.5 88/88] turbostat: Use GCC's CPUID functions to support PIC Luis Henriques

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=1391772205-22239-3-git-send-email-luis.henriques@canonical.com \
    --to=luis.henriques@canonical.com \
    --cc=jack@suse.cz \
    --cc=kernel-team@lists.ubuntu.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®