From owner-freebsd-hackers@freebsd.org Wed Aug 26 21:15:25 2020 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 20BD93BCDAB for ; Wed, 26 Aug 2020 21:15:25 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) Received: from CAN01-TO1-obe.outbound.protection.outlook.com (mail-to1can01on0600.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe5d::600]) (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 4BcJY76c3Pz4g1y; Wed, 26 Aug 2020 21:15:23 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AT+bWdOJ/aqB7709J3yaon+/5S586k5MIU8eqI+4gMrj7rRaa7t1vWXR4zVVu8ou8oYGwKz+fENzpCJDn8/ajgv1DIWl6mT96pJ5mzUl2EHhqu+1bf1uNGdc9KMF7UVWklY45SbHagZHrJZGwrjXTQyPbosKohNWgxLAQ/J9OHM3bngDBONVDQZ9CYojRf4aLMsWweWRHObJDiX4xqyNTwB9NwIbWRakzIYvANkkKLEe/y8ojEsNr0f75TNrrZTVko8ygUue5u1ptIL3z6/orBNZfJYEjhdC2JAdJrfs9HzVbn4ydyQGV4JSui3EXVKoA8RmAR4mevHn33IA63CeEw== 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=Zs7ylJYdETWqZEBg0bog1hOYQ57GbiaTax++XGK+VS8=; b=DSU/JMrLiUk0IcWzNkvlwhA4OSoPnucWSzImrpwoEEAYP5m5e2MukDvWKQuzMiAZb2j9ytJfblYuqrGIcOEI3ym7StnAgQ/7FsSNTmV+kdtJCvT3/ZQ8hHv23XaZCjZm86lwFlTZm/z1fMM8ydgehqd4fbBx48lOMbCluYGeaCbCoPYHNu1/3GLEgYZgyeYtHDxhYkrjwePOt0iwGj8PrJpRbJEROqXCNX4NeCCLKlZSOKTgifvXpPP+GhcPAUYT/ENanLlmHkIaC+Ko8KNnTfGYoEEyeojKnbsn+QTB17nMxF4t27SCnwNLeGl2eYyvCWbEoSHD1VXYsxbwRoKQKA== 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=Zs7ylJYdETWqZEBg0bog1hOYQ57GbiaTax++XGK+VS8=; b=ba0lU0UMe1EN21JC2vUrWAfBENZC7gH3Lv4ohpq7p23b7VSUqHpEsBIJTKuv6pKLp7A+NwO57OwMn+0deT/DcliRzWVpeJz3y9hyVkLZMcLDWPfdb+iqpUDGczu0SzqqsvnqCNMqiDE4asHUGtLsfFPT1lnJYyIrsWFXTBxQaS/Cb/LV3GDy1+kvZK/0Y55pCl7+qSOG6xpvjJ3C4ZAMlIiyX4EnCV7Es5dNHHqJtISpNEI08SPw9kqyDM5KgOB4mpxoNfNsALrkUDTYeC6p5X8vsWN7Y2ryXqkVzz59hTXcW1PX7rXiJgJLQr1eVhJ8AALHsgKk4UpwzBrqn+M+QQ== Received: from QB1PR01MB3364.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:c00:38::14) by YQBPR0101MB1460.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:c00:a::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3326.19; Wed, 26 Aug 2020 21:15:20 +0000 Received: from QB1PR01MB3364.CANPRD01.PROD.OUTLOOK.COM ([fe80::e89a:a655:91ca:4e63]) by QB1PR01MB3364.CANPRD01.PROD.OUTLOOK.COM ([fe80::e89a:a655:91ca:4e63%5]) with mapi id 15.20.3305.026; Wed, 26 Aug 2020 21:15:20 +0000 From: Rick Macklem To: J David , Brandon Bergren CC: FreeBSD Hackers Subject: Re: pidfile_open() usage in "mount" Thread-Topic: pidfile_open() usage in "mount" Thread-Index: AQHWe8eybc/2kMk1JESHDCtWsuNrP6lKpi6AgAA76f0= Date: Wed, 26 Aug 2020 21:15:20 +0000 Message-ID: References: <20200826144013.GV2551@kib.kiev.ua> , In-Reply-To: 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: 8ce90194-9e32-4d31-0a9c-08d84a0523a7 x-ms-traffictypediagnostic: YQBPR0101MB1460: 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: xuU/QknCuYPfW84JOjmiE4y/RegVjRfr0WjAlty/afxMPQWbSAZ9DUlJQeHKzqJRw/aqWCb0w4eDeD/K3DYG/LMIBpGjqMCYEWDpXr0v9LrsupsmbZH/jKwPUuUyj0RHovZmzsLuSjsxRwGDBFoCOT3u9WbEDUa7oSzDb1I2goQWMrpO8+KZAxxMmjCwbelqnghMvSvN2ztbqZwSYE6pS8Ftbbik2hO7wXTb+hZJfbw9ROeK/8uygArHAFLstY0kp/cHlc/6P1b7vfFfdUua+4KK+sPOVfwvOUpacinKg4gdv68ONhG+P5oTF9CXstGGV7KvT/tcjMfiw9mYUkrXlYgKO1Rv6GUwV5wf2xVVqVAbZuLMT9JTt7Jx/njVHV3Kr1NBmk4XSsSMq3xuiWBQDQ== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:QB1PR01MB3364.CANPRD01.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFS:(376002)(346002)(39860400002)(396003)(366004)(136003)(2906002)(83380400001)(5660300002)(52536014)(71200400001)(966005)(4326008)(478600001)(55016002)(9686003)(66556008)(91956017)(64756008)(66446008)(66476007)(76116006)(86362001)(66946007)(8936002)(786003)(186003)(33656002)(110136005)(8676002)(316002)(6506007)(7696005); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: fP1PZD767SbAoc/gamgpMwzRnBP9JlrlmS0wYnIn14CI7r/uTu4P7Uazh0iG6MOV8/EqcgZJYckvM1wOLVbIgVMjff8sd/r6YNfFvd3WBNphvhSwm1z7b3Y9Hq1c948w7PYW7nw7vcHqlt+BsCkPo313Dm/9RtjZTCJ5Mhs/XvSr+wAUFZtTpTrkBSOUHf3hVgm8pdmOR/70+gQxL3jTW+qG3OqYjUnlpGrKxK8j/zvs2TjEih6AuLNV6QhSfewGKBKHyXQiWDzfzO+6SPLrs19+DPthR1s18Qs+vGj8LIZ/PEVEmdFtRzTxLPRm0FQlbAsLvrEpjMRNKEMqHu3ey+LSkAt+JPr8IAMa3jw5CLOQ+HQ0rnhfhz5kgU/q3kQlB4maIRIfloNKIT7dKER+yxOI6OjOEcMToKaw5GPbHew/Evnesk9ODY5e271GbbHP6W5K+RgEhi7PkPewsQ/u2dMd84LN+EeemiLMcJLUyrzJeLUbODnqKrwHQmo9iLzxNjzwLJFke4auTyZuNUIcqgMV8uMCsAxrmhs18/mX+fNnvJswKzYDYGmcNfLuvo/IQ2wUwDPlHlIPrVv+kN+Ga23PwSyetmqpIWOQnaHoGJc26rcQ7dbkJs4KQokzXz8+nTBGMn9GuZiS2OVOFt1q2yi5HbtxXPCO+cNQgGyCsD8Qqy2VND2enIE+60cKE5tg+/XelyBZU8z1vaAucsc8lQ== 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: QB1PR01MB3364.CANPRD01.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-Network-Message-Id: 8ce90194-9e32-4d31-0a9c-08d84a0523a7 X-MS-Exchange-CrossTenant-originalarrivaltime: 26 Aug 2020 21:15:20.5587 (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: FXg4BlSPR3J1juBZQtuDOZw+B9ErFb6jGzJdEEvQ997WiWRFjKy9m36uEb2FJFORegqn3/+kRLiQZooST0xI3g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: YQBPR0101MB1460 X-Rspamd-Queue-Id: 4BcJY76c3Pz4g1y X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=uoguelph.ca header.s=selector1 header.b=ba0lU0UM; dmarc=none; spf=pass (mx1.freebsd.org: domain of rmacklem@uoguelph.ca designates 2a01:111:f400:fe5d::600 as permitted sender) smtp.mailfrom=rmacklem@uoguelph.ca X-Spamd-Result: default: False [-5.08 / 15.00]; NEURAL_HAM_MEDIUM(-0.96)[-0.961]; R_DKIM_ALLOW(-0.20)[uoguelph.ca:s=selector1]; FREEFALL_USER(0.00)[rmacklem]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; R_SPF_ALLOW(-0.20)[+ip6:2a01:111:f400::/48]; NEURAL_HAM_LONG(-0.99)[-0.991]; TAGGED_RCPT(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[uoguelph.ca]; DWL_DNSWL_LOW(-1.00)[uoguelph.ca:dkim]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[uoguelph.ca:+]; NEURAL_HAM_SHORT(-0.63)[-0.633]; FREEMAIL_TO(0.00)[gmail.com,FreeBSD.org]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:8075, ipnet:2a01:111:f000::/36, country:US]; ARC_ALLOW(-1.00)[microsoft.com:s=arcselector9901:i=1]; MAILMAN_DEST(0.00)[freebsd-hackers] X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Aug 2020 21:15:25 -0000 Brandon Bergren wrote:=0A= >> The pidfile_* stuff is meant for the daemon side.=0A= >=0A= >As written, agreed, it clearly is. But alas "meant for" and "used=0A= >for" appear to differ. It looks like there's a client-side use in ZFS=0A= >as well (cddl/compat/opensolaris/misc/fsshare.c).=0A= >=0A= >> Why not just regular open(2)?=0A= >=0A= >That's also a solution I'd be fine with submitting. Certainly less=0A= >work. But there are a couple of reasons not to do that, mostly to do=0A= >with code reuse.=0A= >=0A= >First, the pidfile library does some stuff around path handling that=0A= >is useful not to try to reinvent.=0A= >=0A= >Second, while races do exist, use of pidfiles in this way probably=0A= >isn't going away, so having the code that tries to minimize those=0A= >races in one place makes a lot of sense, rather than having=0A= >potentially multiple idiosyncratic approaches/cases on an ad-hoc=0A= >basis. ("Don't let the perfect be the enemy of the good" and all=0A= >that.)=0A= >=0A= >The CDDL thing is actually a good example of this, because it looks=0A= >lifted straight from mount.c, but when mount.c got updated with the=0A= >mountdpid <=3D 0 check, fsshare.c didn't, and that's almost certainly a=0A= >bug because it could lead to inadvertent kill( -1, SIGHUP ) with=0A= >superuser permissions. Whoops! ZFS just randomly HUP'd every process=0A= >on the system.=0A= >=0A= >Having mount HUP mountd (iff it's running) seems odd to me anyway, but=0A= >today's filesystems are so weird and complex and diverse that I'm sure=0A= >it's essential for somebody.=0A= Yes, it is weird and I don't think I was the guilty party.=0A= The reason is that, if the local file system being mounted happens to be in= =0A= /etc/exports, then /etc/exports has to be re-loaded for the update.=0A= =0A= Ideally, all local file systems would be mounted and then one HUP would=0A= be sent to mountd, but that isn't the way it has worked for a long time=0A= and changing it would be a POLA violation, imho.=0A= =0A= Imagine how many times this happens for a server with 20,000 file=0A= systems that happen to be exported (such a server does exist, apparently).= =0A= =0A= I ended up coming up with an incremental exports update to improve this=0A= and Peter (the guy that has the 20,000+ file system servers) has a patch th= at=0A= uses a database instead of the flat exports file. (Hopefully a variant of h= is=0A= patch can make it into ZFS someday. Now that the big switch of ZFS to ZoL= =0A= has happened, maybe someday soon?)=0A= =0A= rick=0A= =0A= Thanks!=0A= _______________________________________________=0A= freebsd-hackers@freebsd.org mailing list=0A= https://lists.freebsd.org/mailman/listinfo/freebsd-hackers=0A= To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"= =0A= =0A=