@@ -676,6 +676,13 @@ static const struct export_operations erofs_export_ops = {
676
676
.get_parent = erofs_get_parent ,
677
677
};
678
678
679
+ static int erofs_fc_fill_pseudo_super (struct super_block * sb , struct fs_context * fc )
680
+ {
681
+ static const struct tree_descr empty_descr = {"" };
682
+
683
+ return simple_fill_super (sb , EROFS_SUPER_MAGIC , & empty_descr );
684
+ }
685
+
679
686
static int erofs_fc_fill_super (struct super_block * sb , struct fs_context * fc )
680
687
{
681
688
struct inode * inode ;
@@ -776,6 +783,11 @@ static int erofs_fc_fill_super(struct super_block *sb, struct fs_context *fc)
776
783
return 0 ;
777
784
}
778
785
786
+ static int erofs_fc_anon_get_tree (struct fs_context * fc )
787
+ {
788
+ return get_tree_nodev (fc , erofs_fc_fill_pseudo_super );
789
+ }
790
+
779
791
static int erofs_fc_get_tree (struct fs_context * fc )
780
792
{
781
793
struct erofs_fs_context * ctx = fc -> fs_private ;
@@ -844,10 +856,21 @@ static const struct fs_context_operations erofs_context_ops = {
844
856
.free = erofs_fc_free ,
845
857
};
846
858
859
+ static const struct fs_context_operations erofs_anon_context_ops = {
860
+ .get_tree = erofs_fc_anon_get_tree ,
861
+ };
862
+
847
863
static int erofs_init_fs_context (struct fs_context * fc )
848
864
{
849
- struct erofs_fs_context * ctx = kzalloc (sizeof (* ctx ), GFP_KERNEL );
865
+ struct erofs_fs_context * ctx ;
866
+
867
+ /* pseudo mount for anon inodes */
868
+ if (fc -> sb_flags & SB_KERNMOUNT ) {
869
+ fc -> ops = & erofs_anon_context_ops ;
870
+ return 0 ;
871
+ }
850
872
873
+ ctx = kzalloc (sizeof (* ctx ), GFP_KERNEL );
851
874
if (!ctx )
852
875
return - ENOMEM ;
853
876
ctx -> devs = kzalloc (sizeof (struct erofs_dev_context ), GFP_KERNEL );
@@ -874,6 +897,12 @@ static void erofs_kill_sb(struct super_block *sb)
874
897
875
898
WARN_ON (sb -> s_magic != EROFS_SUPER_MAGIC );
876
899
900
+ /* pseudo mount for anon inodes */
901
+ if (sb -> s_flags & SB_KERNMOUNT ) {
902
+ kill_anon_super (sb );
903
+ return ;
904
+ }
905
+
877
906
if (erofs_is_fscache_mode (sb ))
878
907
kill_anon_super (sb );
879
908
else
@@ -907,7 +936,7 @@ static void erofs_put_super(struct super_block *sb)
907
936
erofs_fscache_unregister_fs (sb );
908
937
}
909
938
910
- static struct file_system_type erofs_fs_type = {
939
+ struct file_system_type erofs_fs_type = {
911
940
.owner = THIS_MODULE ,
912
941
.name = "erofs" ,
913
942
.init_fs_context = erofs_init_fs_context ,
0 commit comments