Bug 50991

Summary: 3.7-rc7: CIFS mounted with cache=strict broke some downloaded files
Product: File System Reporter: Maxim Britov (ungifted01)
Component: CIFSAssignee: Jeff Layton (jlayton)
Status: RESOLVED CODE_FIX    
Severity: normal CC: florian, fs_cifs, jlayton, sfrench
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 3.7-rc7 Subsystem:
Regression: No Bisected commit-id:
Attachments: cifs: fix writeback race with file that is growing

Description Maxim Britov 2012-11-26 09:43:36 UTC
cache=strict in 3.6.7 works fine, but 3.7-rc* doesn't.
With cache=none 3.7-rc7 works fine.

maxim ~ $ uname -a
Linux maxim 3.6.7 #1 SMP PREEMPT Wed Nov 21 15:11:28 FET 2012 x86_64 AMD Athlon(tm) II X2 220 Processor AuthenticAMD GNU/Linux

maxim ~ $ wget --no-proxy ftp://ftp.mozilla.org/pub/mozilla.org/thunderbird/releases/17.0/win32/ru/Thunderbird%20Setup%2017.0.exe -O /mnt/install/delme.7z

maxim ~ $ gpg --print-md md5 /mnt/install/delme.7z 
/mnt/install/delme.7z: C2 EE 39 93 C6 38 DE AA  6B B8 7D 31 9C 31 E2 09

maxim ~ $ 7z t /mnt/install/delme.7z >/dev/null ; echo $?
0
maxim ~ $ rm /mnt/install/delme.7z 


maxim ~ $ uname -a
Linux maxim 3.7.0-rc7 #1 SMP PREEMPT Mon Nov 26 10:43:42 FET 2012 x86_64 AMD Athlon(tm) II X2 220 Processor AuthenticAMD GNU/Linux

maxim ~ $ wget --no-proxy ftp://ftp.mozilla.org/pub/mozilla.org/thunderbird/releases/17.0/win32/ru/Thunderbird%20Setup%2017.0.exe -O /mnt/install/delme.7z

maxim ~ $ wget --no-proxy ftp://ftp.mozilla.org/pub/mozilla.org/thunderbird/releases/17.0/win32/ru/Thunderbird%20Setup%2017.0.exe -O /tmp/delme2.7z

maxim ~ $ cp /tmp/delme2.7z /mnt/install/

maxim ~ $ gpg --print-md md5 /mnt/install/delme.7z 
/mnt/install/delme.7z: F9 FB 8C 09 23 98 DF EB  96 95 47 D4 93 97 26 A1

maxim ~ $ gpg --print-md md5 /mnt/install/delme2.7z 
/mnt/install/delme2.7z: C2 EE 39 93 C6 38 DE AA  6B B8 7D 31 9C 31 E2 09

any add info from me?
windows 2003 server on another side (checked with win7 too).
Comment 1 Jeff Layton 2012-11-26 11:40:07 UTC
Thanks for the bug report. I've been able to reproduce it...

While writing out the file, the kernel is occasionally issuing a short write to the server and then is skipping over the gap and writing out the rest of the file. The gaps are not page aligned, so I'm at a bit of a loss for the cause so far...
Comment 2 Jeff Layton 2012-11-26 14:36:11 UTC
Created attachment 87291 [details]
cifs: fix writeback race with file that is growing

Maxim, this patch seems to fix it for me. Does it also fix it for you? I'll plan to send this on to the list tomorrow unless you say it doesn't. With luck, we'll get it in before 3.7 ships.
Comment 3 Maxim Britov 2012-11-26 15:25:58 UTC
Thank you! Works fine now for me
Comment 4 Jeff Layton 2012-11-26 16:15:00 UTC
Thanks. Patch sent to maintainer and linux-cifs ml:

    http://article.gmane.org/gmane.linux.kernel.cifs/7414
Comment 5 Steve French 2012-11-27 23:36:39 UTC
Plan to request upstream merge after one more day in cifs-2.6.git (so it goes through linux-next first)
Comment 7 Jeff Layton 2012-12-01 14:00:36 UTC
Yep, merged last night. Closing bug.
Comment 8 Florian Mickler 2012-12-15 03:31:37 UTC
A patch referencing this bug report has been merged in Linux v3.7-rc8:

commit 3a98b8614312026d489e56c1d0e294a68e2aad77
Author: Jeff Layton <jlayton@redhat.com>
Date:   Mon Nov 26 09:48:41 2012 -0500

    cifs: fix writeback race with file that is growing