Re: [PATCH 1/4] coda: never point a file's f_mapping at a container's mapping

From: Jan Harkes

Date: Sat Nov 28 2026 - 14:40:46 EST


On Fri, Nov 27, 2026 at 10:23:08PM -0800, Andrew Morton wrote:
> On Fri, 27 Nov 2026 20:10:13 -0500 Jan Harkes <jaharkes@xxxxxxxxxx> wrote:
> > > Yeah, I hit this while getting
> > > tools/testing/selftests/mm/memory-failure.c to work on all Linux
> > > filesystems.
> >
> > Did you test this without the actual Coda userspace? What was the
> > cache consistency model your userspace was using?
>
> Couldn't figure out how to get Venus working (I wouldn't know what a
> coda is if it bit me on the foot!) so a mockup thing over tmpfs was
> used in place.
>
> <tries harder>
>
> OK, reran with real Venus and a writable file on the server. The below
> repro makes a writable shared mapping, then opens and maps it again
> while the first mapping is live. All 300 first mappings succeeded and
> 299 of the 300 second mappings failed with EPERM. This uses one Coda
> file and doesn't depend on Venus changing containers between opens.
>
> That one-line-removal fixes this up.

Thank you so much for running that test. Rereading what I wrote, I'm
sorry for my tone and truly appreciate the effort you put in reproducing
the bug.

Now I am really confused as to what the use of file->f_mapping actually
is. I thought I understood how this mmap stuff worked, but clearly I do not.

> I also hit a lockdep splat along the way. That's also appended along
> with a slop-coded "fix" which I haven't even looked at, sorry. But it
> did make the splat go away.

Sweet, it may be slop coded but it looks good. It fixes both the lockdep
my moving the upcall copy_to_user outside of the locked region, but it
also corrects an obvious bug in the error handling when copy_to_user fails.

Thank you,

Jan