linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: Theodore Ts'o <tytso@mit.edu>, linux-ext4 <linux-ext4@vger.kernel.org>
Subject: Re: [PATCH] ext4: use directio end_io error status to finish unwritten aio dio correctly
Date: Wed, 17 Feb 2016 22:01:48 -0800	[thread overview]
Message-ID: <20160218060148.GA10571@infradead.org> (raw)
In-Reply-To: <20160218054557.GH6338@birch.djwong.org>

Might help to tell that this is on top of a direct-io.c patch from the
XFS tree.

I don't think clearing any flags is the right thing - now that we
always call ->end_io the code dealing with it in ext4_ext_direct_IO
can simply be moved to the ->end_io handler.

Something like the untested patch below:

diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 9db04dd..b741c79 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -3166,23 +3166,25 @@ static int ext4_end_io_dio(struct kiocb *iocb, loff_t offset,
 {
         ext4_io_end_t *io_end = iocb->private;
 
-	if (size <= 0)
-		return 0;
-
 	/* if not async direct IO just return */
 	if (!io_end)
 		return 0;
 
+	if (size <= 0) {
+		WARN_ON(io_end->flag & EXT4_IO_END_UNWRITTEN);
+		goto out;
+	}
+
 	ext_debug("ext4_end_io_dio(): io_end 0x%p "
 		  "for inode %lu, iocb 0x%p, offset %llu, size %zd\n",
  		  iocb->private, io_end->inode->i_ino, iocb, offset,
 		  size);
 
-	iocb->private = NULL;
 	io_end->offset = offset;
 	io_end->size = size;
+out:
 	ext4_put_io_end(io_end);

  reply	other threads:[~2016-02-18  6:01 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-18  5:45 [PATCH] ext4: use directio end_io error status to finish unwritten aio dio correctly Darrick J. Wong
2016-02-18  6:01 ` Christoph Hellwig [this message]
2016-02-18 21:30   ` Jan Kara
2016-02-18 22:02   ` Dave Chinner
2016-02-19 13:18     ` Jan Kara
2016-02-19 15:15       ` Theodore Ts'o
2016-02-21  6:28       ` Dave Chinner
2016-02-22  8:19         ` Jan Kara
2016-02-22 20:11           ` Darrick J. Wong
2016-02-22  8:56       ` Christoph Hellwig
2016-02-29  7:03       ` Dave Chinner

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=20160218060148.GA10571@infradead.org \
    --to=hch@infradead.org \
    --cc=darrick.wong@oracle.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=tytso@mit.edu \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).