Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752703Ab2KTITj (ORCPT ); Tue, 20 Nov 2012 03:19:39 -0500 Received: from userp1040.oracle.com ([156.151.31.81]:23102 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752516Ab2KTITh (ORCPT ); Tue, 20 Nov 2012 03:19:37 -0500 Subject: [PATCH 8/9] filemap: don't call generic_write_sync for -EIOCBQUEUED To: axboe@kernel.dk, tytso@mit.edu, david@fromorbit.com, jmoyer@redhat.com, bpm@sgi.com, viro@zeniv.linux.org.uk, jack@suse.cz From: "Darrick J. Wong" Cc: linux-fsdevel@vger.kernel.org, hch@infradead.org, linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org, xfs@oss.sgi.com Date: Mon, 19 Nov 2012 23:51:15 -0800 Message-ID: <20121120075114.25270.24389.stgit@blackbox.djwong.org> In-Reply-To: <20121120074116.24645.36369.stgit@blackbox.djwong.org> References: <20121120074116.24645.36369.stgit@blackbox.djwong.org> User-Agent: StGit/0.15 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Source-IP: ucsinet22.oracle.com [156.151.31.94] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1436 Lines: 39 Hi, As it stands, generic_file_aio_write will call into generic_write_sync when -EIOCBQUEUED is returned from __generic_file_aio_write. EIOCBQUEUED indicates that an I/O was submitted but NOT completed. Thus, we will flush the disk cache, potentially before the write(s) even make it to the disk! Up until now, this has been the best we could do, as file systems didn't bother to flush the disk cache after an O_SYNC AIO+DIO write. After applying the prior two patches to xfs and ext4, at least the major two file systems do the right thing. So, let's go ahead and fix this backwards logic. From: Jeff Moyer Signed-off-by: Jeff Moyer --- mm/filemap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/filemap.c b/mm/filemap.c index 83efee7..8e14c10 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -2532,7 +2532,7 @@ ssize_t generic_file_aio_write(struct kiocb *iocb, const struct iovec *iov, ret = __generic_file_aio_write(iocb, iov, nr_segs, &iocb->ki_pos); mutex_unlock(&inode->i_mutex); - if (ret > 0 || ret == -EIOCBQUEUED) { + if (ret > 0) { ssize_t err; err = generic_write_sync(file, pos, ret); -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/