Received: by 2002:ab2:69cc:0:b0:1fd:c486:4f03 with SMTP id n12csp132734lqp; Mon, 10 Jun 2024 22:19:36 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXsi+0t4wRZD4xInuxF1cmfR7s1EQVMWGx4E4DZ6ivAxzdmvRL8UV7DqaTBCBcCg14W5ItYEabR0I8u/YWELSOASPndqrzj6dvitkjmog== X-Google-Smtp-Source: AGHT+IGCkeO6qb/0lMgQUu5rP26dglAyhA0rL+wnLlEfjDlPnUnKh0VHwun3vtex2QCdYbcRdlEr X-Received: by 2002:a05:6808:1388:b0:3d2:2230:ecf7 with SMTP id 5614622812f47-3d22230ef5dmr8553877b6e.26.1718083176297; Mon, 10 Jun 2024 22:19:36 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718083176; cv=pass; d=google.com; s=arc-20160816; b=zW472NBaw9tXxSHepJHu8iEwrxJVhl9DYcQb+VPLqYzMMUYy4AnqACMpAj4AQPKhED Eqqnmz7x7myNNnl7CLt0J1NNQCHIbFdwacfCLqbwn4zlw+UQ7Tp1nuOIvVIsu7Bwdx4g Hn8UvoewFa1MkIJB86UOYJvnjFYFwZ9Yu+aqYLcJMJSK6ryDp33Z4r9yaxaFA/nLKXI3 EZIRL4x9xG3HV/nFPRWMpVLZ/qTVzN2V9/EXNCb0kN632NVhA/Q9/6mHtLVPYyOMie9d SviFd9x3g9Sz+k2Qan0G8IUJIFljyasP/+R06FC4ahc+yFOgTGAnp9J86pG7OECzVZqw mH0w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=piqzYbgJkU+e1s69JwjuEdZoLPDUayYPpapi3Ayym5o=; fh=ihvdFuNtTZzVLc6kiKJIKWHdarVLdFqBWNuIFwRQ2Xw=; b=PA3SlWrhlUcvetHaY47nYyyOTysVmAKGv8jOkXA/y3ErnLg0x5PY7kIqBwFiQp9eMg czksPGl5/tmgmjLftXyX0DxV1Hi9Fn7dnaJ8ocpfnatW59o6LvVoDTzq5nCrTwW5aNnq +9/1nTdGIijGeJUbNP1oFRadeZuohxDnSw5aZBmtsikX6qsQ2boD0yJ40Icq0qICzUPO P6+smD+BKD5ilqL0SDSoGLpsvJ7urFFnYZsXLAQwMQDslOpMJKzfjIC81ps30/FYIl05 5J+5cW6u93I0CF+F7mDWw1jcIiiTkqsHNdbQ1Quj+jYX3/YUYqqvBtSJuXCcGQockFzq IZ6w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=aPLgoAVz; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-209265-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-209265-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id d2e1a72fcca58-703fd575fa3si8797337b3a.359.2024.06.10.22.19.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Jun 2024 22:19:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-209265-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=aPLgoAVz; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-209265-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-209265-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id DD867B21B6C for ; Tue, 11 Jun 2024 05:18:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 529EC17085F; Tue, 11 Jun 2024 05:17:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="aPLgoAVz" Received: from mail-ed1-f52.google.com (mail-ed1-f52.google.com [209.85.208.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D0E63469D; Tue, 11 Jun 2024 05:17:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.52 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718083077; cv=none; b=rDPkY8OkdY4CE6NP/N/J8C6FwK4pMbY/OR9lXklQrzZslZEGaAIZbhIMr6FmctFOYGYeh1TtZ3Q6GIvtFEtEubvUZWg4OVmPK8Gl2i9aMMMLOE7LF+t3ddTf7EPLwovIBhdXCvaQUC5xPnVQ9TqrkWC2Y35PM1oqbHaRUefJV3E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718083077; c=relaxed/simple; bh=AfWFA0YQaEAWvwqUx+29BJvkXlvDyjanEfD3MpXz1tY=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=Pa3xroA0y8ZGRVT4etzSDB1I95vPXQPaSWXjaK8dnqJF/TqUxy2Koc7wIuZVHXVyLZ/UdgAXwNyceqjMwZmb+kQZu1JNC6wcQLIKZYoZjyKI+lOAeFAJ/BLLO1UnJxPoIIRghYCAkzEWT19elPlJ5DkaNBIQ5H7LiFQ1Ryn4Nmo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=aPLgoAVz; arc=none smtp.client-ip=209.85.208.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ed1-f52.google.com with SMTP id 4fb4d7f45d1cf-57a1fe63947so775206a12.1; Mon, 10 Jun 2024 22:17:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718083074; x=1718687874; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=piqzYbgJkU+e1s69JwjuEdZoLPDUayYPpapi3Ayym5o=; b=aPLgoAVzWQ2XWEUT9RY7KcVkO8ibXonuMNUEgtmzDVXoo/Sy+45+0qosCCV5pWKeSb vGSfXnaqdsZSte87fDyZPCItpOylY6v6jZkfyS716/duvuI06CuLKrGma0nYJqbq02zP EtYLl1sILQJszneDPBav1g/qiCHelvzkQrByBOG7cXpKawUCHbYFP1qOcUeimCEyIqCA 12tXauML4ys26/2JQUTjkP53N5bAIZ7kP9yGxLbmCm3NOZ8CvF9hnvhrpFvvJvvu4BdR f8hx0OCDoH7iJ99z7XYYKHlaQAudImJui14tgVHzK01yuss6G/VWGUXGpFvJbVqBIkvK ANtg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718083074; x=1718687874; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=piqzYbgJkU+e1s69JwjuEdZoLPDUayYPpapi3Ayym5o=; b=OKheA5F1zQQXApuWf+HFk5/gTPT1/8F0I3qshdbV2xLJ9EK0PfeuYzkb3e+wyaeU4G Clx3+w/RTVFBqbOrMAqXFx8XzktBEEpT7S9t98S636eUZWut5Ls/KdD7zoj+1QwjIic5 ivEtKaH2TllwOH3xewF6v+ZJYJFpuVVZibIEI0Y0RULTfwt2UMu1g6XynihGKt4sdxf8 WmbWA+y3AXjuw0KGOpQm4D34szrXsRz22W6ex00WRV263SNp4bTAA3n7gvpVWN1xNeqV 3LMrgXQMo+OpdKTG1Xk18zmd5Y4mGNlsMG74QUOQw2nVor2+vDYnj/SY+xyjdW2YGSFJ 8t9A== X-Forwarded-Encrypted: i=1; AJvYcCXFwpk/rGXOVymkD6GhBXMCoXvrg7eLoT6jOt0jQp6eVBXbhm01LvgSAE08Gd8LJJekV/uKikVauUJfWUbLGo09cK+3SKe82cf4eZaJOWSeKT0PxW7QjD19NMZIMUijUqP7ws7BsGWqOhCif/CpKnEC7VieBg1RG1jU2E7EghW/ff1F24Y+iP3S X-Gm-Message-State: AOJu0Yz5pkD05ItHAicBZm9oBqJ4UN6BLDexZ/XwTJ+VNz6VXimk6osE 4wpHIKYrAFHkQaK+s3EZiyGxyMMtv/0gdkAIqWXszf10B7AUZrwCFXRPo2H56KncsbRIljGxvJM oMrrtBb19iDVArE2PuuFDI831f9dAPol5 X-Received: by 2002:a50:d657:0:b0:57c:6bd6:d8e5 with SMTP id 4fb4d7f45d1cf-57c6bd6de01mr5139006a12.8.1718083073841; Mon, 10 Jun 2024 22:17:53 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240610195828.474370-1-mjguzik@gmail.com> <20240610195828.474370-2-mjguzik@gmail.com> In-Reply-To: From: Mateusz Guzik Date: Tue, 11 Jun 2024 07:17:41 +0200 Message-ID: Subject: Re: [PATCH v2 1/2] vfs: add rcu-based find_inode variants for iget ops To: Christoph Hellwig Cc: brauner@kernel.org, viro@zeniv.linux.org.uk, jack@suse.cz, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-btrfs@vger.kernel.org, josef@toxicpanda.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Jun 11, 2024 at 6:59=E2=80=AFAM Christoph Hellwig wrote: > > > +EXPORT_SYMBOL(iget5_locked_rcu); > > EXPORT_SYMBOL_GPL for rcu APIs. > noted for v3, thanks > > +static void __wait_on_freeing_inode(struct inode *inode, bool locked) > > { > > wait_queue_head_t *wq; > > DEFINE_WAIT_BIT(wait, &inode->i_state, __I_NEW); > > wq =3D bit_waitqueue(&inode->i_state, __I_NEW); > > prepare_to_wait(wq, &wait.wq_entry, TASK_UNINTERRUPTIBLE); > > spin_unlock(&inode->i_lock); > > - spin_unlock(&inode_hash_lock); > > + rcu_read_unlock(); > > + if (locked) > > + spin_unlock(&inode_hash_lock); > > The conditional locking here is goign to make sparse rather unhappy. > Please try to find a way to at least annotate it, or maybe find > another way around like, like leaving the schedule in finish_wait > in the callers. > So I tried out sparse on my patch vs fs-next and found it emits the same warnings. fs/inode.c:846:17: warning: context imbalance in 'inode_lru_isolate' - unexpected unlock fs/inode.c:901:9: warning: context imbalance in 'find_inode' - different lock contexts for basic block fs/inode.c:932:9: warning: context imbalance in 'find_inode_fast' - different lock contexts for basic block fs/inode.c:1621:5: warning: context imbalance in 'insert_inode_locked' - wrong count at exit fs/inode.c:1739:20: warning: context imbalance in 'iput_final' - unexpected unlock fs/inode.c:1753:6: warning: context imbalance in 'iput' - wrong count at ex= it fs/inode.c:2238:13: warning: context imbalance in '__wait_on_freeing_inode' - unexpected unlock The patch does not make things *worse*, so I don't think messing with the code is warranted here. > > +extern struct inode *ilookup5_nowait_rcu(struct super_block *sb, > > + unsigned long hashval, int (*test)(struct inode *, void *= ), > > + void *data); > > No need for the extern here (or down below). > I agree, but this is me just copying and modifying an existing line. include/linux/fs.h is chock full of extern-prefixed func declarations, on top of that some name the arguments while the rest does not. Someone(tm) should definitely clean it up, but I'm not interested in bikeshedding about it. --=20 Mateusz Guzik