From patchwork Mon Aug 27 15:29:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kirill Tkhai X-Patchwork-Id: 10577365 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8B86B920 for ; Mon, 27 Aug 2018 15:29:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 791F72968D for ; Mon, 27 Aug 2018 15:29:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6D3F129694; Mon, 27 Aug 2018 15:29:20 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 0B7A82968D for ; Mon, 27 Aug 2018 15:29:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727233AbeH0TQX (ORCPT ); Mon, 27 Aug 2018 15:16:23 -0400 Received: from mail-ve1eur01on0128.outbound.protection.outlook.com ([104.47.1.128]:59616 "EHLO EUR01-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727226AbeH0TQX (ORCPT ); Mon, 27 Aug 2018 15:16:23 -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:X-MS-Exchange-SenderADCheck; bh=OXy8/7X0TSXhboCFL2wrXXdxJybxn47IBgvvLdh1hg4=; b=Sn6JmWLWGsWQ/RV7banFniPadqt3xqmFzpUFbda+pe9rqwAyND3rqlDSyYk03Er22Bi2aO5i8eNFcZMbpQmgGcAdG2GCfSVUCjnI/Xztkn0IJ6rfivgGjG2fa0Vz6P3Owk3ZIMoiW1l2ecaNSu+EEBpO/vH8BozR/+xlqmEGtZE= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=ktkhai@virtuozzo.com; Received: from localhost.localdomain (185.231.240.5) by AM5PR0801MB2019.eurprd08.prod.outlook.com (2603:10a6:203:4b::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1080.17; Mon, 27 Aug 2018 15:29:13 +0000 Subject: [PATCH 1/6] fuse: Use list_first_entry() in flush_bg_queue() From: Kirill Tkhai To: miklos@szeredi.hu, ktkhai@virtuozzo.com, linux-fsdevel@vger.kernel.org Date: Mon, 27 Aug 2018 18:29:10 +0300 Message-ID: <153538375088.18303.12624556981175203201.stgit@localhost.localdomain> In-Reply-To: <153538208536.18303.10732945923322972743.stgit@localhost.localdomain> References: <153538208536.18303.10732945923322972743.stgit@localhost.localdomain> User-Agent: StGit/0.18 MIME-Version: 1.0 X-Originating-IP: [185.231.240.5] X-ClientProxiedBy: HE1PR0701CA0046.eurprd07.prod.outlook.com (2603:10a6:3:9e::14) To AM5PR0801MB2019.eurprd08.prod.outlook.com (2603:10a6:203:4b::22) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 05c602ea-1947-49cd-cf7e-08d60c31d856 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989137)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060)(7193020);SRVR:AM5PR0801MB2019; X-Microsoft-Exchange-Diagnostics: 1;AM5PR0801MB2019;3:TPaTy1UYQi1gKWw1FPY6rPy3FGnwMHsj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4n3D3TamUnovDRCdzVafojfcuf2/Cn5Zxwh6A+ShgWUhPvUVtIXIcZxROMsbJxx+CYdNO3myaRw1xswkmVsDNC5aMEflUEgUuZlxtHGWVOvYGxXC8gn7NKvEAsgauX8ClOlz6Zz1nVniah/DYGSAyxRxHqHKJDgXEdYdEm1wwIhQLfD2Avjbsk32878lcKtZZXW1kqcB1f5OGA2u88fY3EYz63d6Mm81nPxxXl9lag1bPvEyGkZFH4E1ZU/gJc88HU9LGqfuV5QCg3H2PQ3+K5sUcwcA1Y/R3Rru5lw8rXw;4:TtqDn/VzSDUuvfcsCMDcgniWVaZPB2RZPhk02rBXfZxAHp0MxNksGAi9DHkiJrMXGGz0oNcMr9n+AyESI0xbu8wAqhA+SM5jdvcJaJrHxadUrhh7Wpx1Rn8k4tla4qpaArv+nnoKgLm3fM4HqSBcHoQwDHlAFyYygo8quNyYR0lQ1fS8ozxgqHWfE4+eTXQoQSJF7wDfjaYVs4ppKyr7TGenvFeZKTRztt6SPlldofTMzoEPIAQp2zkv4UHWOWvUFJ7sv7oDVzpt9tRlE9RbHQ== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040522)(2401047)(5005006)(8121501046)(3231311)(944501410)(52105095)(10201501046)(93006095)(93001095)(3002001)(149027)(150027)(6041310)(20161123564045)(20161123560045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(201708071742011)(7699016);SRVR:AM5PR0801MB2019;BCL:0;PCL:0;RULEID:;SRVR:AM5PR0801MB2019; X-Forefront-PRVS: 07778E4001 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(6069001)(396003)(366004)(346002)(376002)(136003)(39850400004)(189003)(199004)(7736002)(14444005)(11346002)(446003)(86362001)(50466002)(61506002)(316002)(956004)(486006)(478600001)(476003)(68736007)(305945005)(16526019)(186003)(8936002)(26005)(2906002)(97736004)(103116003)(9686003)(53936002)(55016002)(81166006)(81156014)(386003)(8676002)(6506007)(230700001)(105586002)(25786009)(106356001)(23676004)(2486003)(7696005)(52116002)(76176011)(58126008)(5660300001)(66066001)(33896004)(47776003)(3846002)(6116002);DIR:OUT;SFP:1102;SCL:1;SRVR:AM5PR0801MB2019;H:localhost.localdomain;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; Received-SPF: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?q?1=3BAM5PR0801MB2019=3B23=3AH56gF?= =?utf-8?q?kBLphqLo0dT74Sxrcdtele3VPBOt7UVghPUFrgCKJ1wuqRYLB6SLNkQEDaNoKBQKx?= =?utf-8?q?Kicf++TM0nEToLtNdY6hatebYMOIKO+keug1pDAlUfDPp4Vr5SDT+bwPk5SX3Gtgt?= =?utf-8?q?dMCdSxKAMnY6ldDW2I+77kB/t/xSdPnJdzzmBM3Q3GFBfhi1hb4e8VebBpmRA/Nk3?= =?utf-8?q?Rq4mWOCSxI/Xdj5SbNdmqoLFVhFHHFjWaiw4hMB6POeWdaXd2YX91pAhCB4PiTtjT?= =?utf-8?q?N1rnZA7fXtGJjBYpBKfZDNBKPRasNsdWitbSkUjC5zuPzf5OJV7SUkhxm2mod4p5y?= =?utf-8?q?Be+LoXv8NNFjWVQQOlHNcLVzH725/n1l6gY5oGM5qldnxIdujnyV4voydV/9IKQME?= =?utf-8?q?uo7jFr/eAfCATSCVgVLW0swHswT2tTx/c08gKRvDd5Nt1bDYFkkgcs4iQYQ+iIZoB?= =?utf-8?q?nNn5+BBqp9bQ7ss5sVrZK5vwc/QQBqYGOSveuhQin+Lg9Vw/rOhR89zl2gd2qUPSD?= =?utf-8?q?YqBCkhNP79jwddmEhf+TMNEVSdzNorRS0O4En5x04y96MWZiBDQnm7IPMFdK90Vn7?= =?utf-8?q?vykmujLvFa8QCjJGL4MjANtCdqwrXq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oA/cV3svB4TxZq4lmv7eGMz1JFwrpXKelwgKbqqNG5zkRHm+mNyZuIxF0/2NuH/NLp5HPJKnwvYr6FUGwx8hNk1B70pk4vUnXX/wrVhhfg= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Aug 2018 15:29:13.8169 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 05c602ea-1947-49cd-cf7e-08d60c31d856 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0801MB2019 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 This cleanup patch makes the function to use the primitive instead of direct dereferencing. Also, move fiq dereferencing out of cycle, since it's always constant. Signed-off-by: Kirill Tkhai --- fs/fuse/dev.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index 11ea2c4a38ab..214ce96b1d26 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -353,12 +353,13 @@ void fuse_queue_forget(struct fuse_conn *fc, struct fuse_forget_link *forget, static void flush_bg_queue(struct fuse_conn *fc) { + struct fuse_iqueue *fiq = &fc->iq; + while (fc->active_background < fc->max_background && !list_empty(&fc->bg_queue)) { struct fuse_req *req; - struct fuse_iqueue *fiq = &fc->iq; - req = list_entry(fc->bg_queue.next, struct fuse_req, list); + req = list_first_entry(&fc->bg_queue, struct fuse_req, list); list_del(&req->list); fc->active_background++; spin_lock(&fiq->waitq.lock); From patchwork Mon Aug 27 15:29:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kirill Tkhai X-Patchwork-Id: 10577367 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 84296920 for ; Mon, 27 Aug 2018 15:29:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7205A29691 for ; Mon, 27 Aug 2018 15:29:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 655992968D; Mon, 27 Aug 2018 15:29:31 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 EC7FB2968D for ; Mon, 27 Aug 2018 15:29:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727124AbeH0TQe (ORCPT ); Mon, 27 Aug 2018 15:16:34 -0400 Received: from mail-he1eur01on0139.outbound.protection.outlook.com ([104.47.0.139]:38752 "EHLO EUR01-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727014AbeH0TQe (ORCPT ); Mon, 27 Aug 2018 15:16:34 -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:X-MS-Exchange-SenderADCheck; bh=G30o8RDpKGoI9zWPlvwHTDFaFafrCTLqiPwzWWktkTM=; b=Pa3PnrJQFTJ82Q/WUwiyx2U57+K3z2E5jA61MYiHg8EF/6+EBGZxo5MgSkWQPh4dvDTZ98S48oVD3pRTO4WEs14Hi8Mrxtpg2Mv+BqdvYPDZ4kfZP4sHauckDI8v8I42e2Ar/8J3r/rPXWrjBXtAkgI1yAWohpuYPoZTA0XVDWc= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=ktkhai@virtuozzo.com; Received: from localhost.localdomain (185.231.240.5) by HE1PR0801MB2027.eurprd08.prod.outlook.com (2603:10a6:3:50::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1080.15; Mon, 27 Aug 2018 15:29:23 +0000 Subject: [PATCH 2/6] fuse: Move clear_bit() up in request_end() From: Kirill Tkhai To: miklos@szeredi.hu, ktkhai@virtuozzo.com, linux-fsdevel@vger.kernel.org Date: Mon, 27 Aug 2018 18:29:19 +0300 Message-ID: <153538375956.18303.16994686498035052815.stgit@localhost.localdomain> In-Reply-To: <153538208536.18303.10732945923322972743.stgit@localhost.localdomain> References: <153538208536.18303.10732945923322972743.stgit@localhost.localdomain> User-Agent: StGit/0.18 MIME-Version: 1.0 X-Originating-IP: [185.231.240.5] X-ClientProxiedBy: DB6P193CA0014.EURP193.PROD.OUTLOOK.COM (2603:10a6:6:29::24) To HE1PR0801MB2027.eurprd08.prod.outlook.com (2603:10a6:3:50::16) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a46b5beb-d121-41de-cb6b-08d60c31de0b X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989137)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060)(7193020);SRVR:HE1PR0801MB2027; X-Microsoft-Exchange-Diagnostics: 1;HE1PR0801MB2027;3:g5z5dsNGjGrOT3fkM0qYx3jsQW+vsxgUI8ip2/K64+Q89+Sg2NoWHz8MZlRxq8eIP14+/ixOKJ2RfR64k++oJu+9wBmAwnB/xA+WCvzcYRnhUr7Nm92hP0GLjcOkjKSSXhRBP4L9Euyl8y47N/xk+NTeICYoJOyC0JsAjiKrotxW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zQQcS6nbWcHTgClIYRoBzXE52ddLWxlVkd5fl7pqO1h921M+PYIhTpAx2k2VFi96hJdE5qNzlRsiXIlgN5jbmoebPrZjM9qRevuyB+LQWbGPZLExVDBihpIRCUTCuNq0vSINKD29X4+dp2Nmip1RSL2A9d+WTTW;4:Q/4YOLz89ZR4F/23nId3UOCbgBIAAuIZlIt7LcyoHZBjNJ4ndXSqtZU4qeVCixghqzIBwa0BbRvadfnrUIT0R0Z3dtNz9KWJpOCtbybn/hKfzzlnqpXe4RB5IY/s5Vq3cB2AK/d9S+fBdt4Nzqr2uJ2wtGfOZGRdspI3z9BqqC1xy74EXvef8NJcf8d6Z7dXGTvBVLq+Vvkxn1iaLEfMc0SvWy1GZSeX7U/517XJXZn47nW70xo+eHnRfzz2aZ9RUE65gkVarsbtRrIBOMPcCA== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040522)(2401047)(5005006)(8121501046)(3231311)(944501410)(52105095)(10201501046)(93006095)(93001095)(3002001)(149027)(150027)(6041310)(20161123564045)(20161123560045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(201708071742011)(7699016);SRVR:HE1PR0801MB2027;BCL:0;PCL:0;RULEID:;SRVR:HE1PR0801MB2027; X-Forefront-PRVS: 07778E4001 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(6069001)(366004)(346002)(136003)(376002)(396003)(39850400004)(189003)(199004)(8936002)(106356001)(105586002)(50466002)(33896004)(76176011)(25786009)(68736007)(6506007)(386003)(2486003)(23676004)(26005)(52116002)(16526019)(7696005)(186003)(14444005)(81166006)(446003)(956004)(476003)(230700001)(486006)(305945005)(6116002)(3846002)(7736002)(11346002)(5660300001)(8676002)(478600001)(81156014)(6666003)(2906002)(53936002)(58126008)(316002)(55016002)(9686003)(103116003)(47776003)(86362001)(97736004)(66066001)(61506002);DIR:OUT;SFP:1102;SCL:1;SRVR:HE1PR0801MB2027;H:localhost.localdomain;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; Received-SPF: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?q?1=3BHE1PR0801MB2027=3B23=3A/OxfR?= =?utf-8?q?3d3wSsioNAhvaTm5uwVKfacYtwTJ8Xxg7xjzI83CaCf2I3ywiK1zbOFLVQd+VXWEk?= =?utf-8?q?eyjL2yBClanVvvAKA5My0vAoV1+3B32KvwV6yJbDfeq7h+20XrFFCcXA5UbIm3iC6?= =?utf-8?q?DPEEj1Q7mOZwl4senEaWJ7ov3UIi8LurK7+AKupVveeE9MWiuV/qVRTTOl23fPUC/?= =?utf-8?q?tfIkHIxbSfVbW/3umVv8OMV1djC2edsaLBTyzUacJWca9E/fMlYTZni2itFCIvcK5?= =?utf-8?q?xEcL9xH4GWPCUg99yhhtpQ4oWo+TRffEmycyrwRtkufIlifFQUqY4Ck2b02HcsN8I?= =?utf-8?q?yDBb65LlXeS1eWtilNCvFHUKwygbKhBSEzmPT2WLg3G9miOENLy+gGYrswT6KWCpm?= =?utf-8?q?0NIiWAhYzRmTHLWgQhm15lRmJJRZPRg+iwAOq/D6y/BnlfyDY2cgsZdYgC2tc54Y2?= =?utf-8?q?i0sFnMfxtDRqe1SG5Af8zaduImIVJxMiB2Hz073TdwrJ40uOS0i5TKSPKIfi7TGFJ?= =?utf-8?q?VUX7HKUJ3FXUf6T0mwMJ1QGxlYIEXBiRvmkbu44IE6+Dyj+iq73Ju38jexsqIfTqX?= =?utf-8?q?FYlFcngPkW4z8QOLvix93pX5pDmGygCOt7cb3aIYWFOWquIWsyxqFJ2oiyoYt6kA+?= =?utf-8?q?cxKawEo+LErkYLz7rvpqVivRDOi0DymZgLv32LOOLcCJXOLoPNOdyxh2MVKmRMNNG?= =?utf-8?q?YzymIast/nXIziafeTSVWqOFR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08jyXNm4zVWHOmOj7tjwe8TnNTieebnROuHpb7vnUfEy9HQM2Erug+VN3RHbcEv0Dq/KsRffu0QUBpoCmc2hMFFeD1nAUtT1ewSB86yPkeKE6TGC6dp9tasTKmkQGOOnaeopNq213emL2C6L1Y5/PyGq1vtTf7jVBnAXoEXZtW9fcNsU7cNwMmPHG9shKG4IYKR1jZLaq1VVrjWfzfz9Si+nvlfEMLOPkzuJdcFGjuqXbB69aGPASyvdNIwXOYv5QqDLilliNA9DZL5rJy708orGWv/xGutnz+yq8MgBYrouiMwA9AK+NFDBmiwbB8Ia8ukSUR0h6cWg1epkh8Zj8qzDLj9Xxe+PQ1gc2gA2vgO1T7FifLiA==;5:7JIkILj04NcFsAWqw5wNR4t/a2+E+x8pdBK43GBnvYIlSooD/h4rDjhim3AjHzK0FEJHc66Y41WBIqxOlpGwdKek710ZQUOmx8E19uryf1it2tj1gXkY5Fc6wD21h1dm0HcP1k6aQ0Cb3ezirnvZhEhPi3smjR44v8mje720beY=;7:EdwNol3aQIwQLBWxKX9gkCwk2S3yMnbeKMaBA5Y/wl4xE19HZgBzdYJ7xq3JUq0LacyvAe6OVLqRkeV0AYa1labgURX/RjBRu0Zz33IMvpaEu2rg2pPfNazOiXhR/DyPmeRkpCjZNQpFpPc3qx0fccK001G7Pm9uK6bY0YCtn2NmncXfIEeL6fvD3d56cBG30ZldRiF3JBk5lcvxkNpTjwpr2bMf0PLc6kUewpGMCc7t1wFR7Htj0c1UkYg7O0Xj SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;HE1PR0801MB2027;20:tBGCyqm0ZD3KYDh5ewhvpD37fMZ6LF3xBpBOofxqr5j38rOCIaqR2fIYMXi8dDBoXYjyXoPznRT/6YTDRYsqGyrnvyAn+VJGw35NYLIgi1oQtPB5SqIsKBANgVO2nwglyM9ugydCWftcM7i2Rz+0r/p/oB+TQtG/0EiN4zmMZmk= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Aug 2018 15:29:23.2154 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a46b5beb-d121-41de-cb6b-08d60c31de0b X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0801MB2027 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 Nobody can clear FR_BACKGROUND bit on processing request in parallel, so it's possible to do it out of fc->lock. Signed-off-by: Kirill Tkhai --- fs/fuse/dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index 214ce96b1d26..ce07a41ff8fe 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -390,8 +390,8 @@ static void request_end(struct fuse_conn *fc, struct fuse_req *req) WARN_ON(test_bit(FR_PENDING, &req->flags)); WARN_ON(test_bit(FR_SENT, &req->flags)); if (test_bit(FR_BACKGROUND, &req->flags)) { - spin_lock(&fc->lock); clear_bit(FR_BACKGROUND, &req->flags); + spin_lock(&fc->lock); if (fc->num_background == fc->max_background) fc->blocked = 0; From patchwork Mon Aug 27 15:29:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kirill Tkhai X-Patchwork-Id: 10577369 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B981613B8 for ; Mon, 27 Aug 2018 15:29:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A700E29694 for ; Mon, 27 Aug 2018 15:29:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9B4CB2969D; Mon, 27 Aug 2018 15:29:37 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 36BF329694 for ; Mon, 27 Aug 2018 15:29:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727226AbeH0TQl (ORCPT ); Mon, 27 Aug 2018 15:16:41 -0400 Received: from mail-db5eur01on0109.outbound.protection.outlook.com ([104.47.2.109]:51264 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727014AbeH0TQk (ORCPT ); Mon, 27 Aug 2018 15:16:40 -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:X-MS-Exchange-SenderADCheck; bh=tjSTzk/e7MyfWxb2FySj0qYzgvbE/OYzrYdutB4aXqA=; b=PXYRuPZdFfIC1IWi2rF/m4JMzQdR96wPynDFluvz+zzJJ2zufNBDHYXm8UnXiG6RQpqwZdoEjtwHhQwuATE7R6VOnpcHhQP7S7Wh5Ba7/CeD3ZZaNCebZT4o6pmEmDXpx5VwQSaew0EFOefdDcvmMuZ57WBNRPk4yhOcniAlrc0= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=ktkhai@virtuozzo.com; Received: from localhost.localdomain (185.231.240.5) by AM5PR0801MB2020.eurprd08.prod.outlook.com (2603:10a6:203:4b::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1080.17; Mon, 27 Aug 2018 15:29:32 +0000 Subject: [PATCH 3/6] fuse: Underline congestion_threshold and max_background may be read w/o fc->lock From: Kirill Tkhai To: miklos@szeredi.hu, ktkhai@virtuozzo.com, linux-fsdevel@vger.kernel.org Date: Mon, 27 Aug 2018 18:29:29 +0300 Message-ID: <153538376941.18303.12286472696863147895.stgit@localhost.localdomain> In-Reply-To: <153538208536.18303.10732945923322972743.stgit@localhost.localdomain> References: <153538208536.18303.10732945923322972743.stgit@localhost.localdomain> User-Agent: StGit/0.18 MIME-Version: 1.0 X-Originating-IP: [185.231.240.5] X-ClientProxiedBy: AM0PR02CA0014.eurprd02.prod.outlook.com (2603:10a6:208:3e::27) To AM5PR0801MB2020.eurprd08.prod.outlook.com (2603:10a6:203:4b::23) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 38531c34-bf55-41c9-1444-08d60c31e31c X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989137)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060)(7193020);SRVR:AM5PR0801MB2020; X-Microsoft-Exchange-Diagnostics: 1;AM5PR0801MB2020;3:Tt32ySTEsULWp6g41BPjie8D3+nt56tsvqTka6l9635GqhjvG7bfNIJE1Q/aLrJ+pKpTmcyXg9Z2JaJL1GXAdLWg2eKgCepw8Y3TT4+VJE0mU4pX0b1FhmL9DjyzscH5Q5cU1PB/O88nkghYlSS7Zzc4WFmCR5Sc1tn5cQh4YZYSEwRQ5+jhDSM/3Uf+vKfWpDfUiSM2gxcffKi0F5afNzHYdwdUxZr8DotYKGFLQmGL1NRiDJnfz6ql0Y0ZCbQ6;25:PYExGpANzvi1j+yXxeX9rFwR4Vjireh4l26vjWMoE658W9vVAdXfb0Hx5lZgAp21H5KB85p0hvhX6s2JDTR/4ahEbaldKLRmF5qpzo/tXx45duB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OgcwvuXPsWz9xzxQ9dBSbP+QjqGVxEjAIx1t5xY1ndKG3Jna1dZkkHSNvGz71kcEMxa7eqt/FidLqbs6WvP89jnCb6tfc5DMPpMSfcJkSKfayPK0DKAfR+IfAA6sa0d5qhJsOb3dBRXYMiGg3DUVzVNZ/3ttdvCV0ptocTaMOYkFWvrKsemXQkve0hqDpsUzr9DSKqp5sxVUF/ryTyiDftNzrkrktEamkDrpJrGAByiHZR44anSOyofYm02tam5V2ZqsZBYEea6MB+RaRKYPvbWTfySRZUqQ5hk X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(211171220733660); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040522)(2401047)(8121501046)(5005006)(3002001)(10201501046)(3231311)(944501410)(52105095)(93006095)(93001095)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123564045)(20161123560045)(20161123562045)(201708071742011)(7699016);SRVR:AM5PR0801MB2020;BCL:0;PCL:0;RULEID:;SRVR:AM5PR0801MB2020; X-Forefront-PRVS: 07778E4001 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(6069001)(39850400004)(136003)(396003)(376002)(346002)(366004)(199004)(189003)(105586002)(61506002)(106356001)(66066001)(50466002)(47776003)(52116002)(230700001)(6116002)(3846002)(33896004)(23676004)(2486003)(76176011)(14444005)(7696005)(5660300001)(6666003)(446003)(11346002)(476003)(2906002)(486006)(956004)(81156014)(53936002)(81166006)(8676002)(9686003)(55016002)(16526019)(186003)(7736002)(386003)(478600001)(6506007)(26005)(25786009)(305945005)(68736007)(8936002)(316002)(97736004)(58126008)(103116003)(86362001);DIR:OUT;SFP:1102;SCL:1;SRVR:AM5PR0801MB2020;H:localhost.localdomain;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; Received-SPF: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) X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frp0wU/MAtwRf/5jx+czwYgmCPXpJJ3lJB00CNtYqQLz2s/1GS3wP3hJrcaPXh3xn76OmoqZlHM5AYfYLz81TZf1C1Hy1eZyYizQ2F4qUmIPHoeAIJLKLujEppARssmP/nH8PiOHl2d1gsTx9we/7OFu5FWLEOMKmHgPVkXLD43JShqN5TPczRdIwvY3E0ZtyXrPrOR6GQrbWuuHRjeV/0AF38oB8pGd4WiQ==;5:LaWve3oHlQHsankoYajA7/tztYqeC4SC+1ugICnbOhrCft70xcYGVN/v3KFlb5+kDS0cmhmZP3dczZlsKqFi0YqSVAvdahPjOE/s9W5N9Z+UDZ+6LmbikaXRo8dLY7DbGEUbvlRqDG+jaZzMwti001c4DnrTyTqc0ZrVtWTbz+Q=;7:pwERL7pd1dfCrYZ+NdQk9+ZAN2KX+KkfoWDR9jL1gLLimsSqBVhORBP4ONAEJAJLYFKUgzUyCqiOPXvuSLCEUk5oFE/9Bu7aVjA2mryx2Zatr+CA+pHPp8oTKG86olz1gFsr6M7VjLpxDyRi02/DWIFTGZwS1o0o10WvE28mjpaFOWYXBO1g3XKn2eIG9G9gQ/CovuNAjDL9vuZPJGQUSzYbkFplLzm7UGcrks3RTf0K1u79B/YwutUppG1Ah0gk SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;AM5PR0801MB2020;20:k4YSEnML99Rxucd4iEmJmNBWugAMbFaBgoUtqGFbPSmSh4B/bbLbOjcuSTiY792RvHYJoAjBwJKPfZgD0Imlop6DopN1FwFonPVYGXXNYhLBckSfaYPFcajBgsV7GkBTIvWeubGY8VbKjSCA5FbxpqU1ZgU7QnZmAphNwAweS18= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Aug 2018 15:29:32.0300 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 38531c34-bf55-41c9-1444-08d60c31e31c X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0801MB2020 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 Since they are of unsigned int type, it's allowed to read them unlocked during reporting to userspace. Let's underline this fact with READ_ONCE() macroses. Signed-off-by: Kirill Tkhai --- fs/fuse/control.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/fuse/control.c b/fs/fuse/control.c index e09b9cd9c3fc..c7290625e171 100644 --- a/fs/fuse/control.c +++ b/fs/fuse/control.c @@ -107,7 +107,7 @@ static ssize_t fuse_conn_max_background_read(struct file *file, if (!fc) return 0; - val = fc->max_background; + val = READ_ONCE(fc->max_background); fuse_conn_put(fc); return fuse_conn_limit_read(file, buf, len, ppos, val); @@ -144,7 +144,7 @@ static ssize_t fuse_conn_congestion_threshold_read(struct file *file, if (!fc) return 0; - val = fc->congestion_threshold; + val = READ_ONCE(fc->congestion_threshold); fuse_conn_put(fc); return fuse_conn_limit_read(file, buf, len, ppos, val); From patchwork Mon Aug 27 15:29:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kirill Tkhai X-Patchwork-Id: 10577377 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A3B8C14BD for ; Mon, 27 Aug 2018 15:33:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8606F29B5D for ; Mon, 27 Aug 2018 15:33:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 79D0D29CEF; Mon, 27 Aug 2018 15:33:43 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 119B029B5D for ; Mon, 27 Aug 2018 15:33:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726939AbeH0TUr (ORCPT ); Mon, 27 Aug 2018 15:20:47 -0400 Received: from mail-eopbgr50107.outbound.protection.outlook.com ([40.107.5.107]:43008 "EHLO EUR03-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727014AbeH0TUr (ORCPT ); Mon, 27 Aug 2018 15:20:47 -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:X-MS-Exchange-SenderADCheck; bh=+aIRAKNytCXhXG8C8MhbyevhWC66MLtsAnZYfMuQYAY=; b=gAOS2AvgAvAXa5t+QopRDl78aS6Vl/U2Gp9TrTtDGtRW/09MfY832f5WLuNoWYaK7Cp2IFzatmMRC5PRHquDZfvAR+mWvzcQegmMqEQm/3LLtFYpB0/sFHmbrNX6lmGF3Or1JU/ps8VpllOFdc2JYIYQ+N7RzrMcvRZYXbzNhSE= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=ktkhai@virtuozzo.com; Received: from localhost.localdomain (185.231.240.5) by VI1PR0801MB2032.eurprd08.prod.outlook.com (2603:10a6:800:8b::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1080.17; Mon, 27 Aug 2018 15:29:41 +0000 Subject: [PATCH 4/6] fuse: Lock fc->lock during changing num_background and congestion_threshold From: Kirill Tkhai To: miklos@szeredi.hu, ktkhai@virtuozzo.com, linux-fsdevel@vger.kernel.org Date: Mon, 27 Aug 2018 18:29:37 +0300 Message-ID: <153538377784.18303.9880331591122960857.stgit@localhost.localdomain> In-Reply-To: <153538208536.18303.10732945923322972743.stgit@localhost.localdomain> References: <153538208536.18303.10732945923322972743.stgit@localhost.localdomain> User-Agent: StGit/0.18 MIME-Version: 1.0 X-Originating-IP: [185.231.240.5] X-ClientProxiedBy: LO2P265CA0159.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:9::27) To VI1PR0801MB2032.eurprd08.prod.outlook.com (2603:10a6:800:8b::13) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c1c7f42a-9c18-4c82-0417-08d60c31e896 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989137)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060)(7193020);SRVR:VI1PR0801MB2032; X-Microsoft-Exchange-Diagnostics: 1;VI1PR0801MB2032;3:P09fR8Yp0H2Rt57B+JcllfFdoLuAUL3WHj+fJhqp9gy7y/VjqiJTbY4NRIyCGn4+AM4yfqw85EbKY0EhQ8yypfnVIbmHa3hnSDn12n2eN3EpXSwfOuwdGLgSoyFK/lLhezYFIAskr/BltTA+2ehvD/nyH/5cZa27sNT4WYn3Qb1mA6UXgv0qtKvC688wLeXFAG1j+CcPnMfCVmG+L6iqKXQsX6OQiU5VKJbuq0pRSJMrngdRKIrXuliCAF+25w1j;25:cE3Q8fyMzO1p1R/r7gjPfv81lV8+5sLN9fEqXngPTf84aQNvsDJVrKdk499b/ChQ11V9IMXUkW2nNWd+K/wa+T2Ue3beEt07PLaYUPmWVtXoMZOqfRRqTj+02LtLQZpXenkeGGz9sgIxVyAjg2+teJm5ycLvtHq/t5xPeVH0lDR2Z4YsPiwxrFF6mZnlP+3+BNfUyw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8oJ6MLubcB9HQ52H2vFOqLq60mCFl10rzmoeufrmkPX4SVgWdxRvjmB1zgSKKNy96rTog4lYIxrIOx5Wa1dHPRFclC/xsbKg0SEBo1Y1xfLmn/i0ogi1l7KJlRMR05hWDLHgbBhQ8cuA17hlFdZVrbzNsBHI4XOCcojw== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(3002001)(10201501046)(3231311)(944501410)(52105095)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123558120)(20161123560045)(20161123564045)(201708071742011)(7699016);SRVR:VI1PR0801MB2032;BCL:0;PCL:0;RULEID:;SRVR:VI1PR0801MB2032; X-Forefront-PRVS: 07778E4001 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(6069001)(396003)(346002)(136003)(39850400004)(366004)(376002)(189003)(199004)(8676002)(6506007)(81156014)(81166006)(316002)(8936002)(58126008)(478600001)(2906002)(86362001)(230700001)(305945005)(47776003)(7736002)(3846002)(6116002)(61506002)(103116003)(106356001)(66066001)(476003)(50466002)(11346002)(446003)(486006)(105586002)(33896004)(76176011)(68736007)(956004)(5660300001)(14444005)(6666003)(26005)(55016002)(186003)(25786009)(97736004)(386003)(9686003)(16526019)(53936002)(7696005)(2486003)(52116002)(23676004);DIR:OUT;SFP:1102;SCL:1;SRVR:VI1PR0801MB2032;H:localhost.localdomain;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; Received-SPF: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?q?1=3BVI1PR0801MB2032=3B23=3AYLKtX?= =?utf-8?q?JqPWswWXZrlYDWCBygo8Hc5k+BG+2e9it/XghnEfRZxlKwZfOZd68GpMmQc+0P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WAvdCCnplqT+0tMR8sRgWvzz6Z/pOLcwAUvSMNNiEs0lmHOzLAXCb69xOvsa9LFIPC2MN347VVb1wmeqguEpBRT/1LVPP+HiSKf1kbJj40YkyVA==;5:UaLsYXmszctXzEqtLFe1YLjhJEKJV0kVfC+vJNjTEuWa41Kx1EuGa1QHyOS7YnzTyI5VjF+Kds9633c+hApkOwO0SY9OUgcOHAMaJOZhI2MoyZXjefbrVaNh4jt09759uI7i2v5nkxXDMnid2yDsXCq61+RmIYRT0oaRZ1ok8VY=;7:aiRK6Pwh4QXTQyIfGWp6CNdUO/6Ul3OzHDOgGTZpz7KEfU02ccBH6SZ/fdfNWi4N46vdLUVLJGTNX/o97T4x4wR/rPLDJp2bDwC7fHov8MweAV7+VouHBq0FhKDQi59sGIMEowEaQrO50ZH+mZ8CdrBrdCc92vz3TgPCCeHYX4f3olJJVN+csnXR2EuIYW5pMv7CYUmUU6qIsgLUfhz14ri5m3NNK5WJyu/eZ7eHaF+O6pKQyORrh39MdJudD/Uh SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;VI1PR0801MB2032;20:NCyEHFyhEO1UIqvScnozNXvsVmU3SU3IviPsFDeCzJznLkU7UtzDvOM0wyGwR1fKA3oynU1/WGSrhWaLC3R0I0axmSPkQP71FL/q6djN/Q79msx5K7ZXD5czdK5g1usdmst/mkd21LbGLCVPGAHwornGn+Uc2NVMrZ/L8ow/fk0= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Aug 2018 15:29:41.0466 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c1c7f42a-9c18-4c82-0417-08d60c31e896 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0801MB2032 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 Functions sequences like request_end()->flush_bg_queue() require max_background and congestion_threshold are constant during their execution. Otherwise, checks like if (fc->num_background == fc->max_background) made in different time may behave not like expected. Signed-off-by: Kirill Tkhai --- fs/fuse/control.c | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/fs/fuse/control.c b/fs/fuse/control.c index c7290625e171..9206501bd94d 100644 --- a/fs/fuse/control.c +++ b/fs/fuse/control.c @@ -125,7 +125,12 @@ static ssize_t fuse_conn_max_background_write(struct file *file, if (ret > 0) { struct fuse_conn *fc = fuse_ctl_file_conn_get(file); if (fc) { + spin_lock(&fc->lock); fc->max_background = val; + fc->blocked = (fc->num_background >= fc->max_background); + if (!fc->blocked && waitqueue_active(&fc->blocked_waitq)) + wake_up(&fc->blocked_waitq); + spin_unlock(&fc->lock); fuse_conn_put(fc); } } @@ -155,18 +160,31 @@ static ssize_t fuse_conn_congestion_threshold_write(struct file *file, size_t count, loff_t *ppos) { unsigned uninitialized_var(val); + struct fuse_conn *fc; ssize_t ret; ret = fuse_conn_limit_write(file, buf, count, ppos, &val, max_user_congthresh); - if (ret > 0) { - struct fuse_conn *fc = fuse_ctl_file_conn_get(file); - if (fc) { - fc->congestion_threshold = val; - fuse_conn_put(fc); + if (ret <= 0) + goto out; + fc = fuse_ctl_file_conn_get(file); + if (!fc) + goto out; + + spin_lock(&fc->lock); + fc->congestion_threshold = val; + if (fc->sb) { + if (fc->num_background < fc->congestion_threshold) { + clear_bdi_congested(fc->sb->s_bdi, BLK_RW_SYNC); + clear_bdi_congested(fc->sb->s_bdi, BLK_RW_ASYNC); + } else { + set_bdi_congested(fc->sb->s_bdi, BLK_RW_SYNC); + set_bdi_congested(fc->sb->s_bdi, BLK_RW_ASYNC); } } - + spin_unlock(&fc->lock); + fuse_conn_put(fc); +out: return ret; } From patchwork Mon Aug 27 15:29:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kirill Tkhai X-Patchwork-Id: 10577371 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EE11B13B8 for ; Mon, 27 Aug 2018 15:29:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DAFC12969D for ; Mon, 27 Aug 2018 15:29:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CED62297BB; Mon, 27 Aug 2018 15:29:58 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 091FA2969D for ; Mon, 27 Aug 2018 15:29:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727118AbeH0TRC (ORCPT ); Mon, 27 Aug 2018 15:17:02 -0400 Received: from mail-he1eur01on0101.outbound.protection.outlook.com ([104.47.0.101]:2163 "EHLO EUR01-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727101AbeH0TRB (ORCPT ); Mon, 27 Aug 2018 15:17:01 -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:X-MS-Exchange-SenderADCheck; bh=Hs72tYcwkrv+dJvDGXUM1JZO+7QAPLBwkNpBBRhU3QI=; b=e27hVvItteoy/87JZCEUtbS/YLs6QMd+TMiRVThuqPBXoyfrgb5pLjCqMc1vh66snKTXirDB15725u+j1FOjB8OH8MuZtWnICvhlH1XJWiWwXhGa08WNj74M0mm9xBQdUf4l90ZqsF5J+lv7CMWhGyVCuYmBwlCWwjzCoeKRmgQ= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=ktkhai@virtuozzo.com; Received: from localhost.localdomain (185.231.240.5) by HE1PR0801MB2026.eurprd08.prod.outlook.com (2603:10a6:3:50::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1080.15; Mon, 27 Aug 2018 15:29:50 +0000 Subject: [PATCH 5/6] fs: Introduce fuse_conn::bg_lock From: Kirill Tkhai To: miklos@szeredi.hu, ktkhai@virtuozzo.com, linux-fsdevel@vger.kernel.org Date: Mon, 27 Aug 2018 18:29:46 +0300 Message-ID: <153538378685.18303.16396611744482855136.stgit@localhost.localdomain> In-Reply-To: <153538208536.18303.10732945923322972743.stgit@localhost.localdomain> References: <153538208536.18303.10732945923322972743.stgit@localhost.localdomain> User-Agent: StGit/0.18 MIME-Version: 1.0 X-Originating-IP: [185.231.240.5] X-ClientProxiedBy: AM4PR07CA0006.eurprd07.prod.outlook.com (2603:10a6:205:1::19) To HE1PR0801MB2026.eurprd08.prod.outlook.com (2603:10a6:3:50::15) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0ddc1049-68d7-4619-4a26-08d60c31ee2b X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989137)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060)(7193020);SRVR:HE1PR0801MB2026; X-Microsoft-Exchange-Diagnostics: 1;HE1PR0801MB2026;3:eggMGv9iHZ1IJAe4PR/qd6DmZFM9VMngruQgsVgHZLO//rMgEJjicq6Z5hwb2UlrpAdiWZyWbs8/7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S6ZipgVf40OzYN0CiF2GtrIXUR64xXCCBRlMPZm2xqr43lC1BlpNlN6+T5Ng8FbqRG+aJN/8dVRTJHYMMgIleQU155YbHuyUKTgpzVyoG/jujRn8P999M1jT1tloL4tqSnmG3nJrZEJdyjYeA6AG2lwVB2U1pev/R/qyY9qx+/QLW+Jv7HJdpBLQVP+PkuRPpcWQQREgw1DJKaU8kJa3MOjXM9A+izUR31nKfqFqxnl+EqbjKNmER7A+eEJzizTKSvrc0wzfF4pAhMdkQ655nwQVP+NNApbxehu6WpiP;4:MknvEGeTC1uiqAOOKGq0anenOxz+dHhNIm8dwPX49U+v8Sn6vZnJDI2Lwe48Yx1nxhJ3ym5lvHeOPX0KXKAYghpbHJ7kjfjBKLGZp+t6eJNVCCrnkVqzARoSDC/bMB9H9mblWluh+HkB+wnpB5+1nrq4cricOWRDpcOY8q9FRZWpChqVE/y0/AXzqnLNdoAa+coGyu3QH1KFeG14iUfYRcTT6iK+EGtiFUO5ui9FdK96pNvx0+tBJhgsbLPa9hkwwV4fxxk9nswEuYdRsKuCdg== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040522)(2401047)(5005006)(8121501046)(10201501046)(93006095)(93001095)(3002001)(3231311)(944501410)(52105095)(149027)(150027)(6041310)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123560045)(20161123564045)(201708071742011)(7699016);SRVR:HE1PR0801MB2026;BCL:0;PCL:0;RULEID:;SRVR:HE1PR0801MB2026; X-Forefront-PRVS: 07778E4001 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(6069001)(136003)(366004)(396003)(346002)(376002)(39850400004)(189003)(199004)(14444005)(2486003)(305945005)(23676004)(52116002)(7696005)(76176011)(58126008)(7736002)(103116003)(61506002)(33896004)(316002)(25786009)(2906002)(66066001)(47776003)(3846002)(6116002)(5660300001)(478600001)(68736007)(26005)(386003)(186003)(6506007)(8936002)(230700001)(9686003)(6666003)(53936002)(11346002)(97736004)(446003)(8676002)(16526019)(81156014)(81166006)(105586002)(86362001)(575784001)(106356001)(476003)(956004)(55016002)(50466002)(486006);DIR:OUT;SFP:1102;SCL:1;SRVR:HE1PR0801MB2026;H:localhost.localdomain;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; Received-SPF: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?q?1=3BHE1PR0801MB2026=3B23=3Asvs7q?= =?utf-8?q?1EBTZp5Rf+UMAEa6xF8IT/G+jljcW4JrAukB9L+vibbGmaYfuRqY1qIyDwuxjmVy6?= =?utf-8?q?qUQjMhJQBRtx3/PCrMKEu1cx/HFCmwNA1lsUvqg77Ay4lyfkYyXJ4FR6UvSlllvpf?= =?utf-8?q?0YF83Xx0rN3qzAxflea0CclfSW2f+8+iGP79Pd6g7qWxw6ncS73js3bYl0TW0rFWK?= =?utf-8?q?4UaR3axP2CFxQkqva2Kil6TuD6wxaSvQp0G2qVEVRDNT3+igZpRB9FPwBnDkbhuHg?= =?utf-8?q?c4CpJneLLHshHxxmkGZFZ5S4GwCbeuGRUawPQyBrVOmZU5peqsFb4pHqRilO6+3MO?= =?utf-8?q?Lu9nYc59MdHuwBYEU9Wid4S3+E26pWFYjiYaNihE/OOh+9mSIO91DGMLwAmH2lKpR?= =?utf-8?q?JbhEv0Naye1DtOQV6Jl5GvKrPXur+9IjtPyZY5221QqReRjxkw393X83XoTnmpBmu?= =?utf-8?q?SyaNI9ugowSyx6FwKJcX1Dqv/se7esbhd/DD9CaKlqII69wErVvkAe2YDgfpgNqiY?= =?utf-8?q?C+SLsVSFjY7VOGsLomxfhWEH8rGC0zcAUazOqbz44/Gkd3khob3YOgldrXFuowwhM?= =?utf-8?q?P8EIYWDwtlK9Kx5w98HszvRshUrC2nHOsN1YnutD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LkQM5Dw/xO8rLZz4hCjJikdH9lr8LS4mQkXx20vFu/T53dit4DQuNr3hYoGBav9yQL47yGmhTahGLsi6ZqU/e4uCh7gHskCJl9G7JVicKFE8uyBPvExqHeE6Biy+VL0IFa6xwUMjODuGO7xgr6u0MNJ/aGDWY= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Aug 2018 15:29:50.4185 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0ddc1049-68d7-4619-4a26-08d60c31ee2b X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0801MB2026 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 To reduce contention of fuse_conn::lock, this patch introduces bg_lock for protection of fields related to background queue. These are: max_background, congestion_threshold, num_background, active_background, bg_queue and blocked. This allows next patch to make async reads not requiring fuse_conn::lock, so async reads and writes will have better performance executed in parallel. Signed-off-by: Kirill Tkhai --- fs/fuse/control.c | 8 ++++---- fs/fuse/dev.c | 20 ++++++++++++-------- fs/fuse/file.c | 2 +- fs/fuse/fuse_i.h | 8 ++++++-- fs/fuse/inode.c | 3 +++ 5 files changed, 26 insertions(+), 15 deletions(-) diff --git a/fs/fuse/control.c b/fs/fuse/control.c index 9206501bd94d..63d0e9552140 100644 --- a/fs/fuse/control.c +++ b/fs/fuse/control.c @@ -125,12 +125,12 @@ static ssize_t fuse_conn_max_background_write(struct file *file, if (ret > 0) { struct fuse_conn *fc = fuse_ctl_file_conn_get(file); if (fc) { - spin_lock(&fc->lock); + spin_lock(&fc->bg_lock); fc->max_background = val; fc->blocked = (fc->num_background >= fc->max_background); if (!fc->blocked && waitqueue_active(&fc->blocked_waitq)) wake_up(&fc->blocked_waitq); - spin_unlock(&fc->lock); + spin_unlock(&fc->bg_lock); fuse_conn_put(fc); } } @@ -171,7 +171,7 @@ static ssize_t fuse_conn_congestion_threshold_write(struct file *file, if (!fc) goto out; - spin_lock(&fc->lock); + spin_lock(&fc->bg_lock); fc->congestion_threshold = val; if (fc->sb) { if (fc->num_background < fc->congestion_threshold) { @@ -182,7 +182,7 @@ static ssize_t fuse_conn_congestion_threshold_write(struct file *file, set_bdi_congested(fc->sb->s_bdi, BLK_RW_ASYNC); } } - spin_unlock(&fc->lock); + spin_unlock(&fc->bg_lock); fuse_conn_put(fc); out: return ret; diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index ce07a41ff8fe..9690e7c79df7 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -287,10 +287,10 @@ void fuse_put_request(struct fuse_conn *fc, struct fuse_req *req) * We get here in the unlikely case that a background * request was allocated but not sent */ - spin_lock(&fc->lock); + spin_lock(&fc->bg_lock); if (!fc->blocked) wake_up(&fc->blocked_waitq); - spin_unlock(&fc->lock); + spin_unlock(&fc->bg_lock); } if (test_bit(FR_WAITING, &req->flags)) { @@ -391,7 +391,7 @@ static void request_end(struct fuse_conn *fc, struct fuse_req *req) WARN_ON(test_bit(FR_SENT, &req->flags)); if (test_bit(FR_BACKGROUND, &req->flags)) { clear_bit(FR_BACKGROUND, &req->flags); - spin_lock(&fc->lock); + spin_lock(&fc->bg_lock); if (fc->num_background == fc->max_background) fc->blocked = 0; @@ -406,7 +406,7 @@ static void request_end(struct fuse_conn *fc, struct fuse_req *req) fc->num_background--; fc->active_background--; flush_bg_queue(fc); - spin_unlock(&fc->lock); + spin_unlock(&fc->bg_lock); } wake_up(&req->waitq); if (req->end) @@ -579,8 +579,8 @@ ssize_t fuse_simple_request(struct fuse_conn *fc, struct fuse_args *args) * * fc->connected must have been checked previously */ -void fuse_request_send_background_locked(struct fuse_conn *fc, - struct fuse_req *req) +void fuse_request_send_background_nocheck(struct fuse_conn *fc, + struct fuse_req *req) { BUG_ON(!test_bit(FR_BACKGROUND, &req->flags)); if (!test_bit(FR_WAITING, &req->flags)) { @@ -588,6 +588,7 @@ void fuse_request_send_background_locked(struct fuse_conn *fc, atomic_inc(&fc->num_waiting); } __set_bit(FR_ISREPLY, &req->flags); + spin_lock(&fc->bg_lock); fc->num_background++; if (fc->num_background == fc->max_background) fc->blocked = 1; @@ -597,6 +598,7 @@ void fuse_request_send_background_locked(struct fuse_conn *fc, } list_add_tail(&req->list, &fc->bg_queue); flush_bg_queue(fc); + spin_unlock(&fc->bg_lock); } void fuse_request_send_background(struct fuse_conn *fc, struct fuse_req *req) @@ -604,7 +606,7 @@ void fuse_request_send_background(struct fuse_conn *fc, struct fuse_req *req) BUG_ON(!req->end); spin_lock(&fc->lock); if (fc->connected) { - fuse_request_send_background_locked(fc, req); + fuse_request_send_background_nocheck(fc, req); spin_unlock(&fc->lock); } else { spin_unlock(&fc->lock); @@ -2105,7 +2107,6 @@ void fuse_abort_conn(struct fuse_conn *fc, bool is_abort) LIST_HEAD(to_end); fc->connected = 0; - fc->blocked = 0; fc->aborted = is_abort; fuse_set_initialized(fc); list_for_each_entry(fud, &fc->devices, entry) { @@ -2127,8 +2128,11 @@ void fuse_abort_conn(struct fuse_conn *fc, bool is_abort) list_splice_tail_init(&fpq->processing, &to_end); spin_unlock(&fpq->lock); } + spin_lock(&fc->bg_lock); + fc->blocked = 0; fc->max_background = UINT_MAX; flush_bg_queue(fc); + spin_unlock(&fc->bg_lock); spin_lock(&fiq->waitq.lock); fiq->connected = 0; diff --git a/fs/fuse/file.c b/fs/fuse/file.c index 32d0b883e74f..a875959dd939 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c @@ -1502,7 +1502,7 @@ __acquires(fc->lock) req->in.args[1].size = inarg->size; fi->writectr++; - fuse_request_send_background_locked(fc, req); + fuse_request_send_background_nocheck(fc, req); return; out_free: diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h index f78e9614bb5f..b2c6a1cd1e2c 100644 --- a/fs/fuse/fuse_i.h +++ b/fs/fuse/fuse_i.h @@ -500,6 +500,10 @@ struct fuse_conn { /** The list of background requests set aside for later queuing */ struct list_head bg_queue; + /** Protects: max_background, congestion_threshold, num_background, + * active_background, bg_queue, blocked */ + spinlock_t bg_lock; + /** Flag indicating that INIT reply has been received. Allocating * any fuse request will be suspended until the flag is set */ int initialized; @@ -857,8 +861,8 @@ ssize_t fuse_simple_request(struct fuse_conn *fc, struct fuse_args *args); */ void fuse_request_send_background(struct fuse_conn *fc, struct fuse_req *req); -void fuse_request_send_background_locked(struct fuse_conn *fc, - struct fuse_req *req); +void fuse_request_send_background_nocheck(struct fuse_conn *fc, + struct fuse_req *req); /* Abort all requests */ void fuse_abort_conn(struct fuse_conn *fc, bool is_abort); diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c index 9db8c0c745a9..a4285ec7c248 100644 --- a/fs/fuse/inode.c +++ b/fs/fuse/inode.c @@ -606,6 +606,7 @@ void fuse_conn_init(struct fuse_conn *fc, struct user_namespace *user_ns) { memset(fc, 0, sizeof(*fc)); spin_lock_init(&fc->lock); + spin_lock_init(&fc->bg_lock); init_rwsem(&fc->killsb); refcount_set(&fc->count, 1); atomic_set(&fc->dev_count, 1); @@ -853,6 +854,7 @@ static void process_init_limits(struct fuse_conn *fc, struct fuse_init_out *arg) sanitize_global_limit(&max_user_bgreq); sanitize_global_limit(&max_user_congthresh); + spin_lock(&fc->bg_lock); if (arg->max_background) { fc->max_background = arg->max_background; @@ -866,6 +868,7 @@ static void process_init_limits(struct fuse_conn *fc, struct fuse_init_out *arg) fc->congestion_threshold > max_user_congthresh) fc->congestion_threshold = max_user_congthresh; } + spin_unlock(&fc->bg_lock); } static void process_init_reply(struct fuse_conn *fc, struct fuse_req *req) From patchwork Mon Aug 27 15:29:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kirill Tkhai X-Patchwork-Id: 10577373 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CD396920 for ; Mon, 27 Aug 2018 15:30:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B70A029AD7 for ; Mon, 27 Aug 2018 15:30:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AB75C29CD8; Mon, 27 Aug 2018 15:30:07 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 8B56629AD7 for ; Mon, 27 Aug 2018 15:30:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727172AbeH0TRK (ORCPT ); Mon, 27 Aug 2018 15:17:10 -0400 Received: from mail-eopbgr40117.outbound.protection.outlook.com ([40.107.4.117]:4992 "EHLO EUR03-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727101AbeH0TRK (ORCPT ); Mon, 27 Aug 2018 15:17:10 -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:X-MS-Exchange-SenderADCheck; bh=er6iB39TyC6kqCoTgFE4qoi35SU038dxvCaWk0F+emI=; b=PKaf+IGHdPmuBXF4MMFttzdsc0+aZKbjf5BlBFefkJb7QQdFiAFBH0To/wbjETJBm3OK1vX0bHHDKBFZ+U+1626XWZlzPP+WQsW5ixoFK0EbONVTMGemrXuIGcLIGurno3XF8aJfjACirXq5g3bBFNgwTIsDQlbTF/2vssNUG4Y= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=ktkhai@virtuozzo.com; Received: from localhost.localdomain (185.231.240.5) by DB6PR0801MB2021.eurprd08.prod.outlook.com (2603:10a6:4:76::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1080.17; Mon, 27 Aug 2018 15:29:58 +0000 Subject: [PATCH 6/6] fuse: Do not take fuse_conn::lock on fuse_request_send_background() From: Kirill Tkhai To: miklos@szeredi.hu, ktkhai@virtuozzo.com, linux-fsdevel@vger.kernel.org Date: Mon, 27 Aug 2018 18:29:56 +0300 Message-ID: <153538379617.18303.11871598131511120870.stgit@localhost.localdomain> In-Reply-To: <153538208536.18303.10732945923322972743.stgit@localhost.localdomain> References: <153538208536.18303.10732945923322972743.stgit@localhost.localdomain> User-Agent: StGit/0.18 MIME-Version: 1.0 X-Originating-IP: [185.231.240.5] X-ClientProxiedBy: DB6P193CA0010.EURP193.PROD.OUTLOOK.COM (2603:10a6:6:29::20) To DB6PR0801MB2021.eurprd08.prod.outlook.com (2603:10a6:4:76::14) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ff7aa21d-12bf-4392-1dd7-08d60c31f3b4 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989137)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(2017052603328)(7153060)(7193020);SRVR:DB6PR0801MB2021; X-Microsoft-Exchange-Diagnostics: 1;DB6PR0801MB2021;3:pihUg+WK14othzYTNcIAAHRW1Q8ugBrKFYIXRyQkUy4FoIvV6t503f695zT4aj/zoDHtp91noYbfZofaXyZmvqdsUQJ8+0AmMC0b8dTX0njPfkx3rM2rMe9Wvx309PB5nqiQ1MuoxFLFCxt9ghw8cBnH2NRHN97AbJp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X5ssN9NeNUFYa7xVzXB7JFPuULeE9jyaomYOkCInPcAIgB3HYDdPLfJKVD4Ru24KSLmDum55HkoLSBZOgqXROEbmg4IpDEk3DSjHNIOJX2wWjGpk7ngDwBkAsgq2SA4+CkJs52xZynN40TDTLXIpg2kj0Q+dPRNmydVPeLjkYtFxU+bQkymc;4:bYbcZznMtgQ+SZ5LNEo+mptcXpCjWSkU80iJ8eu9NLOweXPtHzyJ8KVGDpZ7OY4IZIrmsepIkQEfPZ9v3RyYhwcKP9SF6h04aM+rsmzzUTiqMy40Z+XRpHZFlLH0+Sp7zqTD4/eIa9wnXNNIItGS1p7t3cqpDjKNmYWOGB3x68mkS8+4iLUmLj+6kQ6e3d0XJXKVDt/G3A9SRIJH/PbZVR1g3niZcvh66LVDDbUDdgR9ZZWnr5ofAn3SuSrJwxNRuyaZ0Ak7oTPJl9v6Xa+yYg== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040522)(2401047)(8121501046)(5005006)(3002001)(10201501046)(93006095)(93001095)(3231311)(944501410)(52105095)(149027)(150027)(6041310)(20161123558120)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123560045)(201708071742011)(7699016);SRVR:DB6PR0801MB2021;BCL:0;PCL:0;RULEID:;SRVR:DB6PR0801MB2021; X-Forefront-PRVS: 07778E4001 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(6069001)(39850400004)(376002)(396003)(136003)(366004)(346002)(199004)(189003)(66066001)(97736004)(106356001)(305945005)(86362001)(61506002)(50466002)(105586002)(7736002)(25786009)(14444005)(446003)(11346002)(486006)(956004)(476003)(5660300001)(81156014)(81166006)(33896004)(58126008)(68736007)(103116003)(8676002)(7696005)(47776003)(8936002)(55016002)(230700001)(26005)(52116002)(6506007)(53936002)(386003)(6116002)(3846002)(16526019)(23676004)(2486003)(186003)(316002)(9686003)(76176011)(2906002)(478600001);DIR:OUT;SFP:1102;SCL:1;SRVR:DB6PR0801MB2021;H:localhost.localdomain;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; Received-SPF: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?q?1=3BDB6PR0801MB2021=3B23=3AzcDEG?= =?utf-8?q?40fOXAJKMAtsSEyqMvkXxiohAebXYBXf0vf0smdwiv6BHEcJ21FtFUKo55l8iumRw?= =?utf-8?q?QvP/9NNPu7jWWIa0vw5gmoM9yK7VgVR3ZSlhlzWggbMgT5AzuA39jIuLTW7LUovgK?= =?utf-8?q?r/ERkviNRbOINw5W8UgeOQMHa+/7kQXHLFlFRax6y+eyCzNdVAzP3ohBkizaIJzDr?= =?utf-8?q?HLGZpwglywb9mOSf0ZTsQYxto0/Lz49rJEQCCPIPr/TgOY300YaMU5IjzZYZdD6Bk?= =?utf-8?q?iZO0/6eIFNLUSryvZgC7bhiiOiJFcscF1Ai4mW1S67mbFpxtRVyR+NWuPCpmdHSe3?= =?utf-8?q?nglV3ulNfF0qHsSiipDfbAomOtYDUrZv4nVFt4oMllXY9J0nRj/b4eFkA8e/w/TXN?= =?utf-8?q?0zWviljnqr5xUa0m9rpBI9L0Ll2pk9LyRucDXuhU5GE8S0if5yIvcP9V86inm/vB0?= =?utf-8?q?SuYdvRklGEHWcoTqCbawCQKfHUnKZZRYNiP4Ydjrjc/Gb0cLLP2+8y4EoppvGyQaG?= =?utf-8?q?kxcWlBPBAjSLodmmby5QInfNBkD3hO0Fc/EP8uzNZAmy+pWOIVuDFYki+oyNkODPi?= =?utf-8?q?q99xUq3DxOv6BDQNZtNRnymF/eini4mI5cBogP+BUp6hgEjoFdejoTAK2ad7+zcw1?= =?utf-8?q?xqDqc0oEwc81SMMqcM/9r8XSiAF2Byw/cAFxUh3WB07nUdBqIs6Wsq/qo/5v4V7yI?= =?ut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tMucty/EdRcJAi3VrryQjjZ1bdjzHI1gRgdp1WR5P0lpfxhiqi+e6AMw9Yk2cYnhOfZqFXcjw5CodgPh1iKWn2TVM8HVIHRzCph3dsApHsR1DtLsHxFbW/0FovAMeRrUmaFlskM4Mb0RQHRfberI8gOSL5VBksYuBHcikWaL/ysnFjug8aiIu/3/SCmpNLUCvLbRqirTe+g9biNSKVs9dVwxQyBkncC4Xcv146ElfcqddCJtfd2Kgi/k3gIzO2Jhv0JDk3aMlHlCF5ZXojYCjy3A+zCEkyRW+lr2F825HjyBH9jrfnsMEB+Jg22ISW5Ykd0JjqO7aPFZ3eALS3tA4rRHZIVn/+9W6RT1AiROqKCUt6uK2NaJTvy/htOr3XQ==;5:6S/SkWQTgWETxo7IjIjm++2LwU+hCG63jqXo/scZOHgMpAcRewYI1KD1rosvuHOE314YJ4axpVGdAlc0i5n0YYp4QyVSWsGU8nERmnteL98dfwrXinVMfLbxYXMPtJy8B4WnBte8lVoLEcFc8ot2nEx6pjiXeHODH83vOJ+NjsU=;7:4r4SubmO0XRI5e5B11oKrM8Cvw8EelM5szhDktas1lzh5tPcPgLCB8YIMNxw6/NPkINP98CUAR2F/JrxXWrix2DLRIaXDHe8Bsz6zFLbQqYH/NnBXB8sSoyuUQwWS7EWgKhQI+abd4n1sZ69hOhNAHEB6Nun2KpE/uGQkCYCtmrqVEAlcLGJDkO329mXsIqkfiJiZU3oeqmfGESVBjEBicxNhAVhF0tqx9OdKwP8czqm/Tf2y6IClTUizS382qJa SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;DB6PR0801MB2021;20:zHqNlWefDAuv8x17BLMfcdKViowym5gbqslblDcWKFHiC86kll2nOsg9ih66c2SDpXD0fCKs30XeVwoTtddh5tqo6tzIuFPhPYJ8fVK4Tvds+qZ//mPOxZI+v6WAwrwSMlQOKkmO+2Ft2kWvY8y0s+meBnuRBhU9s+Nr97nENnk= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Aug 2018 15:29:58.7921 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ff7aa21d-12bf-4392-1dd7-08d60c31f3b4 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0801MB2021 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 Currently, we take fc->lock there only to check for fc->connected. But this flag is changed only on connection abort, which is very rare operation. Good thing looks to make fuse_request_send_background() faster, while fuse_abort_conn() slowler. So, we make fuse_request_send_background() lockless and mark (fc->connected == 1) region as RCU-protected. Abort function just uses synchronize_sched() to wait till all pending background requests is being queued, and then makes ordinary abort. Note, that synchronize_sched() is used instead of synchronize_rcu(), since we want to check for fc->connected without rcu_dereference() in fuse_request_send_background() (i.e., not to add memory barriers to this hot path). Also, note fuse_conn::aborting field is introduced. It's aimed to synchronize two sequential aborts executing in parallel: we do not want the secondly called abort finishes before the first one is done, after it sees fc->connected has already became 0. Our storage test shows performance increase on parallel read and write with the patchset (7 test runs, 300 seconds of execution of each, aio): ./io_iops --read --write --iops -u 48g -s 4k -p 24 -n 24 --aio -q 128 -t 300 -f /mnt/vstorage/file Before (iops): 25721.58203 (worst) 26179.43359 26092.58594 25789.96484 26238.63477 (best) 25985.88867 25987.66406 After (iops): 26852.27539 27547.60742 26322.29688 27643.33398 (best) 26753.10547 26157.91016 (worst) 26694.63477 All *after* runs are better than any *before* run, except of one. The best *after* run is 5% better than the best *before* run. The worst *after* run is 1.7% better then the worst *before* run. Signed-off-by: Kirill Tkhai Signed-off-by: Kirill Tkhai Signed-off-by: Miklos Szeredi --- fs/fuse/dev.c | 17 ++++++++++++----- fs/fuse/fuse_i.h | 3 +++ fs/fuse/inode.c | 1 + 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index 9690e7c79df7..064a65ca7283 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -575,8 +575,6 @@ ssize_t fuse_simple_request(struct fuse_conn *fc, struct fuse_args *args) } /* - * Called under fc->lock - * * fc->connected must have been checked previously */ void fuse_request_send_background_nocheck(struct fuse_conn *fc, @@ -604,12 +602,12 @@ void fuse_request_send_background_nocheck(struct fuse_conn *fc, void fuse_request_send_background(struct fuse_conn *fc, struct fuse_req *req) { BUG_ON(!req->end); - spin_lock(&fc->lock); + rcu_read_lock_sched(); if (fc->connected) { fuse_request_send_background_nocheck(fc, req); - spin_unlock(&fc->lock); + rcu_read_unlock_sched(); } else { - spin_unlock(&fc->lock); + rcu_read_unlock_sched(); req->out.h.error = -ENOTCONN; req->end(fc, req); fuse_put_request(fc, req); @@ -2107,6 +2105,13 @@ void fuse_abort_conn(struct fuse_conn *fc, bool is_abort) LIST_HEAD(to_end); fc->connected = 0; + fc->aborting = true; + spin_unlock(&fc->lock); + + /* Propagate fc->connected */ + synchronize_sched(); + + spin_lock(&fc->lock); fc->aborted = is_abort; fuse_set_initialized(fc); list_for_each_entry(fud, &fc->devices, entry) { @@ -2145,12 +2150,14 @@ void fuse_abort_conn(struct fuse_conn *fc, bool is_abort) spin_unlock(&fiq->waitq.lock); kill_fasync(&fiq->fasync, SIGIO, POLL_IN); end_polls(fc); + fc->aborting = false; wake_up_all(&fc->blocked_waitq); spin_unlock(&fc->lock); end_requests(fc, &to_end); } else { spin_unlock(&fc->lock); + wait_event(fc->blocked_waitq, !fc->aborting); } } EXPORT_SYMBOL_GPL(fuse_abort_conn); diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h index b2c6a1cd1e2c..b9a991b42c88 100644 --- a/fs/fuse/fuse_i.h +++ b/fs/fuse/fuse_i.h @@ -523,6 +523,9 @@ struct fuse_conn { abort and device release */ unsigned connected; + /** Connection is now aborting */ + bool aborting; + /** Connection aborted via sysfs */ bool aborted; diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c index a4285ec7c248..9612eb4bc609 100644 --- a/fs/fuse/inode.c +++ b/fs/fuse/inode.c @@ -624,6 +624,7 @@ void fuse_conn_init(struct fuse_conn *fc, struct user_namespace *user_ns) fc->blocked = 0; fc->initialized = 0; fc->connected = 1; + fc->aborting = false; fc->attr_version = 1; get_random_bytes(&fc->scramble_key, sizeof(fc->scramble_key)); fc->pid_ns = get_pid_ns(task_active_pid_ns(current));