Commit 449c2b30 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'vfs-6.18-rc1.async' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs

Pull vfs async directory updates from Christian Brauner:
 "This contains further preparatory changes for the asynchronous directory
  locking scheme:

   - Add lookup_one_positive_killable() which allows overlayfs to
     perform lookup that won't block on a fatal signal

   - Unify the mount idmap handling in struct renamedata as a rename can
     only happen within a single mount

   - Introduce kern_path_parent() for audit which sets the path to the
     parent and returns a dentry for the target without holding any
     locks on return

   - Rename kern_path_locked() as it is only used to prepare for the
     removal of an object from the filesystem:

	kern_path_locked()    => start_removing_path()
	kern_path_create()    => start_creating_path()
	user_path_create()    => start_creating_user_path()
	user_path_locked_at() => start_removing_user_path_at()
	done_path_create()    => end_creating_path()
	NA                    => end_removing_path()"

* tag 'vfs-6.18-rc1.async' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs:
  debugfs: rename start_creating() to debugfs_start_creating()
  VFS: rename kern_path_locked() and related functions.
  VFS/audit: introduce kern_path_parent() for audit
  VFS: unify old_mnt_idmap and new_mnt_idmap in renamedata
  VFS: discard err2 in filename_create()
  VFS/ovl: add lookup_one_positive_killable()
parents 263e777e 4f5ea5aa
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -1285,3 +1285,15 @@ rather than a VMA, as the VMA at this stage is not yet valid.
The vm_area_desc provides the minimum required information for a filesystem
to initialise state upon memory mapping of a file-backed region, and output
parameters for the file system to set this state.

---

**mandatory**

Several functions are renamed:

-  kern_path_locked -> start_removing_path
-  kern_path_create -> start_creating_path
-  user_path_create -> start_creating_user_path
-  user_path_locked_at -> start_removing_user_path_at
-  done_path_create -> end_creating_path
+2 −2
Original line number Diff line number Diff line
@@ -67,11 +67,11 @@ static long do_spu_create(const char __user *pathname, unsigned int flags,
	struct dentry *dentry;
	int ret;

	dentry = user_path_create(AT_FDCWD, pathname, &path, LOOKUP_DIRECTORY);
	dentry = start_creating_user_path(AT_FDCWD, pathname, &path, LOOKUP_DIRECTORY);
	ret = PTR_ERR(dentry);
	if (!IS_ERR(dentry)) {
		ret = spufs_create(&path, dentry, flags, mode, neighbor);
		done_path_create(&path, dentry);
		end_creating_path(&path, dentry);
	}

	return ret;
+9 −13
Original line number Diff line number Diff line
@@ -176,7 +176,7 @@ static int dev_mkdir(const char *name, umode_t mode)
	struct dentry *dentry;
	struct path path;

	dentry = kern_path_create(AT_FDCWD, name, &path, LOOKUP_DIRECTORY);
	dentry = start_creating_path(AT_FDCWD, name, &path, LOOKUP_DIRECTORY);
	if (IS_ERR(dentry))
		return PTR_ERR(dentry);

@@ -184,7 +184,7 @@ static int dev_mkdir(const char *name, umode_t mode)
	if (!IS_ERR(dentry))
		/* mark as kernel-created inode */
		d_inode(dentry)->i_private = &thread;
	done_path_create(&path, dentry);
	end_creating_path(&path, dentry);
	return PTR_ERR_OR_ZERO(dentry);
}

@@ -222,10 +222,10 @@ static int handle_create(const char *nodename, umode_t mode, kuid_t uid,
	struct path path;
	int err;

	dentry = kern_path_create(AT_FDCWD, nodename, &path, 0);
	dentry = start_creating_path(AT_FDCWD, nodename, &path, 0);
	if (dentry == ERR_PTR(-ENOENT)) {
		create_path(nodename);
		dentry = kern_path_create(AT_FDCWD, nodename, &path, 0);
		dentry = start_creating_path(AT_FDCWD, nodename, &path, 0);
	}
	if (IS_ERR(dentry))
		return PTR_ERR(dentry);
@@ -246,7 +246,7 @@ static int handle_create(const char *nodename, umode_t mode, kuid_t uid,
		/* mark as kernel-created inode */
		d_inode(dentry)->i_private = &thread;
	}
	done_path_create(&path, dentry);
	end_creating_path(&path, dentry);
	return err;
}

