[OpenAFS-devel] Cache inconsistency in client 1.4.8 and above

Felix Frank Felix.Frank@Desy.de
Tue, 21 Apr 2009 13:04:26 +0200 (CEST)


  This message is in MIME format.  The first part should be readable text,
  while the remaining parts are likely unreadable without MIME-aware tools.

--579669762-50219747-1240311866=:15575
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed

>> Cache consistency with mmap'ed writes can apparently only be achieved when
>> no afs_linux_writepage_sync's are aborted at all.
>>
>> I think I still haven't truly understood the exact idea of the antirecursion
>> patch. To me, it seems to omit writing some precious data.
>
> We had a backtrace which showed we were calling back into ourselves.
> The sole goal was to prevent that. Anything beyond was incidental and
> uneeded.

There is yet another fix proposal in RT #124627. It works for me at least.
Evidently, after applying fixes, deadlocks could still occur during the
first invocation of osi_VM_StoreAllSegments, so 
linux-mmap-antirecursion-20081020 never really worked, I'm afraid.
This current fix hopefully will.

One thing had me puzzled for a while - the mmap_test program (attached) 
works fine on a 2.6.18-128.1.6.el5 kernel, but reliably produces corrupt
chunks in a virtual machine with the 2.6.18-128.1.6.el5xen kernel,
both using 100MB disk caches. This holds true for both vanilla 1.4.10 and
various fixes I've been trying the last days.

Can anyone reproduce?

Cheers
  - Felix
--579669762-50219747-1240311866=:15575
Content-Type: TEXT/PLAIN; charset=US-ASCII; name=mmap_test.c
Content-Transfer-Encoding: BASE64
Content-Description: 
Content-Disposition: attachment; filename=mmap_test.c

I2luY2x1ZGUgPHN5cy9tbWFuLmg+DQ0KI2luY2x1ZGUgPHN5cy9mY250bC5o
Pg0NCiNpbmNsdWRlIDx1bmlzdGQuaD4NDQojaW5jbHVkZSA8c3RkbGliLmg+
DQ0KI2luY2x1ZGUgPHN0cmluZy5oPg0NCiNpbmNsdWRlIDxzdGRpby5oPg0N
CiNpbmNsdWRlIDx0aW1lLmg+DQ0KI2RlZmluZSBUQVJHRVRTSVpFICg3NTAg
PDwgMjApDQ0KI2RlZmluZSBDSFVOS1NJWkUgKDE0NjApDQ0KI2RlZmluZSBO
UkNIVU5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