From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0975CC0218A for ; Thu, 30 Jan 2025 09:00:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BE753280278; Thu, 30 Jan 2025 04:00:00 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B48032800CF; Thu, 30 Jan 2025 04:00:00 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A1305280278; Thu, 30 Jan 2025 04:00:00 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 8037B2800CF for ; Thu, 30 Jan 2025 04:00:00 -0500 (EST) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 35D07120B27 for ; Thu, 30 Jan 2025 09:00:00 +0000 (UTC) X-FDA: 83063520960.21.0ADCA36 Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by imf26.hostedemail.com (Postfix) with ESMTP id 8E321140012 for ; Thu, 30 Jan 2025 08:59:58 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=linuxfoundation.org header.s=korg header.b=N2NNKFxl; dmarc=pass (policy=none) header.from=linuxfoundation.org; spf=pass (imf26.hostedemail.com: domain of gregkh@linuxfoundation.org designates 147.75.193.91 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1738227598; a=rsa-sha256; cv=none; b=DEkK3mRnzN80P+ksWZHtWFYW1l8qckVMhfjmHLnol99S5zUN1CWNs9uKnpACEn1Tnhn5Qk ZE9ijCeLwFMDstSJ6VbaMlw8SVsoIofism5uIPezr5doqB3J105KYyyqc594T1Nu501Nfe 03Ju6KXBrX5sOjPIcdYfC5p0GHc3Zvw= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=linuxfoundation.org header.s=korg header.b=N2NNKFxl; dmarc=pass (policy=none) header.from=linuxfoundation.org; spf=pass (imf26.hostedemail.com: domain of gregkh@linuxfoundation.org designates 147.75.193.91 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1738227598; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:dkim-signature; bh=NVifzGi1DvOomooBiCx/7kzX/tLkC+pb7o7epnl1N/w=; b=J3ph/L5pIYmOzfAAmyWBg7LTsP9NIz/B1an1hhaENKZcFLJtOpotZtVcp1ZSt3K/DemK1l ousgBLJ8oeXMhuJZSGznIBnz4ozcEmIh1lnjm68/oQwJTzQKdlBwlTn42rsy8hIn2ZzG6X ZEdGsEblt0Tl76QDkmUW32i66aHp0cI= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 3E67FA41C0A; Thu, 30 Jan 2025 08:58:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4BBB9C4CED2; Thu, 30 Jan 2025 08:59:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1738227597; bh=89RPl7js30B6/myj6qO+e/4gddOwS3cGM59hq1Iwc/Q=; h=Subject:To:Cc:From:Date:In-Reply-To:From; b=N2NNKFxlsuxAn1+bqa/09tv0Wu+y48Gd2JnDwtt8KMHpST7c341VtRdY78Irkyhu3 QImbwgROlGOnQkYnwxkGHGY/weAn5O5WwvBz4zlgdvFa/L+MviRzkhAS1l7W1/1y20 vd8fqhCBrOOgorWdNY30uncWrW/1NGiHpJtp+GAw= Subject: Patch "shmem: Fix shmem_rename2()" has been added to the 6.6-stable tree To: akpm@linux-foundation.org,brauner@kernel.org,cel@kernel.org,chuck.lever@oracle.com,gregkh@linuxfoundation.org,hughd@google.com,linux-mm@kvack.org,sashal@kernel.org,viro@zeniv.linux.org.uk,yangerkun@huawei.com,yukuai3@huawei.com Cc: From: Date: Thu, 30 Jan 2025 09:59:31 +0100 In-Reply-To: <20250124191946.22308-7-cel@kernel.org> Message-ID: <2025013031-bagpipe-pueblo-ea57@gregkh> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit X-stable: commit X-Patchwork-Hint: ignore X-Rspam-User: X-Rspamd-Queue-Id: 8E321140012 X-Rspamd-Server: rspam10 X-Stat-Signature: y9y9ziitpzqddf3x8bfb73en7uc5yw4w X-HE-Tag: 1738227598-446431 X-HE-Meta: U2FsdGVkX18+cPcMuoxx9kO+94F8abAZ9dgdicDj1Rkw56FW9a5TsDCX1V1Mg37LXD6XLVUTxCWcfdbG1iMKqfvqNhBQDmLV991m/8oHUavJwm3upzlDQlD31kHf5wDth86/VeOZvNf3GjSqOBj7OkpsjVH7GxdNwdliHSe1CXAUzMasEQ4ptBTkNOSoEsAfi5mqPuz421G/9+uZd9AUFudvoiERMUHszuq64hsSWWyshKsnJIz5mDWv8xVsPGl3V06sHT+hWRJ/fYn48HKwbi7X3xb8ztAC1KC5L/3upCzkstjjlCiRtbTyv+yRgYSQ038bV5U9p8Jrg7dnSIt1vjrosIKj2sPLqbBEYpWalKcQP7eHm65A5h/DeSDbwlIIwZGZtVtZ75d18PgWAGoeeu31TPCk8s5eU7JZMvuTdkik9Da05igBXMSuQKZyE1/8g9W30X3UwgHAkPW9ZQ8owPkyJGNLEcGFf0HbxjG7iwdKADR79zhHeXvkR++gPYQRi4VjCq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msXTaLLdJKNNxw14nqCIENtCWYgfZBGLT12Bu8hpNbidAUiSmoSqPO1sK5iRl4ZgufZ4huurvDUFdXqeA9UK/tAZJPuToqo7esnsIjOumZBqRh4+1l4z2CtrMAaevbVBVoxi2/N/U+LcxBu29v1FWAbdVMtRnYPsmRQ27/cgYYQu1rjdM+oyJJV///F X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: This is a note to let you know that I've just added the patch titled shmem: Fix shmem_rename2() to the 6.6-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: shmem-fix-shmem_rename2.patch and it can be found in the queue-6.6 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let know about it. >From stable+bounces-110406-greg=kroah.com@vger.kernel.org Fri Jan 24 20:22:02 2025 From: cel@kernel.org Date: Fri, 24 Jan 2025 14:19:41 -0500 Subject: shmem: Fix shmem_rename2() To: Hugh Dickins , Andrew Morten , Christian Brauner , Al Viro , Greg Kroah-Hartman , Sasha Levin Cc: , , , yukuai3@huawei.com, yangerkun@huawei.com, Chuck Lever Message-ID: <20250124191946.22308-7-cel@kernel.org> From: Chuck Lever [ Upstream commit ad191eb6d6942bb835a0b20b647f7c53c1d99ca4 ] When renaming onto an existing directory entry, user space expects the replacement entry to have the same directory offset as the original one. Link: https://gitlab.alpinelinux.org/alpine/aports/-/issues/15966 Fixes: a2e459555c5f ("shmem: stable directory offsets") Signed-off-by: Chuck Lever Link: https://lore.kernel.org/r/20240415152057.4605-4-cel@kernel.org Signed-off-by: Christian Brauner Signed-off-by: Chuck Lever Signed-off-by: Greg Kroah-Hartman --- fs/libfs.c | 9 +++++++++ 1 file changed, 9 insertions(+) --- a/fs/libfs.c +++ b/fs/libfs.c @@ -365,6 +365,9 @@ int simple_offset_empty(struct dentry *d * * Caller provides appropriate serialization. * + * User space expects the directory offset value of the replaced + * (new) directory entry to be unchanged after a rename. + * * Returns zero on success, a negative errno value on failure. */ int simple_offset_rename(struct inode *old_dir, struct dentry *old_dentry, @@ -372,8 +375,14 @@ int simple_offset_rename(struct inode *o { struct offset_ctx *old_ctx = old_dir->i_op->get_offset_ctx(old_dir); struct offset_ctx *new_ctx = new_dir->i_op->get_offset_ctx(new_dir); + long new_offset = dentry2offset(new_dentry); simple_offset_remove(old_ctx, old_dentry); + + if (new_offset) { + offset_set(new_dentry, 0); + return simple_offset_replace(new_ctx, old_dentry, new_offset); + } return simple_offset_add(new_ctx, old_dentry); } Patches currently in stable-queue which might be from cel@kernel.org are queue-6.6/libfs-replace-simple_offset-end-of-directory-detection.patch queue-6.6/libfs-re-arrange-locking-in-offset_iterate_dir.patch queue-6.6/libfs-add-simple_offset_empty.patch queue-6.6/shmem-fix-shmem_rename2.patch queue-6.6/revert-libfs-add-simple_offset_empty.patch queue-6.6/libfs-use-d_children-list-to-iterate-simple_offset-directories.patch queue-6.6/libfs-define-a-minimum-directory-offset.patch queue-6.6/libfs-return-enospc-when-the-directory-offset-range-is-exhausted.patch queue-6.6/libfs-fix-simple_offset_rename_exchange.patch queue-6.6/libfs-add-simple_offset_rename-api.patch