From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Morton Subject: Re: [patch 6/6] mm: fsync livelock avoidance Date: Thu, 11 Dec 2008 13:51:40 -0800 Message-ID: <20081211135140.89fac18b.akpm@linux-foundation.org> References: <20081210072454.GB27096@wotan.suse.de> <20081210074209.GG27096@wotan.suse.de> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: linux-fsdevel@vger.kernel.org, mpatocka@redhat.com To: Nick Piggin Return-path: Received: from smtp1.linux-foundation.org ([140.211.169.13]:33814 "EHLO smtp1.linux-foundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757440AbYLKVwA (ORCPT ); Thu, 11 Dec 2008 16:52:00 -0500 In-Reply-To: <20081210074209.GG27096@wotan.suse.de> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Wed, 10 Dec 2008 08:42:09 +0100 Nick Piggin wrote: > This patch fixes fsync starvation problems in the presence of concurrent > dirtiers. One reject in xfs, which now does: int xfs_flush_pages( xfs_inode_t *ip, xfs_off_t first, xfs_off_t last, uint64_t flags, int fiopt) { struct address_space *mapping = VFS_I(ip)->i_mapping; int ret = 0; int ret2; if (mapping_tagged(mapping, PAGECACHE_TAG_DIRTY)) { xfs_iflags_clear(ip, XFS_ITRUNCATED); ret = filemap_fdatawrite(mapping); if (flags & XFS_B_ASYNC) return -ret; ret2 = filemap_fdatawait(mapping); if (!ret) ret = ret2; } return -ret; } ie: it returns a +ve integer on error, heaven knows why. So I did int xfs_flush_pages( xfs_inode_t *ip, xfs_off_t first, xfs_off_t last, uint64_t flags, int fiopt) { struct address_space *mapping = VFS_I(ip)->i_mapping; int ret = 0; if (mapping_tagged(mapping, PAGECACHE_TAG_DIRTY)) { xfs_iflags_clear(ip, XFS_ITRUNCATED); if (flags & XFS_B_ASYNC) { ret = __filemap_fdatawrite_range(mapping, 0, LLONG_MAX, WB_SYNC_NONE); } else { int ret2; mapping_fsync_lock(mapping); ret = filemap_fdatawrite(mapping); ret2 = filemap_fdatawait_fsync(mapping); if (!ret) ret = ret2; mapping_fsync_unlock(mapping); } } return -ret; }