mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alex Markuze <amarkuze@redhat.com>
To: ceph-devel@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, Slava.Dubeyko@ibm.com,
	idryomov@gmail.com, Alex Markuze <amarkuze@redhat.com>
Subject: [PATCH v3 0/2] ceph: fix client race conditions with stale r_parent
Date: Mon, 11 Aug 2025 10:09:51 +0000	[thread overview]
Message-ID: <20250811100953.3103970-1-amarkuze@redhat.com> (raw)

This patch series addresses client-side race conditions in the Ceph filesystem
where the cached parent directory inode (r_parent) can become stale during
concurrent operations like rename, leading to incorrect state application.

The first patch adds validation during reply processing to ensure the cached
parent directory inode matches the directory info in MDS replies. It refactors
the path building API to use a structured approach and prevents applying state
changes to incorrect directory inodes.

The second patch addresses cases where r_parent becomes stale between request
creation and message sending when the parent directory's i_rwsem is not locked.
It validates that r_parent matches the encoded parent inode and updates to the
correct inode if a mismatch is detected, with appropriate warnings for this
rare but problematic condition.

Alex Markuze (2):
  ceph: fix client race condition validating r_parent before applying
    state
  ceph: fix client race condition where r_parent becomes stale before
    sending message

 fs/ceph/debugfs.c    |  14 ++--
 fs/ceph/dir.c        |  17 ++---
 fs/ceph/file.c       |  24 +++----
 fs/ceph/inode.c      |  59 +++++++++++++++--
 fs/ceph/mds_client.c | 148 +++++++++++++++++++++++++++----------------
 fs/ceph/mds_client.h |  12 +++-
 6 files changed, 182 insertions(+), 92 deletions(-)

-- 
2.34.1


             reply	other threads:[~2025-08-11 10:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-11 10:09 Alex Markuze [this message]
2025-08-11 10:09 ` [PATCH v3 1/2] ceph: fix client race condition validating r_parent before applying state Alex Markuze
2025-08-11 19:06   ` Viacheslav Dubeyko
2025-08-11 10:09 ` [PATCH v3 2/2] ceph: fix client race condition where r_parent becomes stale before sending message Alex Markuze
2025-08-11 18:52   ` Viacheslav Dubeyko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250811100953.3103970-1-amarkuze@redhat.com \
    --to=amarkuze@redhat.com \
    --cc=Slava.Dubeyko@ibm.com \
    --cc=ceph-devel@vger.kernel.org \
    --cc=idryomov@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®