Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp1188512rwo; Wed, 2 Aug 2023 09:59:15 -0700 (PDT) X-Google-Smtp-Source: APBJJlE5qLWgcsbeR8yt+28eOnHtDC8vVnBQPNmY+eLcH7q3F9Ew/UFU//kF2VwEu6a7WJsuZYeK X-Received: by 2002:a2e:964e:0:b0:2b9:e701:ac48 with SMTP id z14-20020a2e964e000000b002b9e701ac48mr5592413ljh.32.1690995555672; Wed, 02 Aug 2023 09:59:15 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1690995555; cv=pass; d=google.com; s=arc-20160816; b=HGCZvYy/3Jg03DJ+11LF/YclFbPq5gn9DuweVYL6uiLgUCQinAdstdw7B0WMg3E4N/ Vur3pQh2ZFxmU3qqJptDs3Cd9qulj0d7CxSsiOOF4cJmew79AMnfPW8ELf9LBwS8wp0N XbGiuH1adPUE8UiFoIN/uz4U8YQ9IKIwd8LFdAaOQdcWEvfSpzdhXX1sc1/+20bTKof9 bj6fCia91WSMM9PVu2DStG/el0ELAJplylyOFB9XrjwocXPcRzOCgIJsRgbgRkgl7lbR KP6CxLr1jCKr80BB1rp20sLtIqfdWEiYulFhP0+VsxJI7o3i+mpNo0DY4Kf3/34M5Sri 55Gg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :in-reply-to:from:references:cc:to:content-language:subject :user-agent:date:message-id:dkim-signature:dkim-signature; bh=MHRH0FoR9mBpQKvMfWkHqg9UkK3B8cL5Z4+kU5rZStg=; fh=Azt8lzpdIqmHc8YVfrvYz4IsFvNwmJRa178kLu3cd3A=; b=Aa/v3d4qrSm7HbYUXdr0EB2zEOoS/rojbkxB+czY+hnc4Sk4/Xtf/QFQhAWejQ94nu U7WQwSxqCSbDx7QJPmJdFcXsh5xkYRU+cW1N3oVjHPpgBb5043txsrSsvmtGn0HQZpCs Ia9H9VKXgLUt6GlRz+Zt0wSRnvc8RfbTgA57ykr1rMzU++G8jvrx8tN2q3kOSTw+lXAC XzwBQTaot+atnUW9SYdp6dpHQ3PD+WOqD0GgS8pFtJED7WnC2kReA+8prGCdPQkuyEwQ 3TP5U7fzEmqHvCtwXh6dADO4gee833qjprXdZ9NMPEkp0eqsf+oi+1zEhLiAkqQjxUSH nJHg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b=zsik+J6F; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=IEsRXj6Y; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q22-20020a17090622d600b0099304c10fd0si11389074eja.991.2023.08.02.09.58.50; Wed, 02 Aug 2023 09:59:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b=zsik+J6F; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=IEsRXj6Y; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231773AbjHBQaE (ORCPT + 99 others); Wed, 2 Aug 2023 12:30:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229892AbjHBQaC (ORCPT ); Wed, 2 Aug 2023 12:30:02 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 792BD213D; Wed, 2 Aug 2023 09:30:01 -0700 (PDT) Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 372FYSpO021840; Wed, 2 Aug 2023 16:29:52 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=message-id : date : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding : mime-version; s=corp-2023-03-30; bh=MHRH0FoR9mBpQKvMfWkHqg9UkK3B8cL5Z4+kU5rZStg=; b=zsik+J6F7LJBBlLSc8qiMTzw4hZjbnuhZ/qImkW4n8ecEQ0IdHsTee1sY/2z4bWt6pFh bUNOY0XjFs/lhcRZRzLliWFqbbnxdbQ5L0vgXrjeuH3fuc4JsJgW0QNG60+zcWLhw7jl WJ0a4O2qDcv+ROCcY7b/sYnGdRL3pO559W39ol8ixS+bM08wvliqPDFPgazDL1xemUlh JvZ+o9kZXmB69hNgvB5sFONQyOZGhxmfaxTfTF4/yKijTnbBg0QdpMjxdsyLAjKHZHS7 IOWeMnJ2dsz9vxcsi33lBAF/0h7EohjsQlMZlphxOy+QB2wgor3Tv7kYsuXDAJG91f+4 mw== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3s4spc7scc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 02 Aug 2023 16:29:52 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 372F6JBw020541; Wed, 2 Aug 2023 16:29:51 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2102.outbound.protection.outlook.com [104.47.55.102]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3s4s78df1p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 02 Aug 2023 16:29:51 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mZtAO993wCRD1wWBf2aps/6PyFEEZqcFX0oInJEKEN27l9iC2EOR/2YZdTXxMknwpl4TSkmT62glRxW4brWuXbk2oLHZNgcBSxu09QnrsODVtJoqLk7GLZarUEQFQH1TliFssE/fnfIRnM07Q/Gt1PsqXEzpRQfEI+im2eiqmlJakCLipiM+QfqV0ujK0QMnxY87ds8roiw5KEt+V1KRDa9VaMglGKsE82UEUm534nkz+MubjGKJoK4+b8cQkX9Pju/guUUvdHJbeDr2OpmHA/ATJPSNhBzGjD1teunF7HS23PJH8GjxdgtIBKb3hgb7qY9mG/VBxERkbAPmPSnPOg== 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=MHRH0FoR9mBpQKvMfWkHqg9UkK3B8cL5Z4+kU5rZStg=; b=LcNyxrZAzxkh+7LmFadg7amt6B3udIxhoEWFXumG5Xw3xvObaC/7w0HYWCaRERGhG1Y5hB5Ca4H0nQak/OGDVkgbEKMc70738P1YfE4RAmzu6I6VXZ2AZmNDE3mu8FjhNDfGeCQn/WIVGM4nh2VHpCCCQDjCpACL+7sZ98y3qFUwmNrKvR5aFvJHc6VBHHCyAfVOXZuLHZ7YJ/Ulby8IhujlNIzJO3mrYnV0yYTLhmDemEpdnRyIZt6zL8W32r8kQjf7svy4RSrH3eBWT4Zrrso7YtdhMg2Mb5W08/kkDZ8fiidvHXFeT7uuCZPwrp8IYZXgCuHUO4hHcXYSstDCCg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=MHRH0FoR9mBpQKvMfWkHqg9UkK3B8cL5Z4+kU5rZStg=; b=IEsRXj6YA2cyHFDxmr8bZqXYWpXYDAwE40tLNmUVjATcuB8Mi/Fd8HtiyE/WgIBkYvn/ppIfV3DQ1emCv7WN8Mb/LGb45UweN0R9cWjSvRoWD++vF3mRCBV8acrOdD0PwxjBrop54iqUldD3m0H/AXBanH8gGOB2ILhxKHXl+ho= Received: from MN2PR10MB4270.namprd10.prod.outlook.com (2603:10b6:208:1d6::21) by DS7PR10MB4861.namprd10.prod.outlook.com (2603:10b6:5:3a7::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.19; Wed, 2 Aug 2023 16:29:49 +0000 Received: from MN2PR10MB4270.namprd10.prod.outlook.com ([fe80::3fd7:973:c9d7:afe2]) by MN2PR10MB4270.namprd10.prod.outlook.com ([fe80::3fd7:973:c9d7:afe2%4]) with mapi id 15.20.6631.045; Wed, 2 Aug 2023 16:29:49 +0000 Message-ID: <8c3adfce-39f0-0e60-e35a-2f1be6fb67e6@oracle.com> Date: Wed, 2 Aug 2023 09:29:37 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH v2] nfsd: don't hand out write delegations on O_WRONLY opens Content-Language: en-US To: Jeff Layton , Chuck Lever , Neil Brown , Olga Kornievskaia , Tom Talpey Cc: linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org References: <20230801-wdeleg-v2-1-20c14252bab4@kernel.org> From: dai.ngo@oracle.com In-Reply-To: <20230801-wdeleg-v2-1-20c14252bab4@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: SN1PR12CA0064.namprd12.prod.outlook.com (2603:10b6:802:20::35) To MN2PR10MB4270.namprd10.prod.outlook.com (2603:10b6:208:1d6::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN2PR10MB4270:EE_|DS7PR10MB4861:EE_ X-MS-Office365-Filtering-Correlation-Id: 1ac2a45a-6de9-424e-b503-08db9375b0cb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yVAEZ7Y0xkxHKaLb2VqGvYAgjbqaKEYNZ/b6NtnbSVM6LL+O95bdYKgCgccfCTqDJebA+DztnpQdwfu6r+xkZq1UqNkQcahGT/CwGX+ilDfg99qK65sf58MN7ioplWwtPxA6mxRXSxURP4RP/z6D+y85RlxUdo/Edu4svUQ3dRKn9WgOhDiiBT5uMl4qF1uMk4SfO/yLROcSAEm4+cRPIUcH2OMXzM734VZtJC1PiNW4/L/7XaRpNWti3l5wh1otZxr0iGBm0E5wneUsUj6agua8M6xBRk2Wx7ttlGO+UnbuXKJtKp5teV+euPIrEyULnoW7vFZXxOkeHeevnrtiUR49ZzMvJhVtn7ZAkZgZfRJW6G4+gIKp2hWeKObVNGbqSCd+5N4tHhJKpuHEt06AHnOVsqVAzs2mJGSMXyTVcrc9lHtN//A0snqwYpaaGKoJPg3wnu3p4wS0zB/PrKCW491eGqpWu1EsPaWfCl8geG28mao4SZBalKjnvu++NZWqvYVRvCJU+8sS2pAnNxluy3SFVLLnKpNLrTpcrQ1/8BCOkmX8ks/XpVkYCYgYfH5S/zn6P1RX8mF4F9ZKy+OSj4nKkurj4CEYLmqaHf5uFTs= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN2PR10MB4270.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(376002)(366004)(396003)(346002)(39860400002)(136003)(451199021)(31686004)(31696002)(86362001)(36756003)(478600001)(110136005)(38100700002)(2616005)(6506007)(83380400001)(186003)(26005)(53546011)(41300700001)(8676002)(8936002)(966005)(6512007)(9686003)(6666004)(6486002)(316002)(66476007)(4326008)(5660300002)(66946007)(66556008)(2906002)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?VklHbHZjQSs4ZEJHdmErdUdIeC9iVC8wa3RuaVJtZ1NUSzNGV2RtZnV6OFRJ?= =?utf-8?B?eGgxbmxxQjFtK016OEJaekdvTHRyUTBiM2VmdXN1QVcxRnFML05lQU1ZU0pw?= =?utf-8?B?VmxWcjBVWUFwYkdIejZEeHZZZnMyMG9KZlczZ1djY0U0bnhZdWtjQ0M3SUVX?= =?utf-8?B?eWIweUI5aWRnUXVIeUE3ejZ5QU9qbVRoZDYyMmUyZDZNTUtXL2RRZE1uME9Z?= =?utf-8?B?bmZ2TFdUdk1iWlVpYnV0alRjOGdFZFc1QnRmcHpxWjIwK3ZGSEFpdTNqWTNm?= =?utf-8?B?QWkzVUhQbUk4RnlkUGpZVWtpY3VWWWIxVzZTbHNDbzJlb2RMWnpweUdSUFg1?= =?utf-8?B?M1U4a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ageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: Wql0pk6cYLHSuTqcsBa5MxCnFjZ7UUy5dqyRLOv+Q9biF7GYoEdxy6kzH1iDpKyVPmrCi3+5G5etlND7F5mG/gCIyGUtFEOMxhyK0ACAlVOK+7XFougL30F83y0jMSVouAN2gGUH3vnz5YZsz/ZHunRLoLTifIlh66wURguD0ZFvmofn7qkxHCsMBn7wo/z4N/kmAvo5g/SJHpoLQVMY0cRvLIDiADRGmSIfknZVyQYXNzCrjp7ZeALrUQiP5tpsWI0v6EIwwv5j/bf52CZ71eA5W5jboJklY8RP/JDes+6CNoL2Z/IwE7h2e3uID2T2Z0a8I7K5s4XxbVfVmHv3LQ3pM9gzH4LhRciWmYQO/gwH0f8QLLOkCxXIN/38Tv7dbyTWFl8qZZx6bnAacOunR7n1/fy2rrExSjHbM5rPpggXHPNrMJ79soqP4/rvm520+R5rrtDDKeOkhJFu8lVvx4CFc6c7ZwVn+Q7ieD/QpenUdmNdaFOaTpJwxf46qyzhbkeJGNOTBSnyuTV+4bierZ2qwJGLTydwU/ztB3ohcRAsekn2Nl1YJYhaOTg0rqt9XPWn1W9piO9VoLkUkURnvpECWUMQ3kK6b2T1sWj5Oiz6zPuQbwrHGHkXhfhLlDNGkR2xqOeubcwX4zOswlirTTitXk4F15pN+vkaorAap+1XzfihyZGPFd2ygfmyQWg6JIlRsUS0wuvKjZJgrJi05/t4wrlb6l/+KRgUaUZYbSs1W5ayEfmJGg7UMTvdQ8kdgOEXZtwqfKckxsZrA37Jn/8ZcKn3c7vGjA/sNxXi5QPasXTuKtUA9v50wT2DwO/NjENgNaqLU3qefeWDPWnW3ZAEwKRcKJ1R548hXsgRq3NgkDTeH1fUtTpAHfXqCUPc X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1ac2a45a-6de9-424e-b503-08db9375b0cb X-MS-Exchange-CrossTenant-AuthSource: MN2PR10MB4270.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Aug 2023 16:29:49.2162 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 4olItmmw/kdp0TrxVFt4OGw6v5ipF59+wYnUIY/5tEmX0GLqjTpanHD5dtLHyius57hiRx03r/3OZ4/MwRO75g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR10MB4861 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-08-02_12,2023-08-01_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 bulkscore=0 spamscore=0 mlxlogscore=849 malwarescore=0 adultscore=0 suspectscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2308020146 X-Proofpoint-ORIG-GUID: DNL08SQzO00UWb3CtOOTYrmn295D-rrd X-Proofpoint-GUID: DNL08SQzO00UWb3CtOOTYrmn295D-rrd X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 8/1/23 6:33 AM, Jeff Layton wrote: > I noticed that xfstests generic/001 was failing against linux-next nfsd. > > The client would request a OPEN4_SHARE_ACCESS_WRITE open, and the server > would hand out a write delegation. The client would then try to use that > write delegation as the source stateid in a COPY not sure why the client opens the source file of a COPY operation with OPEN4_SHARE_ACCESS_WRITE? > or CLONE operation, and > the server would respond with NFS4ERR_STALE. If the server does not allow client to use write delegation for the READ, should the correct error return be NFS4ERR_OPENMODE? > > The problem is that the struct file associated with the delegation does > not necessarily have read permissions. It's handing out a write > delegation on what is effectively an O_WRONLY open. RFC 8881 states: > > "An OPEN_DELEGATE_WRITE delegation allows the client to handle, on its > own, all opens." > > Given that the client didn't request any read permissions, and that nfsd > didn't check for any, it seems wrong to give out a write delegation. > > Only hand out a write delegation if we have a O_RDWR descriptor > available. If it fails to find an appropriate write descriptor, go > ahead and try for a read delegation if NFS4_SHARE_ACCESS_READ was > requested. > > This fixes xfstest generic/001. > > Closes: https://bugzilla.linux-nfs.org/show_bug.cgi?id=412 > Signed-off-by: Jeff Layton > --- > Changes in v2: > - Rework the logic when finding struct file for the delegation. The > earlier patch might still have attached a O_WRONLY file to the deleg > in some cases, and could still have handed out a write delegation on > an O_WRONLY OPEN request in some cases. > --- > fs/nfsd/nfs4state.c | 29 ++++++++++++++++++----------- > 1 file changed, 18 insertions(+), 11 deletions(-) > > diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c > index ef7118ebee00..e79d82fd05e7 100644 > --- a/fs/nfsd/nfs4state.c > +++ b/fs/nfsd/nfs4state.c > @@ -5449,7 +5449,7 @@ nfs4_set_delegation(struct nfsd4_open *open, struct nfs4_ol_stateid *stp, > struct nfs4_file *fp = stp->st_stid.sc_file; > struct nfs4_clnt_odstate *odstate = stp->st_clnt_odstate; > struct nfs4_delegation *dp; > - struct nfsd_file *nf; > + struct nfsd_file *nf = NULL; > struct file_lock *fl; > u32 dl_type; > > @@ -5461,21 +5461,28 @@ nfs4_set_delegation(struct nfsd4_open *open, struct nfs4_ol_stateid *stp, > if (fp->fi_had_conflict) > return ERR_PTR(-EAGAIN); > > - if (open->op_share_access & NFS4_SHARE_ACCESS_WRITE) { > - nf = find_writeable_file(fp); > + /* > + * Try for a write delegation first. We need an O_RDWR file > + * since a write delegation allows the client to perform any open > + * from its cache. > + */ > + if ((open->op_share_access & NFS4_SHARE_ACCESS_BOTH) == NFS4_SHARE_ACCESS_BOTH) { > + nf = nfsd_file_get(fp->fi_fds[O_RDWR]); > dl_type = NFS4_OPEN_DELEGATE_WRITE; > - } else { Does this mean OPEN4_SHARE_ACCESS_WRITE do not get a write delegation? It does not seem right. -Dai > + } > + > + /* > + * If the file is being opened O_RDONLY or we couldn't get a O_RDWR > + * file for some reason, then try for a read deleg instead. > + */ > + if (!nf && (open->op_share_access & NFS4_SHARE_ACCESS_READ)) { > nf = find_readable_file(fp); > dl_type = NFS4_OPEN_DELEGATE_READ; > } > - if (!nf) { > - /* > - * We probably could attempt another open and get a read > - * delegation, but for now, don't bother until the > - * client actually sends us one. > - */ > + > + if (!nf) > return ERR_PTR(-EAGAIN); > - } > + > spin_lock(&state_lock); > spin_lock(&fp->fi_lock); > if (nfs4_delegation_exists(clp, fp)) > > --- > base-commit: a734662572708cf062e974f659ae50c24fc1ad17 > change-id: 20230731-wdeleg-bbdb6b25a3c6 > > Best regards,