From patchwork Fri Dec 17 11:59:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasily Averin X-Patchwork-Id: 12684407 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 27185C433F5 for ; Fri, 17 Dec 2021 11:59:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231676AbhLQL7t (ORCPT ); Fri, 17 Dec 2021 06:59:49 -0500 Received: from mail-eopbgr80130.outbound.protection.outlook.com ([40.107.8.130]:14073 "EHLO EUR04-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S230463AbhLQL7s (ORCPT ); Fri, 17 Dec 2021 06:59:48 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=V9I+soY0vT/pAc2vSrnQ0VQsIwdp8wMIiHoipJrsLMA35REbk7hNihswDwpKd7sa7+PMwRnXBVkq08pifdHAApQJUMpWya7NAYQ/RudXLBTDbxoUWl6Fse8Pz2tEaD/GePW3ZwISWYUaBNU/bIi2JUgvUjMiMUUlIjvrjXkT3LtvKY6lum3kOJrx+V2n4Zi6H2OCrwOBdQKTvm1aUIJYL9k2LE3TcBUEMkfxKlhyhy9MaqU2m+i9y9SY0kIKY+8oGt0rrVN0DNY5T3WivoRJLeQEP1AnO0tn9bDKpARByBzGhl4SfpZKHHCWskmmh5nuDBDt9jT7RXoIt2P77IUK3g== 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=8v031afYEdEE1GOIpntHt5nB8C6tAvMLLjS2az0lHNg=; b=C7zajwdlrZTtozxDSifU3jqC9UTXYkPQcrvqkS76FsyBo/brv0BRQfME0seWeWBTHqpgKxFX1N5cKKzCTURaYBUc5iVj/bPL/kiBQVTKQWeRNw7V1BlYdRtbRswRyC09vKvjMAQvFqfnFrvxkfU8u+/mu6ZgtcRrnKayQBL5kidf2HEYb63vxUyFlpRcq2b18Xx8VT46MHOW/5ZAyCxiXNeCAe5PNxYsFuxjtPw30bHhehvoyiQjT5J4CqNCoVfZxvF43sjuBRFeQrxfiH2zBQ8Bl/NYDtpQgvv7mu69cxF7I+7ZXdJE10HHZjwNBkvVsEYKCu7p1UCB8uIjQ9ThNQ== 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=8v031afYEdEE1GOIpntHt5nB8C6tAvMLLjS2az0lHNg=; b=DbbA6gdO2cejt6pzCEM/cSfzsit91wUDY5mRAXmmHB3msg1fsR8IN20KpYVyVyBDAEfgnqMNUPWhTvyl3FoJ4UXlh6ZvhLyeVJXx54qk4JBJHYDdkcslKzUfyjt9T8/EviqvLtd3zj6YFAsbr1ofgeKqP9DUTEqnsYe/xPBnAjg= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from DB9PR08MB6619.eurprd08.prod.outlook.com (2603:10a6:10:257::21) by DB6PR0802MB2181.eurprd08.prod.outlook.com (2603:10a6:4:82::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.17; Fri, 17 Dec 2021 11:59:46 +0000 Received: from DB9PR08MB6619.eurprd08.prod.outlook.com ([fe80::347f:d385:ec53:75aa]) by DB9PR08MB6619.eurprd08.prod.outlook.com ([fe80::347f:d385:ec53:75aa%7]) with mapi id 15.20.4801.015; Fri, 17 Dec 2021 11:59:46 +0000 From: Vasily Averin Subject: [PATCH] fuse: drop obsoleted lockd restriction in fuse_setlk To: Miklos Szeredi Cc: Bruce Fields , Jeff Layton , kernel@openvz.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Message-ID: Date: Fri, 17 Dec 2021 14:59:44 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 Content-Language: en-US X-ClientProxiedBy: FR3P281CA0001.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:1d::10) To DB9PR08MB6619.eurprd08.prod.outlook.com (2603:10a6:10:257::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a4e13cda-d916-4f9f-d3d3-08d9c154b86c X-MS-TrafficTypeDiagnostic: DB6PR0802MB2181:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2449; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: UkRnJsOkeQ0HVS6Mfk8wYoJ5+hjkpwmydIX67B9Zs4BXWIy4WGkthpmwHbkkwU9r4hz/lkHoatAGG4TnBM2EITLIIoW/cMaQnhMgnPJSW+IEKbbfKw/k3RF/3AXOeu/kZ4eKFenwk20vU3izUYgBn90hBRLul2W6fLFTgoRsCMQKZMPnRWlm1gxuho4+hBbje0S6yzS5/kjIjTIkZIygZhdWQdjpayanCOvKh43FO8ZDnd3YT9g5CQJUe+jfP0lfWkVlBNE1qE0RtMy9mDxA9NngE7wy3o/ggyPmfpLpbmAxwrBN3bTMGS130tkNwydKOnOeD4nIkOx7WUDISWblC3Tv7OlGNpb0BWqssTwB1bcCbdATFIFUVbD2KtrJ322qEl5nlXB0XFEasuCf/CP9Anw5c4/KdhAppNyEYTG2u2AeQPW1z6kCjP690FN+bErr61Jq3RPP4NO6LwG00FxQFtr7BC7/+5x/g68kfNE/NFjVLqP1PdfCcLA4OvlTkKrd9xZnWgntdDjb0CnC4tqO+z2pY2egkdjzv3jZEz0F+1fhvCQstfUNVKWwtKARlhytCC2DAbNrpizCvAUWbkeg/Gywpiejsqd5GhAMSZYjX8J3ujEpR7ZC5QU+6sISxFdn9iYCTY/Kqi3en75qFdvPkcYehUhu90FL80JPSN1xRl5flgsyDe0tcrLPlnjEAyCCdQ0Nz/2z5GiwbM9kTe8JUTThDVwsM0nHtYKZNj0/CiN4G7YMOrJ49Y7uht82E2qkLPyMSNfKpNtSCeSP01wrEA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB9PR08MB6619.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(6486002)(6512007)(54906003)(5660300002)(6916009)(8676002)(31696002)(38350700002)(38100700002)(8936002)(508600001)(4326008)(66476007)(31686004)(66556008)(2616005)(6506007)(36756003)(66946007)(26005)(52116002)(86362001)(83380400001)(186003)(316002)(2906002)(45980500001)(43740500002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?wqhado7Nsijqms9Uzcm0/blJWuo8?= =?utf-8?q?lNiyVOZu4NK+MY1q1ljmFuqipVhxqzYehDPJ9CwW1u7DLUlZbyx15p2yzmQOt4WXn?= =?utf-8?q?KWv2vkwihY6VI9B7jJOozdP4hOrfPBakNGv4I1pAE3vMfGPRoKIFZd3//siWPHAMG?= =?utf-8?q?GaXeMn1kXerNZDJE+k3WGmY82+PMRreAwoJstkwfeJBQoOwlen44dTtFB4f+icuIv?= =?utf-8?q?DJILpTS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BrLeQXL0WFMik3CV+lGmPOUmwgXbO4NBkjLq8TKhFQ4OKeWPC0YmWE?= =?utf-8?q?GX33SPxl8JSliubSKKhhsd1uQMTp7ZwiGH4Sx2JZE2JLn/sSuijdoHvIGqs578jRf?= =?utf-8?q?iVgbrnShngHgozLMqYos75teBvZZ7IVizNLgVXEgc6wT65q2kRf4Vgz1hgwhhiaqc?= =?utf-8?q?15Mtx05vDPbjsq28Z8UUNIBBEbgd+3HWKeVlUfCRruL3JJ7Q1b78z07oQM/jq4lvn?= =?utf-8?q?kzPBeXLkBdzmKUqkss7iMObbVDB1q0c/ZMJPbDa5slEc7wVjlYQuhykMDRtTkBVTS?= =?utf-8?q?B8Mxm/1NY5UBjyrX2k3U2dmUGdrQgd3fB36skwNEyH+c1UC33Zed7vAeh7Zt+4RAD?= =?utf-8?q?Gmyh4jRRo1dCt7wTX7OQrxG2bE/+R/sX5gfATe7YtGl9Z55aGEcvOBS02iL4iQw/V?= =?utf-8?q?mYU6FGxe0MebcrdQqsWoTIHxSIA/A4DxeFqeKewKlmn6Ps/SK9b/sa0=3D?= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: a4e13cda-d916-4f9f-d3d3-08d9c154b86c X-MS-Exchange-CrossTenant-AuthSource: DB9PR08MB6619.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Dec 2021 11:59:46.6792 (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: 869qIHj6p4/vqoxF9ssTXAB6bh+QNcV1ddVmwfsk8LZnXMkAy9+OXw5hlMyFHs4dH1i3f7Ze1L88XrOKhuXj9w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0802MB2181 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org kernel export threads like nfsd, lockd and ksmbd can deadlock if exported file system does not support asynchronous processing of blocking locks. Some time ago this problem was work arounded in fuse by commit 48e90761b570 ("fuse: lockd support"), however it was not fully correct because of all locking requests was disables including non-blocking (i.e. w/o FL_SLEEP in fl_flags) locks. Now this check is incomplete: nfs v4 does not use lockd and handles locking request via nfsd directly, recently added ksmbd uses vfs_lock_file() too. However both these servers does not have fl->fl_lmops->lm_grant defined. Original problem was noticed again, and now it will be fixed on the server side: all affected kernel threads will not use FL_SLEEP if exported file system does not support asynchronous processing of blocking locks. According patches was submitted but not merged yet [PATCH] nfs: block notification on fs with its own ->lock [PATCH] ksmbd: force "fail immediately" flag on fs with its own ->lock Signed-off-by: Vasily Averin --- fs/fuse/file.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/fs/fuse/file.c b/fs/fuse/file.c index 9d6c5f6361f7..06e0d7fa86f3 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c @@ -2509,11 +2509,6 @@ static int fuse_setlk(struct file *file, struct file_lock *fl, int flock) pid_t pid_nr = pid_nr_ns(pid, fm->fc->pid_ns); int err; - if (fl->fl_lmops && fl->fl_lmops->lm_grant) { - /* NLM needs asynchronous locks, which we don't support yet */ - return -ENOLCK; - } - /* Unlock on close is handled by the flush method */ if ((fl->fl_flags & FL_CLOSE_POSIX) == FL_CLOSE_POSIX) return 0;