linux-next: manual merge of the vfs tree with Linus' tree

Stephen Rothwell posted 1 patch 1 year, 11 months ago
There is a newer version of this series
linux-next: manual merge of the vfs tree with Linus' tree
Posted by Stephen Rothwell 1 year, 11 months ago
Hi all,

Today's linux-next merge of the vfs tree got a conflict in:

  fs/tracefs/inode.c

between commits:

  7e8358edf503 ("eventfs: Fix file and directory uid and gid ownership")
  ad579864637a ("tracefs: Check for dentry->d_inode exists in set_gid()")

from Linus' tree and commit:

  da549bdd15c2 ("dentry: switch the lists of children to hlist")

from the vfs tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc fs/tracefs/inode.c
index bc86ffdb103b,61ca5fcf10f9..000000000000
--- a/fs/tracefs/inode.c
+++ b/fs/tracefs/inode.c
@@@ -207,28 -206,14 +206,25 @@@ static void set_gid(struct dentry *pare
  
  	change_gid(this_parent, gid);
  repeat:
- 	next = this_parent->d_subdirs.next;
+ 	dentry = d_first_child(this_parent);
  resume:
- 	while (next != &this_parent->d_subdirs) {
+ 	hlist_for_each_entry_from(dentry, d_sib) {
 +		struct tracefs_inode *ti;
- 		struct list_head *tmp = next;
- 		struct dentry *dentry = list_entry(tmp, struct dentry, d_child);
- 		next = tmp->next;
 +
 +		/* Note, getdents() can add a cursor dentry with no inode */
 +		if (!dentry->d_inode)
 +			continue;
 +
  		spin_lock_nested(&dentry->d_lock, DENTRY_D_LOCK_NESTED);
  
  		change_gid(dentry, gid);
  
 +		/* If this is the events directory, update that too */
 +		ti = get_tracefs(dentry->d_inode);
 +		if (ti && (ti->flags & TRACEFS_EVENT_INODE))
 +			eventfs_update_gid(dentry, gid);
 +
- 		if (!list_empty(&dentry->d_subdirs)) {
+ 		if (!hlist_empty(&dentry->d_children)) {
  			spin_unlock(&this_parent->d_lock);
  			spin_release(&dentry->d_lock.dep_map, _RET_IP_);
  			this_parent = dentry;
Re: linux-next: manual merge of the vfs tree with Linus' tree
Posted by Steven Rostedt 1 year, 11 months ago
On Fri, 5 Jan 2024 11:10:16 +1100
Stephen Rothwell <sfr@canb.auug.org.au> wrote:

> Hi all,
> 
> Today's linux-next merge of the vfs tree got a conflict in:
> 
>   fs/tracefs/inode.c
> 
> between commits:
> 
>   7e8358edf503 ("eventfs: Fix file and directory uid and gid ownership")
>   ad579864637a ("tracefs: Check for dentry->d_inode exists in set_gid()")
> 
> from Linus' tree and commit:
> 
>   da549bdd15c2 ("dentry: switch the lists of children to hlist")
> 
> from the vfs tree.
> 
> I fixed it up (see below) and can carry the fix as necessary. This
> is now fixed as far as linux-next is concerned, but any non trivial
> conflicts should be mentioned to your upstream maintainer when your tree
> is submitted for merging.  You may also want to consider cooperating
> with the maintainer of the conflicting tree to minimise any particularly
> complex conflicts.
> 

> diff --cc fs/tracefs/inode.c
> index bc86ffdb103b,61ca5fcf10f9..000000000000
> --- a/fs/tracefs/inode.c
> +++ b/fs/tracefs/inode.c
> @@@ -207,28 -206,14 +206,25 @@@ static void set_gid(struct dentry *pare

Oh, and this is the code that I'm removing and will be in linux-next soon.

-- Steve


>   
>   	change_gid(this_parent, gid);
>   repeat:
> - 	next = this_parent->d_subdirs.next;
> + 	dentry = d_first_child(this_parent);
>   resume:
> - 	while (next != &this_parent->d_subdirs) {
> + 	hlist_for_each_entry_from(dentry, d_sib) {
>  +		struct tracefs_inode *ti;
> - 		struct list_head *tmp = next;
> - 		struct dentry *dentry = list_entry(tmp, struct dentry, d_child);
> - 		next = tmp->next;
>  +
>  +		/* Note, getdents() can add a cursor dentry with no inode */
>  +		if (!dentry->d_inode)
>  +			continue;
>  +
>   		spin_lock_nested(&dentry->d_lock, DENTRY_D_LOCK_NESTED);
>   
>   		change_gid(dentry, gid);
>   
>  +		/* If this is the events directory, update that too */
>  +		ti = get_tracefs(dentry->d_inode);
>  +		if (ti && (ti->flags & TRACEFS_EVENT_INODE))
>  +			eventfs_update_gid(dentry, gid);
>  +
> - 		if (!list_empty(&dentry->d_subdirs)) {
> + 		if (!hlist_empty(&dentry->d_children)) {
>   			spin_unlock(&this_parent->d_lock);
>   			spin_release(&dentry->d_lock.dep_map, _RET_IP_);
>   			this_parent = dentry;