All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: Jan Kara <jack@suse.cz>
Cc: Christoph Hellwig <hch@lst.de>,
	linux-fsdevel@vger.kernel.org, linux-xfs@vger.kernel.org
Subject: Re: Lock ordering in iomap code
Date: Fri, 21 Oct 2016 07:22:01 +1100	[thread overview]
Message-ID: <20161020202201.GN14023@dastard> (raw)
In-Reply-To: <20161020115500.GB25779@quack2.suse.cz>

On Thu, Oct 20, 2016 at 01:55:00PM +0200, Jan Kara wrote:
> Hi Christoph,
> 
> On Mon 17-10-16 12:26:57, Christoph Hellwig wrote:
> > > Ping? I have ext4 DAX read & write path working with the iomap code but to
> > > convert the fault path, I need this resolved. Are you OK with moving
> > > iomap_begin() / iomap_end() calls outside of page lock / entry lock in the
> > > fault path?
> > 
> > Yes, that sounds fine.
> 
> I've been looking into this some more and realized it's not as easy as I've
> originally though. ->page_mkwrite callback is expected to return with the
> page locked so locking it inside the iomap actor is really awkward (think
> of situation when blocksize < pagesize). Since nobody currently has issues
> with ->iomap_begin being sometimes called with page lock and sometimes
> without, I don't think changing that would be worth the hassle. Just one
> more question: Doesn't XFS have some lock ordering issues when
> xfs_file_iomap_begin() gets called with page lock held from
> iomap_page_mkwrite() for a file with extent size hints and thus we end up
> in xfs_iomap_write_direct() with page lock held? We do a lot of stuff there
> including transaction setup and such...

Lock order in xfs is iolock->page lock->transaction->ilock, so what
is being done in xfs_file_iomap_begin (transactions, ilock) is fine
regardless of whether we hold the page locked or noti when called.

Cheers,

Dave.

-- 
Dave Chinner
david@fromorbit.com

      reply	other threads:[~2016-10-20 20:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-07 11:13 Lock ordering in iomap code Jan Kara
2016-10-17  9:31 ` Jan Kara
2016-10-17 10:26   ` Christoph Hellwig
2016-10-20 11:55     ` Jan Kara
2016-10-20 20:22       ` Dave Chinner [this message]

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=20161020202201.GN14023@dastard \
    --to=david@fromorbit.com \
    --cc=hch@lst.de \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    /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.