@@ -224,7 +224,7 @@ static void ovl_free_fs(struct ovl_fs *ofs)
224
224
ovl_inuse_unlock (ofs -> workbasedir );
225
225
dput (ofs -> workbasedir );
226
226
if (ofs -> upperdir_locked )
227
- ovl_inuse_unlock (ofs -> upper_mnt -> mnt_root );
227
+ ovl_inuse_unlock (ovl_upper_mnt ( ofs ) -> mnt_root );
228
228
mntput (ofs -> upper_mnt );
229
229
for (i = 1 ; i < ofs -> numlayer ; i ++ ) {
230
230
iput (ofs -> layers [i ].trap );
@@ -258,7 +258,7 @@ static int ovl_sync_fs(struct super_block *sb, int wait)
258
258
struct super_block * upper_sb ;
259
259
int ret ;
260
260
261
- if (!ofs -> upper_mnt )
261
+ if (!ovl_upper_mnt ( ofs ) )
262
262
return 0 ;
263
263
264
264
/*
@@ -272,7 +272,7 @@ static int ovl_sync_fs(struct super_block *sb, int wait)
272
272
if (!wait )
273
273
return 0 ;
274
274
275
- upper_sb = ofs -> upper_mnt -> mnt_sb ;
275
+ upper_sb = ovl_upper_mnt ( ofs ) -> mnt_sb ;
276
276
277
277
down_read (& upper_sb -> s_umount );
278
278
ret = sync_filesystem (upper_sb );
@@ -310,7 +310,7 @@ static int ovl_statfs(struct dentry *dentry, struct kstatfs *buf)
310
310
/* Will this overlay be forced to mount/remount ro? */
311
311
static bool ovl_force_readonly (struct ovl_fs * ofs )
312
312
{
313
- return (!ofs -> upper_mnt || !ofs -> workdir );
313
+ return (!ovl_upper_mnt ( ofs ) || !ofs -> workdir );
314
314
}
315
315
316
316
static const char * ovl_redirect_mode_def (void )
@@ -372,7 +372,7 @@ static int ovl_remount(struct super_block *sb, int *flags, char *data)
372
372
return - EROFS ;
373
373
374
374
if (* flags & SB_RDONLY && !sb_rdonly (sb )) {
375
- upper_sb = ofs -> upper_mnt -> mnt_sb ;
375
+ upper_sb = ovl_upper_mnt ( ofs ) -> mnt_sb ;
376
376
down_read (& upper_sb -> s_umount );
377
377
ret = sync_filesystem (upper_sb );
378
378
up_read (& upper_sb -> s_umount );
@@ -669,7 +669,7 @@ static struct dentry *ovl_workdir_create(struct ovl_fs *ofs,
669
669
const char * name , bool persist )
670
670
{
671
671
struct inode * dir = ofs -> workbasedir -> d_inode ;
672
- struct vfsmount * mnt = ofs -> upper_mnt ;
672
+ struct vfsmount * mnt = ovl_upper_mnt ( ofs ) ;
673
673
struct dentry * work ;
674
674
int err ;
675
675
bool retried = false;
@@ -1122,7 +1122,7 @@ static int ovl_get_upper(struct super_block *sb, struct ovl_fs *ofs,
1122
1122
if (upper_mnt -> mnt_sb -> s_flags & SB_NOSEC )
1123
1123
sb -> s_flags |= SB_NOSEC ;
1124
1124
1125
- if (ovl_inuse_trylock (ofs -> upper_mnt -> mnt_root )) {
1125
+ if (ovl_inuse_trylock (ovl_upper_mnt ( ofs ) -> mnt_root )) {
1126
1126
ofs -> upperdir_locked = true;
1127
1127
} else {
1128
1128
err = ovl_report_in_use (ofs , "upperdir" );
@@ -1198,7 +1198,7 @@ static int ovl_check_rename_whiteout(struct dentry *workdir)
1198
1198
static int ovl_make_workdir (struct super_block * sb , struct ovl_fs * ofs ,
1199
1199
struct path * workpath )
1200
1200
{
1201
- struct vfsmount * mnt = ofs -> upper_mnt ;
1201
+ struct vfsmount * mnt = ovl_upper_mnt ( ofs ) ;
1202
1202
struct dentry * temp ;
1203
1203
bool rename_whiteout ;
1204
1204
bool d_type ;
@@ -1342,7 +1342,7 @@ static int ovl_get_workdir(struct super_block *sb, struct ovl_fs *ofs,
1342
1342
static int ovl_get_indexdir (struct super_block * sb , struct ovl_fs * ofs ,
1343
1343
struct ovl_entry * oe , struct path * upperpath )
1344
1344
{
1345
- struct vfsmount * mnt = ofs -> upper_mnt ;
1345
+ struct vfsmount * mnt = ovl_upper_mnt ( ofs ) ;
1346
1346
int err ;
1347
1347
1348
1348
err = mnt_want_write (mnt );
@@ -1398,7 +1398,7 @@ static bool ovl_lower_uuid_ok(struct ovl_fs *ofs, const uuid_t *uuid)
1398
1398
{
1399
1399
unsigned int i ;
1400
1400
1401
- if (!ofs -> config .nfs_export && !ofs -> upper_mnt )
1401
+ if (!ofs -> config .nfs_export && !ovl_upper_mnt ( ofs ) )
1402
1402
return true;
1403
1403
1404
1404
for (i = 0 ; i < ofs -> numfs ; i ++ ) {
@@ -1477,7 +1477,7 @@ static int ovl_get_layers(struct super_block *sb, struct ovl_fs *ofs,
1477
1477
/* idx/fsid 0 are reserved for upper fs even with lower only overlay */
1478
1478
ofs -> numfs ++ ;
1479
1479
1480
- layers [0 ].mnt = ofs -> upper_mnt ;
1480
+ layers [0 ].mnt = ovl_upper_mnt ( ofs ) ;
1481
1481
layers [0 ].idx = 0 ;
1482
1482
layers [0 ].fsid = 0 ;
1483
1483
ofs -> numlayer = 1 ;
@@ -1494,8 +1494,8 @@ static int ovl_get_layers(struct super_block *sb, struct ovl_fs *ofs,
1494
1494
goto out ;
1495
1495
}
1496
1496
1497
- if (ofs -> upper_mnt ) {
1498
- ofs -> fs [0 ].sb = ofs -> upper_mnt -> mnt_sb ;
1497
+ if (ovl_upper_mnt ( ofs ) ) {
1498
+ ofs -> fs [0 ].sb = ovl_upper_mnt ( ofs ) -> mnt_sb ;
1499
1499
ofs -> fs [0 ].is_lower = false;
1500
1500
}
1501
1501
@@ -1550,7 +1550,7 @@ static int ovl_get_layers(struct super_block *sb, struct ovl_fs *ofs,
1550
1550
* inode number or a non persistent inode number allocated from a
1551
1551
* dedicated range.
1552
1552
*/
1553
- if (ofs -> numfs - !ofs -> upper_mnt == 1 ) {
1553
+ if (ofs -> numfs - !ovl_upper_mnt ( ofs ) == 1 ) {
1554
1554
if (ofs -> config .xino == OVL_XINO_ON )
1555
1555
pr_info ("\"xino=on\" is useless with all layers on same fs, ignore.\n" );
1556
1556
ofs -> xino_mode = 0 ;
@@ -1699,8 +1699,8 @@ static int ovl_check_overlapping_layers(struct super_block *sb,
1699
1699
{
1700
1700
int i , err ;
1701
1701
1702
- if (ofs -> upper_mnt ) {
1703
- err = ovl_check_layer (sb , ofs , ofs -> upper_mnt -> mnt_root ,
1702
+ if (ovl_upper_mnt ( ofs ) ) {
1703
+ err = ovl_check_layer (sb , ofs , ovl_upper_mnt ( ofs ) -> mnt_root ,
1704
1704
"upperdir" );
1705
1705
if (err )
1706
1706
return err ;
@@ -1836,8 +1836,8 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent)
1836
1836
if (!ofs -> workdir )
1837
1837
sb -> s_flags |= SB_RDONLY ;
1838
1838
1839
- sb -> s_stack_depth = ofs -> upper_mnt -> mnt_sb -> s_stack_depth ;
1840
- sb -> s_time_gran = ofs -> upper_mnt -> mnt_sb -> s_time_gran ;
1839
+ sb -> s_stack_depth = ovl_upper_mnt ( ofs ) -> mnt_sb -> s_stack_depth ;
1840
+ sb -> s_time_gran = ovl_upper_mnt ( ofs ) -> mnt_sb -> s_time_gran ;
1841
1841
1842
1842
}
1843
1843
oe = ovl_get_lowerstack (sb , ofs );
@@ -1846,7 +1846,7 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent)
1846
1846
goto out_err ;
1847
1847
1848
1848
/* If the upper fs is nonexistent, we mark overlayfs r/o too */
1849
- if (!ofs -> upper_mnt )
1849
+ if (!ovl_upper_mnt ( ofs ) )
1850
1850
sb -> s_flags |= SB_RDONLY ;
1851
1851
1852
1852
if (!(ovl_force_readonly (ofs )) && ofs -> config .index ) {
@@ -1874,7 +1874,7 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent)
1874
1874
/* Show index=off in /proc/mounts for forced r/o mount */
1875
1875
if (!ofs -> indexdir ) {
1876
1876
ofs -> config .index = false;
1877
- if (ofs -> upper_mnt && ofs -> config .nfs_export ) {
1877
+ if (ovl_upper_mnt ( ofs ) && ofs -> config .nfs_export ) {
1878
1878
pr_warn ("NFS export requires an index dir, falling back to nfs_export=off.\n" );
1879
1879
ofs -> config .nfs_export = false;
1880
1880
}
0 commit comments