From patchwork Thu Mar 28 10:34:59 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tao Ma X-Patchwork-Id: 231972 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 127E02C00B2 for ; Thu, 28 Mar 2013 21:35:31 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752535Ab3C1Kfa (ORCPT ); Thu, 28 Mar 2013 06:35:30 -0400 Received: from oproxy14-pub.unifiedlayer.com ([67.222.51.224]:34916 "HELO oproxy14-pub.unifiedlayer.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1751730Ab3C1Kfa (ORCPT ); Thu, 28 Mar 2013 06:35:30 -0400 Received: (qmail 7534 invoked by uid 0); 28 Mar 2013 10:35:29 -0000 Received: from unknown (HELO box585.bluehost.com) (66.147.242.185) by oproxy14.unifiedlayer.com with SMTP; 28 Mar 2013 10:35:29 -0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tao.ma; s=default; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=ceiusVrAiBT8BqNbBS8ohWAauNoLlX+fxRc6j3CMWfY=; b=XeibesHzPl0NjqMmwefGKuJD7BVhhD5lWMHbDH37SxAV7MxAhbK15fKHpMCQgDKY1nkGKpYZZnH8BiODNcCVGZk9/ACQ2hYONCekQ7Nc0jAjMRAJSz+56F4eGP/gg+lp; Received: from [182.92.247.2] (port=29862 helo=tma-laptop1.taobao.ali.com) by box585.bluehost.com with esmtpsa (TLSv1:CAMELLIA256-SHA:256) (Exim 4.80) (envelope-from ) id 1ULAB6-0000Ru-Co; Thu, 28 Mar 2013 04:35:29 -0600 From: Tao Ma To: linux-ext4@vger.kernel.org Cc: zab@redhat.com Subject: [PATCH 2/2] ext4: Handle readdir when a file is converted from inline to block based. Date: Thu, 28 Mar 2013 18:34:59 +0800 Message-Id: <1364466899-5599-2-git-send-email-tm@tao.ma> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1364466899-5599-1-git-send-email-tm@tao.ma> References: <1364466899-5599-1-git-send-email-tm@tao.ma> X-Identified-User: {1390:box585.bluehost.com:colyli:tao.ma} {sentby:smtp auth 182.92.247.2 authed with tm@tao.ma} Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Tao Ma Zach reported that if a dir is inlined, the offset is within the inode, while if we have done the conversion, the dir now will have a block offset or even a hashed pos. The good thing is that ext4 is also prepared to handle some situation that the dir is changed during many calls of getdents. This patch just increased the inode->i_version in dir conversion so that normal ext4 readdir codes can work properly to handle this issue. Reported-by: Zach Brown Signed-off-by: Tao Ma --- fs/ext4/inline.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c index 9c09dd5..b1379fc 100644 --- a/fs/ext4/inline.c +++ b/fs/ext4/inline.c @@ -1130,6 +1130,7 @@ static int ext4_finish_convert_inline_dir(handle_t *handle, EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)) csum_size = sizeof(struct ext4_dir_entry_tail); + inode->i_version++; inode->i_size = inode->i_sb->s_blocksize; i_size_write(inode, inode->i_sb->s_blocksize); EXT4_I(inode)->i_disksize = inode->i_sb->s_blocksize;