Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp2438141rdd; Fri, 12 Jan 2024 09:19:45 -0800 (PST) X-Google-Smtp-Source: AGHT+IE/J37pz8oJPbB4LnhQtNJLCb3XxqYEdOyA6Rjx7wpM7wwp1oqbrgtf0lWzjQgt+eGedxBU X-Received: by 2002:a17:907:74b:b0:a2a:b777:b357 with SMTP id xc11-20020a170907074b00b00a2ab777b357mr885725ejb.23.1705079985426; Fri, 12 Jan 2024 09:19:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705079985; cv=none; d=google.com; s=arc-20160816; b=Ks3tAMfTfg4E5tkzsvWBEcXNPlQwvWZtS1vhFNGKfZkRNQ96QO88LvjO7oRvppuvFM KaLOQ1WY2Fk/rQZmzjp5Zo47tlebBpK5HukV1dOjL1UZAKAkZCW1KGxpFTjwkU+7Uasj 7TR2fa0+U00kXlnuEuwbqEy3pHysJxcfpxWlTvJVacRtomQqwD3o8VJ7+pg5HdkkNclK 4dD//1LeiKvyXLrKqARpSHVJaAxXIz/XOz3Sph9nBvCQaHD9GM7pU5KLWtI4IofONQMF 2R6yvvfJ12MdwmU1ZkBwekbeB04w212HIETBjr0F1JjFRmnlCB5aMRxo5sGb672S4ORO USMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=WLjvRHByAruW6OplDRwPaOEWUlHmZ51YTiNDN0UTQxo=; fh=9wUqIqrsmgwv6q3rIxJStkj/a26eyje4p25UuYIwgK8=; b=Am6KWzWeLgUgEFZjPWjHzfM8m2jyNDYwhBxuY9IEkAqhrN9FuG4hAcO/AeSBi9XMVG VlZoqHnI3FsS994cMoYGhfu1NfRo1gv2syTbf6X4KxhcLkVZYHCKUnmODxctV12ZVl+P A76/6/R/XPGZ/jBFFrY1gU/We7SDQVH5GaybbGIt4jUlyvMWJj96dLDMOHa387dK9oDJ 96AR9On6yGnj247TlmH/goWzX8QJAcWyF/Ekn0WBnZcYLM3zVNqDfY2SmvrWLWGqE9im WRNf4F/LWQleGACOZB6AsUj9ohRiNdpR4MFK1fXfAH6Wt+EmaIZVxfNb21UBem4CLan/ +Lrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=gbrP3F43; spf=pass (google.com: domain of linux-kernel+bounces-24914-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-24914-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id q16-20020a1709066b1000b00a2cd1c18a21si520281ejr.55.2024.01.12.09.19.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jan 2024 09:19:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-24914-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=gbrP3F43; spf=pass (google.com: domain of linux-kernel+bounces-24914-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-24914-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 30E471F24AF5 for ; Fri, 12 Jan 2024 17:19:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EB92517C85; Fri, 12 Jan 2024 17:19:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="gbrP3F43" 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 2B47B17C7F for ; Fri, 12 Jan 2024 17:19:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8BFD6C433C7; Fri, 12 Jan 2024 17:19:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705079976; bh=MBcxOKLkDlXIZK4E+irYAbTj9NVjpdpAqSM7zdR7uEU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=gbrP3F439pUgtjsZOBLNb5hXm6C4AVzYN04wxOfHPASS5lO6MlTX+0cb1Yz0i9XRI mbEJ/1P9Ngz8nOHJFJG/+mnE9CeKziPtVj11xKrTcWXpL/bFlinobIK0GIbXCOZNgc whpAS88uney+VDuHmxKytk+sIPwwQQO4awpU+njkbKdHx/uSCd3tkMEY8dt8i2VMz/ qsGIw0Ie2hbAKZrLOSS+nIeix17W0VFkodjZBtuowlGH+uGUVAwYleveOZQNx2vwYq 9Ygh8EzN/Z6eUQc/5Cf/EssNWGE1ZONuFV55sL0Q0p7LWNx2ujZlxtHUfcg9cB+lqg BIqYD0BzMN8pg== Date: Fri, 12 Jan 2024 09:19:35 -0800 From: Jaegeuk Kim To: Al Viro Cc: Linus Torvalds , Linux Kernel Mailing List , Linux F2FS Dev Mailing List Subject: Re: [GIT PULL] f2fs update for 6.8-rc1 Message-ID: References: <20240112071242.GA1674809@ZenIV> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Posted this. https://lore.kernel.org/lkml/20240112171645.3929428-1-jaegeuk@kernel.org/T/#u On 01/12, Jaegeuk Kim wrote: > On 01/12, Al Viro wrote: > > On Thu, Jan 11, 2024 at 09:05:51PM -0800, Linus Torvalds wrote: > > > On Thu, 11 Jan 2024 at 10:28, Jaegeuk Kim wrote: > > > > > > > > git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git tags/f2fs-for-6.8-rc1 > > > > > > Hmm. I got a somewhat confusing conflict in f2fs_rename(). > > > > > > And honestly, I really don't know what the right resolution is. What I > > > ended up with was this: > > > > > > 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); > > > > Where would you end up with old_dir_page != NULL and old_dir_entry == NULL? > > old_dir_page is initialized to NULL and the only place where it's altered > > is > > old_dir_entry = f2fs_parent_dir(old_inode, &old_dir_page); > > Which is immediately followed by > > if (!old_dir_entry) { > > if (IS_ERR(old_dir_page)) > > err = PTR_ERR(old_dir_page); > > goto out_old; > > } > > so we are *not* going to end up at that if (old_is_dir) in that case. > > It seems [1] changed the condition of getting old_dir_page reference as below, > which made f2fs_put_page(old_dir_page, 0) voided. > > - if (S_ISDIR(old_inode->i_mode)) { > + if (old_is_dir && old_dir != new_dir) { > old_dir_entry = 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") > > > > > Original would have been more clear as > > if (old_is_dir) { > > if (old_dir != new_dir) { > > /* we have .. in old_dir_page/old_dir_entry */ > > if (!whiteout) > > f2fs_set_link(old_inode, old_dir_entry, > > old_dir_page, new_dir); > > else > > f2fs_put_page(old_dir_page, 0); > > } > > f2fs_i_links_write(old_dir, false); > > } > > - it is equivalent to what that code used to do. And "don't update .. > > if we are leaving a whiteout behind" was teh bug fixed by commit > > in f2fs tree... > > > > The bottom line: your variant is not broken, but only because > > f2fs_put_page() starts with > > static inline void f2fs_put_page(struct page *page, int unlock) > > { > > if (!page) > > return; > > > > IOW, you are doing f2fs_put_page(NULL, 0), which is an explicit no-op.