Skip to content

kernfs: three standalone fixes

Shakeel Butt driver-core linux-kselftest lkml stable 1 version Applied

Status from this message: Applied to the vfs-7.4.kernfs branch of the vfs/vfs.git tree.

Get series with b4
b4 am [email protected]

Versions newest first

  1. v2 Latest4 patches 1 replyApplied

Changes in v2 from the cover letter

http://lore.kernel.org/[email protected]
- Added cover letter
- Used approppriate tags
- Updated commit messages to be more concise
- Replaced data_race() with READ_ONCE() (TJ)

Patches in v2 Applied

#Subject and filesSizeRepliesApplied
1/4selftests: cover kernfs file handles and same-parent renametools/testing/selftests/filesystems/config tools/testing/selftests/filesystems/kernfs_test.c+295 -20 replies
2/4kernfs: take kernfs_rename_lock for same-parent renames toofs/kernfs/dir.c fs/kernfs/kernfs-internal.h+23 -140 replies
3/4kernfs: don't lose IN_DELETE_SELF when decoding a file handlefs/kernfs/mount.c+21 -110 replies
4/4kernfs: fix up the unlocked attribute reads on the creation pathsfs/kernfs/dir.c fs/kernfs/symlink.c+23 -60 replies

Reviews trailers per patch

3 of 4 patches have a Reviewed-by or Acked-by.

PatchTejun Heo
1/4
2/4A-b
3/4A-b
4/4A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/4] kernfs: three standalone fixes

Three independent kernfs fixes, plus selftest coverage for the paths they touch. The fixes do not depend on each other.

Patch 1 adds tests for decoding a file handle and for a rename that keeps the same parent. Patches 2-4:

- kernfs_rename_ns() takes kernfs_rename_lock only when the parent changes, so two same-parent renames inside one kernfs_path_from_node() walk can build a path that never existed. sysfs_warn_dup() is the only caller that can see it.

- __kernfs_fh_to_dentry() creates inodes with no lock, so a decode racing rmdir() can hash an inode after the removal's ilookup() pass. The inode keeps i_nlink 1, so no IN_DELETE_SELF is sent.

- kernfs_create_link() reads the target's uid and gid unlocked, so a chown in between gives the link an owner the target never had.

Patch 1 applies on top of the patch [1] ("selftests: cover kernfs dentry revalidation") with vfs-7.4.kernfs branch in vfs tree as base.

[1] http://lore.kernel.org/[email protected]

Changes since v1:
http://lore.kernel.org/[email protected]
- Added cover letter
- Used approppriate tags
- Updated commit messages to be more concise
- Replaced data_race() with READ_ONCE() (TJ)

Shakeel Butt (4):
selftests: cover kernfs file handles and same-parent rename
kernfs: take kernfs_rename_lock for same-parent renames too
kernfs: don't lose IN_DELETE_SELF when decoding a file handle
kernfs: fix up the unlocked attribute reads on the creation paths

 fs/kernfs/dir.c                               |  40 ++-
 fs/kernfs/kernfs-internal.h                   |   9 +-
 fs/kernfs/mount.c                             |  32 +-
 fs/kernfs/symlink.c                           |  17 +-
 tools/testing/selftests/filesystems/config    |   1 +
 .../selftests/filesystems/kernfs_test.c       | 296 +++++++++++++++++-
 6 files changed, 362 insertions(+), 33 deletions(-)

base-commit: 47fc64fb3b433abb9f2242a85ba808ac6f87df22

Signature · 1 line
2.53.0-Meta