public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Markus Trippelsdorf <markus@trippelsdorf.de>
To: Christoph Hellwig <hch@infradead.org>
Cc: jack@suse.cz, linux-kernel@vger.kernel.org, xfs@oss.sgi.com,
	viro@zeniv.linux.org.uk, linux-fsdevel@vger.kernel.org,
	Josef Bacik <josef@redhat.com>
Subject: [PATCH] xfs: Fix wrong return value of xfs_file_aio_write
Date: Sun, 24 Jul 2011 13:54:20 +0200	[thread overview]
Message-ID: <20110724115420.GA1626@x4.trippels.de> (raw)
In-Reply-To: <20110724111625.GA12658@infradead.org>

On 2011.07.24 at 07:16 -0400, Christoph Hellwig wrote:
> On Sun, Jul 24, 2011 at 12:02:12AM +0200, Markus Trippelsdorf wrote:
> > The following patch fixes the problem for me:
> 
> Good catch, can you send it with a proper signoff and description?

The fsync prototype change commit 02c24a82187d accidentally overwrote
the ssize_t return value of xfs_file_aio_write with 0 for SYNC type
writes. Fix this by checking if an error occured when calling
xfs_file_fsync and only change the return value in this case.
In addition xfs_file_fsync actually returns a normal negative error, so
fix this, too.
---
 fs/xfs/linux-2.6/xfs_file.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/fs/xfs/linux-2.6/xfs_file.c b/fs/xfs/linux-2.6/xfs_file.c
index cca00f4..825390e 100644
--- a/fs/xfs/linux-2.6/xfs_file.c
+++ b/fs/xfs/linux-2.6/xfs_file.c
@@ -881,11 +881,14 @@ xfs_file_aio_write(
 	/* Handle various SYNC-type writes */
 	if ((file->f_flags & O_DSYNC) || IS_SYNC(inode)) {
 		loff_t end = pos + ret - 1;
+		int error;
 
 		xfs_rw_iunlock(ip, iolock);
-		ret = -xfs_file_fsync(file, pos, end,
+		error = xfs_file_fsync(file, pos, end,
 				      (file->f_flags & __O_SYNC) ? 0 : 1);
 		xfs_rw_ilock(ip, iolock);
+		if (error)
+			ret = error;
 	}
 
 out_unlock:
-- 
Markus

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

  parent reply	other threads:[~2011-07-24 12:11 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1309370716-12235-1-git-send-email-josef@redhat.com>
2011-07-23 18:09 ` [PATCH] fs: push i_mutex and filemap_write_and_wait down into ->fsync() handlers Markus Trippelsdorf
2011-07-23 19:32   ` Markus Trippelsdorf
2011-07-23 20:26   ` Josef Bacik
2011-07-23 20:38     ` Markus Trippelsdorf
2011-07-23 22:02       ` Markus Trippelsdorf
2011-07-24 11:16         ` Christoph Hellwig
2011-07-24 11:42           ` Christoph Hellwig
2011-07-24 11:54           ` Markus Trippelsdorf [this message]
2011-07-24 11:57             ` [PATCH] xfs: Fix wrong return value of xfs_file_aio_write Christoph Hellwig
2011-07-24 11:58             ` [PATCH v2] " Markus Trippelsdorf
2011-07-24 12:03               ` [PATCH] " Markus Trippelsdorf
2011-07-24 12:11                 ` Christoph Hellwig
2011-07-26 15:21                 ` Alex Elder

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=20110724115420.GA1626@x4.trippels.de \
    --to=markus@trippelsdorf.de \
    --cc=hch@infradead.org \
    --cc=jack@suse.cz \
    --cc=josef@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    --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