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 X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CE8B0C47247 for ; Tue, 5 May 2020 19:08:44 +0000 (UTC) Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 97990206B9; Tue, 5 May 2020 19:08:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=sourceforge.net header.i=@sourceforge.net header.b="bSGtaYHI"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=sf.net header.i=@sf.net header.b="muWbi3wI"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="RU4+H/3k" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 97990206B9 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linux-f2fs-devel-bounces@lists.sourceforge.net Received: from [127.0.0.1] (helo=sfs-ml-1.v29.lw.sourceforge.com) by sfs-ml-1.v29.lw.sourceforge.com with esmtp (Exim 4.90_1) (envelope-from ) id 1jW2vs-0004wH-6H; Tue, 05 May 2020 19:08:44 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jW2vq-0004vi-Hg for linux-f2fs-devel@lists.sourceforge.net; Tue, 05 May 2020 19:08:42 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=In-Reply-To:Content-Type:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=jD6qkxVpMOOTs4zUHxXmbDys2ThbOwGFDqRL1J1ilpw=; b=bSGtaYHI3G0UJbwAS14qgQTsiz UrfFe7N5v8ztWiUeNlyzyMGaxYkFAgl7cltw1memf0sfKAJ3rDNQHZRaGTfPIhfkTVlB68M8vAirA snXpy4K33cS5aMvLJ0YU9FegW99h/brzlKwfkw2CQNVhyh1CahW+9Y+OzN12V0PSMEZ4=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To :From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=jD6qkxVpMOOTs4zUHxXmbDys2ThbOwGFDqRL1J1ilpw=; b=muWbi3wIQEvgW4I5T1eteoYaC1 7bVBbgbGIMZHlU4gzq1IN7TXLNEHk56Lijgq1Ok40kGfR0wHKP5bMfnc5xEPwm5U9XB1J8GlqMmKo AD5R7LxBo+MAnUBqlDp3eDBDjZXh1qv6qIbiNbNbSEagQKYNLl1+YGiLSiUPRt/N8jNQ=; Received: from mail.kernel.org ([198.145.29.99]) by sfi-mx-4.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.2) id 1jW2vp-00Bhse-E6 for linux-f2fs-devel@lists.sourceforge.net; Tue, 05 May 2020 19:08:42 +0000 Received: from localhost (unknown [104.132.1.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id DD2D8206B9; Tue, 5 May 2020 19:08:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588705711; bh=mVzsMafczB2qs5W4j7HW8BQBAAFyRC6PAqX0Q2mK0f0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=RU4+H/3k94TUb+vRJxvUd8LSDzIgogLbrBNFDkfR3mygf+YHJmSZMOf+B+YiBYuNy 1wG0m+djLQeonwmVQbvpOrvhow9qHKFDC45NJzjo4/v0QI/fVWF3fc0opCi9eht0R9 RiOUZpZAAL3vMsupVogRK1IKdHnQvjZgpCQQyPtg= Date: Tue, 5 May 2020 12:08:30 -0700 From: Jaegeuk Kim To: Eric Biggers Message-ID: <20200505190830.GD55221@google.com> References: <20200505153139.201697-1-jaegeuk@kernel.org> <20200505165847.GA98848@gmail.com> <20200505181323.GA55221@google.com> <20200505181941.GC98848@gmail.com> <20200505184932.GC55221@google.com> <20200505190108.GB128280@sol.localdomain> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200505190108.GB128280@sol.localdomain> X-Headers-End: 1jW2vp-00Bhse-E6 Subject: Re: [f2fs-dev] [PATCH] f2fs: get parent inode when recovering pino X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kernel-team@android.com, linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net On 05/05, Eric Biggers wrote: > On Tue, May 05, 2020 at 11:49:32AM -0700, Jaegeuk Kim wrote: > > How about this? > > > > From 2a6b0e53e592854306062a2dc35db2d8f79062f2 Mon Sep 17 00:00:00 2001 > > From: Jaegeuk Kim > > Date: Tue, 5 May 2020 11:33:29 -0700 > > Subject: [PATCH] f2fs: find a living dentry when finding parent ino > > > > We need to check any dentry still alive to get parent inode number. > > > > Suggested-by: Eric Biggers > > Signed-off-by: Jaegeuk Kim > > --- > > fs/f2fs/file.c | 5 ++--- > > 1 file changed, 2 insertions(+), 3 deletions(-) > > > > diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c > > index a0a4413d6083b..95139cb85faca 100644 > > --- a/fs/f2fs/file.c > > +++ b/fs/f2fs/file.c > > @@ -169,9 +169,8 @@ static int get_parent_ino(struct inode *inode, nid_t *pino) > > { > > struct dentry *dentry; > > > > - inode = igrab(inode); > > - dentry = d_find_any_alias(inode); > > - iput(inode); > > + /* Need to check if valid dentry still exists. */ > > + dentry = d_find_alias(inode); > > if (!dentry) > > return 0; > > > > It's fine, but it could use some more explanation. (What's a "valid dentry"?) > How about the following? Cool, I took this. Thanks, > > >From f8fe7d57eead1423e8548ac7a5ec881d701466a5 Mon Sep 17 00:00:00 2001 > From: Eric Biggers > Date: Tue, 5 May 2020 11:41:11 -0700 > Subject: [PATCH] f2fs: correctly fix the parent inode number during fsync() > > fsync() may be called on a deleted file that's still open. So when > fsync() tries to set the parent inode number when the inode has > LOST_PINO and i_nlink == 1 (to avoid later checkpoints), it needs to > make sure to get the parent directory via a non-deleted alias. > > Also remove the unnecessary igrab() and iput(), as the caller already > holds a reference to the inode. > > Signed-off-by: Eric Biggers > --- > fs/f2fs/file.c | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > > diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c > index 6ab8f621a3c5a2..b3069188fd3478 100644 > --- a/fs/f2fs/file.c > +++ b/fs/f2fs/file.c > @@ -165,9 +165,11 @@ static int get_parent_ino(struct inode *inode, nid_t *pino) > { > struct dentry *dentry; > > - inode = igrab(inode); > - dentry = d_find_any_alias(inode); > - iput(inode); > + /* > + * Make sure to get the non-deleted alias. The alias associated with > + * the open file descriptor being fsync()'ed may be deleted already. > + */ > + dentry = d_find_alias(inode); > if (!dentry) > return 0; > > -- > 2.26.2 _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel 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 X-Spam-Level: X-Spam-Status: No, score=-7.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6F1EAC47247 for ; Tue, 5 May 2020 19:08:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3CEC1206FA for ; Tue, 5 May 2020 19:08:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588705713; bh=mVzsMafczB2qs5W4j7HW8BQBAAFyRC6PAqX0Q2mK0f0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-ID:From; b=LFgn8B7FTLnFME1VzLP5JcWwXeC66pS9pUw4T1QqrvUP+xo0PDGR8ZPenALBqaZGj ynMG8NbGk/B2OX1mw8L3Vw4OWgXVM9/9UdzOpcelJCvJCsYph436CQLX1hi+mKhuvr zXYN06aSrp1Z6Jn1rils8pArrXq/8aPkzZbNt2H4= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728885AbgEETIc (ORCPT ); Tue, 5 May 2020 15:08:32 -0400 Received: from mail.kernel.org ([198.145.29.99]:52082 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726350AbgEETIb (ORCPT ); Tue, 5 May 2020 15:08:31 -0400 Received: from localhost (unknown [104.132.1.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id DD2D8206B9; Tue, 5 May 2020 19:08:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588705711; bh=mVzsMafczB2qs5W4j7HW8BQBAAFyRC6PAqX0Q2mK0f0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=RU4+H/3k94TUb+vRJxvUd8LSDzIgogLbrBNFDkfR3mygf+YHJmSZMOf+B+YiBYuNy 1wG0m+djLQeonwmVQbvpOrvhow9qHKFDC45NJzjo4/v0QI/fVWF3fc0opCi9eht0R9 RiOUZpZAAL3vMsupVogRK1IKdHnQvjZgpCQQyPtg= Date: Tue, 5 May 2020 12:08:30 -0700 From: Jaegeuk Kim To: Eric Biggers Cc: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, kernel-team@android.com Subject: Re: [f2fs-dev] [PATCH] f2fs: get parent inode when recovering pino Message-ID: <20200505190830.GD55221@google.com> References: <20200505153139.201697-1-jaegeuk@kernel.org> <20200505165847.GA98848@gmail.com> <20200505181323.GA55221@google.com> <20200505181941.GC98848@gmail.com> <20200505184932.GC55221@google.com> <20200505190108.GB128280@sol.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200505190108.GB128280@sol.localdomain> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/05, Eric Biggers wrote: > On Tue, May 05, 2020 at 11:49:32AM -0700, Jaegeuk Kim wrote: > > How about this? > > > > From 2a6b0e53e592854306062a2dc35db2d8f79062f2 Mon Sep 17 00:00:00 2001 > > From: Jaegeuk Kim > > Date: Tue, 5 May 2020 11:33:29 -0700 > > Subject: [PATCH] f2fs: find a living dentry when finding parent ino > > > > We need to check any dentry still alive to get parent inode number. > > > > Suggested-by: Eric Biggers > > Signed-off-by: Jaegeuk Kim > > --- > > fs/f2fs/file.c | 5 ++--- > > 1 file changed, 2 insertions(+), 3 deletions(-) > > > > diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c > > index a0a4413d6083b..95139cb85faca 100644 > > --- a/fs/f2fs/file.c > > +++ b/fs/f2fs/file.c > > @@ -169,9 +169,8 @@ static int get_parent_ino(struct inode *inode, nid_t *pino) > > { > > struct dentry *dentry; > > > > - inode = igrab(inode); > > - dentry = d_find_any_alias(inode); > > - iput(inode); > > + /* Need to check if valid dentry still exists. */ > > + dentry = d_find_alias(inode); > > if (!dentry) > > return 0; > > > > It's fine, but it could use some more explanation. (What's a "valid dentry"?) > How about the following? Cool, I took this. Thanks, > > >From f8fe7d57eead1423e8548ac7a5ec881d701466a5 Mon Sep 17 00:00:00 2001 > From: Eric Biggers > Date: Tue, 5 May 2020 11:41:11 -0700 > Subject: [PATCH] f2fs: correctly fix the parent inode number during fsync() > > fsync() may be called on a deleted file that's still open. So when > fsync() tries to set the parent inode number when the inode has > LOST_PINO and i_nlink == 1 (to avoid later checkpoints), it needs to > make sure to get the parent directory via a non-deleted alias. > > Also remove the unnecessary igrab() and iput(), as the caller already > holds a reference to the inode. > > Signed-off-by: Eric Biggers > --- > fs/f2fs/file.c | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > > diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c > index 6ab8f621a3c5a2..b3069188fd3478 100644 > --- a/fs/f2fs/file.c > +++ b/fs/f2fs/file.c > @@ -165,9 +165,11 @@ static int get_parent_ino(struct inode *inode, nid_t *pino) > { > struct dentry *dentry; > > - inode = igrab(inode); > - dentry = d_find_any_alias(inode); > - iput(inode); > + /* > + * Make sure to get the non-deleted alias. The alias associated with > + * the open file descriptor being fsync()'ed may be deleted already. > + */ > + dentry = d_find_alias(inode); > if (!dentry) > return 0; > > -- > 2.26.2