Re: [PATCH v4] erofs: accept source file descriptor via fsconfig

Christian Brauner <[email protected]> Thu, 23 Jul 2026 16:46:29 +0200
Newsgroups org.ozlabs.lists.linux-erofs,org.kernel.vger.linux-fsdevel
Message-ID <20260723-wickeln-schindel-rotstift-d987d4e9c036@brauner>
> I'm not quite sure if I catched the point, I think Giuseppe's patch here
> tried to record `file` into `sbi->dif0.file` (which indicates the primary
> "device" later.)
> 
> And if `sbi->dif0.file` is set up by erofs_fc_parse_source(),
> erofs_fc_get_tree() will just use `sbi->dif0.file` instead of
> `fc->source` according to this patch.

Oh, so you only do it for file-backed mounts. Do you only allow regular
files or do you also support block devices with
CONFIG_EROFS_FS_BACKED_BY_FILE?

Do you document the expected behavior for the file you're consuming?
Meaning, are concurrent modifications supported and what type of
behavior does this exhibit?

> The reason why `fc->source` is set was discussed in the
> thread of the previous version suggested by Aleksa.
> 
> > 
> > If they close it before this means you can mount something completely
> > different. The other thing is even if they keep the fd open someone
> > could just rename the damn thing and fc->source ends up pointing
> > somwhere completely different. The could switch namespaces as well in
> > some circumstances and then it points again into wherever.
> > 
> > I've played with that fd idea before. The only way to make this work
> > correctly is if you plumb this down into get_tree_nodev()
> 
> fc->source in this case has no use in erofs_fc_get_tree() (`fc->source`
> is just used for mountinfo for example), `sbi->dif0.file` works instead
> I hope I don't misunderstand something.

No, I misunderstood this.