From: Kamal Mostafa <kamal@canonical.com>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org,
kernel-team@lists.ubuntu.com
Cc: Christoph Hellwig <hch@lst.de>,
Dave Chinner <david@fromorbit.com>,
Kamal Mostafa <kamal@canonical.com>
Subject: [PATCH 3.8 06/81] xfs: ensure correct timestamp updates from truncate
Date: Tue, 25 Mar 2014 10:15:19 -0700 [thread overview]
Message-ID: <1395767794-5012-7-git-send-email-kamal@canonical.com> (raw)
In-Reply-To: <1395767794-5012-1-git-send-email-kamal@canonical.com>
3.8.13.20 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Christoph Hellwig <hch@infradead.org>
commit fe60a8a0919eeee862054137fed49f00b710d9cd upstream.
The VFS doesn't set the proper ATTR_CTIME and ATTR_MTIME values for
truncate, so filesystems have to manually add them. The
introduction of xfs_setattr_time accidentally broke this special
case an caused a regression in generic/313. Fix this by removing
the local mask variable in xfs_setattr_size so that we only have a
single place to keep the attribute information.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Jie Liu <jeff.liu@oracle.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
[ kamal: backport to 3.8 ]
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
fs/xfs/xfs_iops.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c
index ca9ecaa..152411e 100644
--- a/fs/xfs/xfs_iops.c
+++ b/fs/xfs/xfs_iops.c
@@ -706,7 +706,6 @@ xfs_setattr_size(
{
struct xfs_mount *mp = ip->i_mount;
struct inode *inode = VFS_I(ip);
- int mask = iattr->ia_valid;
xfs_off_t oldsize, newsize;
struct xfs_trans *tp;
int error;
@@ -726,8 +725,8 @@ xfs_setattr_size(
return XFS_ERROR(error);
ASSERT(S_ISREG(ip->i_d.di_mode));
- ASSERT((mask & (ATTR_UID|ATTR_GID|ATTR_ATIME|ATTR_ATIME_SET|
- ATTR_MTIME_SET|ATTR_KILL_PRIV|ATTR_TIMES_SET)) == 0);
+ ASSERT((iattr->ia_valid & (ATTR_UID|ATTR_GID|ATTR_ATIME|ATTR_ATIME_SET|
+ ATTR_MTIME_SET|ATTR_KILL_PRIV|ATTR_TIMES_SET)) == 0);
if (!(flags & XFS_ATTR_NOLOCK)) {
lock_flags |= XFS_IOLOCK_EXCL;
@@ -741,7 +740,7 @@ xfs_setattr_size(
* Short circuit the truncate case for zero length files.
*/
if (newsize == 0 && oldsize == 0 && ip->i_d.di_nextents == 0) {
- if (!(mask & (ATTR_CTIME|ATTR_MTIME)))
+ if (!(iattr->ia_valid & (ATTR_CTIME|ATTR_MTIME)))
goto out_unlock;
/*
@@ -832,10 +831,11 @@ xfs_setattr_size(
* these flags set. For all other operations the VFS set these flags
* explicitly if it wants a timestamp update.
*/
- if (newsize != oldsize && (!(mask & (ATTR_CTIME | ATTR_MTIME)))) {
+ if (newsize != oldsize &&
+ !(iattr->ia_valid & (ATTR_CTIME | ATTR_MTIME))) {
iattr->ia_ctime = iattr->ia_mtime =
current_fs_time(inode->i_sb);
- mask |= ATTR_CTIME | ATTR_MTIME;
+ iattr->ia_valid |= ATTR_CTIME | ATTR_MTIME;
}
/*
@@ -874,15 +874,15 @@ xfs_setattr_size(
/*
* Change file access modes.
*/
- if (mask & ATTR_MODE)
+ if (iattr->ia_valid & ATTR_MODE)
xfs_setattr_mode(tp, ip, iattr);
- if (mask & ATTR_CTIME) {
+ if (iattr->ia_valid & ATTR_CTIME) {
inode->i_ctime = iattr->ia_ctime;
ip->i_d.di_ctime.t_sec = iattr->ia_ctime.tv_sec;
ip->i_d.di_ctime.t_nsec = iattr->ia_ctime.tv_nsec;
}
- if (mask & ATTR_MTIME) {
+ if (iattr->ia_valid & ATTR_MTIME) {
inode->i_mtime = iattr->ia_mtime;
ip->i_d.di_mtime.t_sec = iattr->ia_mtime.tv_sec;
ip->i_d.di_mtime.t_nsec = iattr->ia_mtime.tv_nsec;
--
1.8.3.2
next prev parent reply other threads:[~2014-03-25 17:15 UTC|newest]
Thread overview: 84+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-25 17:15 [3.8.y.z extended stable] Linux 3.8.13.20 stable review Kamal Mostafa
2014-03-25 17:15 ` [PATCH 3.8 01/81] kernel.h: define u8, s8, u32, etc. limits Kamal Mostafa
2014-03-25 17:15 ` [PATCH 3.8 02/81] kernel.h: undef clashing U64_MAX, U32_MAX size limits Kamal Mostafa
2014-03-25 17:15 ` [PATCH 3.8 03/81] ata: enable quirk from jmicron JMB350 for JMB394 Kamal Mostafa
2014-03-25 17:15 ` [PATCH 3.8 04/81] sata_sil: apply MOD15WRITE quirk to TOSHIBA MK2561GSYN Kamal Mostafa
2014-03-25 17:15 ` [PATCH 3.8 05/81] cgroup: fix locking in cgroup_cfts_commit() Kamal Mostafa
2014-03-25 17:15 ` Kamal Mostafa [this message]
2014-03-25 17:15 ` [PATCH 3.8 07/81] ARM: 7953/1: mm: ensure TLB invalidation is complete before enabling MMU Kamal Mostafa
2014-03-25 17:15 ` [PATCH 3.8 08/81] ARM: 7955/1: spinlock: ensure we have a compiler barrier before sev Kamal Mostafa
2014-03-25 17:15 ` [PATCH 3.8 09/81] ASoC: da9055: Fix device registration of PMIC and CODEC devices Kamal Mostafa
2014-03-25 17:15 ` [PATCH 3.8 10/81] ARM: dma-mapping: fix GFP_ATOMIC macro usage Kamal Mostafa
2014-03-25 17:15 ` [PATCH 3.8 11/81] x86: " Kamal Mostafa
2014-03-25 17:15 ` [PATCH 3.8 12/81] SUNRPC: Fix races in xs_nospace() Kamal Mostafa
2014-03-25 17:15 ` [PATCH 3.8 13/81] drm/i915: Add intel_ring_cachline_align() Kamal Mostafa
2014-03-25 17:15 ` [PATCH 3.8 14/81] drm/i915: Prevent MI_DISPLAY_FLIP straddling two cachelines on IVB Kamal Mostafa
2014-03-25 17:15 ` [PATCH 3.8 15/81] can: kvaser_usb: check number of channels returned by HW Kamal Mostafa
2014-03-25 17:15 ` [PATCH 3.8 16/81] ext4: don't try to modify s_flags if the the file system is read-only Kamal Mostafa
2014-03-25 17:15 ` [PATCH 3.8 17/81] drm/vmwgfx: Fix possible integer overflow Kamal Mostafa
2014-03-25 17:15 ` [PATCH 3.8 18/81] drm/i915/dp: increase native aux defer retry timeout Kamal Mostafa
2014-03-25 17:15 ` [PATCH 3.8 19/81] drm/i915/dp: add native aux defer retry limit Kamal Mostafa
2014-03-25 17:15 ` [PATCH 3.8 20/81] rtlwifi: rtl8192ce: Fix too long disable of IRQs Kamal Mostafa
2014-03-25 17:15 ` [PATCH 3.8 21/81] rtlwifi: Fix incorrect return from rtl_ps_enable_nic() Kamal Mostafa
2014-03-25 17:15 ` [PATCH 3.8 22/81] rtl8187: fix regression on MIPS without coherent DMA Kamal Mostafa
2014-03-25 17:15 ` [PATCH 3.8 23/81] PCI: Enable INTx if BIOS left them disabled Kamal Mostafa
2014-03-25 18:34 ` Bjorn Helgaas
2014-03-25 18:52 ` Kamal Mostafa
2014-03-25 17:15 ` [PATCH 3.8 24/81] cifs: ensure that uncached writes handle unmapped areas correctly Kamal Mostafa
2014-03-25 17:15 ` [PATCH 3.8 25/81] CIFS: Fix too big maxBuf size for SMB3 mounts Kamal Mostafa
2014-03-25 17:15 ` [PATCH 3.8 26/81] ext4: fix online resize with very large inode tables Kamal Mostafa
2014-03-25 17:15 ` [PATCH 3.8 27/81] ext4: fix online resize with a non-standard blocks per group setting Kamal Mostafa
2014-03-25 17:15 ` [PATCH 3.8 28/81] ext4: don't leave i_crtime.tv_sec uninitialized Kamal Mostafa
2014-03-25 17:15 ` [PATCH 3.8 29/81] ALSA: usb-audio: Add a quirk for Plantronics Gamecom 780 Kamal Mostafa
2014-03-25 17:15 ` [PATCH 3.8 30/81] ALSA: usb-audio: work around KEF X300A firmware bug Kamal Mostafa
2014-03-25 17:15 ` [PATCH 3.8 31/81] avr32: fix missing module.h causing build failure in mimc200/fram.c Kamal Mostafa
2014-03-25 17:15 ` [PATCH 3.8 32/81] avr32: Makefile: add '-D__linux__' flag for gcc-4.4.7 use Kamal Mostafa
2014-03-25 17:15 ` [PATCH 3.8 33/81] ARM: 7957/1: add DSB after icache flush in __flush_icache_all() Kamal Mostafa
2014-03-25 17:15 ` [PATCH 3.8 34/81] ACPI / PCI: Fix memory leak in acpi_pci_irq_enable() Kamal Mostafa
2014-03-25 17:15 ` [PATCH 3.8 35/81] ahci: disable NCQ on Samsung pci-e SSDs on macbooks Kamal Mostafa
2014-03-25 17:15 ` [PATCH 3.8 36/81] usb: gadget: bcm63xx_udc: fix build failure on DMA channel code Kamal Mostafa
2014-03-25 17:15 ` [PATCH 3.8 37/81] USB: EHCI: add delay during suspend to prevent erroneous wakeups Kamal Mostafa
2014-03-25 17:15 ` [PATCH 3.8 38/81] USB: serial: option: blacklist interface 4 for Cinterion PHS8 and PXS8 Kamal Mostafa
2014-03-25 17:15 ` [PATCH 3.8 39/81] workqueue: ensure @task is valid across kthread_stop() Kamal Mostafa
2014-03-25 17:15 ` [PATCH 3.8 40/81] cgroup: update cgroup_enable_task_cg_lists() to grab siglock Kamal Mostafa
2014-03-25 17:15 ` [PATCH 3.8 41/81] hwmon: (max1668) Fix writing the minimum temperature Kamal Mostafa
2014-03-25 17:15 ` [PATCH 3.8 42/81] cpufreq: powernow-k8: Initialize per-cpu data-structures properly Kamal Mostafa
2014-03-25 17:15 ` [PATCH 3.8 43/81] ACPI / video: Filter the _BCL table for duplicate brightness values Kamal Mostafa
2014-03-25 17:15 ` [PATCH 3.8 44/81] ARM: 7668/1: fix memset-related crashes caused by recent GCC (4.7.2) optimizations Kamal Mostafa
2014-03-25 17:15 ` [PATCH 3.8 45/81] ARM: 7670/1: fix the memset fix Kamal Mostafa
2014-03-25 17:15 ` [PATCH 3.8 46/81] xtensa: move spill_registers to traps.h Kamal Mostafa
2014-03-25 17:16 ` [PATCH 3.8 47/81] xtensa: clean up stpill_registers Kamal Mostafa
2014-03-25 17:16 ` [PATCH 3.8 48/81] xtensa: introduce spill_registers_kernel macro Kamal Mostafa
2014-03-25 17:16 ` [PATCH 3.8 49/81] dma: ste_dma40: don't dereference free:d descriptor Kamal Mostafa
2014-03-25 17:16 ` [PATCH 3.8 50/81] ARM64: unwind: Fix PC calculation Kamal Mostafa
2014-03-25 17:16 ` [PATCH 3.8 51/81] dm thin: avoid metadata commit if a pool's thin devices haven't changed Kamal Mostafa
2014-03-25 17:16 ` [PATCH 3.8 52/81] ASoC: sta32x: Fix array access overflow Kamal Mostafa
2014-03-25 17:16 ` [PATCH 3.8 53/81] ASoC: wm8770: Fix wrong number of enum items Kamal Mostafa
2014-03-25 17:16 ` [PATCH 3.8 54/81] Input - arizona-haptics: Fix double lock of dapm_mutex Kamal Mostafa
2014-03-25 17:16 ` [PATCH 3.8 55/81] ASoC: dapm: Add locking to snd_soc_dapm_xxxx_pin functions Kamal Mostafa
2014-03-25 17:16 ` [PATCH 3.8 56/81] SELinux: bigendian problems with filename trans rules Kamal Mostafa
2014-03-25 17:16 ` [PATCH 3.8 57/81] quota: Fix race between dqput() and dquot_scan_active() Kamal Mostafa
2014-03-25 17:16 ` [PATCH 3.8 58/81] ASoC: sta32x: Fix cache sync Kamal Mostafa
2014-03-25 17:16 ` [PATCH 3.8 59/81] dm thin: fix the error path for the thin device constructor Kamal Mostafa
2014-03-25 17:16 ` [PATCH 3.8 60/81] qla2xxx: Fix kernel panic on selective retransmission request Kamal Mostafa
2014-03-25 17:16 ` [PATCH 3.8 61/81] ASoC: wm8958-dsp: Fix firmware block loading Kamal Mostafa
2014-03-25 17:16 ` [PATCH 3.8 62/81] i7core_edac: Fix PCI device reference count Kamal Mostafa
2014-03-25 17:16 ` [PATCH 3.8 63/81] i7300_edac: Fix " Kamal Mostafa
2014-03-25 17:16 ` [PATCH 3.8 64/81] ipc,mqueue: remove limits for the amount of system-wide queues Kamal Mostafa
2014-03-25 17:16 ` [PATCH 3.8 65/81] PM / hibernate: Fix restore hang in freeze_processes() Kamal Mostafa
2014-03-25 17:16 ` [PATCH 3.8 66/81] ASoC: da732x: Mark DC offset control registers volatile Kamal Mostafa
2014-03-25 17:16 ` [PATCH 3.8 67/81] dm mpath: fix stalls when handling invalid ioctls Kamal Mostafa
2014-03-25 17:16 ` [PATCH 3.8 68/81] ACPI / processor: Rework processor throttling with work_on_cpu() Kamal Mostafa
2014-03-25 17:16 ` [PATCH 3.8 69/81] USB: serial: ftdi_sio: add id for Z3X Box device Kamal Mostafa
2014-03-25 17:16 ` [PATCH 3.8 70/81] USB: ftdi_sio: add Cressi Leonardo PID Kamal Mostafa
2014-03-25 17:16 ` [PATCH 3.8 71/81] usb: ehci: fix deadlock when threadirqs option is used Kamal Mostafa
2014-03-25 17:16 ` [PATCH 3.8 72/81] ASoC: sta32x: Fix wrong enum for limiter2 release rate Kamal Mostafa
2014-03-25 17:16 ` [PATCH 3.8 73/81] perf/x86: Fix event scheduling Kamal Mostafa
2014-03-25 17:16 ` [PATCH 3.8 74/81] perf: Fix hotplug splat Kamal Mostafa
2014-03-25 17:16 ` [PATCH 3.8 75/81] kvm: x86: fix emulator buffer overflow (CVE-2014-0049) Kamal Mostafa
2014-03-25 17:16 ` [PATCH 3.8 76/81] drm/radeon: print the supported atpx function mask Kamal Mostafa
2014-03-25 17:16 ` [PATCH 3.8 77/81] drm/radeon: fix missing bo reservation Kamal Mostafa
2014-03-25 17:16 ` [PATCH 3.8 78/81] drm/radeon: disable pll sharing for DP on DCE4.1 Kamal Mostafa
2014-03-25 17:16 ` [PATCH 3.8 79/81] powerpc/le: Ensure that the 'stop-self' RTAS token is handled correctly Kamal Mostafa
2014-03-25 17:16 ` [PATCH 3.8 80/81] powerpc/crashdump : Fix page frame number check in copy_oldmem_page Kamal Mostafa
2014-03-25 17:16 ` [PATCH 3.8 81/81] arm64: mm: Add double logical invert to pte accessors Kamal Mostafa
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=1395767794-5012-7-git-send-email-kamal@canonical.com \
--to=kamal@canonical.com \
--cc=david@fromorbit.com \
--cc=hch@lst.de \
--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