All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: Ross Zwisler <ross.zwisler@linux.intel.com>
Cc: linux-kernel@vger.kernel.org, Jan Kara <jack@suse.com>,
	linux-ext4@vger.kernel.org,
	Dan Williams <dan.j.williams@intel.com>,
	linux-nvdimm@lists.01.org,
	Matthew Wilcox <matthew.r.wilcox@intel.com>,
	Andreas Dilger <andreas.dilger@intel.com>
Subject: Re: [PATCH 2/2] ext2: Add locking for DAX faults
Date: Tue, 13 Oct 2015 10:02:37 +1100	[thread overview]
Message-ID: <20151012230237.GG27164@dastard> (raw)
In-Reply-To: <20151012172156.GA19076@linux.intel.com>

On Mon, Oct 12, 2015 at 11:21:56AM -0600, Ross Zwisler wrote:
> On Mon, Oct 12, 2015 at 10:14:43AM +1100, Dave Chinner wrote:
> > On Fri, Oct 09, 2015 at 04:02:08PM -0600, Ross Zwisler wrote:
> <>
> > > +/*
> > > + * The lock ordering for ext2 DAX fault paths is:
> > > + *
> > > + * mmap_sem (MM)
> > > + *   ext2_inode_info->dax_sem
> > > + *     sb_start_pagefault (vfs, freeze - taken in DAX)
> > > + *       address_space->i_mmap_rwsem or page_lock (mutually exclusive in DAX)
> > > + *         ext2_inode_info->truncate_mutex
> > 
> > This is a different lock order to XFS - it puts the i_mmaplock
> > inside sb_start_pagefault(), not outside it. This ordering means the
> > timestamp updates during the page fault are also under
> > ext2_inode_info->dax_sem...
> 
> Yep - I was trying not not open code dax_fault() yet again, but it looks like
> both XFS and ext4 both open-code dax_fault() and call __dax_fault() directly.
> 
> I assume that when we get an analogous lock to i_mmaplock in the ext4 fault
> path we'll end up with the same locking order that is found in XFS.
> 
> I'll do the same for v2 of this patch and I'll kill the then-unused
> dax_fault().

Great!

I'd suggest that you also then rename __dax_fault() to dax_fault()
in that case, and also document the requirements for callers in
terms of sb_start_pagefault() and timestamp updates...

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

WARNING: multiple messages have this Message-ID (diff)
From: Dave Chinner <david@fromorbit.com>
To: Ross Zwisler <ross.zwisler@linux.intel.com>
Cc: linux-kernel@vger.kernel.org, Jan Kara <jack@suse.com>,
	linux-ext4@vger.kernel.org,
	Dan Williams <dan.j.williams@intel.com>,
	linux-nvdimm@ml01.01.org,
	Matthew Wilcox <matthew.r.wilcox@intel.com>,
	Andreas Dilger <andreas.dilger@intel.com>
Subject: Re: [PATCH 2/2] ext2: Add locking for DAX faults
Date: Tue, 13 Oct 2015 10:02:37 +1100	[thread overview]
Message-ID: <20151012230237.GG27164@dastard> (raw)
In-Reply-To: <20151012172156.GA19076@linux.intel.com>

On Mon, Oct 12, 2015 at 11:21:56AM -0600, Ross Zwisler wrote:
> On Mon, Oct 12, 2015 at 10:14:43AM +1100, Dave Chinner wrote:
> > On Fri, Oct 09, 2015 at 04:02:08PM -0600, Ross Zwisler wrote:
> <>
> > > +/*
> > > + * The lock ordering for ext2 DAX fault paths is:
> > > + *
> > > + * mmap_sem (MM)
> > > + *   ext2_inode_info->dax_sem
> > > + *     sb_start_pagefault (vfs, freeze - taken in DAX)
> > > + *       address_space->i_mmap_rwsem or page_lock (mutually exclusive in DAX)
> > > + *         ext2_inode_info->truncate_mutex
> > 
> > This is a different lock order to XFS - it puts the i_mmaplock
> > inside sb_start_pagefault(), not outside it. This ordering means the
> > timestamp updates during the page fault are also under
> > ext2_inode_info->dax_sem...
> 
> Yep - I was trying not not open code dax_fault() yet again, but it looks like
> both XFS and ext4 both open-code dax_fault() and call __dax_fault() directly.
> 
> I assume that when we get an analogous lock to i_mmaplock in the ext4 fault
> path we'll end up with the same locking order that is found in XFS.
> 
> I'll do the same for v2 of this patch and I'll kill the then-unused
> dax_fault().

Great!

I'd suggest that you also then rename __dax_fault() to dax_fault()
in that case, and also document the requirements for callers in
terms of sb_start_pagefault() and timestamp updates...

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

  reply	other threads:[~2015-10-12 23:02 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-09 22:02 [PATCH 0/2] Add updated DAX locking to ext2 Ross Zwisler
2015-10-09 22:02 ` Ross Zwisler
2015-10-09 22:02 ` [PATCH 1/2] dax: dax_pfn_mkwrite() truncate race check Ross Zwisler
2015-10-09 22:02   ` Ross Zwisler
2015-10-09 22:02 ` [PATCH 2/2] ext2: Add locking for DAX faults Ross Zwisler
2015-10-09 22:02   ` Ross Zwisler
2015-10-09 22:18   ` Dan Williams
2015-10-09 22:18     ` Dan Williams
2015-10-09 22:38     ` Ross Zwisler
2015-10-09 22:38       ` Ross Zwisler
2015-10-11 23:14   ` Dave Chinner
2015-10-11 23:14     ` Dave Chinner
2015-10-12 17:21     ` Ross Zwisler
2015-10-12 17:21       ` Ross Zwisler
2015-10-12 23:02       ` Dave Chinner [this message]
2015-10-12 23:02         ` Dave Chinner
2015-10-12 21:41     ` Ross Zwisler
2015-10-12 21:41       ` Ross Zwisler
2015-10-12 23:24       ` Dave Chinner
2015-10-12 23:24         ` Dave Chinner
2015-10-12 23:35         ` Eric Curtin
2015-10-12 23:35           ` Eric Curtin
2015-10-13 22:15           ` Ross Zwisler
2015-10-13 22:15             ` Ross Zwisler
2015-10-13 15:02         ` Ross Zwisler
2015-10-13 15:02           ` Ross Zwisler
2015-10-13  8:07       ` Jan Kara
2015-10-13  8:07         ` Jan Kara
2015-10-13 17:33         ` Ross Zwisler
2015-10-13 17:33           ` Ross Zwisler
2015-10-13 17:47           ` Jan Kara
2015-10-13 17:47             ` Jan Kara

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151012230237.GG27164@dastard \
    --to=david@fromorbit.com \
    --cc=andreas.dilger@intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=jack@suse.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvdimm@lists.01.org \
    --cc=matthew.r.wilcox@intel.com \
    --cc=ross.zwisler@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.