@@ -533,11 +533,13 @@ impl Vfs {
533
533
// cross mountpoint, return mount root entry
534
534
entry = mnt. root_entry ;
535
535
entry. inode = self . convert_inode ( mnt. fs_idx , mnt. ino ) ?;
536
+ entry. attr . st_ino = entry. inode ;
536
537
trace ! (
537
- "vfs lookup cross mountpoint, return new mount fs_idx {} inode { } fuse inode { }" ,
538
+ "vfs lookup cross mountpoint, return new mount fs_idx {} inode 0x{:x } fuse inode 0x{:x}, attr inode 0x{:x }" ,
538
539
mnt. fs_idx,
539
540
mnt. ino,
540
- entry. inode
541
+ entry. inode,
542
+ entry. attr. st_ino,
541
543
) ;
542
544
}
543
545
None => entry. inode = self . convert_inode ( idata. fs_idx ( ) , entry. inode ) ?,
@@ -560,6 +562,18 @@ mod tests {
560
562
fn lookup ( & self , _: & Context , _: Self :: Inode , _: & CStr ) -> Result < Entry > {
561
563
Ok ( Entry :: default ( ) )
562
564
}
565
+ fn getattr (
566
+ & self ,
567
+ _ctx : & Context ,
568
+ _inode : Self :: Inode ,
569
+ _handle : Option < Self :: Handle > ,
570
+ ) -> Result < ( stat64 , Duration ) > {
571
+ let mut attr = Attr {
572
+ ..Default :: default ( )
573
+ } ;
574
+ attr. ino = 1 ;
575
+ Ok ( ( attr. into ( ) , Duration :: from_secs ( 1 ) ) )
576
+ }
563
577
}
564
578
565
579
pub ( crate ) struct FakeFileSystemTwo { }
@@ -1013,6 +1027,11 @@ mod tests {
1013
1027
)
1014
1028
. unwrap ( ) ;
1015
1029
assert_eq ! ( entry3. inode, 0 ) ;
1030
+
1031
+ let ( stat, _) = vfs
1032
+ . getattr ( & ctx, VfsInode ( 0x100_0000_0000_0001 ) , None )
1033
+ . unwrap ( ) ;
1034
+ assert_eq ! ( stat. st_ino, 0x100_0000_0000_0001 ) ;
1016
1035
}
1017
1036
1018
1037
#[ test]
@@ -1022,6 +1041,18 @@ mod tests {
1022
1041
let fs2 = FakeFileSystemTwo { } ;
1023
1042
assert ! ( vfs. mount( Box :: new( fs1) , "/foo" ) . is_ok( ) ) ;
1024
1043
assert ! ( vfs. mount( Box :: new( fs2) , "/bar" ) . is_ok( ) ) ;
1044
+
1045
+ // Lookup inode on pseudo file system.
1046
+ let ctx = Context :: new ( ) ;
1047
+ let entry1 = vfs
1048
+ . lookup (
1049
+ & ctx,
1050
+ ROOT_ID . into ( ) ,
1051
+ CString :: new ( "bar" ) . unwrap ( ) . as_c_str ( ) ,
1052
+ )
1053
+ . unwrap ( ) ;
1054
+ assert_eq ! ( entry1. inode, 0x200_0000_0000_0001 ) ;
1055
+ assert_eq ! ( entry1. attr. st_ino, 0x200_0000_0000_0001 ) ;
1025
1056
}
1026
1057
1027
1058
#[ test]
0 commit comments