public inbox for linux-next@vger.kernel.org
 help / color / mirror / Atom feed
From: Stephen Rothwell <sfr@canb.auug.org.au>
To: Christian Brauner <brauner@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: Carlos Maiolino <cem@kernel.org>,
	Carlos Maiolino <cmaiolino@redhat.com>,
	Chuck Lever <chuck.lever@oracle.com>,
	Jeff Layton <jlayton@kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linux Next Mailing List <linux-next@vger.kernel.org>,
	Lukas Czerner <lczerner@redhat.com>
Subject: linux-next: manual merge of the vfs-brauner tree with the mm tree
Date: Fri, 14 Jul 2023 10:24:53 +1000	[thread overview]
Message-ID: <20230714102453.4399f059@canb.auug.org.au> (raw)

[-- Attachment #1: Type: text/plain, Size: 7588 bytes --]

Hi all,

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

  mm/shmem.c

between commits:

  3c37c527bbf9 ("shmem: make shmem_get_inode() return ERR_PTR instead of NULL")
  1a93dd24f1be ("shmem: quota support")

from the mm tree and commits:

  ad9717ca487a ("shmem: stable directory offsets")
  fa6c36fb3f24 ("shmem: convert to ctime accessor functions")

from the vfs-brauner 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 mm/shmem.c
index c35717763dcc,310b0544eae3..000000000000
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@@ -2445,83 -2355,81 +2445,89 @@@ static void shmem_set_inode_flags(struc
  #define shmem_initxattrs NULL
  #endif
  
+ static struct offset_ctx *shmem_get_offset_ctx(struct inode *inode)
+ {
+ 	return &SHMEM_I(inode)->dir_offsets;
+ }
+ 
 -static struct inode *shmem_get_inode(struct mnt_idmap *idmap, struct super_block *sb,
 -				     struct inode *dir, umode_t mode, dev_t dev,
 -				     unsigned long flags)
 +static struct inode *__shmem_get_inode(struct mnt_idmap *idmap,
 +					     struct super_block *sb,
 +					     struct inode *dir, umode_t mode,
 +					     dev_t dev, unsigned long flags)
  {
  	struct inode *inode;
  	struct shmem_inode_info *info;
  	struct shmem_sb_info *sbinfo = SHMEM_SB(sb);
  	ino_t ino;
 +	int err;
 +
 +	err = shmem_reserve_inode(sb, &ino);
 +	if (err)
 +		return ERR_PTR(err);
  
 -	if (shmem_reserve_inode(sb, &ino))
 -		return NULL;
  
  	inode = new_inode(sb);
 -	if (inode) {
 -		inode->i_ino = ino;
 -		inode_init_owner(idmap, inode, dir, mode);
 -		inode->i_blocks = 0;
 -		inode->i_atime = inode->i_mtime = inode_set_ctime_current(inode);
 -		inode->i_generation = get_random_u32();
 -		info = SHMEM_I(inode);
 -		memset(info, 0, (char *)inode - (char *)info);
 -		spin_lock_init(&info->lock);
 -		atomic_set(&info->stop_eviction, 0);
 -		info->seals = F_SEAL_SEAL;
 -		info->flags = flags & VM_NORESERVE;
 -		info->i_crtime = inode->i_mtime;
 -		info->fsflags = (dir == NULL) ? 0 :
 -			SHMEM_I(dir)->fsflags & SHMEM_FL_INHERITED;
 -		if (info->fsflags)
 -			shmem_set_inode_flags(inode, info->fsflags);
 -		INIT_LIST_HEAD(&info->shrinklist);
 -		INIT_LIST_HEAD(&info->swaplist);
 -		if (sbinfo->noswap)
 -			mapping_set_unevictable(inode->i_mapping);
 -		simple_xattrs_init(&info->xattrs);
 -		cache_no_acl(inode);
 -		mapping_set_large_folios(inode->i_mapping);
  
 -		switch (mode & S_IFMT) {
 -		default:
 -			inode->i_op = &shmem_special_inode_operations;
 -			init_special_inode(inode, mode, dev);
 -			break;
 -		case S_IFREG:
 -			inode->i_mapping->a_ops = &shmem_aops;
 -			inode->i_op = &shmem_inode_operations;
 -			inode->i_fop = &shmem_file_operations;
 -			mpol_shared_policy_init(&info->policy,
 -						 shmem_get_sbmpol(sbinfo));
 -			break;
 -		case S_IFDIR:
 -			inc_nlink(inode);
 -			/* Some things misbehave if size == 0 on a directory */
 -			inode->i_size = 2 * BOGO_DIRENT_SIZE;
 -			inode->i_op = &shmem_dir_inode_operations;
 -			inode->i_fop = &simple_offset_dir_operations;
 -			simple_offset_init(shmem_get_offset_ctx(inode));
 -			break;
 -		case S_IFLNK:
 -			/*
 -			 * Must not load anything in the rbtree,
 -			 * mpol_free_shared_policy will not be called.
 -			 */
 -			mpol_shared_policy_init(&info->policy, NULL);
 -			break;
 -		}
 -
 -		lockdep_annotate_inode_mutex_key(inode);
 -	} else
 +	if (!inode) {
  		shmem_free_inode(sb);
 +		return ERR_PTR(-ENOSPC);
 +	}
 +
 +	inode->i_ino = ino;
 +	inode_init_owner(idmap, inode, dir, mode);
 +	inode->i_blocks = 0;
- 	inode->i_atime = inode->i_mtime = inode->i_ctime = current_time(inode);
++	inode->i_atime = inode->i_mtime = inode_set_ctime_current(inode);
 +	inode->i_generation = get_random_u32();
 +	info = SHMEM_I(inode);
 +	memset(info, 0, (char *)inode - (char *)info);
 +	spin_lock_init(&info->lock);
 +	atomic_set(&info->stop_eviction, 0);
 +	info->seals = F_SEAL_SEAL;
 +	info->flags = flags & VM_NORESERVE;
 +	info->i_crtime = inode->i_mtime;
 +	info->fsflags = (dir == NULL) ? 0 :
 +		SHMEM_I(dir)->fsflags & SHMEM_FL_INHERITED;
 +	if (info->fsflags)
 +		shmem_set_inode_flags(inode, info->fsflags);
 +	INIT_LIST_HEAD(&info->shrinklist);
 +	INIT_LIST_HEAD(&info->swaplist);
 +	INIT_LIST_HEAD(&info->swaplist);
 +	if (sbinfo->noswap)
 +		mapping_set_unevictable(inode->i_mapping);
 +	simple_xattrs_init(&info->xattrs);
 +	cache_no_acl(inode);
 +	mapping_set_large_folios(inode->i_mapping);
 +
 +	switch (mode & S_IFMT) {
 +	default:
 +		inode->i_op = &shmem_special_inode_operations;
 +		init_special_inode(inode, mode, dev);
 +		break;
 +	case S_IFREG:
 +		inode->i_mapping->a_ops = &shmem_aops;
 +		inode->i_op = &shmem_inode_operations;
 +		inode->i_fop = &shmem_file_operations;
 +		mpol_shared_policy_init(&info->policy,
 +					 shmem_get_sbmpol(sbinfo));
 +		break;
 +	case S_IFDIR:
 +		inc_nlink(inode);
 +		/* Some things misbehave if size == 0 on a directory */
 +		inode->i_size = 2 * BOGO_DIRENT_SIZE;
 +		inode->i_op = &shmem_dir_inode_operations;
- 		inode->i_fop = &simple_dir_operations;
++		inode->i_fop = &simple_offset_dir_operations;
++		simple_offset_init(shmem_get_offset_ctx(inode));
 +		break;
 +	case S_IFLNK:
 +		/*
 +		 * Must not load anything in the rbtree,
 +		 * mpol_free_shared_policy will not be called.
 +		 */
 +		mpol_shared_policy_init(&info->policy, NULL);
 +		break;
 +	}
 +
 +	lockdep_annotate_inode_mutex_key(inode);
  	return inode;
  }
  
@@@ -3203,30 -3075,30 +3209,33 @@@ shmem_mknod(struct mnt_idmap *idmap, st
  	    struct dentry *dentry, umode_t mode, dev_t dev)
  {
  	struct inode *inode;
 -	int error = -ENOSPC;
 +	int error;
  
  	inode = shmem_get_inode(idmap, dir->i_sb, dir, mode, dev, VM_NORESERVE);
 -	if (inode) {
 -		error = simple_acl_create(dir, inode);
 -		if (error)
 -			goto out_iput;
 -		error = security_inode_init_security(inode, dir,
 -						     &dentry->d_name,
 -						     shmem_initxattrs, NULL);
 -		if (error && error != -EOPNOTSUPP)
 -			goto out_iput;
  
 -		error = simple_offset_add(shmem_get_offset_ctx(dir), dentry);
 -		if (error)
 -			goto out_iput;
 +	if (IS_ERR(inode))
 +		return PTR_ERR(inode);
  
 -		dir->i_size += BOGO_DIRENT_SIZE;
 -		dir->i_mtime = inode_set_ctime_current(dir);
 -		inode_inc_iversion(dir);
 -		d_instantiate(dentry, inode);
 -		dget(dentry); /* Extra count - pin the dentry in core */
 -	}
 +	error = simple_acl_create(dir, inode);
 +	if (error)
 +		goto out_iput;
 +	error = security_inode_init_security(inode, dir,
 +					     &dentry->d_name,
 +					     shmem_initxattrs, NULL);
 +	if (error && error != -EOPNOTSUPP)
 +		goto out_iput;
 +
- 	error = 0;
++	error = simple_offset_add(shmem_get_offset_ctx(dir), dentry);
++	if (error)
++		goto out_iput;
++
 +	dir->i_size += BOGO_DIRENT_SIZE;
- 	dir->i_ctime = dir->i_mtime = current_time(dir);
++	dir->i_mtime = inode_set_ctime_current(dir);
 +	inode_inc_iversion(dir);
 +	d_instantiate(dentry, inode);
 +	dget(dentry); /* Extra count - pin the dentry in core */
  	return error;
 +
  out_iput:
  	iput(inode);
  	return error;

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

             reply	other threads:[~2023-07-14  0:25 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-14  0:24 Stephen Rothwell [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-09-02  1:21 linux-next: manual merge of the vfs-brauner tree with the mm tree Stephen Rothwell
2024-09-02  9:18 ` Pankaj Raghav (Samsung)
2024-09-18  0:34 ` Stephen Rothwell
2024-02-20 23:32 Stephen Rothwell
2024-03-11 21:56 ` Stephen Rothwell
2023-11-21 23:31 Stephen Rothwell
2024-01-08 21:00 ` Stephen Rothwell
2023-09-28  0:25 Stephen Rothwell
2023-10-30 22:30 ` Stephen Rothwell
2023-09-20 23:13 Stephen Rothwell
2023-07-14  0:02 Stephen Rothwell
2023-05-24  0:06 Stephen Rothwell

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=20230714102453.4399f059@canb.auug.org.au \
    --to=sfr@canb.auug.org.au \
    --cc=akpm@linux-foundation.org \
    --cc=brauner@kernel.org \
    --cc=cem@kernel.org \
    --cc=chuck.lever@oracle.com \
    --cc=cmaiolino@redhat.com \
    --cc=jlayton@kernel.org \
    --cc=lczerner@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@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