public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: stable@vger.kernel.org
Cc: Jeremi Piotrowski <jpiotrowski@linux.microsoft.com>,
	Sasha Levin <sashal@kernel.org>
Subject: Re: [PATCH 5.15] kernfs: switch global kernfs_rwsem lock to per-fs lock
Date: Fri, 29 Nov 2024 15:03:11 -0500	[thread overview]
Message-ID: <20241129143043-6aea62392ec8e78f@stable.kernel.org> (raw)
In-Reply-To: <20241129113236.209845-1-jpiotrowski@linux.microsoft.com>

[ Sasha's backport helper bot ]

Hi,

The upstream commit SHA1 provided is correct: 393c3714081a53795bbff0e985d24146def6f57f

WARNING: Author mismatch between patch and upstream commit:
Backport author: Jeremi Piotrowski <jpiotrowski@linux.microsoft.com>
Commit author: Minchan Kim <minchan@kernel.org>


Status in newer kernel trees:
6.12.y | Present (exact SHA1)
6.11.y | Present (exact SHA1)
6.6.y | Present (exact SHA1)
6.1.y | Present (exact SHA1)
5.15.y | Not found

Note: The patch differs from the upstream commit:
---
1:  393c3714081a5 ! 1:  b3f5272b13165 kernfs: switch global kernfs_rwsem lock to per-fs lock
    @@ Metadata
      ## Commit message ##
         kernfs: switch global kernfs_rwsem lock to per-fs lock
     
    +    [ Upstream commit 393c3714081a53795bbff0e985d24146def6f57f ]
    +
         The kernfs implementation has big lock granularity(kernfs_rwsem) so
         every kernfs-based(e.g., sysfs, cgroup) fs are able to compete the
         lock. It makes trouble for some cases to wait the global lock
    @@ Commit message
         Signed-off-by: Minchan Kim <minchan@kernel.org>
         Link: https://lore.kernel.org/r/20211118230008.2679780-1-minchan@kernel.org
         Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    +    Signed-off-by: Jeremi Piotrowski <jpiotrowski@linux.microsoft.com>
     
      ## fs/kernfs/dir.c ##
     @@
    @@ fs/kernfs/dir.c
      
     -DECLARE_RWSEM(kernfs_rwsem);
      static DEFINE_SPINLOCK(kernfs_rename_lock);	/* kn->parent and ->name */
    - static char kernfs_pr_cont_buf[PATH_MAX];	/* protected by rename_lock */
    - static DEFINE_SPINLOCK(kernfs_idr_lock);	/* root->ino_idr */
    + /*
    +  * Don't use rename_lock to piggy back on pr_cont_buf. We don't want to
     @@ fs/kernfs/dir.c: static DEFINE_SPINLOCK(kernfs_idr_lock);	/* root->ino_idr */
      
      static bool kernfs_active(struct kernfs_node *kn)
    @@ fs/kernfs/dir.c: static struct kernfs_node *kernfs_walk_ns(struct kernfs_node *p
     -	lockdep_assert_held_read(&kernfs_rwsem);
     +	lockdep_assert_held_read(&kernfs_root(parent)->kernfs_rwsem);
      
    - 	/* grab kernfs_rename_lock to piggy back on kernfs_pr_cont_buf */
    - 	spin_lock_irq(&kernfs_rename_lock);
    + 	spin_lock_irq(&kernfs_pr_cont_lock);
    + 
     @@ fs/kernfs/dir.c: struct kernfs_node *kernfs_find_and_get_ns(struct kernfs_node *parent,
      					   const char *name, const void *ns)
      {
    @@ fs/kernfs/dir.c: int kernfs_remove_by_name_ns(struct kernfs_node *parent, const
     +	down_write(&root->kernfs_rwsem);
      
      	kn = kernfs_find_ns(parent, name, ns);
    - 	if (kn)
    - 		__kernfs_remove(kn);
    + 	if (kn) {
    +@@ fs/kernfs/dir.c: int kernfs_remove_by_name_ns(struct kernfs_node *parent, const char *name,
    + 		kernfs_put(kn);
    + 	}
      
     -	up_write(&kernfs_rwsem);
     +	up_write(&root->kernfs_rwsem);
---

Results of testing on various branches:

| Branch                    | Patch Apply | Build Test |
|---------------------------|-------------|------------|
| stable/linux-5.15.y       |  Success    |  Success   |

      parent reply	other threads:[~2024-11-29 20:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-29 11:32 [PATCH 5.15] kernfs: switch global kernfs_rwsem lock to per-fs lock Jeremi Piotrowski
2024-11-29 12:12 ` Greg Kroah-Hartman
2024-11-29 21:20   ` Jeremi Piotrowski
2024-11-30 15:47     ` Greg Kroah-Hartman
2024-11-29 20:03 ` Sasha Levin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241129143043-6aea62392ec8e78f@stable.kernel.org \
    --to=sashal@kernel.org \
    --cc=jpiotrowski@linux.microsoft.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox