Linux Overlay Filesystem development
 help / color / mirror / Atom feed
From: Amir Goldstein <amir73il@gmail.com>
To: Miklos Szeredi <miklos@szeredi.hu>
Cc: Christian Brauner <brauner@kernel.org>, linux-unionfs@vger.kernel.org
Subject: [PATCH v2 2/5] ovl: clarify ovl_get_root() semantics
Date: Sat, 17 Jun 2023 11:46:59 +0300	[thread overview]
Message-ID: <20230617084702.2468470-3-amir73il@gmail.com> (raw)
In-Reply-To: <20230617084702.2468470-1-amir73il@gmail.com>

Change the semantics to take a reference on upperdentry instead
of transferrig the reference.

This is needed for upcoming port to new mount api.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
---
 fs/overlayfs/super.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
index ee9adb413d0e..280f2aa2f356 100644
--- a/fs/overlayfs/super.c
+++ b/fs/overlayfs/super.c
@@ -1922,6 +1922,8 @@ static struct dentry *ovl_get_root(struct super_block *sb,
 	ovl_set_upperdata(d_inode(root));
 	ovl_inode_init(d_inode(root), &oip, ino, fsid);
 	ovl_dentry_init_flags(root, upperdentry, oe, DCACHE_OP_WEAK_REVALIDATE);
+	/* root keeps a reference of upperdentry */
+	dget(upperdentry);
 
 	return root;
 }
@@ -2100,7 +2102,7 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent)
 	if (!root_dentry)
 		goto out_free_oe;
 
-	mntput(upperpath.mnt);
+	path_put(&upperpath);
 	kfree(splitlower);
 
 	sb->s_root = root_dentry;
-- 
2.34.1


  parent reply	other threads:[~2023-06-17  8:47 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-17  8:46 [PATCH v2 0/5] Prep patches for porting overlayfs to new mount api Amir Goldstein
2023-06-17  8:46 ` [PATCH v2 1/5] ovl: negate the ofs->share_whiteout boolean Amir Goldstein
2023-06-20  9:20   ` Christian Brauner
2023-06-17  8:46 ` Amir Goldstein [this message]
2023-06-20  9:21   ` [PATCH v2 2/5] ovl: clarify ovl_get_root() semantics Christian Brauner
2023-06-17  8:47 ` [PATCH v2 3/5] ovl: pass ovl_fs to xino helpers Amir Goldstein
2023-06-20  9:21   ` Christian Brauner
2023-06-17  8:47 ` [PATCH v2 4/5] ovl: store enum redirect_mode in config instead of a string Amir Goldstein
2023-06-20  8:48   ` Miklos Szeredi
2023-06-20  8:50     ` Miklos Szeredi
2023-06-20  9:23   ` Christian Brauner
2023-06-17  8:47 ` [PATCH v2 5/5] ovl: factor out ovl_parse_options() helper Amir Goldstein
2023-06-20  9:19   ` Christian Brauner
2023-06-20  9:26 ` [PATCH v2 0/5] Prep patches for porting overlayfs to new mount api Christian Brauner
2023-06-20  9:46   ` Amir Goldstein
2023-06-20 10:12     ` Christian Brauner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230617084702.2468470-3-amir73il@gmail.com \
    --to=amir73il@gmail.com \
    --cc=brauner@kernel.org \
    --cc=linux-unionfs@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox