Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp897243pxb; Wed, 13 Jan 2021 19:53:51 -0800 (PST) X-Google-Smtp-Source: ABdhPJyjH2bQHJAd6U2Z1uRsuOsDe7w2oS+qwfeP10a1DZoAt93fXb8b5WwBhuyKWjr6VGxCjhK7 X-Received: by 2002:a17:907:206a:: with SMTP id qp10mr3897238ejb.432.1610596431239; Wed, 13 Jan 2021 19:53:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610596431; cv=none; d=google.com; s=arc-20160816; b=sWNIhwWpDgnKWhVP4wwZ6TgN8JsAuLIZ2Qa+umv/DOuxOlpLNl0PLHiBCj37mcY2z7 8FCgm65E+ODYtapux1Rmd8bnUAFJ+Mol/Z7PNZl2gUA/S421t1nVhti8x/pVl5d6cHjV hQNeuGcmQXYymsIe4S8wnAh4cDJNuSK4NxH8L8A1RUSCV6NZoTMnV1KRkSIHX+EobBSJ nNylZHyOekak5/dpeANdrMj03sCInvAHz+f7IUCouPf9jhPOJ42EJczLgzG2DgdsPZ6s 9gkFPjSktW51cC01mfojeqP2qNg9bEPeGVx2xvJruN8W5OgQn/KR584Du4a3PVF98nwg KfJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=oZsIWRCaDvU63TcmtGnxC85oFHc8anxOcxGiiNQDmKw=; b=AKY+TsioC471TkLsNdz1GRnnCpAvTQKY8W02fEDaM+uc0FNbbOIyHSfhJklgfNNSfa eleVr+t42o2V1/fa81pfu3WwHd+c5E5VBnIZf3vQsry8xRfGFcjE6lujVQXsAbrUD7B1 BQ0s3YQA2D4mEKdtqNexL70VREqdjUJ3atSNOL1tRPyh5QEags2ski77FzwWIKDN4SBM 7J3X9cCuhQZGH0dVLwdVTWjJVnUUk8n0l+DKuCRk98uCkASuoGIWejVIcSAwkXDXnlCT LCXcoUyxcEpZfMjigTVcapIM7PBBFzm6iZm4gD2yF34x49w9tIopafu5rDf5giJEugVG kvUQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t23si820472edw.381.2021.01.13.19.53.27; Wed, 13 Jan 2021 19:53:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726565AbhANDxC (ORCPT + 99 others); Wed, 13 Jan 2021 22:53:02 -0500 Received: from outgoing-auth-1.mit.edu ([18.9.28.11]:38619 "EHLO outgoing.mit.edu" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726506AbhANDxC (ORCPT ); Wed, 13 Jan 2021 22:53:02 -0500 Received: from cwcc.thunk.org (pool-72-74-133-215.bstnma.fios.verizon.net [72.74.133.215]) (authenticated bits=0) (User authenticated as tytso@ATHENA.MIT.EDU) by outgoing.mit.edu (8.14.7/8.12.4) with ESMTP id 10E3pwCG021668 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 13 Jan 2021 22:51:58 -0500 Received: by cwcc.thunk.org (Postfix, from userid 15806) id 0E6F015C3453; Wed, 13 Jan 2021 22:51:58 -0500 (EST) Date: Wed, 13 Jan 2021 22:51:58 -0500 From: "Theodore Ts'o" To: yangerkun Cc: linux-ext4@vger.kernel.org, adilger.kernel@dilger.ca, jack@suse.cz, yi.zhang@huawei.com, lihaotian9@huawei.com, lutianxiong@huawei.com, linfeilong@huawei.com Subject: Re: [PATCH v3] ext4: fix bug for rename with RENAME_WHITEOUT Message-ID: References: <20210105062857.3566-1-yangerkun@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210105062857.3566-1-yangerkun@huawei.com> Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Tue, Jan 05, 2021 at 02:28:57PM +0800, yangerkun wrote: > We got a "deleted inode referenced" warning cross our fsstress test. The > bug can be reproduced easily with following steps: > > cd /dev/shm > mkdir test/ > fallocate -l 128M img > mkfs.ext4 -b 1024 img > mount img test/ > dd if=/dev/zero of=test/foo bs=1M count=128 > mkdir test/dir/ && cd test/dir/ > for ((i=0;i<1000;i++)); do touch file$i; done # consume all block > cd ~ && renameat2(AT_FDCWD, /dev/shm/test/dir/file1, AT_FDCWD, > /dev/shm/test/dir/dst_file, RENAME_WHITEOUT) # ext4_add_entry in > ext4_rename will return ENOSPC!! > cd /dev/shm/ && umount test/ && mount img test/ && ls -li test/dir/file1 > We will get the output: > "ls: cannot access 'test/dir/file1': Structure needs cleaning" > and the dmesg show: > "EXT4-fs error (device loop0): ext4_lookup:1626: inode #2049: comm ls: > deleted inode referenced: 139" > > ext4_rename will create a special inode for whiteout and use this 'ino' > to replace the source file's dir entry 'ino'. Once error happens > latter(the error above was the ENOSPC return from ext4_add_entry in > ext4_rename since all space has been consumed), the cleanup do drop the > nlink for whiteout, but forget to restore 'ino' with source file. This > will trigger the bug describle as above. > > Signed-off-by: yangerkun Thanks, replied. - Ted