All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ross Zwisler <ross.zwisler@linux.intel.com>
To: Dan Williams <dan.j.williams@intel.com>
Cc: Ross Zwisler <ross.zwisler@linux.intel.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Jan Kara <jack@suse.com>,
	linux-ext4@vger.kernel.org, Dave Chinner <david@fromorbit.com>,
	"linux-nvdimm@lists.01.org" <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: Fri, 9 Oct 2015 16:38:02 -0600	[thread overview]
Message-ID: <20151009223802.GA13367@linux.intel.com> (raw)
In-Reply-To: <CAPcyv4jeb=58Y5zG3WKJfPckUecFwUiTW-MZQb7rzvpwPMa4Ow@mail.gmail.com>

On Fri, Oct 09, 2015 at 03:18:11PM -0700, Dan Williams wrote:
> On Fri, Oct 9, 2015 at 3:02 PM, Ross Zwisler
> <ross.zwisler@linux.intel.com> wrote:
> > Add locking to ensure that DAX faults are isolated from ext2 operations
> > that modify the data blocks allocation for an inode.  This is intended to
> > be analogous to the work being done in XFS by Dave Chinner:
> >
> > http://www.spinics.net/lists/linux-fsdevel/msg90260.html
> >
> > Compared with XFS the ext2 case is greatly simplified by the fact that ext2
> > already allocates and zeros new blocks before they are returned as part of
> > ext2_get_block(), so DAX doesn't need to worry about getting unmapped or
> > unwritten buffer heads.
> >
> > This means that the only work we need to do in ext2 is to isolate the DAX
> > faults from inode block allocation changes.  I believe this just means that
> > we need to isolate the DAX faults from truncate operations.
> >
> > The newly introduced dax_sem is intended to replicate the protection
> > offered by i_mmaplock in XFS.  In addition to truncate the i_mmaplock also
> > protects XFS operations like hole punching, fallocate down, extent
> > manipulation IOCTLS like xfs_ioc_space() and extent swapping.  Truncate is
> > the only one of these operations supported by ext2.
> >
> > Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>
> [..]
> 
> ...not a review of the ext2 changes.
> 
> > diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c
> > index c60a248..2b974fc 100644
> > --- a/fs/ext2/inode.c
> > +++ b/fs/ext2/inode.c
> > @@ -1085,6 +1085,7 @@ static void ext2_free_branches(struct inode *inode, __le32 *p, __le32 *q, int de
> >                 ext2_free_data(inode, p, q);
> >  }
> >
> > +/* dax_sem must be held when calling this function */
> >  static void __ext2_truncate_blocks(struct inode *inode, loff_t offset)
> >  {
> 
> How about  a "WARN_ON(!rwsem_is_locked(&ei->dax_sem));" to backstop
> this assumption?

Yep, sounds like a good idea.  Thanks.

WARNING: multiple messages have this Message-ID (diff)
From: Ross Zwisler <ross.zwisler@linux.intel.com>
To: Dan Williams <dan.j.williams@intel.com>
Cc: Ross Zwisler <ross.zwisler@linux.intel.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Jan Kara <jack@suse.com>,
	linux-ext4@vger.kernel.org, Dave Chinner <david@fromorbit.com>,
	"linux-nvdimm@lists.01.org" <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: Fri, 9 Oct 2015 16:38:02 -0600	[thread overview]
Message-ID: <20151009223802.GA13367@linux.intel.com> (raw)
In-Reply-To: <CAPcyv4jeb=58Y5zG3WKJfPckUecFwUiTW-MZQb7rzvpwPMa4Ow@mail.gmail.com>

On Fri, Oct 09, 2015 at 03:18:11PM -0700, Dan Williams wrote:
> On Fri, Oct 9, 2015 at 3:02 PM, Ross Zwisler
> <ross.zwisler@linux.intel.com> wrote:
> > Add locking to ensure that DAX faults are isolated from ext2 operations
> > that modify the data blocks allocation for an inode.  This is intended to
> > be analogous to the work being done in XFS by Dave Chinner:
> >
> > http://www.spinics.net/lists/linux-fsdevel/msg90260.html
> >
> > Compared with XFS the ext2 case is greatly simplified by the fact that ext2
> > already allocates and zeros new blocks before they are returned as part of
> > ext2_get_block(), so DAX doesn't need to worry about getting unmapped or
> > unwritten buffer heads.
> >
> > This means that the only work we need to do in ext2 is to isolate the DAX
> > faults from inode block allocation changes.  I believe this just means that
> > we need to isolate the DAX faults from truncate operations.
> >
> > The newly introduced dax_sem is intended to replicate the protection
> > offered by i_mmaplock in XFS.  In addition to truncate the i_mmaplock also
> > protects XFS operations like hole punching, fallocate down, extent
> > manipulation IOCTLS like xfs_ioc_space() and extent swapping.  Truncate is
> > the only one of these operations supported by ext2.
> >
> > Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>
> [..]
> 
> ...not a review of the ext2 changes.
> 
> > diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c
> > index c60a248..2b974fc 100644
> > --- a/fs/ext2/inode.c
> > +++ b/fs/ext2/inode.c
> > @@ -1085,6 +1085,7 @@ static void ext2_free_branches(struct inode *inode, __le32 *p, __le32 *q, int de
> >                 ext2_free_data(inode, p, q);
> >  }
> >
> > +/* dax_sem must be held when calling this function */
> >  static void __ext2_truncate_blocks(struct inode *inode, loff_t offset)
> >  {
> 
> How about  a "WARN_ON(!rwsem_is_locked(&ei->dax_sem));" to backstop
> this assumption?

Yep, sounds like a good idea.  Thanks.

  reply	other threads:[~2015-10-09 22:38 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 [this message]
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
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=20151009223802.GA13367@linux.intel.com \
    --to=ross.zwisler@linux.intel.com \
    --cc=andreas.dilger@intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=david@fromorbit.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 \
    /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.