Re: [PATCH] aoe: adjust ref of head for compound page tails

From: Ed Cashin
Date: Wed Aug 07 2013 - 17:21:52 EST


On Aug 7, 2013, at 5:00 PM, Andrew Morton wrote:

> On Thu, 1 Aug 2013 21:29:59 -0400 Ed Cashin <ecashin@xxxxxxxxxx> wrote:
>
>> As discussed previously, the fact that some users of the block
>> layer provide bios that point to pages with a zero _count means
>> that it is not OK for the network layer to do a put_page on the
>> skb frags during an skb_linearize, so the aoe driver gets a
>> reference to pages in bios and puts the reference before ending
>> the bio. And because it cannot use get_page on a page with a
>> zero _count, it manipulates the value directly.
>>
>> It is not OK to increment the _count of a compound page tail,
>> though, since the VM layer will VM_BUG_ON a non-zero _count.
>> Block users that do direct I/O can result in the aoe driver
>> seeing compound page tails in bios. In that case, the same logic
>> works as long as the head of the compound page is used instead of
>> the tails. This patch handles compound pages and does not BUG.
>>
>> It relies on the block layer user leaving the relationship
>> between the page tail and its head alone for the duration between
>> the submission of the bio and its completion, whether successful
>> or not.
>
> What are the end-user-visible effects of the problem which is being
> fixed? Please always include this info when fixing bugs so that others
> can work out what kernel version(s) need the patch.


Sorry. I tried to cover that but maybe should have separated it more clearly from the running text.

The patch changes the current behavior encountered with direct I/O and aoe:

aoe can BUG when direct I/O used

... to a new behavior:

aoe does not BUG when direct I/O is used

And the user will never know that instead aoe is manipulating the _count of the head page, even though that's what's happening with this patch applied.

(The user-visible effects that motivated the older patch that added the BUG to aoe when page tails are used for block I/O was a VM_BUG_ON that occurred when the aoe driver manipulated the _count of a compound page tail.)

--
Ed Cashin
ecashin@xxxxxxxxxx


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/