]> git.baikalelectronics.ru Git - kernel.git/commit
prevent cifs_writepages() from skipping unwritten pages
authorDave Kleikamp <shaggy@linux.vnet.ibm.com>
Tue, 18 Nov 2008 03:49:05 +0000 (03:49 +0000)
committerSteve French <sfrench@us.ibm.com>
Tue, 18 Nov 2008 04:30:07 +0000 (04:30 +0000)
commitd6f48e0a2e7ff454ede004892df3e70e527b00ee
treedcb1aeb0e2b6a9af57479287ff4b9c94b070d0d3
parent1777503b6589ad6e1a2ea6cb0855b6754206fc42
prevent cifs_writepages() from skipping unwritten pages

Fixes a data corruption under heavy stress in which pages could be left
dirty after all open instances of a inode have been closed.

In order to write contiguous pages whenever possible, cifs_writepages()
asks pagevec_lookup_tag() for more pages than it may write at one time.
Normally, it then resets index just past the last page written before calling
pagevec_lookup_tag() again.

If cifs_writepages() can't write the first page returned, it wasn't resetting
index, and the next call to pagevec_lookup_tag() resulted in skipping all of
the pages it previously returned, even though cifs_writepages() did nothing
with them.  This can result in data loss when the file descriptor is about
to be closed.

This patch ensures that index gets set back to the next returned page so
that none get skipped.

Signed-off-by: Dave Kleikamp <shaggy@linux.vnet.ibm.com>
Acked-by: Jeff Layton <jlayton@redhat.com>
Cc: Shirish S Pargaonkar <shirishp@us.ibm.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
fs/cifs/file.c