Re: [PATCH] dio: invalidate clean pages before dio write

From: Benjamin LaHaise
Date: Fri Mar 09 2007 - 20:23:23 EST


On Fri, Mar 09, 2007 at 02:35:57PM -0800, Zach Brown wrote:
> + if (rw == WRITE && mapping->nrpages) {
> + int err = invalidate_inode_pages2_range(mapping,
> + offset >> PAGE_CACHE_SHIFT, end);
> + if (err && retval >= 0)
> + retval = err;
> + }

I don't think reporting the error is the correct thing to do in the presense
of the write having completed. It's a race that the caller can do nothing
about and is arguably a kernel bug, so I'd rather do something like:

if (err) {
if (!retval)
retval = err;
else
printk_ratelimited(KERN_DEBUG
"dio sucks and hit the race %ld %ld\n",
retval, err);
}

Aside from that, I much prefer this approach to fix the problem than going
around and changing semantics. Feel free to add my Signed-off-by.

-ben
--
"Time is of no importance, Mr. President, only life is important."
Don't Email: <zyntrop@xxxxxxxxx>.
-
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/