[linux-cifs-client] 'cp -a' does not preserve mtime

Suresh Jayaraman sjayaraman at suse.de
Wed Dec 19 06:35:29 GMT 2007


When I mount a windows share (2000 professional) on Linux, and try to
copy files from Linux to windows, the modified time is not preserved.
All atime, mtime and ctime are set to the current time.

The same behaviour is observed with cifs-1.48 (which includes a fix for
mtime bouncing), with cifs-1.50 and with 2.6.23 vanilla kernel.

Comparing the network trace between a windows client and a Linux client,
it seems the Linux client sends:

Trans2 QUERY_PATH_INFO
Create AndX, Write Andx
Trans2 SET_PATH_INFO
Close
commands

whereas the windows client sends:

Trans2 QUERY_PATH_INFO
Trans2 QUERY_FS_INFO
Create AndX
Trans2 QUERY_FILE_INFO
Trans2 SET_FILE_INFO
Close
commands

It looks like the Windows server(Windows 2000 professional) is not
honouring the SET_PATH_INFO request from Linux client, because the
SET_PATH_INFO Data contains the correct modified time as shown below:

Request
--------
SET_PATH_INFO Parameters
Level of Interest: Set File Basic Info (1004)
Reserved: 00000000
File Name: \diow_bior.c

SET_PATH_INFO Data
Created: No time specified (0)
Last Access: Dec 19, 2007 17:49:29.000000000
Last Write: Sep 26, 2007 13:37:02.000000000
Change: Dec 19, 2007 17:50:03.694488100

Response
--------
SET_PATH_INFO Parameters
EA Error offset: 0

The debug log by enabling cifsFYI to "1" is posted below:

--
device eth0 entered promiscuous mode
 fs/cifs/inode.c: CIFS VFS: in cifs_revalidate as Xid: 48 with uid: 0
 fs/cifs/inode.c: Revalidate:  inode 0xc09e7e0c count 1 dentry:
0xc095184c d_time 0 jiffies 64403
 fs/cifs/inode.c: Getting info on
 fs/cifs/transport.c: For smb_command 50
 fs/cifs/transport.c: Sending smb of length 74
 fs/cifs/connect.c: rfc1002 length 0x96)
 fs/cifs/inode.c: Old time 38797
 fs/cifs/inode.c: New time 64403
 fs/cifs/inode.c: Directory inode
 fs/cifs/inode.c: cifs_revalidate - inode unchanged
 fs/cifs/inode.c: CIFS VFS: leaving cifs_revalidate (xid = 48) rc = 0
 fs/cifs/dir.c: CIFS VFS: in cifs_lookup as Xid: 49 with uid: 0
 fs/cifs/dir.c:  parent inode = 0xc09e7e0c name is: diow_bior.c and
