From patchwork Mon Dec 27 15:50:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasily Averin X-Patchwork-Id: 12699851 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 97E67C433F5 for ; Mon, 27 Dec 2021 15:52:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239711AbhL0Pws (ORCPT ); Mon, 27 Dec 2021 10:52:48 -0500 Received: from mail-eopbgr60123.outbound.protection.outlook.com ([40.107.6.123]:63715 "EHLO EUR04-DB3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S241371AbhL0Puo (ORCPT ); Mon, 27 Dec 2021 10:50:44 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HO0KQqvYZjmmCGkhugoCtFnovaywiFMLg08B08R2yXhDy3LAUP2GTgrUhWbe+HLVACyD02OpP2CBRRNNFtPAOGfW/GGUPKkI0PluIYmOxuLm1Y6vy+NRJjQDlxO16/cFn+DHRuF7L4SRICA01QRvKhJG3Q1TXAxbz1ypSt9xCbXfONEFZmONhojJaTuAIjMJgTPQ5q9FxMBJ2VWaRS9pPVUsBSSE/YYamyoAxDFho8BrApMHq4QRcq+Azb7DsjJDpodAXy6CYEWMale+2eh3YCSBLlQ9//KZt1kZeuKu5wvpDZyTb6W5HkSsnuWq9viL338o3W8TWcURcpqQE2d8rg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=QpZ2mWkNhQrdF25BsqIPQmFUXbB0oAdiW8gmQRvH0vw=; b=eZ7te1UAxOi/MZ+dxexmkn2HvkPfbOLWAGDfJ/UBqXqm01ihDAZUJBrYhvwGFQHoHaEYJAPo/MDYOhUuIUCe38IfaCVgexODAFqtEBMJp9dtIp7MvQOWAvouvJ46ULCSxZJZhz8P7MNkpB+4Cu19RNWmpjyqpbsShpRDVMfRcZ/3LVHIuapCwpwn4uA3YuoaQwTm0cp/JgrqT5L1pN4Ysd5sLRbghyWuaxDTDDYbXe/svyTE+K5nGuQV2sXQVKQhckDlt2UXy5Z2AHxle2mYtnZObtjMr4T6Biz5lt6sv5SMbKTwZUWWl8SRbcbGCHb7yss/ldADTBYlDuG8rZJNvA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=QpZ2mWkNhQrdF25BsqIPQmFUXbB0oAdiW8gmQRvH0vw=; b=aP/R5c6Tmc7gOsqLTOTz+lpZZ8eIWD6yhsjj7iIQ2VVI8TEvbWj3IriIcMfSjPiYvvKkrDt8mH4K/ojm+UmUGmiJEXvF9onaQEkK9GIUzHbncO5xHkKrCZWqGesejj4kZUlzX8mnXRRO+Jt4QMROWboQiHq1as60FcqdtjubsDE= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from AM9PR08MB6241.eurprd08.prod.outlook.com (2603:10a6:20b:281::21) by AM8PR08MB5732.eurprd08.prod.outlook.com (2603:10a6:20b:1d4::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4823.16; Mon, 27 Dec 2021 15:50:42 +0000 Received: from AM9PR08MB6241.eurprd08.prod.outlook.com ([fe80::f9ca:fe00:10da:a62f]) by AM9PR08MB6241.eurprd08.prod.outlook.com ([fe80::f9ca:fe00:10da:a62f%5]) with mapi id 15.20.4823.022; Mon, 27 Dec 2021 15:50:42 +0000 From: Vasily Averin Subject: [PATCH v2] nfs: local_lock: handle async processing of F_SETLK with FL_SLEEP To: Trond Myklebust , Anna Schumaker Cc: kernel@openvz.org, linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org References: <202112272042.Xlz50x0x-lkp@intel.com> Message-ID: <3e5d6777-9365-c853-071f-3e9fc4df922c@virtuozzo.com> Date: Mon, 27 Dec 2021 18:50:41 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 In-Reply-To: <202112272042.Xlz50x0x-lkp@intel.com> Content-Language: en-US X-ClientProxiedBy: AM5PR1001CA0002.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:206:2::15) To AM9PR08MB6241.eurprd08.prod.outlook.com (2603:10a6:20b:281::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4688f9fd-bbc8-4b9e-16ce-08d9c950a318 X-MS-TrafficTypeDiagnostic: AM8PR08MB5732:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:923; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BcXxmFPFgVD0UwWNsW5BweuzkkCI5QtEsy23ctCqTs1/80UyhEajLAAFQKPwgMUFfbYDVndjkbTyTdwfxPS5U0xnscSdfIG17NPsthr1SkY0pDdPVdBqwLHbRVPA+q35wd8qMxRaJMtcNVVNJ0E39HNDylyXTs1uwbGnCVUtWG+GgVEjXHp3zzdSNDGdA6gJHP6B77AqGOhMaDke0jr6h2TVlcpkHpbmTDDv8Y1F/n+MbmWY5tOYZcRoG3FXLDXIJfm4IeJNnxP4AlO485KawkkooRvPor+Qx06rZXgaZCYDk9oLeqArlWAG6e8C6oWoUX7QOGklkb9obtOE1s3sEVuUR1q79+QaUKNgZ7aCZ66IZicbbt6XTeP4NL2gfqqQ8OVC9S0MXnZ2zbPQd4GuF6BTxFhZZg5d23x4SYYjrm8YXes31B3m7Kk/d9fZsBKgC6ZpMqSB8PncuSoqgMYMrNLjn5zJG5wu8AnCj4ZHAG6Zizu6SIZxTn7RliGZy+G16mV9CuFezWLr8D82exSwXid9+4RA5/PYZ8T+iIec7FlHe4TjoHIoOE2BT067ip5HLrub4TOSuKcT7Vxqj8X22jNKJZCQbJoGd4aCTVbaZe8O+AA5ytQC82G46mM4Xc8jEnLO1dK72HdtnqS0pwK//+GLZaKLLvRxdHpUnCWgc4N/m2tTrT+56sgKS6msgpc3JTlMCqu5yu3ePqL73PZG9I9Xw0rI03FK5Jh6OIjt9nilwG+IFjtCANsNSKI22Vn3Hfb+ti5cdm5APr+diSy7gdk1aejvTEwGZLULhR6s0v3fbHpgZ3ZhT0I1way9kkfh1VW7p2jKCse89ts6Jj0XXM+7fIM2RS2LFeCzvgd5QK4= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM9PR08MB6241.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(31696002)(4326008)(186003)(6486002)(38100700002)(38350700002)(6512007)(5660300002)(31686004)(52116002)(83380400001)(2616005)(6506007)(8676002)(86362001)(66946007)(26005)(66476007)(66556008)(316002)(8936002)(36756003)(966005)(2906002)(110136005)(508600001)(43740500002)(45980500001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?fW0JGoZmB7+zXuKRVuzHm5JO1hEI?= =?utf-8?q?WgglMtOOB4QGq3LYRWe+hkoB+GSj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5fa12WOvFfAMrVh8YMTsQ4evQ2HsbMZKg?= =?utf-8?q?UEGxVGnkNkqgoSz0lRnK8AfYJk0eaTloZ4mdaruFDRzFlqyz4e6VTutXITEMyXaKX?= =?utf-8?q?NtAzVHki1fAr10fb4JHXgR25ZmAi7exD/uRRGTEl5sndcucU4Y2Zj/WmoRcWIMX8F?= =?utf-8?q?RXyY1ASa+HQB6hhtHST97CRVNzjl7LK5BK4Jw0zzfoCCcm+moKmzx8UvrLt5PKKwQ?= =?utf-8?q?2IezD7psaS6dkDX2GRsT7aMc6LCr2zXfICQX8MzosQhChkqQCGfSuK3tH9sHoSeoN?= =?utf-8?q?VACEatg/U/tUQWxjEbAt84UMYng3h+Lc1u/tV9bym9PnnhIyOu1VVR17LHMj6WK4i?= =?utf-8?q?1SjoU0GdQZmqJcwE+1vBlPtrn/ppqz638N5K5eyS7iIsqVKM5hfmadJjnCOcz/VIp?= =?utf-8?q?5bsN2PypIo+7M3roMugyUuO2sBpUSTEHvR39LNXlDnZeBe0DIL9ay8YrqoTxyhySJ?= =?utf-8?q?7GjL9guu/o6Tzx8dx+lOn46rtB13F1t9qNTvAnSzZ9snao1KfXmrc/C3rmDEYxbKz?= =?utf-8?q?2pWE6Mu27cDRWoGtqxfEpp5Cqpvovmy+XYZMsMqro3Sw1b4ppFZ/THO0xqy/WKLxb?= =?utf-8?q?kcbNrb1UtNhAjvPMCtXi0iZ70Imh7OHcBlZGGH5mB8iuVCATZaofUoU=3D?= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4688f9fd-bbc8-4b9e-16ce-08d9c950a318 X-MS-Exchange-CrossTenant-AuthSource: AM9PR08MB6241.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Dec 2021 15:50:42.2029 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: yjbRTuzaoYRQeb3ylJanlwh6V7yhypVX4BzWGYQwCqkZ/s+kHTz22q1oWX9JoHJy+I0uSyThiHuZPivS91iKyQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR08MB5732 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org nfsd and lockd use F_SETLK cmd with the FL_SLEEP flag set to request asynchronous processing of blocking locks. Currently nfs mounted with 'local_lock' option use locks_lock_file_wait() function blocked on such requests. To handle such requests properly, non-blocking posix_file_lock() function should be used instead. https://bugzilla.kernel.org/show_bug.cgi?id=215383 Signed-off-by: Vasily Averin --- v2: fixed 'fl_flags && FL_SLEEP' => 'fl_flags & FL_SLEEP' --- fs/nfs/file.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/nfs/file.c b/fs/nfs/file.c index 24e7dccce355..38e1821cff5d 100644 --- a/fs/nfs/file.c +++ b/fs/nfs/file.c @@ -769,9 +769,11 @@ do_setlk(struct file *filp, int cmd, struct file_lock *fl, int is_local) */ if (!is_local) status = NFS_PROTO(inode)->lock(filp, cmd, fl); + else if ((fl->fl_flags & FL_SLEEP) && IS_SETLK(cmd)) + status = posix_lock_file(filp, fl, NULL); else status = locks_lock_file_wait(filp, fl); - if (status < 0) + if (status) goto out; /*