Commit 99c21bea authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull misc vfs updates from Christian Brauner:
 "Features:

   - Add CONFIG_DEBUG_VFS infrastucture:
      - Catch invalid modes in open
      - Use the new debug macros in inode_set_cached_link()
      - Use debug-only asserts around fd allocation and install

   - Place f_ref to 3rd cache line in struct file to resolve false
     sharing

Cleanups:

   - Start using anon_inode_getfile_fmode() helper in various places

   - Don't take f_lock during SEEK_CUR if exclusion is guaranteed by
     f_pos_lock

   - Add unlikely() to kcmp()

   - Remove legacy ->remount_fs method from ecryptfs after port to the
     new mount api

   - Remove invalidate_inodes() in favour of evict_inodes()

   - Simplify ep_busy_loopER by removing unused argument

   - Avoid mmap sem relocks when coredumping with many missing pages

   - Inline getname()

   - Inline new_inode_pseudo() and de-staticize alloc_inode()

   - Dodge an atomic in putname if ref == 1

   - Consistently deref the files table with rcu_dereference_raw()

   - Dedup handling of struct filename init and refcounts bumps

   - Use wq_has_sleeper() in end_dir_add()

   - Drop the lock trip around I_NEW wake up in evict()

   - Load the ->i_sb pointer once in inode_sb_list_{add,del}

   - Predict not reaching the limit in alloc_empty_file()

   - Tidy up do_sys_openat2() with likely/unlikely

   - Call inode_sb_list_add() outside of inode hash lock

   - Sort out fd allocation vs dup2 race commentary

   - Turn page_offset() into a wrapper around folio_pos()

   - Remove locking in exportfs around ->get_parent() call

   - try_lookup_one_len() does not need any locks in autofs

   - Fix return type of several functions from long to int in open

   - Fix return type of several functions from long to int in ioctls

  Fixes:

   - Fix watch queue accounting mismatch"

* tag 'vfs-6.15-rc1.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs: (30 commits)
  fs: sort out fd allocation vs dup2 race commentary, take 2
  fs: call inode_sb_list_add() outside of inode hash lock
  fs: tidy up do_sys_openat2() with likely/unlikely
  fs: predict not reaching the limit in alloc_empty_file()
  fs: load the ->i_sb pointer once in inode_sb_list_{add,del}
  fs: drop the lock trip around I_NEW wake up in evict()
  fs: use wq_has_sleeper() in end_dir_add()
  VFS/autofs: try_lookup_one_len() does not need any locks
  fs: dedup handling of struct filename init and refcounts bumps
  fs: consistently deref the files table with rcu_dereference_raw()
  exportfs: remove locking around ->get_parent() call.
  fs: use debug-only asserts around fd allocation and install
  fs: dodge an atomic in putname if ref == 1
  vfs: Remove invalidate_inodes()
  ecryptfs: remove NULL remount_fs from super_operations
  watch_queue: fix pipe accounting mismatch
  fs: place f_ref to 3rd cache line in struct file to resolve false sharing
  epoll: simplify ep_busy_loop by removing always 0 argument
  fs: Turn page_offset() into a wrapper around folio_pos()
  kcmp: improve performance adding an unlikely hint to task comparisons
  ...
parents c4cff1ea 4dec4f91
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -1157,3 +1157,8 @@ in normal case it points into the pathname being looked up.
NOTE: if you need something like full path from the root of filesystem,
you are still on your own - this assists with simple cases, but it's not
magic.

---

** mandatory **
invalidate_inodes() is gone use evict_inodes() instead.
+2 −1
Original line number Diff line number Diff line
@@ -27,9 +27,10 @@ static int mte_dump_tag_range(struct coredump_params *cprm,
	int ret = 1;
	unsigned long addr;
	void *tags = NULL;
	int locked = 0;

	for (addr = start; addr < start + len; addr += PAGE_SIZE) {
		struct page *page = get_dump_page(addr);
		struct page *page = get_dump_page(addr, &locked);

		/*
		 * get_dump_page() returns NULL when encountering an empty
+3 −4
Original line number Diff line number Diff line
@@ -482,14 +482,13 @@ static long papr_vpd_create_handle(struct papr_location_code __user *ulc)
		goto free_blob;
	}

	file = anon_inode_getfile("[papr-vpd]", &papr_vpd_handle_ops,
				  (void *)blob, O_RDONLY);
	file = anon_inode_getfile_fmode("[papr-vpd]", &papr_vpd_handle_ops,
				  (void *)blob, O_RDONLY,
				  FMODE_LSEEK | FMODE_PREAD);
	if (IS_ERR(file)) {
		err = PTR_ERR(file);
		goto put_fd;
	}

	file->f_mode |= FMODE_LSEEK | FMODE_PREAD;
	fd_install(fd, file);
	return fd;
put_fd:
+2 −14
Original line number Diff line number Diff line
@@ -266,24 +266,12 @@ static struct file *vfio_device_open_file(struct vfio_device *device)
	if (ret)
		goto err_free;

	/*
	 * We can't use anon_inode_getfd() because we need to modify
	 * the f_mode flags directly to allow more than just ioctls
	 */
	filep = anon_inode_getfile("[vfio-device]", &vfio_device_fops,
				   df, O_RDWR);
	filep = anon_inode_getfile_fmode("[vfio-device]", &vfio_device_fops,
				   df, O_RDWR, FMODE_PREAD | FMODE_PWRITE);
	if (IS_ERR(filep)) {
		ret = PTR_ERR(filep);
		goto err_close_device;
	}

	/*
	 * TODO: add an anon_inode interface to do this.
	 * Appears to be missing by lack of need rather than
	 * explicitly prevented.  Now there's need.
	 */
	filep->f_mode |= (FMODE_PREAD | FMODE_PWRITE);

	/*
	 * Use the pseudo fs inode on the device to link all mmaps
	 * to the same address space, allowing us to unmap all vmas
+0 −3
Original line number Diff line number Diff line
@@ -442,7 +442,6 @@ static int autofs_dev_ioctl_timeout(struct file *fp,
		sbi->exp_timeout = timeout * HZ;
	} else {
		struct dentry *base = fp->f_path.dentry;
		struct inode *inode = base->d_inode;
		int path_len = param->size - AUTOFS_DEV_IOCTL_SIZE - 1;
		struct dentry *dentry;
		struct autofs_info *ino;
@@ -460,9 +459,7 @@ static int autofs_dev_ioctl_timeout(struct file *fp,
				"the parent autofs mount timeout which could "
				"prevent shutdown\n");

		inode_lock_shared(inode);
		dentry = try_lookup_one_len(param->path, base, path_len);
		inode_unlock_shared(inode);
		if (IS_ERR_OR_NULL(dentry))
			return dentry ? PTR_ERR(dentry) : -ENOENT;
		ino = autofs_dentry_ino(dentry);
Loading