Re: [PATCH 5.15] kernfs: switch global kernfs_rwsem lock to per-fs lock

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[ 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@xxxxxxxxxxxxxxxxxxx>
Commit author: Minchan Kim <minchan@xxxxxxxxxx>


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@xxxxxxxxxx>
         Link: https://lore.kernel.org/r/20211118230008.2679780-1-minchan@xxxxxxxxxx
         Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
    +    Signed-off-by: Jeremi Piotrowski <jpiotrowski@xxxxxxxxxxxxxxxxxxx>
     
      ## 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   |




[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux