From patchwork Wed Jul 20 01:12:26 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Patlasov X-Patchwork-Id: 9239241 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 47A78602F0 for ; Wed, 20 Jul 2016 09:45:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 36D2B26246 for ; Wed, 20 Jul 2016 09:45:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2B42126CF9; Wed, 20 Jul 2016 09:45:56 +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 97CA926246 for ; Wed, 20 Jul 2016 09:45:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752740AbcGTJpx (ORCPT ); Wed, 20 Jul 2016 05:45:53 -0400 Received: from mail-ve1eur01on0134.outbound.protection.outlook.com ([104.47.1.134]:27456 "EHLO EUR01-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752284AbcGTJpv (ORCPT ); Wed, 20 Jul 2016 05:45:51 -0400 X-Greylist: delayed 14411 seconds by postgrey-1.27 at vger.kernel.org; Wed, 20 Jul 2016 05:45:50 EDT 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=Iycm8m8yRgCoravPYamtkF5SiLFrD97tlBbAwDJi7EQ=; b=Hho+LxQCDofYOiv1+zG8Hk8wWVn//ybIZ4e7imh5/KJpVWs/0IUCjpqs6w/SRjNdtc+1hTu6AcoaBrWlZs9ofA90cN6DABJPn7cRkDHJgQ7MmTHcm/YYS65Z2A4zwgKHGeR2DTZ57NDJAALUZj0h+zKAuBAH+uRrI94pwqmp9lc= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=MPatlasov@virtuozzo.com; Received: from [10.161.30.23] (162.246.95.100) by HE1PR0801MB1849.eurprd08.prod.outlook.com (10.168.150.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.544.10; Wed, 20 Jul 2016 01:12:47 +0000 Subject: [PATCH v2] fuse: fuse_flush must check mapping->flags for errors From: Maxim Patlasov To: CC: , , , , Date: Tue, 19 Jul 2016 18:12:26 -0700 Message-ID: <20160720011135.7038.47635.stgit@maxim-thinkpad> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Originating-IP: [162.246.95.100] X-ClientProxiedBy: CO2PR20CA0026.namprd20.prod.outlook.com (10.163.96.36) To HE1PR0801MB1849.eurprd08.prod.outlook.com (10.168.150.145) X-MS-Office365-Filtering-Correlation-Id: b1e32a30-7e44-442e-a0d1-08d3b03af6fa X-Microsoft-Exchange-Diagnostics: 1; HE1PR0801MB1849; 2:rbNpdMSQoO3EGJHxudXbPrm/vH7ZYq1JFFRs9P9d7vGRa+pSPsTzNtGvpCdb+oi8N4mQ55+9CDoGljdqx2JQ4OwIXSllDDRZ1bBITMH3cWqLznsIECf+WRqrxcU73oi1qBld/0vs5siuAZrOtkofOL6MMdOZRatq0QDTxBpBHrb4w6Au/FB/mHNxA8tjWvoF; 3:RekQYK06NFGRLDLnCqr2IIOCB9oytkaEsB+6HPVGlezOFg0k+jA64LZ8rQUPydXgUa1FK2t9l6CbB5+u6S4+X+QVxmdoWXXmEVXS4T5npzGmWJZPfvNMcxCAlJvAE02p; 25:1PG7gOuQfZzIr3WV34VyDMZEZly3jQOmf5Pv9SfBz4Czu6vAEpR0J7P6OiwkoHUCvGC/D6WVJnEvLYNwyjGMGZLeT7YSDvpnAEVhavlChT7BDbdLj2ADj03av55SNsSqab8VmdKtwPfCXXY9+dF4y3ZROfaRxSut9bCeio0mKfc6+abbOsjX6pZ3bfV46IRIT4yntrq/kMcEdiSoXaIdkISgoX+Ya3u585NfpAM1S+nmome3G65NGlx1at1mqkAnryvjoN06sdfel7TtTYj4AXhsimiIEcMazdlLAIH4DhYf4349CGe+Eowf1rdDT7KsPCODBlU78XmIePIkB5CRzBzSU22R5lJiEhMUoKbzo9X4zYB3c237v9mnqHVPreIf3iiXYzBRMihI8YIvMM49Myvaz8dxCHXpJPenD8xxwPw= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:HE1PR0801MB1849; X-LD-Processed: 0bc7f26d-0264-416e-a6fc-8352af79c58f,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; HE1PR0801MB1849; 31:KUFy5kV70P8lWpjFMxBzvagQUa5uVgeTaGWOhpkDbki8oTNJ2njAOoeuA+aFg68a67jveeBMFbJjPFuVKuAq/iv/3Xqt+1w9b4yB6iwaZZ+KZWZz2jegDCBVbcyrKHIqRVCQAEbCMb6unPuxzdttaihFIlSiGLepwFl3/R5ZAcfltBQsRHGu6C5qtUG9BPMmhGG/cHI4m1Pjl0+UYJG8Dw==; 4:D3E8du1a5VNhpHJHym4DJa6IzzNkSQ9CepJuvOdUuZPS6nJLZjicHxOjQYLdbP1At5xlUUrPrlBGyBZfHUxqqbFey+QznD5XvWJ4PiPsCgfyk0jz5mWMBEe0AYR23v8NHWiWtlHhHk3zsvH8S5gtHGzvSvAh6jhrxTW3ErAIgwDsoVO08VA0LEH/hf9R4vQ8Agara4q/4LYI4vJIpuYVrnbWCVNasqFKrDw8uxhY2G38X5CuUWASVSvDObjHJSaRXoKGKt8uaIymkNp1dncdJIorQDz3bRg8jQRwtqH2Tnr1DpgmBADKpswhbKPCzBiWxMsaCk8/RXJAbzhanwtnsi8nPiB8Z6Ibw5rWkVKw00il1Tbq+T5TTIT/l0AMhNmNBv9YN7cHUbvUUvWEUbcnrwYOxYmH97vPEeOhL5Xozgs= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040130)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6041072)(6043046); SRVR:HE1PR0801MB1849; BCL:0; PCL:0; RULEID:; SRVR:HE1PR0801MB1849; X-Forefront-PRVS: 000947967F X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6049001)(6009001)(7916002)(199003)(189002)(50466002)(4326007)(107886002)(83506001)(230700001)(23676002)(42186005)(101416001)(33646002)(103116003)(2351001)(47776003)(66066001)(50986999)(68736007)(54356999)(106356001)(2906002)(4001350100001)(7846002)(80792005)(7736002)(77096005)(92566002)(86362001)(305945005)(19580395003)(4001430100002)(19580405001)(81156014)(3846002)(97746001)(81166006)(8676002)(33716001)(1076002)(110136002)(189998001)(586003)(97736004)(6116002)(229853001)(105586002)(9686002)(7099028); DIR:OUT; SFP:1102; SCL:1; SRVR:HE1PR0801MB1849; 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?MTtIRTFQUjA4MDFNQjE4NDk7MjM6SGdkUG9hYXpzTExjaEpSUENqRnhpVXpU?= =?utf-8?B?d0J4cHJjTlpiK1psUU56SmJJNUhJNFFuZDZiOGdEZ3NWTnkyM25hVkhBNmVh?= =?utf-8?B?dmtLK3pYM3RMN2pwTnloRmFhNkRuTENmd2huZmhRUEU0dDhnYjM3MW5BOFFr?= =?utf-8?B?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6Qj3ktnqMQfjokZhWvfUDhmRvNNDErNXv9Crf0EtBoOJDKDyXjgs9neTpXT3; 5:DdPRq2khxHphJi6R/9A+R8y9AGJS3y/XEpiLXN9yOE2YCrgo/vt9jLU2ffc62c0lAP3pSRVmn6No4vJycaJsMyL2yhdp2taCFF16TGPn/ei/lu/pY1v4cpMcJzWh4PxrxUAuK97ywQmd4Ybrn36evg==; 24:r8JL4Kngf1v0Pb/Q/zSYLNDD7a7b3+OMZSYSO72mWp6UBI6b+n3kWskNQS1pFvjfBVVo2hrVvTmOt2O8udNZ8jR/tEw4iq9d6F7AuQPvGQc=; 7:Ce7FWu0lMK9bZ8UakigzhXqTDGn59sBTngVGduCeC1D7vU1lBeX8mie9oDGfe2OZSlYnWHTRjEFGe1b7PZBDroSpZ8fJ768u8ozeKAA6um2zSQRliI2ewPJozjg5EUVGMRIGGI4+uuJRH2wTXg+MtY0cP2d0NKDxsLhy2l59UqaBpD+aldZIweRvFM0xLO4ki0pPkz7ctHdNpAg+xA6kKMnD56H/ptZy+/Cpv2+GrOdSYNX1jxr0TJRlnpQrDhRT SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; HE1PR0801MB1849; 20:glXOo1aFJIX1cQIilqvEpNsBDbzYn70BV/aN3b6qGzo9g874haPE9hvLUXXXr2J0jfJ7l6DB9f4L+RJXZP7uL59v5xpHysoi5XyV4a0EntKmimwxVNoAOBCISth2d5ImOpPKVJmj+rMDEBw4Ch/Z8EHOf7kSNSZlj/MUOEMPPLA= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jul 2016 01:12:47.2961 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0801MB1849 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(). Changed in v2: - fixed silly type: check must be *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..6cac3dc 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c @@ -417,6 +417,15 @@ static int fuse_flush(struct file *file, fl_owner_t id) fuse_sync_writes(inode); inode_unlock(inode); + 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; + req = fuse_get_req_nofail_nopages(fc, file); memset(&inarg, 0, sizeof(inarg)); inarg.fh = ff->fh;