From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D7FFD1ED38 for ; Tue, 25 Jul 2023 11:24:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5D3C5C433C9; Tue, 25 Jul 2023 11:24:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1690284268; bh=8m6eav4SntL9E9lvTwD8myAVuBHyodsZr0FeIXrhjMo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ti5PZBpRXa86sgsIZpqCMaW5nf4bfjfucTBnLDXZd7WeEDaTl+6hPKz4uPVC5tg2a dIV8ECuvqXVS5oWNa+/vt0zrKkXZ/3923FJeGVQ/xRFC/fwPauXuaFoa8KQ9JtWHE9 AIG4M1aLBHKsMz2szL/yA17tGfjXBmJYbDQkOdqg= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Ted Tso , Jan Kara , Christian Brauner Subject: [PATCH 5.10 296/509] ext4: Remove ext4 locking of moved directory Date: Tue, 25 Jul 2023 12:43:55 +0200 Message-ID: <20230725104607.288640820@linuxfoundation.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230725104553.588743331@linuxfoundation.org> References: <20230725104553.588743331@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Jan Kara commit 3658840cd363f2be094f5dfd2f0b174a9055dd0f upstream. Remove locking of moved directory in ext4_rename2(). We will take care of it in VFS instead. This effectively reverts commit 0813299c586b ("ext4: Fix possible corruption when moving a directory") and followup fixes. CC: Ted Tso CC: stable@vger.kernel.org Signed-off-by: Jan Kara Message-Id: <20230601105830.13168-1-jack@suse.cz> Signed-off-by: Christian Brauner Signed-off-by: Greg Kroah-Hartman --- fs/ext4/namei.c | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) --- a/fs/ext4/namei.c +++ b/fs/ext4/namei.c @@ -3863,19 +3863,10 @@ static int ext4_rename(struct inode *old return retval; } - /* - * We need to protect against old.inode directory getting converted - * from inline directory format into a normal one. - */ - if (S_ISDIR(old.inode->i_mode)) - inode_lock_nested(old.inode, I_MUTEX_NONDIR2); - old.bh = ext4_find_entry(old.dir, &old.dentry->d_name, &old.de, &old.inlined); - if (IS_ERR(old.bh)) { - retval = PTR_ERR(old.bh); - goto unlock_moved_dir; - } + if (IS_ERR(old.bh)) + return PTR_ERR(old.bh); /* * Check for inode number is _not_ due to possible IO errors. @@ -4065,10 +4056,6 @@ release_bh: brelse(old.bh); brelse(new.bh); -unlock_moved_dir: - if (S_ISDIR(old.inode->i_mode)) - inode_unlock(old.inode); - return retval; }