Received: by 2002:ac8:3b51:0:b0:3f3:9eb6:4eb6 with SMTP id r17csp4233382qtf; Wed, 21 Jun 2023 03:50:25 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6hA87M2WKFv1dAjtE/uiX4cKj7OI0elATh4SSEtjeO18LuQIDF5taLeWpWFPU4EiG4CXPR X-Received: by 2002:a17:90a:1db:b0:25e:8cfb:11cd with SMTP id 27-20020a17090a01db00b0025e8cfb11cdmr8632286pjd.46.1687344625566; Wed, 21 Jun 2023 03:50:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687344625; cv=none; d=google.com; s=arc-20160816; b=cTalTuthGK4FUhxh1GRkgmubgZYvVLYoQle5H3P4GnCw69PZYXLIUNerGlwREOsM4y QqU77GcYnU4Ti36uQB+eqFMEKsYgQ4bbHYTyXqOpJyvr05eOOWZoasa8YCPJC+y6WiIJ qxeOPqSyF0VWqtsesEUv2DrBsva3NDYIRSTZ62OYd6bWxKoeME5/Bg+ccUWZFoTsUUNa nCxoZIoAwVGGleD2wYyBQ5/4+oozIrGoZt3mc5Xngh6Xp16/KYrvgMz/n5lzNFfUFsWx Vw6A+9LWnz077qirdz31E+uNL3bV7rXXEHfcEzb+UaQyUhKx7AAIsLmUUIbekp4l6ba0 mdEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id:dkim-signature; bh=/nDUysOIs+S67QS0PXY41K9/6X1N3a9ho9GHTrfj2i0=; b=0lOzS/eCGqsQRvsYSfkZnj8OPTAX08ChD+FshmLWiOk/l0ZJKVG7xBSrSlnvAZIpgB bqdKBIo783cflE0rmvYIPHDxCu0pQiYmZ6QPqpXMcqRnezWI0Z8rAkgzzyeIP9klL9b+ 6IP9z4ArvIKkkbu1Fz5Gv53/hVpSBHA8QgWRinPn+RMezs8QHK8ozQAuuY73AmLHNtZp bZmLubuehC85e3wmNA9ad5U6JTSr3zpHX6NYFZ18IUIdaL783C5K19eV7mV+1vj9BzRi U9u/4gE4rllGPuU6QlrksF3G9WTFlfYBsZ26ogsavk+eVB5+KsRKppsC4Bbecg1bod8P 1Z3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=a6p6PJqC; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x17-20020a17090a8a9100b0025be125bda9si317232pjn.38.2023.06.21.03.50.12; Wed, 21 Jun 2023 03:50:25 -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=@kernel.org header.s=k20201202 header.b=a6p6PJqC; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231454AbjFUKhW (ORCPT + 99 others); Wed, 21 Jun 2023 06:37:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49626 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231349AbjFUKgm (ORCPT ); Wed, 21 Jun 2023 06:36:42 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8DE351BCD; Wed, 21 Jun 2023 03:35:24 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1908D61486; Wed, 21 Jun 2023 10:35:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C8984C433C0; Wed, 21 Jun 2023 10:35:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1687343723; bh=/nDUysOIs+S67QS0PXY41K9/6X1N3a9ho9GHTrfj2i0=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=a6p6PJqCNZCyMhzG8L0y2KV1XMdLUq9rM7BtrK0thbvITt6Gbpu4/tg5tSRO+XIuE gqtY54aFk5vcoAOhF5Rulvr5Hibmec5CT6Y37PLVThyrlAej05jXapqpAeyuPu8rgq 7D8g+WDF3jwxK5DifiLYwtvVdOuFH655lyvrCbCqiRNbiNRlwJfdy83IGz3tir5s2F swu0D+OvGOiGFJxORVSKVK+cGWgor/7YXe62lmWAVvlsmIpC0CV+bG9rZsS0L3zAyg n2FtNGgOJW2QbNvHi7mwiWNNMqMeZNTKMG4mTuVmRk1CTpcPrTv9p1+Uqomphqa7AY MFr2VGKSG1F8g== Message-ID: <26dce201000d32fd3ca1ca5b5f8cd4f5ae0b38b2.camel@kernel.org> Subject: Re: [PATCH 2/3] fd/locks: allow get the lock owner by F_OFD_GETLK From: Jeff Layton To: stsp , linux-kernel@vger.kernel.org Cc: Chuck Lever , Alexander Viro , Christian Brauner , linux-fsdevel@vger.kernel.org, Matthew Wilcox Date: Wed, 21 Jun 2023 06:35:21 -0400 In-Reply-To: <9c0a7cde-da32-bc09-0724-5b1387909d18@yandex.ru> 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> <9c0a7cde-da32-bc09-0724-5b1387909d18@yandex.ru> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.48.3 (3.48.3-1.fc38) MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 On Wed, 2023-06-21 at 11:57 +0500, stsp wrote: > 20.06.2023 18:58, Jeff Layton =D0=BF=D0=B8=D1=88=D0=B5=D1=82: > > No, it won't. The l_pid field is populated from the file_lock->fl_pid. > > That field is set when the lock is set, and never updated. So it's quit= e > > possible for F_GETLK to return the pid of a process that no longer > > exists. > >=20 > > In principle, we could try to address that by changing how we track loc= k > > ownership, but that's a fairly major overhaul, and I'm not clear on any > > use-cases where that matters. >=20 > OK, in this case I'll just put a comments > into the code, summarizing the info I got > from you and Matthew. > Thanks guys for all the info, its very helpful. >=20 > Now I only need to convert the current > "fundamental problem" attitude into a "not > implemented yet" via the code comment. >=20 >=20 > > > So my call is to be brave and just re-consider > > > the conclusion of that article, made 10 years > > > ago! :) > > >=20 > > I think my foot has too many bullet wounds for that sort of bravery. > I am perfectly fine with leaving this thing > unimplemented. But what really bothers > me is the posix proposal, which I think was > done. Please tell me it allows fixing fl_pid > in the future (rather than to mandate -1), > and I am calm. I don't think we can change this at this point. The bottom line (again) is that OFD locks are owned by the file descriptor (much like with flock()), and since file descriptors can be shared across multiple process it's impossible to say that some single process owns it. --=20 Jeff Layton