-
Notifications
You must be signed in to change notification settings - Fork 10
Commit 1b2565a
committed
ceph: fix race condition validating r_parent before applying state
jira LE-4311
Rebuild_History Non-Buildable kernel-5.14.0-570.49.1.el9_6
Rebuild_CHGLOG: - ceph: fix client race condition validating r_parent before applying state (Alex Markuze) [RHEL-114962]
Rebuild_FUZZ: 94.96%
commit-author Alex Markuze <amarkuze@redhat.com>
commit 15f519e
Empty-Commit: Cherry-Pick Conflicts during history rebuild.
Will be included in final tarball splat. Ref for failed cherry-pick at:
ciq/ciq_backports/kernel-5.14.0-570.49.1.el9_6/15f519e9.failed
Add validation to ensure the cached parent directory inode matches the
directory info in MDS replies. This prevents client-side race conditions
where concurrent operations (e.g. rename) cause r_parent to become stale
between request initiation and reply processing, which could lead to
applying state changes to incorrect directory inodes.
[ idryomov: folded a kerneldoc fixup and a follow-up fix from Alex to
move CEPH_CAP_PIN reference when r_parent is updated:
When the parent directory lock is not held, req->r_parent can become
stale and is updated to point to the correct inode. However, the
associated CEPH_CAP_PIN reference was not being adjusted. The
CEPH_CAP_PIN is a reference on an inode that is tracked for
accounting purposes. Moving this pin is important to keep the
accounting balanced. When the pin was not moved from the old parent
to the new one, it created two problems: The reference on the old,
stale parent was never released, causing a reference leak.
A reference for the new parent was never acquired, creating the risk
of a reference underflow later in ceph_mdsc_release_request(). This
patch corrects the logic by releasing the pin from the old parent and
acquiring it for the new parent when r_parent is switched. This
ensures reference accounting stays balanced. ]
Cc: stable@vger.kernel.org
Signed-off-by: Alex Markuze <amarkuze@redhat.com>
Reviewed-by: Viacheslav Dubeyko <Slava.Dubeyko@ibm.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
(cherry picked from commit 15f519e)
Signed-off-by: Jonathan Maple <jmaple@ciq.com>
# Conflicts:
# fs/ceph/debugfs.c
# fs/ceph/dir.c
# fs/ceph/file.c
# fs/ceph/inode.c
# fs/ceph/mds_client.c
# fs/ceph/mds_client.h1 parent 5862c9d commit 1b2565aCopy full SHA for 1b2565a
File tree
Expand file treeCollapse file tree
1 file changed
+696
-0
lines changedOpen diff view settings
Filter options
- ciq/ciq_backports/kernel-5.14.0-570.49.1.el9_6
Expand file treeCollapse file tree
1 file changed
+696
-0
lines changedOpen diff view settings
0 commit comments