From mboxrd@z Thu Jan 1 00:00:00 1970 From: Steven Whitehouse Subject: Re: [PATCH v3] vfs: fix a bug when we do some dio reads with append dio writes Date: Mon, 16 Dec 2013 09:37:34 +0000 Message-ID: <1387186654.2736.6.camel@menhir> References: <1386413726-4610-1-git-send-email-wenqing.lz@taobao.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Cc: linux-fsdevel@vger.kernel.org, Jan Kara , Christoph Hellwig , Dmitry Monakhov , Dave Chinner , Alexander Viro , Zheng Liu To: Zheng Liu Return-path: Received: from mx1.redhat.com ([209.132.183.28]:59048 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752936Ab3LPJie (ORCPT ); Mon, 16 Dec 2013 04:38:34 -0500 In-Reply-To: <1386413726-4610-1-git-send-email-wenqing.lz@taobao.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Hi, On Sat, 2013-12-07 at 18:55 +0800, Zheng Liu wrote: > From: Zheng Liu > > Currently we check i_size in buffered read path after we know the page > is update. But it could return some zero-filled pages to the userspace > when we do some append dio writes. We could use the following code > snippet to reproduce this problem in a ext2/3/4 filesystem. > If the page is not uptodate, then neither (potentially) is i_size, since the underlying fs has not had a chance to get its own locks and update the inode size. I suspect that the correct fix would be to implement ->launder_page to avoid the race that you've identified here, if I've understood it correctly, Steve.