From patchwork Sun Mar 29 17:28:13 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartlomiej Zolnierkiewicz X-Patchwork-Id: 25290 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id 6782BDDE06 for ; Mon, 30 Mar 2009 04:30:24 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752083AbZC2RaU (ORCPT ); Sun, 29 Mar 2009 13:30:20 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752560AbZC2RaQ (ORCPT ); Sun, 29 Mar 2009 13:30:16 -0400 Received: from mu-out-0910.google.com ([209.85.134.191]:52378 "EHLO mu-out-0910.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752047AbZC2RaN (ORCPT ); Sun, 29 Mar 2009 13:30:13 -0400 Received: by mu-out-0910.google.com with SMTP id g7so702586muf.1 for ; Sun, 29 Mar 2009 10:30:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:subject:date :user-agent:cc:mime-version:content-type:content-transfer-encoding :content-disposition:message-id; bh=9ZuHKFPABZZ83wW9EtjWgOzEJv84orPNW0g6exshf5c=; b=fUP5VHpd1uQ5/3TOIK0MbB7eDpRKTNt0DdOf7xv5PJt4J79XF/S7Cc0xwh9dew510w V2+EDXI0hNf7GYLha5NBkYadmrg/EXT2zViC614C6d/Kq6d5l84MnhA0hx2rRhRl7IsK 15xVYdUH7M66A7WobnqjzbUkVs7AOK9tjxBR8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:subject:date:user-agent:cc:mime-version:content-type :content-transfer-encoding:content-disposition:message-id; b=ZXz91hqlMwNDNwGN/EwH7CIk4rSIlcZpDQguj811y1isYXWVGtxlFRRMtHB/D7752w IQlgDqqWdvBgynb9/ovA/V16GZhMyfkV1nLYKeZ7fz7cTnWfX9BytVnl5pLPZN+apdHc irUcU0+KBW5QdSKGNm4+rIlGypfLaaN1Mapr4= Received: by 10.103.198.20 with SMTP id a20mr1297994muq.63.1238347809441; Sun, 29 Mar 2009 10:30:09 -0700 (PDT) Received: from localhost.localdomain (chello089077051219.chello.pl [89.77.51.219]) by mx.google.com with ESMTPS id i5sm7489649mue.43.2009.03.29.10.30.08 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 29 Mar 2009 10:30:08 -0700 (PDT) From: Bartlomiej Zolnierkiewicz To: "Theodore Ts'o" Subject: [PATCH] ext4: fix blkdev_issue_flush() failure handling Date: Sun, 29 Mar 2009 19:28:13 +0200 User-Agent: KMail/1.11.1 (Linux/2.6.29-next-20090327-dirty; KDE/4.2.1; i686; ; ) Cc: linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org MIME-Version: 1.0 Content-Disposition: inline Message-Id: <200903291928.14451.bzolnier@gmail.com> Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org blkdev_issue_flush() may fail (i.e. due to media error on FLUSH CACHE command execution) so its users should check for the return value. Signed-off-by: Bartlomiej Zolnierkiewicz --- fs/ext4/fsync.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Index: b/fs/ext4/fsync.c =================================================================== --- a/fs/ext4/fsync.c +++ b/fs/ext4/fsync.c @@ -48,7 +48,7 @@ int ext4_sync_file(struct file *file, st { struct inode *inode = dentry->d_inode; journal_t *journal = EXT4_SB(inode->i_sb)->s_journal; - int ret = 0; + int ret = 0, tmp_ret; J_ASSERT(ext4_journal_current_handle() == NULL); @@ -92,8 +92,11 @@ int ext4_sync_file(struct file *file, st .nr_to_write = 0, /* sys_fsync did this */ }; ret = sync_inode(inode, &wbc); - if (journal && (journal->j_flags & JBD2_BARRIER)) - blkdev_issue_flush(inode->i_sb->s_bdev, NULL); + if (journal && (journal->j_flags & JBD2_BARRIER)) { + tmp_ret = blkdev_issue_flush(inode->i_sb->s_bdev, NULL); + if (ret == 0 && tmp_ret < 0 && tmp_ret != -EOPNOTSUPP) + ret = tmp_ret; + } } out: return ret;