From owner-freebsd-fs@freebsd.org Fri Nov 2 15:51:32 2018 Return-Path: Delivered-To: freebsd-fs@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DCFAE10FB720 for ; Fri, 2 Nov 2018 15:51:31 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) Received: from CAN01-TO1-obe.outbound.protection.outlook.com (mail-eopbgr670078.outbound.protection.outlook.com [40.107.67.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-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 801E571B62; Fri, 2 Nov 2018 15:51:31 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) Received: from YTOPR0101MB1162.CANPRD01.PROD.OUTLOOK.COM (52.132.50.155) by YTOPR0101MB0716.CANPRD01.PROD.OUTLOOK.COM (52.132.43.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1294.26; Fri, 2 Nov 2018 15:51:30 +0000 Received: from YTOPR0101MB1162.CANPRD01.PROD.OUTLOOK.COM ([fe80::9c71:6eb6:1bff:727b]) by YTOPR0101MB1162.CANPRD01.PROD.OUTLOOK.COM ([fe80::9c71:6eb6:1bff:727b%3]) with mapi id 15.20.1294.024; Fri, 2 Nov 2018 15:51:30 +0000 From: Rick Macklem To: Andriy Gapon , Konstantin Belousov CC: FreeBSD Filesystems , Josh Paetzel Subject: Re: How to fill in the fsid for file systems? Thread-Topic: How to fill in the fsid for file systems? Thread-Index: AQHUb557F1RNqdJl0kuwS+F5J/DjsKU2/twAgAGdwkKAAGQrgIAAehmGgAELs4CAATs6uIAATiWAgAACTACAAJQ+WA== Date: Fri, 2 Nov 2018 15:51:29 +0000 Message-ID: References: <20181030012240.GM5335@kib.kiev.ua> <4269ff9a-8e11-f441-fbb5-b23a6d8e253b@FreeBSD.org>, In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=rmacklem@uoguelph.ca; x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; YTOPR0101MB0716; 6:WuuzOgnjgFuvQTMZwoM/dWljZojh9shNBbL2AqjUtoap4s1IWeTSoMfIB1xaAbhUZeSMtKZUWyaY/6cLu6bSUY9jCv3oEH2Bu6GfyxN5mBEH6zRzTiIs7TQyxZtzKi4LtJUSAQTRFlktygytkFKsr3geMsW8/apYNHIZLnycf82ECCo2303Cu41w9icABvAd7Q1Z49v+qh5PQWXGKfI9cwBGNZjTsspzUyRBelLx5eo28XfYFyU/pQY+SQk3dQBKp+07+z8OyQzLoDQ3CQfGrYn64cU6j39Sgs5ChJ1G1CSv48lcV7HxUsGF4vkxORFypg0Hlfp/RDFARWhF0kMWq17muUc+yWSLzqlfOHc/8eUDFgvRN9YQPpfeTr54im+HNDAFpGEVZeEVvkb6mS/JCHMI8GvLpxJl3IcN51tqiWqJp1bi64Wb6q0Cnmu39dVZ/aD80v6uEkOOTd+FKqfJJw==; 5:SB9jlotCp/z7pfHVUTMB02KvzzoCCqyw0X+2mF93cK68YdhLCjxV8Q7pC0KvIzeotpZol1FHaXjrIwi0Ad0NpXfps2aNphyMhxms2eT/+1IsTnHpGX/UFaSrAofrunL3GipnL7iJGvrat+NesUbFw76axE/uFjMl1KLCZFd4ajI=; 7:QomrWlOvJlmLzprlVQYGsdaCDTUil9GKbYOvd08Gr5aQAIyQc0FYdu00hRKVwJmuhin4Doj7APV7JIeNvGc61lUiWdm8mB/vaVTWR7RZ9gBUOEMaPNNtRS7G0SGljOYW3pcc+MOCoDulCOZuVAwU6Q== x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-correlation-id: 473c86b0-ee3c-4046-fb2a-08d640db0e45 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(5600074)(711020)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020); SRVR:YTOPR0101MB0716; x-ms-traffictypediagnostic: YTOPR0101MB0716: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(8121501046)(5005006)(3231382)(944501410)(52105095)(3002001)(10201501046)(93006095)(93001095)(148016)(149066)(150057)(6041310)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(201703131423095)(201702281529075)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051)(76991095); SRVR:YTOPR0101MB0716; BCL:0; PCL:0; RULEID:; SRVR:YTOPR0101MB0716; x-forefront-prvs: 08444C7C87 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(366004)(39860400002)(396003)(376002)(136003)(346002)(189003)(199004)(51444003)(446003)(81166006)(39060400002)(305945005)(99286004)(76176011)(7696005)(71200400001)(71190400001)(2900100001)(46003)(74316002)(186003)(6506007)(14454004)(4326008)(74482002)(8936002)(5660300001)(102836004)(6436002)(68736007)(786003)(316002)(476003)(53936002)(93886005)(229853002)(2906002)(486006)(86362001)(53546011)(9686003)(97736004)(6246003)(105586002)(256004)(25786009)(33656002)(54906003)(106356001)(110136005)(11346002)(8676002)(81156014)(55016002)(478600001); DIR:OUT; SFP:1101; SCL:1; SRVR:YTOPR0101MB0716; H:YTOPR0101MB1162.CANPRD01.PROD.OUTLOOK.COM; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: uoguelph.ca does not designate permitted sender hosts) x-microsoft-antispam-message-info: a1PkB6mUWikzu0QYEnXbB0J9SBxhK/ogZvr6jT28S6j8L7OW0DIltPd6ukzTXmVlC7CLaaMepdrSrn/9SPJvWKZtRNHCRA278jjRI7rAXdICNSd8HANKZqtbl5k88vISZKOziLC7rdOcMjDsP+H5hm6lkb1/+EvWLr44uF3NtAJQ3WnyZ1Dqax1FG+mq+y+2x3NdViYA3E3nYf8+91P3c7P4Xhj2Gnop7xo0VwxVycsPR1Gg8SlbJ8OobgkUW5sfsbAITh5r37cpw5nuU4y1ZENifwNwn/1z/0S9PvWHp9ZYMz2oiB/tKUPw9bK5AThmdl3QFjiDwl72JG/PUcWsVN9xFaNUSZr6xeN0AQm3pNw= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM 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-Network-Message-Id: 473c86b0-ee3c-4046-fb2a-08d640db0e45 X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Nov 2018 15:51:30.0048 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: be62a12b-2cad-49a1-a5fa-85f4f3156a7d X-MS-Exchange-Transport-CrossTenantHeadersStamped: YTOPR0101MB0716 X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Nov 2018 15:51:32 -0000 Andriy Gapon wrote: >On 02/11/2018 08:45, Andriy Gapon wrote: >> On 02/11/2018 04:24, Rick Macklem wrote: >>> I have two comments. The first is related to the above and the second i= s a big >>> picture question related to doing this. >>> >>> Specifically w.r.t. the above. I probably rambled and didn't make what = I was >>> trying to say clear, so I'll try again... >>> - getfh(2) returns a file handle that is used for NFS, but is also used= for system >>> calls (fhopen(2), fhstat(2) and fhstatfs(2)) that are not related to = NFS. >>> --> A file handle isn't really NFS specific, although NFS is the big = user of it. >>> If the above is correct, then it seems that there should only be one ki= nd of file handle. >>> --> Since the fsid is a key part of a file handle, one kind of file han= dle implies one >>> kind of fsid. >>> I just think trying to create two kinds of fsid and two kinds of file h= andle would >>> make the code confusing and unnecessarily complex. >> >> As as far as I understand, VFS calls like, say, VOP_VPTOFH fill only the= file ID >> portion of the file handle, fh_fid. fh_fsid is left to a caller, so pot= entially >> we could already have a discrepancy there (but we don't). >> >> Also, I do not think that NFS uses getfh(2), but I could be wrong. I th= ink that >> NFS, being in kernel, directly uses VFS interfaces like the mentioned VO= P_VPTOFH. >> >> I am not sure if getfh(2) has any requirement that its result should be >> compatible with anything NFS. My impression is that it should only be u= sable >> for fhopen(2) and the like. But I can be wrong again. mountd uses getfh(2) to acquire a file handle at mount time for a client. S= o, for NFSv3 it does use getfh(2) to acquire the "root" file handle for the mount. (Technically, it's the Mount protocol, but since that is required for NFSv3= mounting, you might as well call it NFS and this one needs to be an NFS usable file = handle.) >> >> So, if any of my assumptions is wrong, then you are right, of course, an= d I >> should withdraw my argument. >> Thanks! >> > >Looking through the actual code, it appears that rpc.lockd (and only it?) = could >be mixing NFS and local file handles... I suspect, but not sure, that loc= kd >could pass a file handle received "from NFS" to fhopen(2). Good point. SInce the NLM isn't NFS I tend to forget about it. rick