From: Dave Chinner <david@fromorbit.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH 1/7] xfs: ensure sync write errors are returned
Date: Fri, 17 Dec 2010 08:57:12 +1100 [thread overview]
Message-ID: <20101216215712.GB5193@dastard> (raw)
In-Reply-To: <20101216115738.GB20445@infradead.org>
On Thu, Dec 16, 2010 at 06:57:38AM -0500, Christoph Hellwig wrote:
> > error2 = filemap_write_and_wait_range(mapping, pos, end);
> > - if (!error)
> > + if (error2)
> > error = error2;
> > if (need_i_mutex)
> > mutex_lock(&inode->i_mutex);
> > @@ -777,7 +777,7 @@ write_retry:
> >
> > error2 = -xfs_file_fsync(file,
> > (file->f_flags & __O_SYNC) ? 0 : 1);
> > - if (!error)
> > + if (error2 && error >= 0)
> > error = error2;
>
> Shouldn't the filemap_write_and_wait_range clause use a similar check as
> this one?
No need, because when we enter the branch, error is guaranteed to be
greater than zero as the code jumps over this branch if it is <= 0.
Hence we only need to overwrite error with error2 from
filemap_write_and_wait_range() if error2 actually contains an error
(i.e. < 0).
The second hunk then has to deal with the fact that error can have
any value, and we only want to overwrite error if it doesn't already
contain an error value and error2 does. Hence the check for error >=
0 to ensure we don't overwrite an error from
filemap_write_and_wait_range().
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2010-12-16 21:55 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-15 1:23 [PATCH 0/7] xfs: serialise unaligned direct IOs Dave Chinner
2010-12-15 1:23 ` [PATCH 1/7] xfs: ensure sync write errors are returned Dave Chinner
2010-12-16 11:57 ` Christoph Hellwig
2010-12-16 21:57 ` Dave Chinner [this message]
2010-12-16 20:50 ` Alex Elder
2010-12-17 6:43 ` Dave Chinner
2010-12-15 1:23 ` [PATCH 2/7] xfs: factor common post-write isize handling code Dave Chinner
2010-12-15 1:23 ` [PATCH 4/7] xfs: split direct IO write path from xfs_file_aio_write Dave Chinner
2010-12-16 12:06 ` Christoph Hellwig
2010-12-17 7:31 ` Dave Chinner
2010-12-20 11:29 ` Christoph Hellwig
2010-12-21 0:51 ` Dave Chinner
2010-12-15 1:23 ` [PATCH 5/7] xfs: split buffered " Dave Chinner
2010-12-15 1:23 ` [PATCH 6/7] xfs: factor common write setup code Dave Chinner
2010-12-15 1:23 ` [PATCH 7/7] xfs: serialise unaligned direct IOs 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=20101216215712.GB5193@dastard \
--to=david@fromorbit.com \
--cc=hch@infradead.org \
--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