[linux-cifs-client] Detect errors in cifs_writepages when called from pdflush

Peter Schwenke peter at bluetoad.com.au
Fri Apr 17 12:40:01 GMT 2009


There is a data integrity problem when cifs_writepages is called from
pdflush when an error occurs while a large file is being written.  For
example, a short network break.

You'll need 2 computers.  One with the cifs server, one to run the test
from.  For the cifs server we have used a Linux box with a VMWare XP
client and an XP machine.

1. Have a console ready for you type into. This should be on the machine
with the CIFS client E.g. screen or minicom via serial console or even
the main  tty console.
2. Run the attached test program from an xterm  where you are ssh'd into
the machine running the CIFs client
3. When the fflush messages have started appearing, pull the cable on
the cifs server
4. In the console from 1. run 'sync'.  Get yourself ready to plug the
cable in
5. When the kernel message similar to Write2 ret=-11  message appears on
the console, plug the cable back in.

The test program should terminate successfully.  However, the resulting
file will have zeroes in it somewhere in place of the correct data.  I
do have another test program for checking the file, if required.

I have also caused the problem without running the sync.

The problem is that the return code from do_writepages is lost in the
hierarchy of calls from (missing some)

fs/fs_writeback.c : void generic_sync_sb_inodes
to
mm/page-writeback.c: int do_writepages
to cifs_writepages

The patch in the next message fixes the problem.

I have wondered if this could affect other file systems and if something
should be done in  fs_writeback.c or page-writeback.c.  However, it
would need to be fairly major like adding the ability to override
generic_sync_sb_inodes in file systems through  the super_operations
structure or something.

-- 
                                                              Regards
                                                              ...Peter
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fsBig.c
Type: text/x-csrc
Size: 2227 bytes
Desc: not available
Url : http://lists.samba.org/archive/linux-cifs-client/attachments/20090417/65388076/fsBig.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fsstuff.h
Type: text/x-chdr
Size: 400 bytes
Desc: not available
Url : http://lists.samba.org/archive/linux-cifs-client/attachments/20090417/65388076/fsstuff.bin


More information about the linux-cifs-client mailing list