From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dmitry Monakhov Subject: Re: [PATCH v2 3/5] ext4: fix wrong m_len value after unwritten extent conversion Date: Thu, 07 Mar 2013 19:42:35 +0400 Message-ID: <87vc93gqs4.fsf@openvz.org> References: <1362579435-6333-1-git-send-email-wenqing.lz@taobao.com> <1362579435-6333-4-git-send-email-wenqing.lz@taobao.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Zheng Liu , Theodore Ts'o To: Zheng Liu , linux-ext4@vger.kernel.org Return-path: Received: from mail-la0-f51.google.com ([209.85.215.51]:33709 "EHLO mail-la0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756048Ab3CGPml (ORCPT ); Thu, 7 Mar 2013 10:42:41 -0500 Received: by mail-la0-f51.google.com with SMTP id fo13so639899lab.38 for ; Thu, 07 Mar 2013 07:42:39 -0800 (PST) In-Reply-To: <1362579435-6333-4-git-send-email-wenqing.lz@taobao.com> Sender: linux-ext4-owner@vger.kernel.org List-ID: On Wed, 6 Mar 2013 22:17:13 +0800, Zheng Liu wrote: > From: Zheng Liu > > We always assume that the return value of ext4_ext_map_blocks is equal > to map->m_len but when we try to convert an unwritten extent 'm_len' > value will break this assumption. It is harmless until we use status > tree as a extent cache because we need to update status tree according > to 'm_len' value. > > Meanwhile this commit marks EXT4_MAP_MAPPED flag after unwritten extent > conversion. It shouldn't cause a bug because we update status tree > according to checking EXT4_MAP_UNWRITTEN flag. But it should be fixed. > > After applied this commit, the following error message from self-testing > infrastructure disappears. > > ... > kernel: ES len assertation failed for inode: 230 retval 1 != > map->m_len 3 in ext4_map_blocks (allocation) > ... Ok. fill free to add Reviewed-by: Dmitry Monakhov > > Signed-off-by: Zheng Liu > Cc: "Theodore Ts'o" > Cc: Dmitry Monakhov > --- > fs/ext4/extents.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c > index 25c86aa..110e85a 100644 > --- a/fs/ext4/extents.c > +++ b/fs/ext4/extents.c > @@ -3650,6 +3650,10 @@ ext4_ext_handle_uninitialized_extents(handle_t *handle, struct inode *inode, > path, map->m_len); > } else > err = ret; > + map->m_flags |= EXT4_MAP_MAPPED; > + if (allocated > map->m_len) > + allocated = map->m_len; > + map->m_len = allocated; > goto out2; > } > /* buffered IO case */ > -- > 1.7.12.rc2.18.g61b472e > > -- > To unsubscribe from this list: send the line "unsubscribe linux-ext4" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html