linux-kernel.vger.kernel.org archive mirror
 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, Hulk Robot <hulkci@huawei.com>,
	Zhang Xiaoxu <zhangxiaoxu5@huawei.com>,
	Steve French <stfrench@microsoft.com>,
	Sasha Levin <sashal@kernel.org>
Subject: [PATCH 4.19 18/58] cifs: update ctime and mtime during truncate
Date: Tue, 14 Jul 2020 20:43:51 +0200	[thread overview]
Message-ID: <20200714184057.061438764@linuxfoundation.org> (raw)
In-Reply-To: <20200714184056.149119318@linuxfoundation.org>

From: Zhang Xiaoxu <zhangxiaoxu5@huawei.com>

[ Upstream commit 5618303d8516f8ac5ecfe53ee8e8bc9a40eaf066 ]

As the man description of the truncate, if the size changed,
then the st_ctime and st_mtime fields should be updated. But
in cifs, we doesn't do it.

It lead the xfstests generic/313 failed.

So, add the ATTR_MTIME|ATTR_CTIME flags on attrs when change
the file size

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Zhang Xiaoxu <zhangxiaoxu5@huawei.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 fs/cifs/inode.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index 44fb9ae6d1055..1d951936b0923 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -2225,6 +2225,15 @@ set_size_out:
 	if (rc == 0) {
 		cifsInode->server_eof = attrs->ia_size;
 		cifs_setsize(inode, attrs->ia_size);
+
+		/*
+		 * The man page of truncate says if the size changed,
+		 * then the st_ctime and st_mtime fields for the file
+		 * are updated.
+		 */
+		attrs->ia_ctime = attrs->ia_mtime = current_time(inode);
+		attrs->ia_valid |= ATTR_CTIME | ATTR_MTIME;
+
 		cifs_truncate_page(inode->i_mapping, inode->i_size);
 	}
 
-- 
2.25.1




  parent reply	other threads:[~2020-07-14 18:46 UTC|newest]

