Skip to content

cifs: mtime lost when copying to a share #7207

@antoileb

Description

@antoileb

Describe the bug

When copying files to a cifs share with -p, the mtime attributes are lost. I'm fairly confident other attributes are also lost but I've only looked out for mtime.
This issue occurs since kernel version 6.12.62+rpt-rpi-v8 (on Raspberry Pi OS Trixie) and downgrading to 6.12.47+rpt-rpi-v8 fixes the issue.

Steps to reproduce the behaviour

  • mount a CIFS share mount -t cifs //<host>/home /mnt/nas
  • copy files using cp -p to this network share cp -p /home/hiver/test/file.pdf /mnt/nas/
hiver@rpi:~/test $ stat -c "%y" file.pdf
2026-01-25 15:11:40.580874684 +0100
hiver@rpi:~/test $ cp -p file.pdf /mnt/nas
hiver@rpi:~/test $ stat -c "%y" /mnt/nas/file.pdf
2026-01-25 15:12:46.343470200 +0100 # the mtime has changed

The same under 6.12.47:

hiver@rpi:~ $ stat -c "%y" /mnt/nas/file.pdf
2026-01-25 15:11:40.580874600 +0100 # the same as the source file

Device (s)

Raspberry Pi 3 Mod. B+

System

# cat /etc/rpi-issue
Raspberry Pi reference 2024-03-15
Generated using pi-gen, https://github.com/RPi-Distro/pi-gen, f19ee211ddafcae3008
27f953d143de92a5c6624, stage2

# vcgencmd version
Aug 20 2025 17:04:09
Copyright (c) 2012 Broadcom
version cd866525580337c0aee4b25880e1f5f9f674fb24 (clean) (release) (start)

# uname -a
Linux rpi 6.12.62+rpt-rpi-v8 #1 SMP PREEMPT Debian 1:6.12.62-1+rpt1 (2025-12-18) aarch64 GNU/Linux

Logs

I wasn't able to find anything releveant in the logs

Additional context

I initially encountered this issue while using FreeFileSync using SFTP and other users of the same software also encountered this issue on different hardware/software. I'm quite sure this is a upstream kernel bug introduced during 6.18 and then backported to 6.12, but as I am unable to check against a upstream kernel build, I'm reporting this issue here

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions