Bug 6529 - Offline files conflict with Vista and Office 2003
Offline files conflict with Vista and Office 2003
Status: RESOLVED FIXED
Product: Samba 3.3
Classification: Unclassified
Component: File services
3.3.2
x86 Linux
: P3 normal
: ---
Assigned To: Jeremy Allison
Samba QA Contact
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2009-07-01 17:43 UTC by Justin Maggard
Modified: 2012-05-30 11:12 UTC (History)
3 users (show)

See Also:
jra: review? (metze)


Attachments
Wireshark capture of the attempted sync transaction (201.87 KB, application/octet-stream)
2009-07-01 17:44 UTC, Justin Maggard
no flags Details
Wireshark trace referred to in the Microsoft email. (121.86 KB, application/x-extension-pcap)
2009-08-21 20:15 UTC, Jeremy Allison
no flags Details
Patch for master. (2.58 KB, patch)
2009-08-21 20:34 UTC, Jeremy Allison
no flags Details
Better patch for master, uses rounding instead of truncation. (4.14 KB, patch)
2009-08-21 23:38 UTC, Jeremy Allison
no flags Details
git-am patch for 3.4.1. (4.37 KB, patch)
2009-08-22 00:08 UTC, Jeremy Allison
no flags Details
git-am format patch for 3.3.x (4.30 KB, patch)
2009-08-22 00:25 UTC, Jeremy Allison
no flags Details
git-am format patch for 3.2.x (3.62 KB, patch)
2009-08-22 00:33 UTC, Jeremy Allison
no flags Details
Regular format patch for 3.0.x (2.99 KB, patch)
2009-08-22 00:34 UTC, Jeremy Allison
no flags Details
Second part of the patch for master (applies on top of the other patch). (27.94 KB, patch)
2009-08-24 23:00 UTC, Jeremy Allison
no flags Details
Patch for 3.4.1 (3.00 KB, patch)
2009-09-06 23:04 UTC, Jeremy Allison
no flags Details
Patch for 3.4.1 (19.31 KB, patch)
2009-09-06 23:06 UTC, Jeremy Allison
no flags Details
Regular format patch for 3.0.x. (15.63 KB, patch)
2009-09-09 16:34 UTC, Jeremy Allison
no flags Details
git-am format patch for v3-4-test. (20.00 KB, patch)
2009-09-09 16:41 UTC, Jeremy Allison
vl: review+
metze: review+
Details
Regular format patch for 3.0.x. (17.03 KB, patch)
2009-09-11 14:00 UTC, Jeremy Allison
no flags Details
Regular format patch for 3.0.x. (20.67 KB, patch)
2009-09-11 19:00 UTC, Jeremy Allison
no flags Details
Torture test for master to ensure we don't regress. (5.21 KB, patch)
2009-09-14 20:49 UTC, Jeremy Allison
no flags Details
git-am format patch for 3.4.2 (in addition to existing pushed fix). (884 bytes, patch)
2009-09-15 16:01 UTC, Jeremy Allison
no flags Details
git-am format patch for 3.3.x (18.42 KB, patch)
2009-09-15 16:16 UTC, Jeremy Allison
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Justin Maggard 2009-07-01 17:43:33 UTC
We're running into an offline file sync conflict using Excel from Office 2003 on a Windows Vista machine.  Steps to reproduce are:
1) From Windows, set the directory (in your Samba share) to make files always available offline.
2) Copy an Excel spreadsheet into the directory, and sync.
3) Modify the spreadsheet and save it.
4) Click the Sync button in Windows Explorer.

Windows reports a conflict, and gives the reason as the file was changed on both the computer and the server while the computer was offline.

From what I've seen, this only appears to happen with Office 2003 -- Office 2007 works fine for me.
Comment 1 Justin Maggard 2009-07-01 17:44:51 UTC
Created attachment 4390 [details]
Wireshark capture of the attempted sync transaction
Comment 2 Jeremy Allison 2009-07-01 20:10:35 UTC
Juston, ping me @ work to discuss and get this fixed.
Thanks,
Jeremy
Comment 3 Jeremy Allison 2009-08-21 20:14:35 UTC
Info from Microsoft.

