From owner-freebsd-fs@freebsd.org Wed Jun 5 05:38:55 2019 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 0950715C603D for ; Wed, 5 Jun 2019 05:38:55 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) Received: from CAN01-QB1-obe.outbound.protection.outlook.com (mail-eopbgr660050.outbound.protection.outlook.com [40.107.66.50]) (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 7A4976CC81; Wed, 5 Jun 2019 05:38:53 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) Received: from YQXPR01MB3128.CANPRD01.PROD.OUTLOOK.COM (52.132.93.160) by YQXPR01MB3736.CANPRD01.PROD.OUTLOOK.COM (52.132.92.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1965.12; Wed, 5 Jun 2019 05:38:51 +0000 Received: from YQXPR01MB3128.CANPRD01.PROD.OUTLOOK.COM ([fe80::f9fe:559f:fdc:9e5a]) by YQXPR01MB3128.CANPRD01.PROD.OUTLOOK.COM ([fe80::f9fe:559f:fdc:9e5a%3]) with mapi id 15.20.1943.018; Wed, 5 Jun 2019 05:38:51 +0000 From: Rick Macklem To: Alexander Motin , "mmacy@ixsystems.com" , "ryan@ixsystems.com" , "pjd@freebsd.org" , Peter Eriksson CC: "freebsd-fs@freebsd.org" Subject: RFC: patching fsshare in ZFS Thread-Topic: RFC: patching fsshare in ZFS Thread-Index: AQHVG2D0yISfnX1rEEaIeN2nOcwYOA== Date: Wed, 5 Jun 2019 05:38:51 +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: c50f9637-af5e-4778-e0bc-08d6e9781740 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(2017052603328)(7193020); SRVR:YQXPR01MB3736; x-ms-traffictypediagnostic: YQXPR01MB3736: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:10000; x-forefront-prvs: 00594E8DBA x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(366004)(39860400002)(396003)(346002)(376002)(136003)(199004)(189003)(55016002)(256004)(14444005)(478600001)(53936002)(14454004)(316002)(786003)(74482002)(4326008)(25786009)(99286004)(5660300002)(2201001)(52536014)(486006)(6506007)(71190400001)(71200400001)(7696005)(305945005)(64756008)(66446008)(66556008)(76116006)(73956011)(46003)(476003)(33656002)(68736007)(8676002)(186003)(86362001)(66476007)(66946007)(2501003)(6436002)(81156014)(81166006)(110136005)(9686003)(102836004)(8936002)(2906002)(74316002); DIR:OUT; SFP:1101; SCL:1; SRVR:YQXPR01MB3736; H:YQXPR01MB3128.CANPRD01.PROD.OUTLOOK.COM; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: uoguelph.ca does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: c9IFICl+02ZPruxHJVeg+KRf+GvkJcZQpwjCsk//tU1KK6PPcQ1A33gHvv9sQj/1HrJlzBa3ixIzSupGnsAaIV7eIsDY+6Pr3aSBpavPBunVHp+0DtZ0mkT9xq1HLPcDeuBpewadKUMQas8+jDxq468YyhUx81OK2VaCWKDBmOv+ilZskNUTuaccPKDwLLc/JYjHnF+H8q26GhCqilpm9KuLXEobSGOHXYvcxfDNuvikGMfqwUvgFXZq6Iqgj0YlsKv/lKy/U3vpTxxIgKyKILfNQbo6Zt/xCxelfghDypOR+1BTxSSWuTKMXkvz9qmfmizY6Wj27918P22PaLT03w88aqICaq22QQE9Pg+wC/ubGbznL4DqxszZ1taMap0hzrq6DzooLlkfry4YGLcJ0GOTlrcsX6B38A9wV05ibuE= 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: c50f9637-af5e-4778-e0bc-08d6e9781740 X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Jun 2019 05:38:51.4279 (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: rmacklem@uoguelph.ca X-MS-Exchange-Transport-CrossTenantHeadersStamped: YQXPR01MB3736 X-Rspamd-Queue-Id: 7A4976CC81 X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; spf=pass (mx1.freebsd.org: domain of rmacklem@uoguelph.ca designates 40.107.66.50 as permitted sender) smtp.mailfrom=rmacklem@uoguelph.ca X-Spamd-Result: default: False [-1.41 / 15.00]; ARC_NA(0.00)[]; TO_DN_EQ_ADDR_SOME(0.00)[]; NEURAL_HAM_MEDIUM(-0.97)[-0.970,0]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:40.107.0.0/16]; NEURAL_HAM_LONG(-0.97)[-0.967,0]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[uoguelph.ca]; RCPT_COUNT_FIVE(0.00)[6]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_SPAM_SHORT(0.83)[0.832,0]; MX_GOOD(-0.01)[mx2.hc184-76.ca.iphmx.com,mx1.hc184-76.ca.iphmx.com,mx2.hc184-76.ca.iphmx.com,mx1.hc184-76.ca.iphmx.com,mx2.hc184-76.ca.iphmx.com,mx1.hc184-76.ca.iphmx.com,mx2.hc184-76.ca.iphmx.com,mx1.hc184-76.ca.iphmx.com,mx2.hc184-76.ca.iphmx.com,mx1.hc184-76.ca.iphmx.com,mx2.hc184-76.ca.iphmx.com,mx1.hc184-76.ca.iphmx.com,mx2.hc184-76.ca.iphmx.com,mx1.hc184-76.ca.iphmx.com,mx2.hc184-76.ca.iphmx.com,mx1.hc184-76.ca.iphmx.com,mx2.hc184-76.ca.iphmx.com,mx1.hc184-76.ca.iphmx.com,mx2.hc184-76.ca.iphmx.com,mx1.hc184-76.ca.iphmx.com,mx2.hc184-76.ca.iphmx.com,mx1.hc184-76.ca.iphmx.com,mx2.hc184-76.ca.iphmx.com,mx1.hc184-76.ca.iphmx.com,mx2.hc184-76.ca.iphmx.com,mx1.hc184-76.ca.iphmx.com,mx2.hc184-76.ca.iphmx.com,mx1.hc184-76.ca.iphmx.com,mx2.hc184-76.ca.iphmx.com,mx1.hc184-76.ca.iphmx.com]; RCVD_IN_DNSWL_NONE(0.00)[50.66.107.40.list.dnswl.org : 127.0.3.0]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_LAST(0.00)[] 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: Wed, 05 Jun 2019 05:38:55 -0000 Hi, First off, sorry for sending this to all you guys. (I used to send this stu= ff to Josh P, but I'm not sure which of you guys are best for FreeNAS/NFS related stuff. If you let me know who you'd rather I email, then I'll only bother them;-) I try to avoid ZFS like the plague, but there are a couple of things relate= d the nfsshare property that I think would be nice to patch. 1 - There is a simple patch by Quentin Rameau in PR#147881 that adds suppor= t for ";" to be used as a separator in the nfsshare property, so that m= ultiple lines of exports can be generated. For example, for an nfsshare property of "-maproot=3Droot host1; -ro host2", the following two exports lines w= ould be generated (assuming /tank/vol1 is the file system mountpoint) /tank/vol1 -maproot=3Droot host1 /tank/vol1 -ro host2 Right now, I think the nfsshare property only generates one line per f= ile system, which has to apply to all clients, giving them all the same options. (I made a couple of comments related to this patch in the PR.) One question is whether an nfsshare property that is a null string or = just whitespace is currently allowed? (I couldn't see anything in fsshare()= that disallows it, but I don't know anything about the code used to set the= property.) 2 - Peter has some NFS servers with 20000-72000+ file systems being exporte= d. The current code in fsshare.c copies the exports file and then append= s the new entry for a file system and then replaces the exports file with the = new one. I think this file copying happens for every file system, which seems= like a lot of overhead. (I forget what Peter said w.r.t. how long this takes, b= ut I think it was quite a while.) My guess is that Pawel did this so that the update to the file would= happen atomically. It seems to me that if mountd held a read lock on the export file wh= ile reading it and fsshare() held a write lock on the file while appending the new = entry, that the file copying could be avoided? - The main problem I see w.r.t. doing this is that an old mountd bin= ary that doesn't read lock the file could be broken by the fsshare() change. --> One way to avoid this would be to have the new mountd write mo= re than just the pid in the MOUNTD_PID file so that fsshare() could = tell if mountd was going to be read locking the file. OR Just don't MFC the change and assume that the new mountd wou= ld be released when the new fsshare() is (in FreeBSD13?). Anyhow, I can tweak mountd.c and fsshare.c, but that's as far as I can take= it. Others would need to do testing and whatever it takes to get a change to fs= share.c into the ZFS sources. So, what do you think about this? rick