Merge tag 'vfs-6.16-rc3.fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs

Pull vfs fixes from Christian Brauner:

- Fix a regression in overlayfs caused by reworking the lookup_one*()
set of helpers

- Make sure that the name of the dentry is printed in overlayfs'
mkdir() helper

- Add missing iocb values to TRACE_IOCB_STRINGS define

- Unlock the superblock during iterate_supers_type(). This was an
accidental internal api change

- Drop a misleading assert in file_seek_cur_needs_f_lock() helper

- Never refuse to return PIDFD_GET_INGO when parent pid is zero

That can trivially happen in container scenarios where the parent
process might be located in an ancestor pid namespace

- Don't revalidate in try_lookup_noperm() as that causes regression for
filesystems such as cifs

- Fix simple_xattr_list() and reset the err variable after
security_inode_listsecurity() got called so as not to confuse
userspace about the length of the xattr

* tag 'vfs-6.16-rc3.fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs:
fs: drop assert in file_seek_cur_needs_f_lock
fs: unlock the superblock during iterate_supers_type
ovl: fix debug print in case of mkdir error
VFS: change try_lookup_noperm() to skip revalidation
fs: add missing values to TRACE_IOCB_STRINGS
fs/xattr.c: fix simple_xattr_list()
ovl: fix regression caused by lookup helpers API changes
pidfs: never refuse ppid == 0 in PIDFD_GET_INFO

