Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp7751915rwd; Tue, 20 Jun 2023 05:56:15 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6mR2JFem9AEyrtw787HnsjIu64+nNqGE61hQr/63v6haUFNL6dFgM1s8HucIxtH7sk1Lgw X-Received: by 2002:a17:903:32c1:b0:1ab:7fb:aac1 with SMTP id i1-20020a17090332c100b001ab07fbaac1mr15276556plr.24.1687265774889; Tue, 20 Jun 2023 05:56:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687265774; cv=none; d=google.com; s=arc-20160816; b=EeWN1qdarheqdu5tgQghN/+5MvUabUkpH1DP6IZolFPywkrRz2MHrrXty1JsjOxk5/ 6GUBLkCrhbajSNlNV/kD3qZYNqugAJWnhZGSs8Arv88hmVm/zXKmj+2ozPoJ5ZfQKEa+ B8uSAF9xGCwGbANcb+p1tPTVDC1OyEaaZeufa+JWv5moIFigTxUmlG8cH//ViwQMmSVM PrzePssNGL0EvEMIU6/uYJ7/ShswrWEc/HhXB+YrvL9RxZQT1b3HGa4eZOTq3ewlIOB3 zqtYh2I0IpILMmZo9XlLrtH56vYCoHOC08Fs2oTy9wBIeg3oJXl+bi0GP9EosgW/8Z9L ZbUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=djyFSMQCvvi3PtQek0qog/X/Y7hUR7MnMTmzr3nhW4g=; b=ejrpsud19boDcCe+MyCKnl6ZRKMWP6W9pJ8oz3rmrKRq44/0ORkYwfSIRbOl+i4dIC +MeH+Q9M8yzp0smIUrha4SUcwJIWXo4wL1dQU/4XzI8Q7ODe7KiywdQZwWuGgNao7B43 SPaKWXtUUZLK2ps1TK4lgyzMgS5h11Sw0fKmMHLr6stoeyxrMXbSH6VyYh/qIRy6Y0T/ MLBvpowpfep953oeQSdz9ykM1IwcqILZ0IZFxlB0LqN3+D0hGw3U+aXQjFDrSyiHU3Y+ JVChMwnKNa1HN1lvXAKq0F4r90KnpfUgvKC9rWMoIiGW9csGrq9UpkIbMHO0IRLuq3oq kd3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@yandex.ru header.s=mail header.b=nObO3tXw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jb9-20020a170903258900b001a94b91f412si1806295plb.164.2023.06.20.05.56.02; Tue, 20 Jun 2023 05:56:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@yandex.ru header.s=mail header.b=nObO3tXw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232645AbjFTMeb (ORCPT + 99 others); Tue, 20 Jun 2023 08:34:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55618 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231805AbjFTMea (ORCPT ); Tue, 20 Jun 2023 08:34:30 -0400 Received: from forward502c.mail.yandex.net (forward502c.mail.yandex.net [178.154.239.210]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0764410DA; Tue, 20 Jun 2023 05:34:27 -0700 (PDT) Received: from mail-nwsmtp-smtp-production-main-63.sas.yp-c.yandex.net (mail-nwsmtp-smtp-production-main-63.sas.yp-c.yandex.net [IPv6:2a02:6b8:c14:6e01:0:640:627f:0]) by forward502c.mail.yandex.net (Yandex) with ESMTP id 0F98F5E8DC; Tue, 20 Jun 2023 15:34:22 +0300 (MSK) Received: by mail-nwsmtp-smtp-production-main-63.sas.yp-c.yandex.net (smtp/Yandex) with ESMTPSA id 5Ygda0tDguQ0-z3EyeGZo; Tue, 20 Jun 2023 15:34:21 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1687264461; bh=djyFSMQCvvi3PtQek0qog/X/Y7hUR7MnMTmzr3nhW4g=; h=From:In-Reply-To:Cc:Date:References:To:Subject:Message-ID; b=nObO3tXw07UF99ZwPSgfjLyWQ6W5or7uUaW9qg/A9XS4ufoP7v0XmdeIhYXT3Q7jO 9036yWJW/zNO05uL8vNS0vIIV7gJvV5AESjcLKVqELuqzkDbjjAe1YdUNydqLiIcdQ Pn2aHPUXgrgschLMqNT6dzUSgnzMnImKEs2NAOOg= Authentication-Results: mail-nwsmtp-smtp-production-main-63.sas.yp-c.yandex.net; dkim=pass header.i=@yandex.ru Message-ID: Date: Tue, 20 Jun 2023 17:34:00 +0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: [PATCH 2/3] fd/locks: allow get the lock owner by F_OFD_GETLK Content-Language: en-US To: Jeff Layton , linux-kernel@vger.kernel.org Cc: Chuck Lever , Alexander Viro , Christian Brauner , linux-fsdevel@vger.kernel.org References: <20230620095507.2677463-1-stsp2@yandex.ru> <20230620095507.2677463-3-stsp2@yandex.ru> <5728ebda22a723b0eb209ae078e8f132d7b4ac7b.camel@kernel.org> <5f644a24-90b5-a02f-b593-49336e8e0f5a@yandex.ru> <2eb8566726e95a01536b61a3b8d0343379092b94.camel@kernel.org> From: stsp In-Reply-To: <2eb8566726e95a01536b61a3b8d0343379092b94.camel@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 20.06.2023 17:02, Jeff Layton пишет: > Suppose I start a process (call it pid 100), and then spawn a thread > (101). I then have 101 open a file and set an OFD lock on it (such that > the resulting fl_pid field in the file_lock is set to 101). How come? There are multiple places in locks.c with this line: fl->fl_pid = current->tgid; And I've yet to see the line like: fl->fl_pid = current->pid; Its simply not there. No, we put tgid into l_pid! tgid will still be 100, no matter how many threads you spawn or destroy. Or what am I misseng? > That's just one example, of course. The underlying problem is that OFD > locks are not owned by processes in the same way that traditional POSIX > locks are, so reporting a pid there is unreliable, at best. But we report tgid. It doesn't depend on threads. I don't understand. :)