@@ -256,7 +256,7 @@ static int dev_rmdir(const char *name)
	struct dentry *dentry;
	int err;

	dentry = kern_path_locked(name, &parent);
	dentry = start_removing_path(name, &parent);
	if (IS_ERR(dentry))
		return PTR_ERR(dentry);
	if (d_inode(dentry)->i_private == &thread)
@@ -265,9 +265,7 @@ static int dev_rmdir(const char *name)
	else
		err = -EPERM;

	dput(dentry);
	inode_unlock(d_inode(parent.dentry));
	path_put(&parent);
	end_removing_path(&parent, dentry);
	return err;
}

@@ -325,7 +323,7 @@ static int handle_remove(const char *nodename, struct device *dev)
	int deleted = 0;
	int err = 0;

	dentry = kern_path_locked(nodename, &parent);
	dentry = start_removing_path(nodename, &parent);
	if (IS_ERR(dentry))
		return PTR_ERR(dentry);

@@ -349,10 +347,8 @@ static int handle_remove(const char *nodename, struct device *dev)
		if (!err || err == -ENOENT)
			deleted = 1;
	}
	dput(dentry);
	inode_unlock(d_inode(parent.dentry));
	end_removing_path(&parent, dentry);

	path_put(&parent);
	if (deleted && strchr(nodename, '/'))
		delete_path(nodename);
	return err;
+4 −6
Original line number Diff line number Diff line
@@ -255,7 +255,7 @@ static long bch2_ioctl_subvolume_create(struct bch_fs *c, struct file *filp,
		snapshot_src = inode_inum(to_bch_ei(src_path.dentry->d_inode));
	}

	dst_dentry = user_path_create(arg.dirfd,
	dst_dentry = start_creating_user_path(arg.dirfd,
			(const char __user *)(unsigned long)arg.dst_ptr,
			&dst_path, lookup_flags);
	error = PTR_ERR_OR_ZERO(dst_dentry);
@@ -314,7 +314,7 @@ static long bch2_ioctl_subvolume_create(struct bch_fs *c, struct file *filp,
	d_instantiate(dst_dentry, &inode->v);
	fsnotify_mkdir(dir, dst_dentry);
err3:
	done_path_create(&dst_path, dst_dentry);
	end_creating_path(&dst_path, dst_dentry);
err2:
	if (arg.src_ptr)
		path_put(&src_path);
@@ -334,7 +334,7 @@ static long bch2_ioctl_subvolume_destroy(struct bch_fs *c, struct file *filp,
	if (arg.flags)
		return -EINVAL;

	victim = user_path_locked_at(arg.dirfd, name, &path);
	victim = start_removing_user_path_at(arg.dirfd, name, &path);
	if (IS_ERR(victim))
		return PTR_ERR(victim);

@@ -351,9 +351,7 @@ static long bch2_ioctl_subvolume_destroy(struct bch_fs *c, struct file *filp,
		d_invalidate(victim);
	}
err:
	inode_unlock(dir);
	dput(victim);
	path_put(&path);
	end_removing_path(&path, victim);
	return ret;
}

+1 −2
Original line number Diff line number Diff line
@@ -387,10 +387,9 @@ int cachefiles_bury_object(struct cachefiles_cache *cache,
		cachefiles_io_error(cache, "Rename security error %d", ret);
	} else {
		struct renamedata rd = {
			.old_mnt_idmap	= &nop_mnt_idmap,
			.mnt_idmap	= &nop_mnt_idmap,
			.old_parent	= dir,
			.old_dentry	= rep,
			.new_mnt_idmap	= &nop_mnt_idmap,
			.new_parent	= cache->graveyard,
			.new_dentry	= grave,
		};
Loading