Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758900AbZCRSmr (ORCPT ); Wed, 18 Mar 2009 14:42:47 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1756011AbZCRSmg (ORCPT ); Wed, 18 Mar 2009 14:42:36 -0400 Received: from e23smtp01.au.ibm.com ([202.81.31.143]:39316 "EHLO e23smtp01.au.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754559AbZCRSmf (ORCPT ); Wed, 18 Mar 2009 14:42:35 -0400 Date: Thu, 19 Mar 2009 00:12:22 +0530 From: "Aneesh Kumar K.V" To: Jan Kara Cc: LKML , linux-ext4@vger.kernel.org, Nick Piggin Subject: Re: [PATCH 3/4] fs: Avoid data corruption with blocksize < pagesize Message-ID: <20090318184222.GA6369@skywalker> References: <1237311235-13623-1-git-send-email-jack@suse.cz> <1237311235-13623-2-git-send-email-jack@suse.cz> <1237311235-13623-3-git-send-email-jack@suse.cz> <1237311235-13623-4-git-send-email-jack@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1237311235-13623-4-git-send-email-jack@suse.cz> User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1366 Lines: 36 On Tue, Mar 17, 2009 at 06:33:54PM +0100, Jan Kara wrote: > Assume the following situation: > Filesystem with blocksize < pagesize - suppose blocksize = 1024, > pagesize = 4096. File 'f' has first four blocks already allocated. > (line with "state:" contains the state of buffers in the page - m = mapped, > u = uptodate, d = dirty) > > process 1: process 2: > > write to 'f' bytes 0 - 1024 > state: |mud,-,-,-|, page dirty > write to 'f' bytes 1024 - 4096: > __block_prepare_write() maps blocks > state: |mud,m,m,m|, page dirty > we fail to copy data -> copied = 0 > block_write_end() does nothing > page gets unlocked If copied = 0 then in block_write_end we do page_zero_new_buffers(page, start+copied, start+len which would mean we should not see garbage. > writepage() is called on the page > block_write_full_page() writes buffers with garbage > -aneesh -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/