Jeremy,

    After much of testing and debugging, it seems that we are getting the cause
why Windows takes the file offline and the timestamp update only goes to local
store.   When Windows close one particular handle through which the file had
been modified, it queries the timestamps using FIND_FIRST2 on the file after
receiving the close response. Those timestamps are then saved in CSC cache.
 We can see that the LastWriteTime value returned from the create response does
not match the value returned from FIND_FRIST2 query.  The mismatch of
LastWriteTime  causes Windows to declare the version conflict between server
copy and local cache and thus takes it offline.

   Here are the details shown in the traces you sent us..

   Office2003-opnclose-samba-bad.cap:

      Opening file,  the current time stamp is written to the excel file

            Frame 175   10.20.0.111 10.20.0.66  SMB   Trans2 Response,
FIND_FIRST2, Files: excel test.xls  Last Write: Jul  8, 2009 15:10:06.000000000

            Frame 185   10.20.0.111 10.20.0.66  SMB   NT Create AndX Response,
FID: 0x13ff                 Last Write: Jul  8, 2009 15:10:06.000000000

            Frame 214   10.20.0.66  10.20.0.111 SMB   Trans2 Request,
SET_FILE_INFO, FID: 0x13ff

      So far so good..

      Closing file,  the original time stamp is supposed to be restored to the
excel file

            Frame 574   10.20.0.111 10.20.0.66  SMB   Trans2 Response,
FIND_FIRST2, Files: excel test.xls  Last Write: Jul  8, 2009 19:36:12.294000000
            Frame 587   10.20.0.111 10.20.0.66  SMB   NT Create AndX Response,
FID: 0x103e                 Last Write: Jul  8, 2009 19:36:12.000000000

      Mismatch of time stamp is detected and remote file is closed and it is
going offline.  SET_FILEINFO will not sent to the server any update will
only goes to local copy.

            Frame 588   10.20.0.66  10.20.0.111 SMB   Close Request, FID:
0x103e

    From all the failed cases I got, I can see that only the millisecond part
is different.
Comment 4 Jeremy Allison 2009-08-21 20:15:37 UTC
Created attachment 4587 [details]
Wireshark trace referred to in the Microsoft email.
Comment 5 Jeremy Allison 2009-08-21 20:34:24 UTC
Created attachment 4588 [details]
Patch for master.

Need confirmation on ext4, but this should work.
Jeremy.
Comment 6 Jeremy Allison 2009-08-21 23:38:21 UTC
Created attachment 4589 [details]
Better patch for master, uses rounding instead of truncation.
Comment 7 Jeremy Allison 2009-08-22 00:08:38 UTC
Created attachment 4590 [details]
git-am patch for 3.4.1.
Comment 8 Jeremy Allison 2009-08-22 00:25:49 UTC
Created attachment 4591 [details]
git-am format patch for 3.3.x
Comment 9 Jeremy Allison 2009-08-22 00:33:29 UTC
Created attachment 4592 [details]
git-am format patch for 3.2.x
Comment 10 Jeremy Allison 2009-08-22 00:34:03 UTC
Created attachment 4593 [details]
Regular format patch for 3.0.x
Comment 11 Jeremy Allison 2009-08-22 00:35:11 UTC
Metze and Volker, please review. I think this needs to go into 3.4.1, but I'd like your thoughts on this.

Thanks,

Jeremy.
Comment 12 Jeremy Allison 2009-08-24 15:27:35 UTC
NB. Please postpone the review and addition for 3.4.1 - there are still some issues with this patch on a ext4 filesystem that I'm trying to track down.

Jeremy.
Comment 13 Jeremy Allison 2009-08-24 23:00:42 UTC
Created attachment 4594 [details]
Second part of the patch for master (applies on top of the other patch).

From the reporter:

