]> git.michaelhowe.org Git - packages/o/openafs.git/commit
Unix CM: Avoid using stale DV in afs_StoreAllSegments
authorMarc Dionne <marc.dionne@your-file-system.com>
Fri, 19 Dec 2014 15:11:53 +0000 (10:11 -0500)
committerStephan Wiesand <stephan.wiesand@desy.de>
Fri, 23 Jan 2015 07:36:59 +0000 (02:36 -0500)
commit013e8db33fbec8b5db4ac5a1ec94a7f5b2afbc45
treee1e6b3c5743a711db5cc130c91afb84c5e796c88
parent7308aab9d911d87bde8a0a8a1e6120b83ea9bde6
Unix CM: Avoid using stale DV in afs_StoreAllSegments

It was reported in RT 131976 that on Linux some file
corruption was observed when doing mmap writes to
a file substantially larger than the cache size.

osi_VM_StoreAllSegments drops locks and asks the OS to flush
any dirty pages in the file 's mapping.  This will trigger
calls into our writepage op, and if the number of dirty
cache chunks is too high (as will happen for a file larger
than the cache size), afs_DoPartialWrite will recursively
call afs_StoreAllSegments and some chunks will be written
back to the server.  After potentially doing this several
times, control will return to the original afs_StoreAllSegments.

At that point the data version that was stored before
osi_VM_StoreAllSegments is no longer correct, leading to
possible data corruption.

Triggering this bug requires writing a file larger than the
cache so that partial stores are done, and writing enough
data to exceed the system's maximum dirty ratio and cause
it to initiate writeback.

To fix, just wait until after osi_VM_StoreAllSegments to
look at and store the data version

FIXES 131976

Reviewed-on: http://gerrit.openafs.org/11644
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
(cherry picked from commit b22c586bcdf785c489009ab96cbb572181cb9b09)

Change-Id: I32a2f6f32d432fe4a2e21ebd4bb278a9d7e5499f
Reviewed-on: http://gerrit.openafs.org/11656
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
src/afs/afs_segments.c