Re: [PATCH V2] Btrfs: fix old data problem caused by aio vs dio
From: Josef Bacik <hidden>
Date: 2012-06-26 12:56:15
On Tue, Jun 26, 2012 at 12:07:17AM -0600, Miao Xie wrote:
The 209th case of xfstests failed because of the race between aio and dio. The detail reason is following: Task1 Task2 Btrfs-worker invalidate pages read pages do direct io invalidate pages fail* finish ordered io read data from pages
This just papers over the problem and makes DIO touch page cache which it shouldn't be doing if it's working properly, so NAK. We need to figure out why exactly my patch didn't work, since it should be working. The write should be doing lock_extent setup ordered extent unlock_extent and the read should be doing lock_extent check for ordered extent if there is one unlock and wait and then loop do read unlock_extent there should be no room for races in here. The patch I sent earlier should have caught if we had done a read between the invalidate and the locking and should be invalidating the range again and then checking. If this isn't working then something else is going sideways and we really need to figure out what it is rather than just working around the issue, as it will likely bite us in a different way later. Thanks, Josef