From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Christoph Hellwig <hch@lst.de>
Cc: linux-fsdevel@vger.kernel.org, xfs@oss.sgi.com,
linux-ext4@vger.kernel.org, ocfs2-devel@oss.oracle.com
Subject: Re: [PATCH 1/3] direct-io: always call ->end_io if non-NULL
Date: Thu, 4 Feb 2016 00:17:57 -0800 [thread overview]
Message-ID: <20160204081757.GM22352@birch.djwong.org> (raw)
In-Reply-To: <20160204071455.GA20002@lst.de>
On Thu, Feb 04, 2016 at 08:14:55AM +0100, Christoph Hellwig wrote:
> On Wed, Feb 03, 2016 at 11:55:31AM -0800, Darrick J. Wong wrote:
> > This will have the effect of a later error superseding an earlier error. I'm
> > under the impression that code should generally preserve the first error, since
> > some side effect of that probably caused the rest of the errors.
> >
> > That said, my guess is that 95% of the time err is set, retval and err will
> > both be -EIO anyway. I'm not particularly passionate about whether or not we
> > preserve the first error code.
>
> This leaves the option to the file system to pass the value through
> or not. Note that ret before the call will usually have the positive
> number of bytes written, so checking if it's 'set' wouldn't be enough
> even if adding some special casing in the callers.
Ok, I can live with that.
> > > +static int ext4_end_io_dio(struct kiocb *iocb, loff_t offset,
> > > ssize_t size, void *private)
> > > {
> > > ext4_io_end_t *io_end = iocb->private;
> > >
> > > + if (size <= 0)
> > > + return 0;
> >
> > This leaks the ext4_io_end_t, if there was one. Granted, that only happens
> > during an AIO DIO to an unwritten extent, but in any case I suggest removing
> > this hunk and...
>
> It's the same behavior as before - and if you look at ext4_ext_direct_IO
> it seems to expect this and works around it.
Gotcha. That's right, so I'll stop worrying about these. :)
--D
>
> > > + if (bytes <= 0)
> > > + return 0;
> > > +
> >
> > I suspect we still need to unlock the mutexes later on in this function.
> >
> > > /* this io's submitter should not have unlocked this before we could */
> > > BUG_ON(!ocfs2_iocb_is_rw_locked(iocb));
> > >
> > > @@ -644,6 +647,8 @@ static void ocfs2_dio_end_io(struct kiocb *iocb,
> > > level = ocfs2_iocb_rw_locked_level(iocb);
> > > ocfs2_rw_unlock(inode, level);
> > > }
> >
> > Do we need to still have an accurate value for bytes the conditional above
> > even if the IO errored out?
>
> Again, no changes to the old behavior. ocfs has some magic stuffed
> in iocb->private to deal with the locked state of an iocb, and while
> I don't fully understand it I suspect it's to handle the existing
> odd ->end_io calling conventions. Cleaning this up would be nice,
> but let's keep that a separate patch.
>
> > > struct kiocb *iocb,
> > > loff_t offset,
> > > @@ -1655,15 +1655,19 @@ xfs_end_io_direct_write(
> > > struct inode *inode = file_inode(iocb->ki_filp);
> > > struct xfs_ioend *ioend = private;
> > >
> > > + if (size <= 0)
> > > + return 0;
> >
> > Same thing here, I think we can end up leaking the ioend.
>
> This keeps the existing behavior. But either way, at least for
> XFS all this will be properly fixed in the next patch anyway.
next prev parent reply other threads:[~2016-02-04 8:18 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-03 18:40 vfs/xfs: directio updates to ease COW handling V2 Christoph Hellwig
2016-02-03 18:40 ` [PATCH 1/3] direct-io: always call ->end_io if non-NULL Christoph Hellwig
2016-02-03 19:55 ` Darrick J. Wong
2016-02-04 7:14 ` Christoph Hellwig
2016-02-04 8:17 ` Darrick J. Wong [this message]
2016-02-03 18:40 ` [PATCH 2/3] xfs: don't use ioends for direct write completions Christoph Hellwig
2016-02-05 21:57 ` Darrick J. Wong
2016-02-05 22:36 ` Dave Chinner
2016-02-08 1:00 ` Dave Chinner
2016-02-08 6:17 ` Dave Chinner
2016-02-08 7:31 ` Christoph Hellwig
2016-02-08 9:16 ` Dave Chinner
2016-02-08 9:22 ` Christoph Hellwig
2016-02-03 18:40 ` [PATCH 3/3] xfs: fold xfs_vm_do_dio into xfs_vm_direct_IO Christoph Hellwig
2016-02-03 19:43 ` vfs/xfs: directio updates to ease COW handling V2 Jeff Moyer
2016-02-03 20:01 ` Darrick J. Wong
2016-02-03 21:53 ` Jeff Moyer
-- strict thread matches above, loose matches on Subject: below --
2016-02-02 20:17 VFS/XFS: directio updates to ease COW handling Christoph Hellwig
2016-02-02 20:17 ` [PATCH 1/3] direct-io: always call ->end_io if non-NULL Christoph Hellwig
2016-02-03 0:05 ` Darrick J. Wong
2016-02-03 15:48 ` Christoph Hellwig
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=20160204081757.GM22352@birch.djwong.org \
--to=darrick.wong@oracle.com \
--cc=hch@lst.de \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=ocfs2-devel@oss.oracle.com \
--cc=xfs@oss.sgi.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 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).