Thread overview: 66+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-14 18:43 [PATCH 4.19 00/58] 4.19.133-rc1 review Greg Kroah-Hartman
2020-07-14 18:43 ` [PATCH 4.19 01/58] KVM: s390: reduce number of IO pins to 1 Greg Kroah-Hartman
2020-07-14 18:43 ` [PATCH 4.19 02/58] spi: spi-fsl-dspi: Adding shutdown hook Greg Kroah-Hartman
2020-07-14 18:43 ` [PATCH 4.19 03/58] spi: spi-fsl-dspi: Fix lockup if device is removed during SPI transfer Greg Kroah-Hartman
2020-07-14 18:43 ` [PATCH 4.19 04/58] spi: spi-fsl-dspi: use IRQF_SHARED mode to request IRQ Greg Kroah-Hartman
2020-07-14 18:43 ` [PATCH 4.19 05/58] spi: spi-fsl-dspi: Fix external abort on interrupt in resume or exit paths Greg Kroah-Hartman
2020-07-14 18:43 ` [PATCH 4.19 06/58] regmap: fix alignment issue Greg Kroah-Hartman
2020-07-14 18:43 ` [PATCH 4.19 07/58] ARM: dts: omap4-droid4: Fix spi configuration and increase rate Greg Kroah-Hartman
2020-07-14 18:43 ` [PATCH 4.19 08/58] drm/tegra: hub: Do not enable orphaned window group Greg Kroah-Hartman
2020-07-14 18:43 ` [PATCH 4.19 09/58] gpu: host1x: Detach driver on unregister Greg Kroah-Hartman
2020-07-14 18:43 ` [PATCH 4.19 10/58] spi: spidev: fix a race between spidev_release and spidev_remove Greg Kroah-Hartman
2020-07-14 18:43 ` [PATCH 4.19 11/58] spi: spidev: fix a potential use-after-free in spidev_release() Greg Kroah-Hartman
2020-07-14 18:43 ` [PATCH 4.19 12/58] ixgbe: protect ring accesses with READ- and WRITE_ONCE Greg Kroah-Hartman
2020-07-14 18:43 ` [PATCH 4.19 13/58] i40e: " Greg Kroah-Hartman
2020-07-14 18:43 ` [PATCH 4.19 14/58] drm: panel-orientation-quirks: Add quirk for Asus T101HA panel Greg Kroah-Hartman
2020-07-14 18:43 ` [PATCH 4.19 15/58] drm: panel-orientation-quirks: Use generic orientation-data for Acer S1003 Greg Kroah-Hartman
2020-07-15 14:45   ` Pavel Machek
2020-07-14 18:43 ` [PATCH 4.19 16/58] s390/kasan: fix early pgm check handler execution Greg Kroah-Hartman
2020-07-14 18:43 ` [PATCH 4.19 17/58] drm/sun4i: mixer: Call of_dma_configure if theres an IOMMU Greg Kroah-Hartman
2020-07-14 18:43 ` Greg Kroah-Hartman [this message]
2020-07-14 18:43 ` [PATCH 4.19 19/58] ARM: imx6: add missing put_device() call in imx6q_suspend_init() Greg Kroah-Hartman
2020-07-14 18:43 ` [PATCH 4.19 20/58] scsi: mptscsih: Fix read sense data size Greg Kroah-Hartman
2020-07-14 18:43 ` [PATCH 4.19 21/58] usb: dwc3: pci: Fix reference count leak in dwc3_pci_resume_work Greg Kroah-Hartman
2020-07-14 18:43 ` [PATCH 4.19 22/58] block: release bip in a right way in error path Greg Kroah-Hartman
2020-07-14 18:43 ` [PATCH 4.19 23/58] nvme-rdma: assign completion vector correctly Greg Kroah-Hartman
2020-07-14 18:43 ` [PATCH 4.19 24/58] x86/entry: Increase entry_stack size to a full page Greg Kroah-Hartman
2020-07-14 18:43 ` [PATCH 4.19 25/58] net: qrtr: Fix an out of bounds read qrtr_endpoint_post() Greg Kroah-Hartman
2020-07-14 18:43 ` [PATCH 4.19 26/58] drm/mediatek: Check plane visibility in atomic_update Greg Kroah-Hartman
2020-07-14 18:44 ` [PATCH 4.19 27/58] net: cxgb4: fix return error value in t4_prep_fw Greg Kroah-Hartman
2020-07-14 18:44 ` [PATCH 4.19 28/58] smsc95xx: check return value of smsc95xx_reset Greg Kroah-Hartman
2020-07-14 18:44 ` [PATCH 4.19 29/58] smsc95xx: avoid memory leak in smsc95xx_bind Greg Kroah-Hartman
2020-07-14 18:44 ` [PATCH 4.19 30/58] net: hns3: fix use-after-free when doing self test Greg Kroah-Hartman
2020-07-14 18:44 ` [PATCH 4.19 31/58] ALSA: compress: fix partial_drain completion state Greg Kroah-Hartman
2020-07-14 18:44 ` [PATCH 4.19 32/58] arm64: kgdb: Fix single-step exception handling oops Greg Kroah-Hartman
2020-07-14 18:44 ` [PATCH 4.19 33/58] nbd: Fix memory leak in nbd_add_socket Greg Kroah-Hartman
2020-07-14 18:44 ` [PATCH 4.19 34/58] cxgb4: fix all-mask IP address comparison Greg Kroah-Hartman
2020-07-14 18:44 ` [PATCH 4.19 35/58] bnxt_en: fix NULL dereference in case SR-IOV configuration fails Greg Kroah-Hartman
2020-07-14 18:44 ` [PATCH 4.19 36/58] net: macb: mark device wake capable when "magic-packet" property present Greg Kroah-Hartman
2020-07-14 18:44 ` [PATCH 4.19 37/58] mlxsw: spectrum_router: Remove inappropriate usage of WARN_ON() Greg Kroah-Hartman
2020-07-14 18:44 ` [PATCH 4.19 38/58] ALSA: opl3: fix infoleak in opl3 Greg Kroah-Hartman
2020-07-14 18:44 ` [PATCH 4.19 39/58] ALSA: hda - let hs_mic be picked ahead of hp_mic Greg Kroah-Hartman
2020-07-14 18:44 ` [PATCH 4.19 40/58] ALSA: usb-audio: add quirk for MacroSilicon MS2109 Greg Kroah-Hartman
2020-07-14 18:44 ` [PATCH 4.19 41/58] KVM: arm64: Fix definition of PAGE_HYP_DEVICE Greg Kroah-Hartman
2020-07-14 18:44 ` [PATCH 4.19 42/58] KVM: arm64: Stop clobbering x0 for HVC_SOFT_RESTART Greg Kroah-Hartman
2020-07-14 18:44 ` [PATCH 4.19 43/58] KVM: x86: bit 8 of non-leaf PDPEs is not reserved Greg Kroah-Hartman
2020-07-14 18:44 ` [PATCH 4.19 44/58] KVM: x86: Inject #GP if guest attempts to toggle CR4.LA57 in 64-bit mode Greg Kroah-Hartman
2020-07-14 18:44 ` [PATCH 4.19 45/58] KVM: x86: Mark CR4.TSD as being possibly owned by the guest Greg Kroah-Hartman
2020-07-14 18:44 ` [PATCH 4.19 46/58] kallsyms: Refactor kallsyms_show_value() to take cred Greg Kroah-Hartman
2020-07-14 18:44 ` [PATCH 4.19 47/58] kernel: module: Use struct_size() helper Greg Kroah-Hartman
2020-07-14 18:44 ` [PATCH 4.19 48/58] module: Refactor section attr into bin attribute Greg Kroah-Hartman
2020-07-14 18:44 ` [PATCH 4.19 49/58] module: Do not expose section addresses to non-CAP_SYSLOG Greg Kroah-Hartman
2020-07-14 18:44 ` [PATCH 4.19 50/58] kprobes: Do not expose probe " Greg Kroah-Hartman
2020-07-14 18:44 ` [PATCH 4.19 51/58] bpf: Check correct cred for CAP_SYSLOG in bpf_dump_raw_ok() Greg Kroah-Hartman
2020-07-14 18:44 ` [PATCH 4.19 52/58] Revert "ath9k: Fix general protection fault in ath9k_hif_usb_rx_cb" Greg Kroah-Hartman
2020-07-14 18:44 ` [PATCH 4.19 53/58] btrfs: fix fatal extent_buffer readahead vs releasepage race Greg Kroah-Hartman
2020-07-14 18:44 ` [PATCH 4.19 54/58] drm/radeon: fix double free Greg Kroah-Hartman
2020-07-14 18:44 ` [PATCH 4.19 55/58] dm: use noio when sending kobject event Greg Kroah-Hartman
2020-07-14 18:44 ` [PATCH 4.19 56/58] ARC: entry: fix potential EFA clobber when TIF_SYSCALL_TRACE Greg Kroah-Hartman
2020-07-14 18:44 ` [PATCH 4.19 57/58] ARC: elf: use right ELF_ARCH Greg Kroah-Hartman
2020-07-14 18:44 ` [PATCH 4.19 58/58] s390/mm: fix huge pte soft dirty copying Greg Kroah-Hartman
2020-07-15  9:41 ` [PATCH 4.19 00/58] 4.19.133-rc1 review Naresh Kamboju
2020-07-15 12:39   ` Greg Kroah-Hartman
2020-07-15 10:49 ` Jon Hunter
2020-07-15 15:21 ` Shuah Khan
2020-07-15 16:42 ` Guenter Roeck
2020-07-16  7:45 ` Pavel Machek

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=20200714184057.061438764@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=hulkci@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sashal@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=stfrench@microsoft.com \
    --cc=zhangxiaoxu5@huawei.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).