dentry = 0xf1aa684c
 fs/cifs/dir.c:  NULL inode in lookup
 fs/cifs/dir.c:  Full path: \diow_bior.c inode = 0x00000000
 fs/cifs/inode.c: Getting info on \diow_bior.c
 fs/cifs/transport.c: For smb_command 50
 fs/cifs/transport.c: Sending smb of length 98
 fs/cifs/connect.c: rfc1002 length 0x27)
 fs/cifs/connect.c: invalid transact2 word count
 fs/cifs/netmisc.c:  !!Mapping smb error code 2 to POSIX err -2 !!
 fs/cifs/cifssmb.c: Send error in QPathInfo = -2
 fs/cifs/dir.c: CIFS VFS: leaving cifs_lookup (xid = 49) rc = 0
 fs/cifs/dir.c: neg dentry 0xf1aa684c name = diow_bior.c
 fs/cifs/dir.c: CIFS VFS: in cifs_create as Xid: 50 with uid: 0
 fs/cifs/transport.c: For smb_command 162
 fs/cifs/transport.c: Sending smb of length 110
 fs/cifs/connect.c: rfc1002 length 0x6b)
 fs/cifs/inode.c: Getting info on \diow_bior.c
 fs/cifs/inode.c: Old time 0
 fs/cifs/inode.c: New time 64413
 fs/cifs/inode.c: File inode
 fs/cifs/dir.c: Exclusive Oplock for inode c09e7068
 fs/cifs/dir.c: CIFS VFS: leaving cifs_create (xid = 50) rc = 0
 fs/cifs/file.c: CIFS VFS: in cifs_open as Xid: 51 with uid: 0
 fs/cifs/file.c: CIFS VFS: leaving cifs_open (xid = 51) rc = 0
 fs/cifs/file.c: prepare write for page c22e9c40 from 0 to 4096
 fs/cifs/file.c: CIFS VFS: in cifs_commit_write as Xid: 52 with uid: 0
 fs/cifs/file.c: commit write for page c22e9c40 up to position 4096 for 4096
 fs/cifs/file.c: CIFS VFS: leaving cifs_commit_write (xid = 52) rc = 0
 fs/cifs/file.c: prepare write for page c221c0c0 from 0 to 927
 fs/cifs/file.c: CIFS VFS: in cifs_commit_write as Xid: 53 with uid: 0
 fs/cifs/file.c: commit write for page c221c0c0 up to position 5023 for 927
 fs/cifs/file.c: write 927 bytes to offset 4096 of diow_bior.c
 fs/cifs/file.c: CIFS VFS: in cifs_write as Xid: 54 with uid: 0
 fs/cifs/cifssmb.c: write2 at 4096 927 bytes
 fs/cifs/transport.c: For smb_command 47
 fs/cifs/transport.c: Sending smb:  total_len 995
 fs/cifs/connect.c: rfc1002 length 0x33)
 fs/cifs/misc.c: Null buffer passed to cifs_small_buf_release
 fs/cifs/file.c: CIFS VFS: leaving cifs_write (xid = 54) rc = 0
 fs/cifs/file.c: CIFS VFS: leaving cifs_commit_write (xid = 53) rc = 0
 fs/cifs/inode.c: CIFS VFS: in cifs_setattr as Xid: 55 with uid: 0
 fs/cifs/inode.c: setattr on file diow_bior.c attrs->iavalid 0x1f0
 fs/cifs/file.c: CIFS VFS: in cifs_writepages as Xid: 56 with uid: 0
 fs/cifs/cifssmb.c: write2 at 0 4096 bytes
 fs/cifs/transport.c: For smb_command 47
 fs/cifs/transport.c: Sending smb:  total_len 4164
 fs/cifs/connect.c: rfc1002 length 0x33)
 fs/cifs/misc.c: Null buffer passed to cifs_small_buf_release
 fs/cifs/file.c: CIFS VFS: leaving cifs_writepages (xid = 56) rc = 0
 fs/cifs/inode.c: CIFS - CTIME changed
 fs/cifs/cifssmb.c: In SetTimes
 fs/cifs/transport.c: For smb_command 50
 fs/cifs/transport.c: Sending smb of length 140
 fs/cifs/connect.c: rfc1002 length 0x40)
 fs/cifs/inode.c: CIFS VFS: leaving cifs_setattr (xid = 55) rc = 0
 fs/cifs/inode.c: CIFS VFS: in cifs_setattr as Xid: 57 with uid: 0
 fs/cifs/inode.c: setattr on file diow_bior.c attrs->iavalid 0x46
 fs/cifs/file.c: CIFS VFS: in cifs_writepages as Xid: 58 with uid: 0
 fs/cifs/file.c: CIFS VFS: leaving cifs_writepages (xid = 58) rc = 0
 fs/cifs/inode.c: UID changed to 1000
 fs/cifs/inode.c: GID changed to 100
 fs/cifs/inode.c: CIFS VFS: leaving cifs_setattr (xid = 57) rc = 0
 fs/cifs/file.c: CIFS VFS: in cifs_writepages as Xid: 59 with uid: 0
 fs/cifs/file.c: CIFS VFS: leaving cifs_writepages (xid = 59) rc = 0
 fs/cifs/file.c: Flush inode c09e7068 file f33965c0 rc 0
 fs/cifs/file.c: CIFS VFS: in cifs_close as Xid: 60 with uid: 0
 fs/cifs/cifssmb.c: In CIFSSMBClose
 fs/cifs/transport.c: For smb_command 4
 fs/cifs/transport.c: Sending smb of length 41
 fs/cifs/connect.c: rfc1002 length 0x27)
 fs/cifs/file.c: closing last open instance for inode c09e7068
 fs/cifs/file.c: CIFS VFS: leaving cifs_close (xid = 60) rc = 0
 fs/cifs/inode.c: CIFS VFS: in cifs_revalidate as Xid: 61 with uid: 0
 fs/cifs/inode.c: Revalidate: \diow_bior.c inode 0xc09e7068 count 1
dentry: 0xf1aa684c d_time 64404 jiffies 64417
 fs/cifs/inode.c: CIFS VFS: leaving cifs_revalidate (xid = 61) rc = 0
 fs/cifs/xattr.c: CIFS VFS: in cifs_setxattr as Xid: 62 with uid: 0
 fs/cifs/xattr.c: set POSIX ACL rc -95
 fs/cifs/xattr.c: CIFS VFS: leaving cifs_setxattr (xid = 62) rc = -95
 fs/cifs/inode.c: CIFS VFS: in cifs_revalidate as Xid: 63 with uid: 0
 fs/cifs/inode.c: Revalidate: \diow_bior.c inode 0xc09e7068 count 1
dentry: 0xf1aa684c d_time 64404 jiffies 64417
 fs/cifs/inode.c: CIFS VFS: leaving cifs_revalidate (xid = 63) rc = 0
 fs/cifs/inode.c: CIFS VFS: in cifs_setattr as Xid: 64 with uid: 0
 fs/cifs/inode.c: setattr on file diow_bior.c attrs->iavalid 0x41
 fs/cifs/file.c: CIFS VFS: in cifs_writepages as Xid: 65 with uid: 0
 fs/cifs/file.c: CIFS VFS: leaving cifs_writepages (xid = 65) rc = 0
 fs/cifs/inode.c: Mode changed to 0x81a4
 fs/cifs/inode.c: CIFS VFS: leaving cifs_setattr (xid = 64) rc = 0
device eth0 left promiscuous mode
--

Is this a known issue? The difference in sequence of commands send by
linux client causing the issue?


Thanks,

-- 
Suresh Jayaraman



More information about the linux-cifs-client mailing list