Re: [RFC PATCH V2 09/12] fs: Prevent mode change if file is mmap'ed

From: Ira Weiny
Date: Wed Jan 15 2020 - 12:53:19 EST


On Wed, Jan 15, 2020 at 10:21:45AM +0000, David Laight wrote:
> From ira.weiny@xxxxxxxxx
> > Sent: 10 January 2020 19:30
> >
> > Page faults need to ensure the inode mode is correct and consistent with
> > the vmf information at the time of the fault. There is no easy way to
> > ensure the vmf information is correct if a mode change is in progress.
> > Furthermore, there is no good use case to require a mode change while
> > the file is mmap'ed.
> >
> > Track mmap's of the file and fail the mode change if the file is
> > mmap'ed.
>
> This seems wrong to me.
> I presume the 'mode changes' are from things like 'chmod -w ...'.

No... Sorry... "mode" was a _very_ bad name. In this context "mode" was the
"DAX mode" not the file mode.

> mmap() should be no different to open().
> Only the permissions set when the file is opened count.
>
> Next you'll be stopping unlink() when a file is open :-)

hehehe :-D no ... sorry that was not the meaning.

To be clear what this is preventing is a change from non-DAX to DAX or vice
versa while a file is mmap'ed.

I'm looking at a better name for this. For this commit message is this more
clear?

<commit>
fs: Prevent DAX change if file is mmap'ed

Page faults need to ensure the inode DAX configuration is correct and
consistent with the vmf information at the time of the fault. There is
no easy way to ensure the vmf information is correct if a DAX change is
in progress. Furthermore, there is no good use case to require changing
DAX configs while the file is mmap'ed.

Track mmap's of the file and fail the DAX change if the file is mmap'ed.
</commit>

Sorry for the confusion,
Ira

>
> David
>
> -
> Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
> Registration No: 1397386 (Wales)
>