----------------------------------------------------------------------------
This patch also looks good with my test cases.  I wan't able to make ext4 fail at all.  I made ext3 fail a few times, but then it started working and never failed again on my next 50 sync attempts.  So, I'm not really sure what was going on there, and I haven't been able to make it happen again.  Maybe I'll
play with it some more later this week.  But this patch makes it behave the best I've seen so far. :)
----------------------------------------------------------------------------

Backports for the other branches to follow when I return from the UK on Sept. 5th.

Jeremy.
Comment 14 Jeremy Allison 2009-09-06 23:04:45 UTC
Created attachment 4651 [details]
Patch for 3.4.1

Ok, here's the fix for 3.4.x. It still needs testing when I get back in at work on the 8th, but this is what I'm planning for 3.4.x (maybe 3.4.1 ?).

Jeremy.
Comment 15 Jeremy Allison 2009-09-06 23:06:26 UTC
Created attachment 4652 [details]
Patch for 3.4.1

Grrr. Somehow selected the wrong file... This is the correct one.
Jeremy.
Comment 16 Jeremy Allison 2009-09-08 19:47:05 UTC
Got confirmation from the reporter the 3.4.1 patch works on ext3/ext4.
Jeremy.

Comment 17 Jeremy Allison 2009-09-09 16:34:48 UTC
Created attachment 4669 [details]
Regular format patch for 3.0.x.

Final patch for 3.0.x. Normal patch format.
Jeremy.
Comment 18 Jeremy Allison 2009-09-09 16:41:21 UTC
Created attachment 4670 [details]
git-am format patch for v3-4-test.
Comment 19 Jeremy Allison 2009-09-09 19:00:19 UTC
3.0 patch still needs some work. I have an idea as to the problem...
Jeremy.
Comment 20 Jeremy Allison 2009-09-11 14:00:38 UTC
Created attachment 4684 [details]
Regular format patch for 3.0.x.

Works for me in my test env. on 3.0.x.
Jeremy.
Comment 21 Jeremy Allison 2009-09-11 19:00:00 UTC
Created attachment 4685 [details]
Regular format patch for 3.0.x.

Needed a litte more of 3.4.x back-ported than I thought (need to stop setting mtime from clobbering atime). Works for me - waiting for input from the reporter.
Jeremy.
Comment 22 Stefan Metzmacher 2009-09-12 01:47:55 UTC
Comment on attachment 4670 [details]
git-am format patch for v3-4-test.

I think this patch looks good
Comment 23 Jeremy Allison 2009-09-14 18:19:33 UTC
Customer confirms 3.0.x patch also. Karolin, please apply the git-am format patch for 3.4.2 in attachment #18 [details].

https://bugzilla.samba.org/attachment.cgi?id=4670&action=view

Torture test to follow.

Jeremy.
Comment 24 Jeremy Allison 2009-09-14 20:49:06 UTC
Created attachment 4692 [details]
Torture test for master to ensure we don't regress.
Comment 25 Karolin Seeger 2009-09-15 02:24:27 UTC
Pushed to v3-4-test.
I guess the 3.3 patch should be pushed also, right?
Comment 26 Jeremy Allison 2009-09-15 11:35:40 UTC
Hang on a minute Karolin, let me review and ensure the patches are identical and working first. It's been a while since I created the 3.3.x patch so I'd like to review first.

Thanks for checking !

Jeremy.
Comment 27 Jeremy Allison 2009-09-15 16:01:15 UTC
Created attachment 4697 [details]
git-am format patch for 3.4.2 (in addition to existing pushed fix).

Karolin, here is a typo fix that would prevent the correct bugfix from working on a DARWIN (MacOSX) machine. Please push to 3.4.2 in addition to the existing fix to complete the patch.
Jeremy.
Comment 28 Jeremy Allison 2009-09-15 16:16:01 UTC
Created attachment 4698 [details]
git-am format patch for 3.3.x

Here's the 3.3.x backport. Apply once I've confirmed in my test env.
Thanks,
Jeremy.
Comment 29 Stefan Metzmacher 2012-05-30 11:12:44 UTC
This somehow didn't make it to 3.3.x and 3.4.x (but it's fixed in 3.5.x and higher)