diff options
author | 2019-11-19 15:31:46 +0200 | |
---|---|---|
committer | 2020-03-17 15:04:22 +0100 | |
commit | 62c832ed4e1b67cc65d909005aae5ce7031a2b38 (patch) | |
tree | f9a7a2103b79c4068be7a3f878d1f8d264d40a98 /fs/overlayfs/super.c | |
parent | ovl: factor out helper ovl_get_root() (diff) | |
download | linux-62c832ed4e1b67cc65d909005aae5ce7031a2b38.tar.gz linux-62c832ed4e1b67cc65d909005aae5ce7031a2b38.tar.bz2 linux-62c832ed4e1b67cc65d909005aae5ce7031a2b38.zip |
ovl: simplify i_ino initialization
Move i_ino initialization to ovl_inode_init() to avoid the dance of setting
i_ino in ovl_fill_inode() sometimes on the first call and sometimes on the
seconds call.
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Diffstat (limited to 'fs/overlayfs/super.c')
-rw-r--r-- | fs/overlayfs/super.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c index ae9e8b0877f3..4db51c7f48e1 100644 --- a/fs/overlayfs/super.c +++ b/fs/overlayfs/super.c @@ -1594,6 +1594,13 @@ static struct dentry *ovl_get_root(struct super_block *sb, struct ovl_entry *oe) { struct dentry *root; + struct ovl_path *lowerpath = &oe->lowerstack[0]; + unsigned long ino = d_inode(lowerpath->dentry)->i_ino; + int fsid = lowerpath->layer->fsid; + struct ovl_inode_params oip = { + .upperdentry = upperdentry, + .lowerpath = lowerpath, + }; root = d_make_root(ovl_new_inode(sb, S_IFDIR, 0)); if (!root) @@ -1602,6 +1609,9 @@ static struct dentry *ovl_get_root(struct super_block *sb, root->d_fsdata = oe; if (upperdentry) { + /* Root inode uses upper st_ino/i_ino */ + ino = d_inode(upperdentry)->i_ino; + fsid = 0; ovl_dentry_set_upper_alias(root); if (ovl_is_impuredir(upperdentry)) ovl_set_flag(OVL_IMPURE, d_inode(root)); @@ -1611,8 +1621,7 @@ static struct dentry *ovl_get_root(struct super_block *sb, ovl_set_flag(OVL_WHITEOUTS, d_inode(root)); ovl_dentry_set_flag(OVL_E_CONNECTED, root); ovl_set_upperdata(d_inode(root)); - ovl_inode_init(d_inode(root), upperdentry, ovl_dentry_lower(root), - NULL); + ovl_inode_init(d_inode(root), &oip, ino, fsid); return root; } |