From patchwork Wed Sep 12 19:08:37 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 1446061 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 0290E4025E for ; Wed, 12 Sep 2012 19:08:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750726Ab2ILTIp (ORCPT ); Wed, 12 Sep 2012 15:08:45 -0400 Received: from mx2.netapp.com ([216.240.18.37]:40792 "EHLO mx2.netapp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750737Ab2ILTIp (ORCPT ); Wed, 12 Sep 2012 15:08:45 -0400 X-IronPort-AV: E=Sophos;i="4.80,411,1344236400"; d="scan'208";a="688873635" Received: from smtp1.corp.netapp.com ([10.57.156.124]) by mx2-out.netapp.com with ESMTP; 12 Sep 2012 12:08:43 -0700 Received: from lade.trondhjem.org.com (cfreitas-lxp.hq.netapp.com [10.63.232.175]) by smtp1.corp.netapp.com (8.13.1/8.13.1/NTAP-1.6) with ESMTP id q8CJ8gME023839; Wed, 12 Sep 2012 12:08:43 -0700 (PDT) From: Trond Myklebust To: linux-nfs@vger.kernel.org Subject: [PATCH 2/2] NFS: Write the entire file if a server reboot occurs during fsync() Date: Wed, 12 Sep 2012 15:08:37 -0400 Message-Id: <1347476917-34642-2-git-send-email-Trond.Myklebust@netapp.com> X-Mailer: git-send-email 1.7.11.4 In-Reply-To: <1347476917-34642-1-git-send-email-Trond.Myklebust@netapp.com> References: <1347476917-34642-1-git-send-email-Trond.Myklebust@netapp.com> Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org This is to ensure that we don't clear the NFS_CONTEXT_RESEND_WRITES flag while there are still writes that haven't been resent. Signed-off-by: Trond Myklebust --- fs/nfs/file.c | 7 +++++++ fs/nfs/nfs4file.c | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/fs/nfs/file.c b/fs/nfs/file.c index cc9b566..c814666 100644 --- a/fs/nfs/file.c +++ b/fs/nfs/file.c @@ -301,6 +301,13 @@ nfs_file_fsync(struct file *file, loff_t start, loff_t end, int datasync) mutex_lock(&inode->i_mutex); ret = nfs_file_fsync_commit(file, start, end, datasync); mutex_unlock(&inode->i_mutex); + /* + * If nfs_file_fsync_commit detected a server reboot, then + * resend all dirty pages that might have been covered by + * the NFS_CONTEXT_RESEND_WRITES flag + */ + start = 0; + end = LLONG_MAX; } while (ret == -EAGAIN); return ret; diff --git a/fs/nfs/nfs4file.c b/fs/nfs/nfs4file.c index eef1b38..afddd66 100644 --- a/fs/nfs/nfs4file.c +++ b/fs/nfs/nfs4file.c @@ -105,6 +105,13 @@ nfs4_file_fsync(struct file *file, loff_t start, loff_t end, int datasync) /* application has asked for meta-data sync */ ret = pnfs_layoutcommit_inode(inode, true); mutex_unlock(&inode->i_mutex); + /* + * If nfs_file_fsync_commit detected a server reboot, then + * resend all dirty pages that might have been covered by + * the NFS_CONTEXT_RESEND_WRITES flag + */ + start = 0; + end = LLONG_MAX; } while (ret == -EAGAIN); return ret;