From patchwork Wed Jul 20 01:07:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Patlasov X-Patchwork-Id: 9238651 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id BCF15600CB for ; Wed, 20 Jul 2016 01:41:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ACB5D20587 for ; Wed, 20 Jul 2016 01:41:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A125826B4A; Wed, 20 Jul 2016 01:41:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3573520587 for ; Wed, 20 Jul 2016 01:41:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753012AbcGTBl0 (ORCPT ); Tue, 19 Jul 2016 21:41:26 -0400 Received: from mail-db5eur01on0108.outbound.protection.outlook.com ([104.47.2.108]:15370 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752459AbcGTBlZ (ORCPT ); Tue, 19 Jul 2016 21:41:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=F+rDfICebtHEbWs5vNsCOsozJFUMoP7FEBikI4u/cL0=; b=VlzmdG0V30AZRRTb1c0o77SgxHT2b+sOwanZyhnvW3AtoFKPns+jOCvBEMXXClBtLZFMw+gYHpsPk+/twKts/hhzQYjrTDoUGdsiP4x1ZThg0Hz48EkfEcK3PdFYwTBCcNHmHd81LG/Up9uBFy3x+axQ32onrkWTUPZCCL76RH0= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=MPatlasov@virtuozzo.com; Received: from [10.161.30.23] (162.246.95.100) by AM5PR0801MB1842.eurprd08.prod.outlook.com (10.169.247.147) with Microsoft SMTP Server (TLS) id 15.1.528.16; Wed, 20 Jul 2016 01:07:55 +0000 Subject: [PATCH] fuse: fuse_flush must check mapping->flags for errors From: Maxim Patlasov To: CC: , , , , Date: Tue, 19 Jul 2016 18:07:41 -0700 Message-ID: <20160720010707.6780.44793.stgit@maxim-thinkpad> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Originating-IP: [162.246.95.100] X-ClientProxiedBy: CY1PR21CA0012.namprd21.prod.outlook.com (10.161.247.22) To AM5PR0801MB1842.eurprd08.prod.outlook.com (10.169.247.147) X-MS-Office365-Filtering-Correlation-Id: fdb60120-4b8b-4191-a9cc-08d3b03a4905 X-Microsoft-Exchange-Diagnostics: 1; AM5PR0801MB1842; 2:aVLM1Q0Frks3s+u7zc0wejrb+mDgP726h71Z9bbrL2FhvvqozeWrKsIuhLONIRabuy7wItMdE79bAvoCqROgs4m/eCdsSgrh6kLUWHPIWwSLLdxmizqYcG7+o7htJmfVKPr6r9mpb8oDaJeVZHNce47ZqdZmdrCYUIxRLNccfu4FAp3vD7+mUrfrAu5wN8ef; 3:HdB3+nVYkZSetYGtVB4r9l9qFAJnfh+6o5xbTmhcUFqk5lsJ0AA0IaQoyyJig7s1FTEZcz9pfjZgQKvBay3HefSQWD/aw4tU4XSko2s7Ecd0cHlPx7r351lhnybtEGrf X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:AM5PR0801MB1842; X-Microsoft-Exchange-Diagnostics: 1; AM5PR0801MB1842; 25:FH10db0bxbw4SYLtWturtjocVmyTNjiChYc9Kr9PJoWT56VNEPk6BfkxbLhH1OXzZ1vIHO2xArilq27r77BcsuC7m/mS8lTQNo/pmFYP3QrgwmQJNvVl00XrvCQtyCTPZ/hpclma8q5/XWGgFWmRPGtoTcD0PB5Xh/RaX2L+AqRh2wUgI5v7pPwRz81ouaxoK3Ie5y5EUrvtl6YRs808V/RdhsFGlNrtUJukHmFeGCgpEr9njFdlT2qRLmUJuHsIlIBmgAJYiYvbmTPAFk9bcIU3GMbgaMIjgx0+EFbtubU16Um0rS8ydKLQUDG34RViIthh4ZMpH966k5fyqCM7xVnHwXMDmVFfU/VMu6m2sYOGMgnTljdDEW53sQ8kB/2dkc9wd1YUx03m//0cOW+Xt5DJ+3jewn3cY+T40XDbVnTdqF87k8gAFLRSuN+DoYQIoYFiUtlfzYPTcHBFOHuWX5JIOOykgJSc+u9S41Y3KIuUJAVvZK7pxzXrxMaBSJBtztr84ODzeJRGNrowxt/44x8loD40UpHwcFiGhgFJ91TnS/v2siiZBQbq2bD4qq8depEpQ5Msv0DoF3SC8nZ/mgIaveXKUCYUF4P8Z9yBjEh2qi/og+MuLLpLKMrH3N5tTvl/oHxMkoTgq6xQBivlfyDlH0iHYJuSWtjj3UIsj9xvjgHw7bu9vtJxrgkUFVP7; 31:bLtSgRR6Br3cqhcRY48t2e9bW3eSM/YV/rEmd/9EvGSQzVYZGHt+kJOd8yR+IVHrAX50I9TPPjofDg1En32Vg37DomiNTLbM/x9FKTIyeLBCB5zWsHxlcYdBw3MY7LuQjnRK9mAJXAe8avR0gIqVTeNXuEDeJFApkiz6mj4Df9hqiXBcyzHlvUgHu4mkoxcvC3SlBLM0a9YxGB1YiMou5A== X-LD-Processed: 0bc7f26d-0264-416e-a6fc-8352af79c58f,ExtAddr X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040130)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(6041072)(6043046); SRVR:AM5PR0801MB1842; BCL:0; PCL:0; RULEID:; SRVR:AM5PR0801MB1842; X-Microsoft-Exchange-Diagnostics: 1; AM5PR0801MB1842; 4:zECo+iO7hDJ+reCWatu5m76O+yPq/tryMgHVxzqAUXZ0GHg6gKLPwhkm1Ng7RRBAsiSWAfIVJZHoKWko/16OO5QJ85cDrFlMNyhqyGlhYOxKE2KWeDsNnLQj4nJW712YfdOHoRVlgZUCOTnHO6wbaKpGQioZZ/DU277S0IvvVDQ2Y5GJIzdHC0L42FVBcSVQuPvv2od/Hj3AkXWNu6amksQmrPjYSezh/7AWTqC2ijhfUfTZ5h7aHhHhNXjhQaEIkR0rWC6dcAlYRAXvqrBRQDdzZkzsuW9VYFcPyWn5SG6Pnzgt6mU11/AqLFl603HWxPA8GCQv3F6hOwdwIDrh5dYv1ojK/mfu1H1dFKZYzZLL1CmNje9J07b/kLe1lNsWj9Wfcyks3CKKsutMxS5qyZtVtPpGmQs3fHlWexRXnKY= X-Forefront-PRVS: 000947967F X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6049001)(6009001)(7916002)(199003)(189002)(42186005)(107886002)(101416001)(19580395003)(110136002)(4001350100001)(105586002)(97746001)(106356001)(97736004)(23676002)(586003)(2351001)(229853001)(33646002)(19580405001)(103116003)(50986999)(66066001)(47776003)(54356999)(230700001)(4326007)(68736007)(50466002)(33716001)(92566002)(9686002)(81166006)(3846002)(1076002)(80792005)(81156014)(83506001)(2906002)(4001430100002)(86362001)(8676002)(6116002)(7846002)(305945005)(77096005)(7736002)(189998001)(7099028); DIR:OUT; SFP:1102; SCL:1; SRVR:AM5PR0801MB1842; H:[10.161.30.23]; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtBTTVQUjA4MDFNQ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1oOiq7X+1unlJo181ymYCL1KubamvQvsRHdzfKjwnyxabTWgscauelP10o7BNVna0bfRMqDpRHFbk5QtDnTjNhXXcAyQVREHFEJeIV/s1JWyzqlXg+i095+5q3xVyz/gBYPl8qX4zQpKzzVGZ+sATo24PFWq23GKjBZsAwHe/htwKDryl+GZ9g0P+OO0KXiOy4lNyR3bi2C2jmB/30Jl1WEdQz/UjHvofa71iOE+qq3YA25M2R1Mj3Zw2tN1uYOcI5YFlI; 5:8WJnNdASTIl0SzD5nh/jfcgCk4SESxIEHpVetOiSplm76J2D8Ny48IBl/60bMGZWJlWKyYf8JG15doPAtT07oqXCtlEpQqps3HAq/53oYX6qyH4kUCHL863YvIoFm8v5L+wI2RnG9sQNEB/8v7RWDg==; 24:5D9Fh4ZfZ8o57FqRiZHGFEEtGavFz3OZagbriCgGHpOsfV7BkPwX+bze6Ve0IexC0CSvufI+EagQoyNmhM4Q786p9LOUb0bNahLB9SDkZl8=; 7:69M4jv+F8zrVtbGIGAuWiS399SVKhat6hZg1RNuiWURoFOv2c7UrRduWAfw7xxkWFRPKankc2hJuNyP0/2dyVn8LccPMRYQtoDTB/RMzwgDT50rFUFE2QsZLDqwKKolR9Vji97E11hcdyue7cBUtXWmlfMpsSUduns4YGQepee7ByXS48k5DM6RCABJvG52KJdYl5CxyK03O1Z5xYKg35NRhCIXhPJDdl6fO3bBiVz1U4HTRCME092KCIgMlJ7y8 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; AM5PR0801MB1842; 20:FGfkQx+utCaB1pkzSWJ36+BXTAyECZC4JOmTTx2RNxZxWMsbIIXKAU2HwJ9LRdnJrMaKW45eU1OmF8J0WnnULJ1Rq6NNVW1KnY6Yu2W7l5H8/00XEjGiS58zdIpPeyIGWqWILAX4RAoudSjevE9mcUyomhD7zLM/2I/0fVYWsoU= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jul 2016 01:07:55.6611 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0801MB1842 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP fuse_flush() calls write_inode_now() that triggers writeback, but actual writeback will happen later, on fuse_sync_writes(). If an error happens, fuse_writepage_end() will set error bit in mapping->flags. So, we have to check mapping->flags after fuse_sync_writes(). Signed-off-by: Maxim Patlasov --- fs/fuse/file.c | 9 +++++++++ 1 file changed, 9 insertions(+) -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/fs/fuse/file.c b/fs/fuse/file.c index ad1da83..b43401e 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c @@ -413,6 +413,15 @@ static int fuse_flush(struct file *file, fl_owner_t id) if (err) return err; + if (test_bit(AS_ENOSPC, &file->f_mapping->flags) && + test_and_clear_bit(AS_ENOSPC, &file->f_mapping->flags)) + err = -ENOSPC; + if (test_bit(AS_EIO, &file->f_mapping->flags) && + test_and_clear_bit(AS_EIO, &file->f_mapping->flags)) + err = -EIO; + if (err) + return err; + inode_lock(inode); fuse_sync_writes(inode); inode_unlock(inode);