From patchwork Mon Mar 22 14:30:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Aur=C3=A9lien_Aptel?= X-Patchwork-Id: 12154959 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 752F2C433C1 for ; Mon, 22 Mar 2021 14:31:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2951F6187E for ; Mon, 22 Mar 2021 14:31:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229905AbhCVObJ (ORCPT ); Mon, 22 Mar 2021 10:31:09 -0400 Received: from de-smtp-delivery-102.mimecast.com ([194.104.109.102]:24271 "EHLO de-smtp-delivery-102.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230359AbhCVOaf (ORCPT ); Mon, 22 Mar 2021 10:30:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=mimecast20200619; t=1616423434; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CPz3aHV8Cee91K/15ZTExGdgTdvPWeF2XQ+Mky+0YlM=; b=URGsQuMDNNQBetzwaNrbL+WgaFu4YE4hv0JRHp1xVH6oDkg4L5wd4fRyw8jViMTMvwD5WQ zjVYV3Bgosgl6+e7FGMsJlQcj7fdocFZvDbe/L9X1eF3tO9ao+9OOThdO88hNnUloKyT9U VpbN9tvsqjW90NLDS2eR9F70EGadtJQ= Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05lp2108.outbound.protection.outlook.com [104.47.17.108]) (Using TLS) by relay.mimecast.com with ESMTP id de-mta-7-VLvb6E5HOzqiWHsi9_pjag-1; Mon, 22 Mar 2021 15:30:33 +0100 X-MC-Unique: VLvb6E5HOzqiWHsi9_pjag-1 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jxT52BHdG36LzgzVCmOPAT3cs70ZPGGU6MpwcFqn/gpmIRVU8R/rNYkZC3pmvQ+S9xIaO5xShRSPnAzyJTOGvf1sR4RB0VHAS2rZRA0UMHn0SZnnNDo+7ldfD+WupVRocpEDqfc/fpQ5SgBPOGjf7zQE9n7iuzADqSxDg43uU5w48YUPxosx+eZ0DB5VXnduOvHHTMJCmx6OGleJiXANqFjKgG+aorVDWnF6m9oMbd2l28pJZoHynyaFrhm08q64M/Eg/H0eTpW/+zZSizG+rIVPy8POjVMVK8UE5L976ldqfB5tCs7UCB8W16WiZ8OOmqJkA3ifqreJD+PE5qHu3w== 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-SenderADCheck; bh=hVFacGV4SniNSnyeySgeeFeg6E4lzyN6UFK+BMYvr+Y=; b=fqK+s2vJvny28KT8sjN8nH7b7EPOZud71Zrsj9fGAnpk5KqRh1PUiSszinQqbQfJnMTx1T2bI/ShS9YeTEF39rF3O8CIDqCqyjIySgamYmLNz23ZCB1hYB5volCewWE46jFbj2PxEfjj3Wku/SLsIBbKjLWkUuSgUgj7lIgbhx5HiqtdqpmG3spavivE95oYnllAJK8L0kUUjerL1z2qj0jliO8wqXB7yd5tOXauoStWSvvFobPHCbwWQVspiuqMdCeqUfUQ7FLjokzTFQ4EXvXh/CwvlbsMwbGIR+08uM/PLJw9Q4S2AZbQWB8f/zkb88F0SeAItNCKWbOfrX8uSg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none Authentication-Results: gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=none action=none header.from=suse.com; Received: from VI1PR0402MB3359.eurprd04.prod.outlook.com (2603:10a6:803:3::28) by VI1PR04MB4319.eurprd04.prod.outlook.com (2603:10a6:803:43::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3955.18; Mon, 22 Mar 2021 14:30:30 +0000 Received: from VI1PR0402MB3359.eurprd04.prod.outlook.com ([fe80::3c87:7c9e:2597:4d94]) by VI1PR0402MB3359.eurprd04.prod.outlook.com ([fe80::3c87:7c9e:2597:4d94%5]) with mapi id 15.20.3933.032; Mon, 22 Mar 2021 14:30:30 +0000 From: =?utf-8?q?Aur=C3=A9lien_Aptel?= To: Pavel Shilovsky , Tom Talpey CC: =?utf-8?q?Aur=C3=A9lien_Aptel?= , "Alejandro Colomar (man-pages)" , Steve French , linux-cifs , linux-fsdevel , mtk.manpages@gmail.com, linux-man@vger.kernel.org Subject: [PATCH v5] flock.2: add CIFS details Date: Mon, 22 Mar 2021 15:30:24 +0100 Message-ID: <20210322143024.13930-1-aaptel@suse.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: References: X-Originating-IP: [2003:fa:700:2815:b96b:85ea:1f90:5f2c] X-ClientProxiedBy: ZR0P278CA0130.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:40::9) To VI1PR0402MB3359.eurprd04.prod.outlook.com (2603:10a6:803:3::28) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost (2003:fa:700:2815:b96b:85ea:1f90:5f2c) by ZR0P278CA0130.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:40::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3955.18 via Frontend Transport; Mon, 22 Mar 2021 14:30:30 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 13d1bb7a-feca-4a1c-074c-08d8ed3f0b90 X-MS-TrafficTypeDiagnostic: VI1PR04MB4319: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Kf8KDqzX5C2p3C2aBdLmdkWbVoC9Cnw4omofpaWCrAd7mNj3c7d32xg6StHmDqsif5MRaorKQsd9u32oH0se3p/8lqRnBu9y9tezg529YYq2L4ndDPVgohJNfT1CTuO8S6eh/Rn6mDU+ZCIEIIgxuodoJs3pO7K3K4I1MGu5tQFKc4kxCX9DxlsARydTn3H4yN9gHj3KGMwuAOXa1z9t8Ja9QtUH/EDXkbNetYyqm5DMY7QswsLUS5A2BBgCMhUCvfVtKB9lZTRpJqgMhmGvkbXOtnc0y8KDa1qUeO9SZ1d4Kz8eNiBFYYdxNTfPDcKzW9ORvNS2XjvQi28uYk4AFOvc/fo65CHgXOYrbTKZDW+guU4iBpP5upu+mdwx5U+N2sAuv6TbdRz0Kw1ZHeWmGc0nJzDrCQ2cy4vw0+EJtAVGvUigJD3/BuXtvBgaEdClZATSvuYSjZLmI6nPEXRHgofaUfekGKzXf3J0qruZMUWajmoOMjjCr+laS2O6GVe3veJ6RR9roFm7GxDs50bCH1hofrOfxYQJCMtRgT+hgOQpJgIGAw0qxNrLuGyoqkNf5rDYHed4ohPCm8/PVwnABfL/b+D7pJznnADwwCSk6RZ6yUxC+vKDn9Lfanf53IRxx4PbMydXLc2+npB0cpf2YQfc9VO+m1r4hvUJm8zod64lrbwv8NTcoEBJepu4sOzqxjjstM/hsfJ9F8UMHDOhGw9Z4U2h9XtZr1Fa/ZXY0gNpmWc+C7zu3/jnp7XFPke6JMWRQe2x9ePsoCyOMEsnBbcoyIfcihXe/YJ9kKb5PM8pFSFRFAqK8kgR9yRIwymStTUhbtEbDjOT9dplmCS1BvkFfoK105YA6HczXiqCkzhD03lEreVnJbQ6e3bV5DnL6YCsuzOZJiQaKgAp+Lxz52+owskC0kELzvUkGXnbpRop0fyzC3yk0uksNA+/K+XYwR0epkyBHf0ViO8ksGziEMEFql1zqecXxltpoG2dm5s= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:5;SRV:;IPV:NLI;SFV:SPM;H:VI1PR0402MB3359.eurprd04.prod.outlook.com;PTR:;CAT:OSPM;SFS:(39840400004)(136003)(346002)(376002)(396003)(366004)(5660300002)(52116002)(6666004)(54906003)(4326008)(66946007)(110136005)(1076003)(66556008)(478600001)(16526019)(6486002)(86362001)(38100700001)(186003)(316002)(36756003)(8676002)(83380400001)(2906002)(2616005)(66476007)(8936002)(6496006)(23200700001);DIR:OUT;SFP:1501; X-MS-Exchange-AntiSpam-MessageData: agQc/6tZN+eBGZMcRqQsu0KHHHcQ8ji4CWSWo8wmxjkhe8+TSMxr3diHgCSdTtlDQILkuBgGjq2F/rRjXvGYu8H4sK76OcvLb1cXzLsg+T+EZEKylLDkra4R8fAl+pPXhH2aYuEBhUGC+/Uw/D1j2TpFW7qO1Ny5v+gv7SXn6cR2b7+i8LAMweOYH0sBSd2VNVsXFFA7AfK9Sj0UyjZK5jg5K9S/MofutrxHzpw/923H9dtxAkkYXDX7BG31NRPu+M2+aP5B5z4eR8Mv/4Pid/ebt5fKygD1vhJ14HsSBg9127oxbf3kzKBbSknbkc1sqJz/fsLeOh3bejaHY3TEKRHY4q8o64LZ/iY3le073/TmT6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a-feca-4a1c-074c-08d8ed3f0b90 X-MS-Exchange-CrossTenant-AuthSource: VI1PR0402MB3359.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Mar 2021 14:30:30.6975 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: OkQXxDH78TMEoVqpM73j8bac4SRP8oMl1wq/Duyn28T/8/inHLJei1ZOYFQrWnNX X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB4319 Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org From: Aurelien Aptel CIFS flock() locks behave differently than the standard. Give overview of those differences. Here is the rendered text: CIFS details In Linux kernels up to 5.4, flock() is not propagated over SMB. A file with such locks will not appear locked for remote clients. Since Linux 5.5, flock() locks are emulated with SMB byte-range locks on the entire file. Similarly to NFS, this means that fcntl(2) and flock() locks interact with one another. Another important side-effect is that the locks are not advisory anymore: any IO on a locked file will always fail with EACCES when done from a separate file descriptor. This difference originates from the design of locks in the SMB proto- col, which provides mandatory locking semantics. Remote and mandatory locking semantics may vary with SMB protocol, mount options and server type. See mount.cifs(8) for additional infor- mation. Signed-off-by: Aurelien Aptel --- man2/flock.2 | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/man2/flock.2 b/man2/flock.2 index 328377365..61822c9bc 100644 --- a/man2/flock.2 +++ b/man2/flock.2 @@ -239,6 +239,31 @@ see the discussion of the .I "local_lock" option in .BR nfs (5). +.SS CIFS details +In Linux kernels up to 5.4, +.BR flock () +is not propagated over SMB. +A file with such locks will not appear locked for remote clients. +.PP +Since Linux 5.5, +.BR flock () +locks are emulated with SMB byte-range locks on the entire file. +Similarly to NFS, this means that +.BR fcntl (2) +and +.BR flock () +locks interact with one another. +Another important side-effect is that the locks are not advisory anymore: +any IO on a locked file will always fail with +.BR EACCES +when done from a separate file descriptor. +This difference originates from the design of locks in the SMB protocol, +which provides mandatory locking semantics. +.PP +Remote and mandatory locking semantics may vary with SMB protocol, mount options and server type. +See +.BR mount.cifs (8) +for additional information. .SH SEE ALSO .BR flock (1), .BR close (2),