From mboxrd@z Thu Jan 1 00:00:00 1970 From: Zheng Liu Subject: Re: [PATCH v2] vfs: fix a bug when we do some dio reads with append dio writes Date: Sat, 30 Nov 2013 00:12:06 +0800 Message-ID: <20131129161206.GA23032@gmail.com> References: <1385687220-6734-1-git-send-email-wenqing.lz@taobao.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: "linux-fsdevel@vger.kernel.org" , Christoph Hellwig , Dmitry Monakhov , Dave Chinner , Jan Kara , Alexander Viro , Zheng Liu To: Peng Tao Return-path: Received: from mail-pb0-f48.google.com ([209.85.160.48]:37173 "EHLO mail-pb0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751718Ab3K2QJO (ORCPT ); Fri, 29 Nov 2013 11:09:14 -0500 Received: by mail-pb0-f48.google.com with SMTP id md12so14651200pbc.21 for ; Fri, 29 Nov 2013 08:09:13 -0800 (PST) Content-Disposition: inline In-Reply-To: Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Fri, Nov 29, 2013 at 05:18:04PM +0800, Peng Tao wrote: > On Fri, Nov 29, 2013 at 9:07 AM, Zheng Liu wrote: > > generic_file_aio_read() > > ->do_generic_file_read() > > [fallback to buffered read] > This seems to be another thing that you might want to fix. In > generic_file_aio_read() of DIO, if pos >= isize, it also falls back to > do_generic_file_read() but can just return instead. Sorry, maybe I don't clarify the problem. Actually this patch tries to fix this problem that you pointed out. When we do some append dio writes, and we try to do some dio reads to get the last some data from the same file, we will encounter this problem. The root cause is that we will fall back to buffered read if pos >= isize. In first version [1], I just let it return directly to fix the problem if pos >= isize. But it's not perfect. 1. http://www.spinics.net/lists/linux-fsdevel/msg70358.html > Or is there any > historical reason to fall back there? I also want to know why we do this. :) Regards, - Zheng