+40 -14
+6 -2
fs/file.c
··· 1198 1198 if (!(file->f_mode & FMODE_ATOMIC_POS) && !file->f_op->iterate_shared) 1199 1199 return false; 1200 1200 1201 - VFS_WARN_ON_ONCE((file_count(file) > 1) && 1202 - !mutex_is_locked(&file->f_pos_lock)); 1201 + /* 1202 + * Note that we are not guaranteed to be called after fdget_pos() on 1203 + * this file obj, in which case the caller is expected to provide the 1204 + * appropriate locking. 1205 + */ 1206 + 1203 1207 return true; 1204 1208 } 1205 1209
+13 -4
fs/namei.c
··· 2917 2917 * @base: base directory to lookup from 2918 2918 * 2919 2919 * Look up a dentry by name in the dcache, returning NULL if it does not 2920 - * currently exist. The function does not try to create a dentry. 2920 + * currently exist. The function does not try to create a dentry and if one 2921 + * is found it doesn't try to revalidate it. 2921 2922 * 2922 2923 * Note that this routine is purely a helper for filesystem usage and should 2923 2924 * not be called by generic code. It does no permission checking. ··· 2934 2933 if (err) 2935 2934 return ERR_PTR(err); 2936 2935 2937 - return lookup_dcache(name, base, 0); 2936 + return d_lookup(base, name); 2938 2937 } 2939 2938 EXPORT_SYMBOL(try_lookup_noperm); 2940 2939 ··· 3058 3057 * Note that this routine is purely a helper for filesystem usage and should 3059 3058 * not be called by generic code. It does no permission checking. 3060 3059 * 3061 - * Unlike lookup_noperm, it should be called without the parent 3060 + * Unlike lookup_noperm(), it should be called without the parent 3062 3061 * i_rwsem held, and will take the i_rwsem itself if necessary. 3062 + * 3063 + * Unlike try_lookup_noperm() it *does* revalidate the dentry if it already 3064 + * existed. 3063 3065 */ 3064 3066 struct dentry *lookup_noperm_unlocked(struct qstr *name, struct dentry *base) 3065 3067 { 3066 3068 struct dentry *ret; 3069 + int err; 3067 3070 3068 - ret = try_lookup_noperm(name, base); 3071 + err = lookup_noperm_common(name, base); 3072 + if (err) 3073 + return ERR_PTR(err); 3074 + 3075 + ret = lookup_dcache(name, base, 0); 3069 3076 if (!ret) 3070 3077 ret = lookup_slow(name, base, 0); 3071 3078 return ret;
+8 -2
fs/overlayfs/namei.c
··· 1393 1393 bool ovl_lower_positive(struct dentry *dentry) 1394 1394 { 1395 1395 struct ovl_entry *poe = OVL_E(dentry->d_parent); 1396 - struct qstr *name = &dentry->d_name; 1396 + const struct qstr *name = &dentry->d_name; 1397 1397 const struct cred *old_cred; 1398 1398 unsigned int i; 1399 1399 bool positive = false; ··· 1416 1416 struct dentry *this; 1417 1417 struct ovl_path *parentpath = &ovl_lowerstack(poe)[i]; 1418 1418 1419 + /* 1420 + * We need to make a non-const copy of dentry->d_name, 1421 + * because lookup_one_positive_unlocked() will hash name 1422 + * with parentpath base, which is on another (lower fs). 1423 + */ 1419 1424 this = lookup_one_positive_unlocked( 1420 1425 mnt_idmap(parentpath->layer->mnt), 1421 - name, parentpath->dentry); 1426 + &QSTR_LEN(name->name, name->len), 1427 + parentpath->dentry); 1422 1428 if (IS_ERR(this)) { 1423 1429 switch (PTR_ERR(this)) { 1424 1430 case -ENOENT:
+5 -3
fs/overlayfs/overlayfs.h
··· 246 246 struct dentry *dentry, 247 247 umode_t mode) 248 248 { 249 - dentry = vfs_mkdir(ovl_upper_mnt_idmap(ofs), dir, dentry, mode); 250 - pr_debug("mkdir(%pd2, 0%o) = %i\n", dentry, mode, PTR_ERR_OR_ZERO(dentry)); 251 - return dentry; 249 + struct dentry *ret; 250 + 251 + ret = vfs_mkdir(ovl_upper_mnt_idmap(ofs), dir, dentry, mode); 252 + pr_debug("mkdir(%pd2, 0%o) = %i\n", dentry, mode, PTR_ERR_OR_ZERO(ret)); 253 + return ret; 252 254 } 253 255 254 256 static inline int ovl_do_mknod(struct ovl_fs *ofs,
+1 -1
fs/pidfs.c
··· 366 366 kinfo.pid = task_pid_vnr(task); 367 367 kinfo.mask |= PIDFD_INFO_PID; 368 368 369 - if (kinfo.pid == 0 || kinfo.tgid == 0 || (kinfo.ppid == 0 && kinfo.pid != 1)) 369 + if (kinfo.pid == 0 || kinfo.tgid == 0) 370 370 return -ESRCH; 371 371 372 372 copy_out:
+3 -1
fs/super.c
··· 964 964 spin_unlock(&sb_lock); 965 965 966 966 locked = super_lock_shared(sb); 967 - if (locked) 967 + if (locked) { 968 968 f(sb, arg); 969 + super_unlock_shared(sb); 970 + } 969 971 970 972 spin_lock(&sb_lock); 971 973 if (p)
+1
fs/xattr.c
··· 1479 1479 buffer += err; 1480 1480 } 1481 1481 remaining_size -= err; 1482 + err = 0; 1482 1483 1483 1484 read_lock(&xattrs->lock); 1484 1485 for (rbp = rb_first(&xattrs->rb_root); rbp; rbp = rb_next(rbp)) {
+3 -1
include/linux/fs.h
··· 399 399 { IOCB_WAITQ, "WAITQ" }, \ 400 400 { IOCB_NOIO, "NOIO" }, \ 401 401 { IOCB_ALLOC_CACHE, "ALLOC_CACHE" }, \ 402 - { IOCB_DIO_CALLER_COMP, "CALLER_COMP" } 402 + { IOCB_DIO_CALLER_COMP, "CALLER_COMP" }, \ 403 + { IOCB_AIO_RW, "AIO_RW" }, \ 404 + { IOCB_HAS_METADATA, "AIO_HAS_METADATA" } 403 405 404 406 struct kiocb { 405 407 struct file *ki_filp;