From nobody Thu Dec 25 17:55:32 2025 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 6410522603 for ; Fri, 12 Jan 2024 17:16:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="kJjpyS+W" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B0B79C433C7; Fri, 12 Jan 2024 17:16:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705079812; bh=lryv/farYg+kjJnYzgoPmLVHiOFuDwPZIzxjpW3gLXk=; h=From:To:Cc:Subject:Date:From; b=kJjpyS+WcmdNVBnqw2w0+DO9Nx1eDtj14ip+T9pZ4gGXCSR1tgVZBju9cf5qT7JaV TwFkmGRPWyYxGd2Kdz353JHiLwRPBp7mo8biHW+YkVtn3cjgCbIg42f+t6o+cQI220 /V7LfJOaA0WIpnGaNuJF5fBFzD5Sb2GIYpL/fxfJBUCIVLt9J+XKHkYY/kYRJZw/CU vZMTFfORwmK+mwkSEsZZD/thYi9ongQqzksdhZ+6wlkrdnTNlMUBbRrfvKvsPiDeY9 +eBWAQIrV9YAeLA/E8fkLbRpzxmdp2VFvUxNpU2axoHLnWOspls3U+UmGXeZmbXwhx gJKVx299R+VIQ== From: Jaegeuk Kim To: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Cc: Jaegeuk Kim , Al Viro Subject: [PATCH] f2fs: remove unnecessary f2fs_put_page in f2fs_rename Date: Fri, 12 Jan 2024 09:16:45 -0800 Message-ID: <20240112171645.3929428-1-jaegeuk@kernel.org> X-Mailer: git-send-email 2.43.0.275.g3460e3d667-goog Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" [1] changed the below condition, which made f2fs_put_page() voided. This patch reapplies the AL's resolution in -next from [2]. - if (S_ISDIR(old_inode->i_mode)) { + if (old_is_dir && old_dir !=3D new_dir) { old_dir_entry =3D f2fs_parent_dir(old_inode, &old_dir_page); if (!old_dir_entry) { if (IS_ERR(old_dir_page)) [1] 7deee77b993a ("f2fs: Avoid reading renamed directory if parent does not= change") [2] https://lore.kernel.org/all/20231220013402.GW1674809@ZenIV/ Suggested-by: Al Viro Signed-off-by: Jaegeuk Kim Reviewed-by: Chao Yu --- fs/f2fs/namei.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c index b3bb815fc6aa..ba11298b7837 100644 --- a/fs/f2fs/namei.c +++ b/fs/f2fs/namei.c @@ -1105,14 +1105,11 @@ static int f2fs_rename(struct mnt_idmap *idmap, str= uct inode *old_dir, iput(whiteout); } =20 - if (old_is_dir) { - if (old_dir_entry) - f2fs_set_link(old_inode, old_dir_entry, - old_dir_page, new_dir); - else - f2fs_put_page(old_dir_page, 0); + if (old_dir_entry) + f2fs_set_link(old_inode, old_dir_entry, old_dir_page, new_dir); + if (old_is_dir) f2fs_i_links_write(old_dir, false); - } + if (F2FS_OPTION(sbi).fsync_mode =3D=3D FSYNC_MODE_STRICT) { f2fs_add_ino_entry(sbi, new_dir->i_ino, TRANS_DIR_INO); if (S_ISDIR(old_inode->i_mode)) --=20 2.43.0.275.g3460e3d667-goog