From owner-freebsd-current@freebsd.org Mon Oct 16 22:38:20 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 3679CE4723B for ; Mon, 16 Oct 2017 22:38:20 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-qt0-x236.google.com (mail-qt0-x236.google.com [IPv6:2607:f8b0:400d:c0d::236]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E341570591 for ; Mon, 16 Oct 2017 22:38:19 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-qt0-x236.google.com with SMTP id 31so9599654qtz.9 for ; Mon, 16 Oct 2017 15:38:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=zGL26q/V3Rn7ygDqcyQkCz9wMBVdouaIpcOuIkal4x4=; b=UlOpi16+p7D32vlV7p8owmuf7fSAS1rFqrXOYah88XOAphOdWaD9eNXe88CATf05hm SGhS1SJOyRZeths3UzR/ia9B67cppaqLzyrx4+a6AvK0FcDpPu9poII2sQCvH2OSzNvx CdYQwOSVqTQZIuogetj6z6tl0TLAWShwxV/xngVYTfHvlWaZB/dcg9nrNqueU1Pcn8zP fQCENujFcFnW3banflw/IxzjXZ1VqZrULFvKoFjh5vBtheEFpYTlj6Px1ex0EhitehYN 7KF4GLjmx6ToCJBYJwsatcFDbI8fo917JMKIyXkVTPDPyS1X4w/k6xqL6quVA7DhCLYk yp5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=zGL26q/V3Rn7ygDqcyQkCz9wMBVdouaIpcOuIkal4x4=; b=oZYAuIJGBi6jK742vQruR/AMbzHv7W6FjRnD7G36dJUeTb6j7/KXqpycxZcEPWH5K5 vDdxpSrMT6HfwckPh7l4QU59BiPFCXfj6tPOBUuNimE/YsTp0xv01bzdIQPpLRPVLeDh VxDj98ruInGVuz6975wljr4Z8p4zWMX/Dubuy2KgbCW0LZli+j7qSBWcCNYmB0OSk+IS eZApwCvQuvNy3WzkGRHXVbjDolsob+T9Q/vVgvRFo52TeumpZMo8w588kkfEy/fiU9LE B5DjHksub0Fv9cW4/FNNeDxE9yJxjeUSBkO4BMRTiEp+/RgSyQSaVHslOBOPEFgFfXis Lqag== X-Gm-Message-State: AMCzsaW33+IBrHUFepMY6N2PGd1/Me6PjvmAd/5Vt1VAvF3DT9o4kitB j+dDxmslSNuzKTSj7dSehflyUOXO8kykIy+wfmo= X-Google-Smtp-Source: AOwi7QBIWcJy/7A/pcropJAvFMtn8zCxlHBnvJ5dUGFCCaZjiBNkYAHXnFPtxIw9hjkeUb2//Dv7SWm8CYj1BgB+lo4= X-Received: by 10.200.27.221 with SMTP id m29mr17108908qtk.152.1508193495894; Mon, 16 Oct 2017 15:38:15 -0700 (PDT) MIME-Version: 1.0 Received: by 10.237.51.167 with HTTP; Mon, 16 Oct 2017 15:38:15 -0700 (PDT) In-Reply-To: References: From: Mateusz Guzik Date: Tue, 17 Oct 2017 00:38:15 +0200 Message-ID: Subject: Re: pfind_locked(pid) fails when in a jail? To: Rick Macklem Cc: "freebsd-current@freebsd.org" , "fabian.freyer@physik.tu-berlin.de" Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.23 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: Mon, 16 Oct 2017 22:38:20 -0000 On Tue, Oct 17, 2017 at 12:24 AM, Rick Macklem wrote: > Hi, > > A problem w.r.t. the NFSv4 client's renew thread (nfscl) running up a lot > of CPU > when the NFSv4 mount is in a jail has been reported to the freebsd-stable@ > mailing list. > > I know nothing about jails, but when looking at the code, the most obvious > cause of this would be "pfind_locked(pid)" failing to find a process. > - Will a jail affect how pfind_locked() behaves? > - If the answer is "yes", then I need to know how to either... > 1 - Make pfind_locked() work the same as when no jail exists. > OR > 2 - A way for the Renew thread can determine that a jail will affect > pfind_locked() > behaviour, so it can avoid this problem. > #1 is preferred, since #2 may not be 100% correct, although #2 would allow > the > code to behave well for most cases. (The exception is a case where a file > remains > open for a long period of time, with different processes doing byte range > locks on > the file.) > pfind* does not do any filtering. 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 saving the pid. There is no usable process exit notification right now, but it can be added if necessary. -- Mateusz Guzik