From owner-freebsd-hackers@freebsd.org Fri Jan 1 01:09:21 2021 Return-Path: Delivered-To: freebsd-hackers@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 69D734B8C58 for ; Fri, 1 Jan 2021 01:09:21 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) Received: from CAN01-TO1-obe.outbound.protection.outlook.com (mail-eopbgr670083.outbound.protection.outlook.com [40.107.67.83]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail.protection.outlook.com", Issuer "GlobalSign Organization Validation CA - SHA256 - G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4D6RkS1N4Nz4j6N for ; Fri, 1 Jan 2021 01:09:19 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Wi6mWhn9Yk0NUG0L9jvJpX1i3KvncYUDeChfnnfIEf8B61m2X0uYsTtRQGeLNX3V5wkl+tqQjbrt8S0Srl4DiA9WWLLmEJ5Tfmq6E1KrDDSN6S+fNqAmSNxvkSL5hkvQpCkPSSqWNFxPFau0CWJOtxngvp+9QLMRwOK2TxUOe1fDQxF+KPjotFx16UzQS8he3bdJPpykboZqwvDiCy2N5KuWJuX9sHPCf8F0jLURX7cOFd5o6CWePhRsKJ7v2Vpn8+J641Uhmi8urDz43zTOGyPF9fgr3wTv071L+e9Iu+AzX5/1cBaCEMUIjbN5yVD7+I2vDAfyTQAUXAoZdr0lqA== 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=q2ib9NSqMK2Qj2RLc6P7cTcGULLf3sYF7ZjTLcooo00=; b=atlveXEDJl3l/ifbTM2KA49/JBP8SANWb/dfptkGAX999hb11mE8f/O8uCnRCmJi8p1FwPGGz7V8gosJ6w1gBOWV+Xj9y3NmV4CerBAi9iO6NPOlphaCuxrsIl8AHqAe05rW+B2tVjkhhwJS7wR1m/clacrkbTlSU5o165V1ZPzaBRpxWgSGd7bwmukv9IAheYn7gdibO06IXDLq3c2CQf5To8J+Yvd4vKkJ4STb33wDozxoKpnE+wo55pS/B8h2o3d4wVq8nFnpVOIMjp2CLEUHtAVHWSo7e+UHtiBomkw4co9IkEd3a9DvIPG26sLM6hqUo3422HY33Tsj4wQjZQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=uoguelph.ca; dmarc=pass action=none header.from=uoguelph.ca; dkim=pass header.d=uoguelph.ca; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uoguelph.ca; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=q2ib9NSqMK2Qj2RLc6P7cTcGULLf3sYF7ZjTLcooo00=; b=AvOO8gKQJtGFvon5SIsWU6sfPUmY6xfTmeaT4rOK7Gwx0s5O8nhsOUxHYWncZfgblbW+0XMVV4XdNzL2D8CcKldcTqjh9F18S0YFtUJwm6scxj7zHs8yt1tsJFLtzywi1b36fFLeCakpQ1TOyRpwRl2EMdVcMoHWuPh8ihlYEPpsRfU0MvosRWHM95nymyVhfZ4zwwzPuPPMqalIly6NDcfEcQqd/u8QUjNe8reMmZa9g9VpV1BKU8bNol9bG+XZTQ7dij6lyouKpxHLGRytgK3cBrw09Peonv1M2Bbx/8jwUxzP4w1Ko6PX75ooKgJhlDZv2U+2gmUdbgnbRqutpQ== Received: from YQXPR0101MB0968.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:c00:19::29) by YQXPR0101MB1479.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:c00:1c::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3721.22; Fri, 1 Jan 2021 01:09:18 +0000 Received: from YQXPR0101MB0968.CANPRD01.PROD.OUTLOOK.COM ([fe80::3d86:c7f9:bc4c:40c0]) by YQXPR0101MB0968.CANPRD01.PROD.OUTLOOK.COM ([fe80::3d86:c7f9:bc4c:40c0%6]) with mapi id 15.20.3721.020; Fri, 1 Jan 2021 01:09:18 +0000 From: Rick Macklem To: Chris Johns CC: "freebsd-hackers@freebsd.org" Subject: Re: sys/fs/nfsclient on RTEMS gets a bad seqid error with open Thread-Topic: sys/fs/nfsclient on RTEMS gets a bad seqid error with open Thread-Index: AQHW39ixX2g8xupI30yVViAOBKgn+g== Date: Fri, 1 Jan 2021 01:09:18 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 4cfd3067-117e-4df8-25d1-08d8adf1dd71 x-ms-traffictypediagnostic: YQXPR0101MB1479: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:10000; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: Gy4oVQfkRnRpP6Q9PYTlUAsiT2yZ3FeAPTaaG91ulAPyxA2NF75JsRHA2Si9myF0j9KTtHaDOPQuUGp/YNErjJTYHFMsRQffyo3oMi4tReKuvA8fUQCKJoW0Jg2xhzY5wL33B425DsO56Gmg25rE4jCys0AXohma7yFGeMZkrLoC5Wh6PxCuyv6EKNpLb5mWPU+LblEu9M487b/cBA9436VcvBtS81CNo3M07qFbFJf8JqdCeMnXIf0M51+fiKXgkW7Nf8fu5DUUjzvaBURJIs9A+lLQZYlCN0ocX7nL6Pgqx61EQey5y99cAGu9/TtHXb95BJVI7Z+UN0bWKIjodVIGAnJZxuzAU7eI6KhaO/1yPa3TGc/qI/ks0mTN7Sbu60C33MJWR/5guRZNnvTw6g== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:YQXPR0101MB0968.CANPRD01.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFS:(366004)(39860400002)(136003)(346002)(396003)(376002)(316002)(8936002)(86362001)(7696005)(26005)(66946007)(786003)(4326008)(55016002)(9686003)(6916009)(186003)(5660300002)(478600001)(6506007)(83380400001)(91956017)(76116006)(33656002)(66556008)(66446008)(66476007)(64756008)(2906002)(52536014)(8676002)(71200400001); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: =?iso-8859-1?Q?dVfP7L7VPbAn0PnFIIX+lSW41QwngECbs7Ybkxhh9Vw9Pj8o8F73IfeNpx?= =?iso-8859-1?Q?gLvSRpfkvuJRE4R333CMcIVDUY16PKc4Vrsybq4/SmlZSjAhAcjjgjpI0L?= =?iso-8859-1?Q?yXksKoRYrpayLDq7TU8r6MV4+HoGQQLsmXTQt9F3beCz5f3XzplNrJKnN6?= =?iso-8859-1?Q?Tv6Oq6AEGmmidUyXCCmeAIxJ9vngTrrVWZyOQG/yl01Q1xFmgSRVn9CHZo?= =?iso-8859-1?Q?lQmPORT1kVgIXNBbOS9EzJypH+kOZRyhp9Kp797acX8x41HMIqolBBEMu4?= =?iso-8859-1?Q?kii+IGwl8MgKKaE7YTfAryfbSIlstwFSZR9UrpDtXoTvhfVJdLmOgF/W6z?= =?iso-8859-1?Q?E7yKu6qFf+Fpw+9ihl+tjK0kJyyOmo7fnUr1Vka/EbeIZn9C/53evEOblJ?= =?iso-8859-1?Q?xKsNL6uz5v+BJS+oeloFeBTuwQ7et0b01zm5ctcXfB4GG/wFmXIxGBXwoX?= =?iso-8859-1?Q?4ZNYlK8PwtvXJ86+xVwatlvVJoSA0ToOxHvUcr3cRGrdTEP9Xxns96dtIh?= =?iso-8859-1?Q?BT5uysvpU8T8xVFn3mEntL9+ZYCylWWKuCT0Pd2fEZQQzOZyzWWdr4FbVv?= =?iso-8859-1?Q?rUZgoM+IvEF5KyO1RB/HPtdwUNFocx+lw6hIt2+HY7jiFUAqGKxNzuBFSS?= =?iso-8859-1?Q?KB3t837SNmxyvqBq2vfScclhH2PZOEPFgE+g+WM3btDmpxuiiXol+pfHpN?= =?iso-8859-1?Q?hZOuSrMbDRkT6hE4q0dq2ijxBZnI38tZxfMMEDxqKKK9Cy7g37jKAlVZpe?= =?iso-8859-1?Q?+5UNfgsKQAw3+Maa+pM9HaqGe6XyrTkyWzoPNGbMoWbVMiGGSWZM+jZLyX?= =?iso-8859-1?Q?9Llyz4VZv/ZUXVHQ6p1oVSyWdsvj5LnRVkB3mJcwPvQsU8JzuMqboL6h+b?= =?iso-8859-1?Q?p6bXoTysfK2948ppMCmH3a3Kh7asfbQrcF3WNkgnxADFEIJSSIojgh1rEk?= =?iso-8859-1?Q?WzARiTarPcl3ZNclGB6tkvow5pKoH02YfX6y78yXdi2m5Wh76eUGNrHxuh?= =?iso-8859-1?Q?XdtrjLquZlgzWpkjA=3D?= x-ms-exchange-transport-forked: True Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: uoguelph.ca X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: YQXPR0101MB0968.CANPRD01.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-Network-Message-Id: 4cfd3067-117e-4df8-25d1-08d8adf1dd71 X-MS-Exchange-CrossTenant-originalarrivaltime: 01 Jan 2021 01:09:18.6618 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: be62a12b-2cad-49a1-a5fa-85f4f3156a7d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: eyC/KlGtH2/IY3ry5wG/a7Fy67v7Rezv8tzgahMD4rHrswg5tNHMD4ema++ih/KAqPa2ve9R7Xw0HYbUbSYPYA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: YQXPR0101MB1479 X-Rspamd-Queue-Id: 4D6RkS1N4Nz4j6N X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=pass header.d=uoguelph.ca header.s=selector1 header.b=AvOO8gKQ; arc=pass (microsoft.com:s=arcselector9901:i=1); dmarc=pass (policy=none) header.from=uoguelph.ca; spf=pass (mx1.freebsd.org: domain of rmacklem@uoguelph.ca designates 40.107.67.83 as permitted sender) smtp.mailfrom=rmacklem@uoguelph.ca X-Spamd-Result: default: False [-1.00 / 15.00]; TO_DN_EQ_ADDR_SOME(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:40.107.0.0/16]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[uoguelph.ca:+]; RCPT_COUNT_TWO(0.00)[2]; DMARC_POLICY_ALLOW(-0.50)[uoguelph.ca,none]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_LAST(0.00)[]; RBL_DBL_DONT_QUERY_IPS(0.00)[40.107.67.83:from]; ARC_ALLOW(-1.00)[microsoft.com:s=arcselector9901:i=1]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:8075, ipnet:40.104.0.0/14, country:US]; FAKE_REPLY(1.00)[]; R_DKIM_ALLOW(-0.20)[uoguelph.ca:s=selector1]; FREEFALL_USER(0.00)[rmacklem]; FROM_HAS_DN(0.00)[]; NEURAL_SPAM_SHORT(1.00)[1.000]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; NEURAL_SPAM_MEDIUM(1.00)[1.000]; DWL_DNSWL_LOW(-1.00)[uoguelph.ca:dkim]; SPAMHAUS_ZRD(0.00)[40.107.67.83:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[40.107.67.83:from]; RWL_MAILSPIKE_POSSIBLE(0.00)[40.107.67.83:from]; MAILMAN_DEST(0.00)[freebsd-hackers] X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Jan 2021 01:09:21 -0000 >On 31/12/20 10:04 am, Rick Macklem wrote:=0A= >> Chris Johns wrote:=0A= >>> Hello,=0A= >>>=0A= >>> I am porting the kernel's nfsclient file system to the RTEMS port of Fr= eeBSD. I=0A= >>> have ported across the FreeBSD file descriptors, VFS and NFS code. I ha= ve a=0A= >>> custom pseudofs file system as my root file system and I can mount an N= FSv4=0A= >>> mount exported from a FreeBSD 12 box.=0A= >>>=0A= >>> When I open a file there are a some getattr RPC calls that are successf= ul=0A= >>> however the open call (PUTFH, OPEN, GETATTR) results in the server retu= rning the=0A= >>> bas seqid (10026) error code for the OPEN and I am not sure why this is= =0A= >>> happening. I suspect I am missing a step in the nfsclient set up.=0A= >> Well, for NFSv4.0 Opens, there is a field in the open_owner called a "se= qid',=0A= >> which is used to serialize Open calls. If that "seqid" gets screwed up, = you=0A= >> get a "bad seqid" (10026) from the server and your mount is broken.=0A= >=0A= >There is only one open call being made and the seq id in the packet is 0. = The=0A= >server code seems to consider ownership when returning this error and this= is an=0A= >area I am not sure about. RTEMS simulates a process and does not have a no= rmal=0A= >user/group model.=0A= Did you do a Setclientid, Setclientidconfirm to set up the clientid?=0A= =0A= The first Open should be fine with seqid=3D=3D0 and the reply will flag it= =0A= as "needs Openconfirm".=0A= --> 10026 means the server thinks it has already seen the open_owner=0A= string for that client.=0A= =0A= I'd suggest to capture a packet trace of a mount from the FreeBSD client=0A= and then look at it in wireshark, to see what should be happening.=0A= =0A= >> A couple of possibilities:=0A= >> - The FreeBSD client code depends on an exclusive lock on the vnode=0A= >> to serialize the Opens.=0A= >=0A= >There is only one open call active. This is something I can control.=0A= If all your Opens are serialized, you can use a single open_owner for=0A= everything. The open_owner string should always be the same to do=0A= this.=0A= The FreeBSD client can do this for NFSv4.1 by specifying "oneopenown"=0A= as a mount option.=0A= =0A= >> --> If what you are doing doesn't serialize them, then that will be a= =0A= >> problem.=0A= >> - If the VOP_OPEN() generates an unexpected error (I just ran into this= =0A= >> on FreeBSD head), then the client might not get things correct.=0A= >> --> The seqid is incremented for some errors, but not others.=0A= >=0A= >I am currently basing this work on the FreeBSD 12 branch we have. A master= port=0A= >is next.=0A= >=0A= > Btw, all this seqid stuff goes away when you use NFSv4.1 and there=0A= > are NFSv4.1 only clients out there. You might want to consider doing=0A= > this. If I was writing the code now, there would be no NFSv4.0.=0A= >=0A= >Ah OK. How do I make the FreeBSD nfsclient operate as NFSv4.1? I looked in= to=0A= >this but I could not figure out how.=0A= minorversion=3D1 mount option, which sets nm_minorvers to 1.=0A= =0A= rick=0A= =0A= > rick=0A= > ps: Getting this seqid stuff right was about the hardest part of=0A= > implementing NFSv4.0 and it could still be buggy.=0A= =0A= Hmm yes it seems a little tricky.=0A= =0A= Thanks=0A= Chris=0A=