From owner-freebsd-current@freebsd.org Tue Oct 17 00:08:16 2017 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D88CEE492CE for ; Tue, 17 Oct 2017 00:08:16 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01on0051.outbound.protection.outlook.com [104.47.34.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (Client CN "mail.protection.outlook.com", Issuer "Microsoft IT SSL SHA2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 75D9B730DB; Tue, 17 Oct 2017 00:08:16 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) Received: from YTOPR0101MB2172.CANPRD01.PROD.OUTLOOK.COM (52.132.46.161) by YTOPR0101MB1308.CANPRD01.PROD.OUTLOOK.COM (52.132.45.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.77.7; Tue, 17 Oct 2017 00:08:15 +0000 Received: from YTOPR0101MB2172.CANPRD01.PROD.OUTLOOK.COM ([fe80::50ab:b8bf:bbb9:81f4]) by YTOPR0101MB2172.CANPRD01.PROD.OUTLOOK.COM ([fe80::50ab:b8bf:bbb9:81f4%13]) with mapi id 15.20.0077.022; Tue, 17 Oct 2017 00:08:15 +0000 From: Rick Macklem To: Mateusz Guzik , Ian Lepore CC: "freebsd-current@freebsd.org" , "fabian.freyer@physik.tu-berlin.de" Subject: Re: pfind_locked(pid) fails when in a jail? Thread-Topic: pfind_locked(pid) fails when in a jail? Thread-Index: AQHTRsy4PlPkoH+r1k6i+VZl2ipOV6LnEU+AgAALmQCAAAVwgIAABEed Date: Tue, 17 Oct 2017 00:08:15 +0000 Message-ID: References: <1508195986.74236.6.camel@freebsd.org>, <20171016233912.7n6rosak5a5tzcbz@mguzik> In-Reply-To: <20171016233912.7n6rosak5a5tzcbz@mguzik> 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; YTOPR0101MB1308; 6:O00Du9ou5r+guMPMcmVEPdzXL6h/vjYVHi6uhoQrhUekz3GqNl01d2WsM1oJCQouncyhoN1NBe4XnD0kDoti5ZU0mq0L9F6cPLy4LbczEoOFqevGmTQNBICqmFjTOH4MvTg0y1TFeYCxEWLca460wIfAEIszux+agPn4g8vSyfIxu3EH1DKPs7g6LKa0KKuV/U68xIlGpmZtgyCYnrkkeEAgyheAb6k4wC65ZF07r/AbLsCs7QDWZF0H/0ld3IQJfbnzchfwKCNACNZ+1Pa3X0KTE3VAl6cddEAhMNxnMevB/U9xhdpxMHn7OKz13NeFVe30bNvp+jrBh8aBaQEyQQ==; 5:TArJMld1hSaBPpI+RVFaVQKC9TSvGERBXadXjtcm204KiHMacVtoNkzH2+jcH58xGk6ox9Y8GoL6/6R66MBO3UB0f4dLidhiLc16R5hNnTNYzbp7eM7vGgUsfCfWEVqT1/FYTGlR/bcTbnvBmpWq+azSvKrR+ZtcFWhG9SIJBOA=; 24:b34n+p5a8e4JlM88TIvd59ek0R6IMiS90k9g69T0dsn/ww5amgZdDRPbWS4w/GnVWhBmjZjLeL1yHN3HIy/jL8rfrKCMR1BQQGTRVm42moo=; 7:13gPX1Kpqh0TREEDgi8wPlFvsF58v6tDjU2OFAyMoHCoWMhgDo48f0IUJYIqvv0rVZbicw1NAmaL4l1xEz0owiv3vetlBvNy/c259UKOaKh44LtYwcuyvBegrN+agD82WMBXRrp/65KMgQ9wIESUiPCa8qCfQw4GKXBnmzdIiP8U9Fc8eDn7ZStmOTfbzENUuxKU4Okd2tZiohKlTVaYefW6OVt99fyqgsT1xsy09ks= x-ms-exchange-antispam-srfa-diagnostics: SSOS; x-ms-office365-filtering-correlation-id: e3c577b0-abf9-4477-06e3-08d514f329b8 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030254152)(2017052603199)(201703131423075)(201703031133081)(201702281549075); SRVR:YTOPR0101MB1308; x-ms-traffictypediagnostic: YTOPR0101MB1308: x-exchange-antispam-report-test: UriScan:; x-microsoft-antispam-prvs: x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(5005006)(8121501046)(100000703101)(100105400095)(3002001)(10201501046)(93006095)(93001095)(6041248)(20161123564025)(20161123558100)(20161123555025)(20161123560025)(201703131423075)(201702281529075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:YTOPR0101MB1308; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:YTOPR0101MB1308; x-forefront-prvs: 04631F8F77 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(6009001)(376002)(346002)(39860400002)(189002)(199003)(51914003)(8676002)(102836003)(189998001)(2950100002)(2900100001)(6506006)(25786009)(74482002)(68736007)(50986999)(39060400002)(229853002)(54356999)(76176999)(101416001)(81156014)(81166006)(97736004)(6436002)(7696004)(5660300001)(8936002)(14454004)(4326008)(478600001)(305945005)(55016002)(105586002)(74316002)(5250100002)(6246003)(9686003)(86362001)(93886005)(53936002)(54906003)(316002)(33656002)(3280700002)(106356001)(786003)(2906002)(110136005)(3660700001); DIR:OUT; SFP:1101; SCL:1; SRVR:YTOPR0101MB1308; H:YTOPR0101MB2172.CANPRD01.PROD.OUTLOOK.COM; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; received-spf: None (protection.outlook.com: uoguelph.ca does not designate permitted sender hosts) 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-originalarrivaltime: 17 Oct 2017 00:08:15.2015 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: be62a12b-2cad-49a1-a5fa-85f4f3156a7d X-MS-Exchange-Transport-CrossTenantHeadersStamped: YTOPR0101MB1308 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Oct 2017 00:08:17 -0000 [stuff snipped] > > > > > pfind* does not do any filtering. > > Hmm, well I have no idea why the jailed mounts get looping in here then. > > The real question though is why are you calling it in the first place. = The > > calls > > I grepped in nfscl_procdoesntexist are highly suspicious - there is no > > guarantee > > the process you found here is the same you had at the time you were sav= ing > > the pid. > > Long long ago (about 2002) this code was written for OpenBSD2.6. I added a call from the kernel exit() code to do this. When I ported it to FreeBSD around 2005, I didn't find any way for a process exit notification to be do= ne, so I created the first version of this code. (This way of doing it was firs= t coded for Mac OS X 10.3, if I recall correctly.) Since it does check that the time of process creation is the same, it doesn= 't seem likely that it would find a different process (ie. two processes with = the same pid that were created at the same time within the clock resolution of that creation time seems highly unlikely in practice?). > > There is no usable process exit notification right now, but it can be a= dded > > if necessary. > > If there was a way for the NFS client to register to get a notification tha= t a given process is terminating (exit'ng), that could certainly be used instea= d of this code. I wouldn't want a call for every exit(), but only the ones that have NFSv4 = opens. >> >> Does that mean there is something wrong with the existing eventhandler >> notifications related to proc fork/exec/exit? >> > >I already noted in the other mail that the current mechanism has >avoidable global locking, lists traversals etc. But even with these >issues fixed it calls everything for everyone. > >What's needed is a mechanism to register per-process callbacks. Details >can be flamed over (e.g. should it require allocating a buffer per >process or perhaps just one and then point to it from a resizable >per-proc table when registered), but calling something which has nothing >to do in almost all cases and from in a super inefficient way at that is >definitely something we need to start cleaning up. Yes, I would agree, although it doesn't explain what this CPU hog case is caused by. Thanks for the comments and if you create/commit the above, let me know and I'll change the NFS client code to use it (if your patch doesn't do tha= t). rick