From patchwork Fri Apr 17 12:44:38 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Schwenke X-Patchwork-Id: 18668 Received: from lists.samba.org (mail.samba.org [66.70.73.150]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n3HD3VjC017269 for ; Fri, 17 Apr 2009 13:03:31 GMT Received: from dp.samba.org (localhost [127.0.0.1]) by lists.samba.org (Postfix) with ESMTP id 60231163D17 for ; Fri, 17 Apr 2009 13:03:10 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.1.7 (2006-10-05) on dp.samba.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=3.8 tests=BAYES_00 autolearn=ham version=3.1.7 X-Original-To: linux-cifs-client@lists.samba.org Delivered-To: linux-cifs-client@lists.samba.org X-Greylist: delayed 1376 seconds by postgrey-1.24 at dp.samba.org; Fri, 17 Apr 2009 13:02:46 GMT Received: from mailout2.pacific.net.au (mailout2-14.pacific.net.au [125.255.80.141]) by lists.samba.org (Postfix) with ESMTP id B52F5163B66 for ; Fri, 17 Apr 2009 13:02:46 +0000 (GMT) Received: from mailproxy2.pacific.net.au (mailproxy2.pacific.net.au [61.8.2.163]) by mailout2.pacific.net.au (Postfix) with ESMTP id 7FCA112A0F1 for ; Fri, 17 Apr 2009 22:44:41 +1000 (EST) Received: from fender.bluetoad.com.au (unknown [203.143.225.228]) by mailproxy2.pacific.net.au (Postfix) with ESMTP id 5E98D27403 for ; Fri, 17 Apr 2009 22:44:41 +1000 (EST) Received: from localhost (localhost.localdomain [127.0.0.1]) by fender.bluetoad.com.au (Postfix) with ESMTP id 0A6C73C00B59 for ; Fri, 17 Apr 2009 22:44:40 +1000 (EST) Received: from fender.bluetoad.com.au ([127.0.0.1]) by localhost (fender [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 04701-03 for ; Fri, 17 Apr 2009 22:44:40 +1000 (EST) Received: from kay (fender.bluetoad.com.au [10.80.201.3]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by fender.bluetoad.com.au (Postfix) with ESMTP id A83D33C00B57 for ; Fri, 17 Apr 2009 22:44:40 +1000 (EST) Date: Fri, 17 Apr 2009 22:44:38 +1000 From: Peter Schwenke To: linux-cifs-client@lists.samba.org Message-ID: <20090417124438.GB31321@kay> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.17+20080114 (2008-01-14) X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at bluetoad.com.au Subject: [linux-cifs-client] [PATCH] cifs: Detect errors in cifs_writepages when called from pdflush X-BeenThere: linux-cifs-client@lists.samba.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: The Linux CIFS VFS client List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-cifs-client-bounces+patchwork-cifs-client=patchwork.kernel.org@lists.samba.org Errors-To: linux-cifs-client-bounces+patchwork-cifs-client=patchwork.kernel.org@lists.samba.org The return code isn't checked in the case of cifs_writepages being invoked as a result of pdflush. This results in data integrity problems when errors such as a network break occur when CIFSSMBWrite2 is called. The resulting EAGAIN isn't acted on. Signed-off-by: Peter Schwenke --- fs/cifs/file.c | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 042b122..8cc1094 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c @@ -1374,6 +1374,17 @@ retry: set_bit(AS_ENOSPC, &mapping->flags); else set_bit(AS_EIO, &mapping->flags); + /* + * The return code isn't checked in the + * case of cifs_writepages being + * invoked as a result of pdflush. + * See generic_sync_sb_inodes() + */ + if (current_is_pdflush()) + if (rc == -ENOSPC) + CIFS_I(mapping->host)->write_behind_rc = rc; + else + CIFS_I(mapping->host)->write_behind_rc = -EIO; } else { cifs_stats_bytes_written(cifs_sb->tcon, bytes_written);