@@ -1589,6 +1589,34 @@ static int ovl_check_overlapping_layers(struct super_block *sb,
1589
1589
return 0 ;
1590
1590
}
1591
1591
1592
+ static struct dentry * ovl_get_root (struct super_block * sb ,
1593
+ struct dentry * upperdentry ,
1594
+ struct ovl_entry * oe )
1595
+ {
1596
+ struct dentry * root ;
1597
+
1598
+ root = d_make_root (ovl_new_inode (sb , S_IFDIR , 0 ));
1599
+ if (!root )
1600
+ return NULL ;
1601
+
1602
+ root -> d_fsdata = oe ;
1603
+
1604
+ if (upperdentry ) {
1605
+ ovl_dentry_set_upper_alias (root );
1606
+ if (ovl_is_impuredir (upperdentry ))
1607
+ ovl_set_flag (OVL_IMPURE , d_inode (root ));
1608
+ }
1609
+
1610
+ /* Root is always merge -> can have whiteouts */
1611
+ ovl_set_flag (OVL_WHITEOUTS , d_inode (root ));
1612
+ ovl_dentry_set_flag (OVL_E_CONNECTED , root );
1613
+ ovl_set_upperdata (d_inode (root ));
1614
+ ovl_inode_init (d_inode (root ), upperdentry , ovl_dentry_lower (root ),
1615
+ NULL );
1616
+
1617
+ return root ;
1618
+ }
1619
+
1592
1620
static int ovl_fill_super (struct super_block * sb , void * data , int silent )
1593
1621
{
1594
1622
struct path upperpath = { };
@@ -1710,25 +1738,11 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent)
1710
1738
sb -> s_flags |= SB_POSIXACL ;
1711
1739
1712
1740
err = - ENOMEM ;
1713
- root_dentry = d_make_root ( ovl_new_inode ( sb , S_IFDIR , 0 ) );
1741
+ root_dentry = ovl_get_root ( sb , upperpath . dentry , oe );
1714
1742
if (!root_dentry )
1715
1743
goto out_free_oe ;
1716
1744
1717
- root_dentry -> d_fsdata = oe ;
1718
-
1719
1745
mntput (upperpath .mnt );
1720
- if (upperpath .dentry ) {
1721
- ovl_dentry_set_upper_alias (root_dentry );
1722
- if (ovl_is_impuredir (upperpath .dentry ))
1723
- ovl_set_flag (OVL_IMPURE , d_inode (root_dentry ));
1724
- }
1725
-
1726
- /* Root is always merge -> can have whiteouts */
1727
- ovl_set_flag (OVL_WHITEOUTS , d_inode (root_dentry ));
1728
- ovl_dentry_set_flag (OVL_E_CONNECTED , root_dentry );
1729
- ovl_set_upperdata (d_inode (root_dentry ));
1730
- ovl_inode_init (d_inode (root_dentry ), upperpath .dentry ,
1731
- ovl_dentry_lower (root_dentry ), NULL );
1732
1746
1733
1747
sb -> s_root = root_dentry ;
1734
1748
0 commit comments