Received: by 2002:a05:7412:98c1:b0:fa:551:50a7 with SMTP id kc1csp1560584rdb; Mon, 8 Jan 2024 03:20:04 -0800 (PST) X-Google-Smtp-Source: AGHT+IGZy5aof9oSxkwN9tN2jMvlpoOZ8dTdQUh5NNl68ypdFHcyC3H48IouqGp22KwMGWWxt8QU X-Received: by 2002:aa7:938c:0:b0:6d9:ebbd:12f5 with SMTP id t12-20020aa7938c000000b006d9ebbd12f5mr3859219pfe.52.1704712804325; Mon, 08 Jan 2024 03:20:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704712804; cv=none; d=google.com; s=arc-20160816; b=ab9LkUw2kzEuMrjzBpRv4xIhFaco83Nib6xJZxTjKHL5esRAmKMrGnq0JmrsK1sVv1 MwxmonpFj3iqnJYoEC+zMk6F4SbXWAAbig6kwZB1dEiD/Vj+9f5tRunj3xLysmtjecB7 1WPoh1V8qd4FY0adGHGIx+5J0Knil3v1fijH4SjbKP8qt+J77b+QE4/e43B9bbTUUX/v 0n+1dcLGYwwv0qWfGvRTgug3ysT4bjH7/IfYd9gGEnRo8p+qnB/PK9pGm7xBzLWYB9Ks w96cb0NFw6x29oDRJFuZq8kwFPkjQTFvVKCH1XrVU/7FFCmhRxBpFHTMEfsPnRSxsg7R rYMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature:dkim-signature; bh=f8fz1LwBIALyfM11oRY2m1XNTcJkSMTOVPkbnveA3Jw=; fh=5bZJvUVizpGgs2e+HFJpjbr584azj5ES1ipcO2oN3Bc=; b=zpWvjVA19fLVf+bNuLBD7p6hVrHSgUIt6ifXSRVT0EBVZleJhEJaH3TDlUkf30Mhl2 6TfYiAuJbva7X/YECpccFNBflBge3mdBiLELvVgYIUuBh+yl25txf0RgB17hz9TsmN+q A4XOhDg+nViTlhjpfRSsXV0ndk4Bl4T1r/++DZr6UpROyG3RBiaW0tDAOh5n2zYklA7z niuUHXGC7vg0U5QsqzEKCl6/DHk/Ld4nJO48tfivQ+uNCeaeWUOOcsp9Lm3zacJgahXm fwfnjD7jraF74lq4FFY0j7BpH3Fslw/sbNq1qWanFI0YkkPg6L3Okj27mT5fb6yHazqQ ATOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codewreck.org header.s=2 header.b=I8jTdHBm; dkim=pass header.i=@codewreck.org header.s=2 header.b=I8jTdHBm; spf=pass (google.com: domain of linux-kernel+bounces-19404-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-19404-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=codewreck.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id b4-20020aa78ec4000000b006daa81ef27esi5869598pfr.240.2024.01.08.03.20.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jan 2024 03:20:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-19404-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@codewreck.org header.s=2 header.b=I8jTdHBm; dkim=pass header.i=@codewreck.org header.s=2 header.b=I8jTdHBm; spf=pass (google.com: domain of linux-kernel+bounces-19404-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-19404-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=codewreck.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id B6AE5283223 for ; Mon, 8 Jan 2024 11:20:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0089114AA7; Mon, 8 Jan 2024 11:19:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=codewreck.org header.i=@codewreck.org header.b="I8jTdHBm"; dkim=pass (2048-bit key) header.d=codewreck.org header.i=@codewreck.org header.b="I8jTdHBm" X-Original-To: linux-kernel@vger.kernel.org Received: from nautica.notk.org (nautica.notk.org [91.121.71.147]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 86C4514291 for ; Mon, 8 Jan 2024 11:19:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=codewreck.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=codewreck.org Received: by nautica.notk.org (Postfix, from userid 108) id BFA30C009; Mon, 8 Jan 2024 12:19:54 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=codewreck.org; s=2; t=1704712794; bh=f8fz1LwBIALyfM11oRY2m1XNTcJkSMTOVPkbnveA3Jw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=I8jTdHBmiAJZYNs4r5kggZ38nHm3BhvicdQrHU/xYfo50jFhI+JMI42vPVvkuEbty 16kd6Q9dt58aIKF4BkMQlVJ2O0XD5BwPCIr/rNtYmxHVhn4kHEPSJuwIyyZwZBxq9C 4mCsgI6+tNmrJq0mRtG36Wbq1h1582a+uEL3KBLjCamhNVd99XjEPbxjOx6XRuKdfV pZgiK04S0N5idBKKzWPTjvZDZLKmYFE+AvWY44Lne/59rcIFvfiRytRivMufZ0axws qKtTAfxXdeYgPE8WGoNIGbwNIJLwhson8ZLa/ThxD1S0nNJ/Fb+A6zmndv30bSwCLn WxRhYjuteC1Bw== X-Spam-Level: Received: from gaia (localhost [127.0.0.1]) by nautica.notk.org (Postfix) with ESMTPS id 1ABCEC009; Mon, 8 Jan 2024 12:19:51 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=codewreck.org; s=2; t=1704712794; bh=f8fz1LwBIALyfM11oRY2m1XNTcJkSMTOVPkbnveA3Jw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=I8jTdHBmiAJZYNs4r5kggZ38nHm3BhvicdQrHU/xYfo50jFhI+JMI42vPVvkuEbty 16kd6Q9dt58aIKF4BkMQlVJ2O0XD5BwPCIr/rNtYmxHVhn4kHEPSJuwIyyZwZBxq9C 4mCsgI6+tNmrJq0mRtG36Wbq1h1582a+uEL3KBLjCamhNVd99XjEPbxjOx6XRuKdfV pZgiK04S0N5idBKKzWPTjvZDZLKmYFE+AvWY44Lne/59rcIFvfiRytRivMufZ0axws qKtTAfxXdeYgPE8WGoNIGbwNIJLwhson8ZLa/ThxD1S0nNJ/Fb+A6zmndv30bSwCLn WxRhYjuteC1Bw== Received: from localhost (gaia [local]) by gaia (OpenSMTPD) with ESMTPA id d357a046; Mon, 8 Jan 2024 11:19:49 +0000 (UTC) Date: Mon, 8 Jan 2024 20:19:34 +0900 From: asmadeus@codewreck.org To: Eric Van Hensbergen Cc: linux-kernel@vger.kernel.org, v9fs@lists.linux.dev, linux_oss@crudebyte.com, rminnich@gmail.com, lucho@ionkov.net Subject: Re: [PATCH] fs/9p: fix inode nlink accounting Message-ID: References: <20240107-fix-nlink-handling-v1-1-8b1f65ebc9b2@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20240107-fix-nlink-handling-v1-1-8b1f65ebc9b2@kernel.org> Eric Van Hensbergen wrote on Sun, Jan 07, 2024 at 07:07:52PM +0000: > I was running some regressions and noticed a (race-y) kernel warning that > happens when nlink becomes less than zero. Looking through the code > it looks like we aren't good about protecting the inode lock when > manipulating nlink and some code that was added several years ago to > protect against bugs in underlying file systems nlink handling didn't > look quite right either. I took a look at what NFS was doing and tried to > follow similar approaches in the 9p code. I was about to say the set/inc/etc_nlink helpers could probably just be using atomic (there's an atomic_dec_if_postive that we could have used for the v9fs_dec_count warning), but this isn't our code so not much to do about that -- I agree it needs a lock. I didn't take the time to check if you missed any, but it won't be worse than what we have right now: Acked-by: Dominique Martinet -- Dominique Martinet | Asmadeus