Re: [RFC PATCH V2 07/12] fs: Add locking for a dynamic inode 'mode'

From: Ira Weiny
Date: Thu Jan 16 2020 - 13:54:27 EST


On Wed, Jan 15, 2020 at 09:40:40PM -0800, Darrick J. Wong wrote:
> On Wed, Jan 15, 2020 at 11:08:46AM -0800, Ira Weiny wrote:
> > On Mon, Jan 13, 2020 at 05:03:22PM -0800, Darrick J. Wong wrote:
> > > On Mon, Jan 13, 2020 at 04:20:05PM -0800, Ira Weiny wrote:
> > > > On Mon, Jan 13, 2020 at 02:12:18PM -0800, Darrick J. Wong wrote:
> > > > > On Fri, Jan 10, 2020 at 11:29:37AM -0800, ira.weiny@xxxxxxxxx wrote:
> > > > > > From: Ira Weiny <ira.weiny@xxxxxxxxx>
> >
> > [snip]
> >
> > > > > > +``lock_mode``
> > > > > > + called to prevent operations which depend on the inode's mode from
> > > > > > + proceeding should a mode change be in progress
> > > > >
> > > > > "Inodes can't change mode, because files do not suddenly become
> > > > > directories". ;)
> > > >
> > > > Yea sorry.
> > > >
> > > > >
> > > > > Oh, you meant "lock_XXXX is called to prevent a change in the pagecache
> > > > > mode from proceeding while there are address space operations in
> > > > > progress". So these are really more aops get and put functions...
> > > >
> > > > At first I actually did have aops get/put functions but this is really
> > > > protecting more than the aops vector because as Christoph said there are file
> > > > operations which need to be protected not just address space operations.
> > > >
> > > > But I agree "mode" is a bad name... Sorry...
> > >
> > > inode_fops_{get,set}(), then?
> > >
> > > inode_start_fileop()
> > > inode_end_fileop() ?
> > >
> > > Trying to avoid sounding foppish <COUGH>
> >
> > What about?
> >
> > inode_[un]lock_state()?
>
> Kinda vague -- which state? inodes retain a lot of different state.
>
> This locking primitive ensures that file operations pointers can't
> change while any operations are ongoing, right?

file ops
Address space ops
...

Whatever it needs...

With the current patch set we could be more specific and call it.

inode_[un]lock_dax_state()

Ira

>
> --D
>
> > Ira
> >