@@ -30,8 +30,9 @@ static int ovl_check_redirect(struct dentry *dentry, struct ovl_lookup_data *d,
3030{
3131 int res ;
3232 char * buf ;
33+ struct ovl_fs * ofs = OVL_FS (d -> sb );
3334
34- buf = ovl_get_redirect_xattr (dentry , prelen + strlen (post ));
35+ buf = ovl_get_redirect_xattr (ofs , dentry , prelen + strlen (post ));
3536 if (IS_ERR_OR_NULL (buf ))
3637 return PTR_ERR (buf );
3738
@@ -104,12 +105,13 @@ int ovl_check_fb_len(struct ovl_fb *fb, int fb_len)
104105 return 0 ;
105106}
106107
107- static struct ovl_fh * ovl_get_fh (struct dentry * dentry , const char * name )
108+ static struct ovl_fh * ovl_get_fh (struct ovl_fs * ofs , struct dentry * dentry ,
109+ const char * name )
108110{
109111 int res , err ;
110112 struct ovl_fh * fh = NULL ;
111113
112- res = ovl_do_getxattr (dentry , name , NULL , 0 );
114+ res = ovl_do_getxattr (ofs , dentry , name , NULL , 0 );
113115 if (res < 0 ) {
114116 if (res == - ENODATA || res == - EOPNOTSUPP )
115117 return NULL ;
@@ -123,7 +125,7 @@ static struct ovl_fh *ovl_get_fh(struct dentry *dentry, const char *name)
123125 if (!fh )
124126 return ERR_PTR (- ENOMEM );
125127
126- res = ovl_do_getxattr (dentry , name , fh -> buf , res );
128+ res = ovl_do_getxattr (ofs , dentry , name , fh -> buf , res );
127129 if (res < 0 )
128130 goto fail ;
129131
@@ -186,9 +188,9 @@ struct dentry *ovl_decode_real_fh(struct ovl_fh *fh, struct vfsmount *mnt,
186188 return real ;
187189}
188190
189- static bool ovl_is_opaquedir (struct dentry * dentry )
191+ static bool ovl_is_opaquedir (struct super_block * sb , struct dentry * dentry )
190192{
191- return ovl_check_dir_xattr (dentry , OVL_XATTR_OPAQUE );
193+ return ovl_check_dir_xattr (sb , dentry , OVL_XATTR_OPAQUE );
192194}
193195
194196static struct dentry * ovl_lookup_positive_unlocked (const char * name ,
@@ -251,7 +253,7 @@ static int ovl_lookup_single(struct dentry *base, struct ovl_lookup_data *d,
251253 d -> stop = true;
252254 goto put_and_out ;
253255 }
254- err = ovl_check_metacopy_xattr (this );
256+ err = ovl_check_metacopy_xattr (OVL_FS ( d -> sb ), this );
255257 if (err < 0 )
256258 goto out_err ;
257259
@@ -271,7 +273,7 @@ static int ovl_lookup_single(struct dentry *base, struct ovl_lookup_data *d,
271273 if (d -> last )
272274 goto out ;
273275
274- if (ovl_is_opaquedir (this )) {
276+ if (ovl_is_opaquedir (d -> sb , this )) {
275277 d -> stop = true;
276278 if (last_element )
277279 d -> opaque = true;
@@ -391,7 +393,7 @@ int ovl_check_origin_fh(struct ovl_fs *ofs, struct ovl_fh *fh, bool connected,
391393static int ovl_check_origin (struct ovl_fs * ofs , struct dentry * upperdentry ,
392394 struct ovl_path * * stackp )
393395{
394- struct ovl_fh * fh = ovl_get_fh (upperdentry , OVL_XATTR_ORIGIN );
396+ struct ovl_fh * fh = ovl_get_fh (ofs , upperdentry , OVL_XATTR_ORIGIN );
395397 int err ;
396398
397399 if (IS_ERR_OR_NULL (fh ))
@@ -413,10 +415,10 @@ static int ovl_check_origin(struct ovl_fs *ofs, struct dentry *upperdentry,
413415 * Verify that @fh matches the file handle stored in xattr @name.
414416 * Return 0 on match, -ESTALE on mismatch, < 0 on error.
415417 */
416- static int ovl_verify_fh (struct dentry * dentry , const char * name ,
417- const struct ovl_fh * fh )
418+ static int ovl_verify_fh (struct ovl_fs * ofs , struct dentry * dentry ,
419+ const char * name , const struct ovl_fh * fh )
418420{
419- struct ovl_fh * ofh = ovl_get_fh (dentry , name );
421+ struct ovl_fh * ofh = ovl_get_fh (ofs , dentry , name );
420422 int err = 0 ;
421423
422424 if (!ofh )
@@ -440,8 +442,9 @@ static int ovl_verify_fh(struct dentry *dentry, const char *name,
440442 *
441443 * Return 0 on match, -ESTALE on mismatch, -ENODATA on no xattr, < 0 on error.
442444 */
443- int ovl_verify_set_fh (struct dentry * dentry , const char * name ,
444- struct dentry * real , bool is_upper , bool set )
445+ int ovl_verify_set_fh (struct ovl_fs * ofs , struct dentry * dentry ,
446+ const char * name , struct dentry * real , bool is_upper ,
447+ bool set )
445448{
446449 struct inode * inode ;
447450 struct ovl_fh * fh ;
@@ -454,9 +457,9 @@ int ovl_verify_set_fh(struct dentry *dentry, const char *name,
454457 goto fail ;
455458 }
456459
457- err = ovl_verify_fh (dentry , name , fh );
460+ err = ovl_verify_fh (ofs , dentry , name , fh );
458461 if (set && err == - ENODATA )
459- err = ovl_do_setxattr (dentry , name , fh -> buf , fh -> fb .len );
462+ err = ovl_do_setxattr (ofs , dentry , name , fh -> buf , fh -> fb .len );
460463 if (err )
461464 goto fail ;
462465
@@ -481,7 +484,7 @@ struct dentry *ovl_index_upper(struct ovl_fs *ofs, struct dentry *index)
481484 if (!d_is_dir (index ))
482485 return dget (index );
483486
484- fh = ovl_get_fh (index , OVL_XATTR_UPPER );
487+ fh = ovl_get_fh (ofs , index , OVL_XATTR_UPPER );
485488 if (IS_ERR_OR_NULL (fh ))
486489 return ERR_CAST (fh );
487490
@@ -574,7 +577,7 @@ int ovl_verify_index(struct ovl_fs *ofs, struct dentry *index)
574577 goto fail ;
575578 }
576579
577- err = ovl_verify_fh (upper , OVL_XATTR_ORIGIN , fh );
580+ err = ovl_verify_fh (ofs , upper , OVL_XATTR_ORIGIN , fh );
578581 dput (upper );
579582 if (err )
580583 goto fail ;
@@ -585,7 +588,7 @@ int ovl_verify_index(struct ovl_fs *ofs, struct dentry *index)
585588 if (err )
586589 goto fail ;
587590
588- if (ovl_get_nlink (origin .dentry , index , 0 ) == 0 )
591+ if (ovl_get_nlink (ofs , origin .dentry , index , 0 ) == 0 )
589592 goto orphan ;
590593 }
591594
@@ -741,7 +744,7 @@ struct dentry *ovl_lookup_index(struct ovl_fs *ofs, struct dentry *upper,
741744 }
742745
743746 /* Verify that dir index 'upper' xattr points to upper dir */
744- err = ovl_verify_upper (index , upper , false);
747+ err = ovl_verify_upper (ofs , index , upper , false);
745748 if (err ) {
746749 if (err == - ESTALE ) {
747750 pr_warn_ratelimited ("suspected multiply redirected dir found (upper=%pd2, origin=%pd2, index=%pd2).\n" ,
@@ -790,12 +793,12 @@ int ovl_path_next(int idx, struct dentry *dentry, struct path *path)
790793}
791794
792795/* Fix missing 'origin' xattr */
793- static int ovl_fix_origin (struct dentry * dentry , struct dentry * lower ,
794- struct dentry * upper )
796+ static int ovl_fix_origin (struct ovl_fs * ofs , struct dentry * dentry ,
797+ struct dentry * lower , struct dentry * upper )
795798{
796799 int err ;
797800
798- if (ovl_check_origin_xattr (upper ))
801+ if (ovl_check_origin_xattr (ofs , upper ))
799802 return 0 ;
800803
801804 err = ovl_want_write (dentry );
@@ -920,7 +923,7 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry,
920923 * of lower dir and set upper parent "impure".
921924 */
922925 if (upperdentry && !ctr && !ofs -> noxattr && d .is_dir ) {
923- err = ovl_fix_origin (dentry , this , upperdentry );
926+ err = ovl_fix_origin (ofs , dentry , this , upperdentry );
924927 if (err ) {
925928 dput (this );
926929 goto out_put ;
@@ -939,7 +942,7 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry,
939942 if (upperdentry && !ctr &&
940943 ((d .is_dir && ovl_verify_lower (dentry -> d_sb )) ||
941944 (!d .is_dir && ofs -> config .index && origin_path ))) {
942- err = ovl_verify_origin (upperdentry , this , false);
945+ err = ovl_verify_origin (ofs , upperdentry , this , false);
943946 if (err ) {
944947 dput (this );
945948 if (d .is_dir )
@@ -1060,13 +1063,13 @@ struct dentry *ovl_lookup(struct inode *dir, struct dentry *dentry,
10601063 ovl_dentry_set_upper_alias (dentry );
10611064 else if (index ) {
10621065 upperdentry = dget (index );
1063- upperredirect = ovl_get_redirect_xattr (upperdentry , 0 );
1066+ upperredirect = ovl_get_redirect_xattr (ofs , upperdentry , 0 );
10641067 if (IS_ERR (upperredirect )) {
10651068 err = PTR_ERR (upperredirect );
10661069 upperredirect = NULL ;
10671070 goto out_free_oe ;
10681071 }
1069- err = ovl_check_metacopy_xattr (upperdentry );
1072+ err = ovl_check_metacopy_xattr (ofs , upperdentry );
10701073 if (err < 0 )
10711074 goto out_free_oe ;
10721075 uppermetacopy = err ;
0 commit comments