aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/dev-replace.c
diff options
context:
space:
mode:
authorAlex Markuze <[email protected]>2025-08-12 09:57:39 +0000
committerIlya Dryomov <[email protected]>2025-09-09 10:57:02 +0000
commitbec324f33d1ed346394b2eee25bf6dbf3511f727 (patch)
treefb179b6cc5e257693717c22d2dda7fc2cd05a526 /fs/btrfs/dev-replace.c
parentceph: fix race condition validating r_parent before applying state (diff)
downloadkernel-bec324f33d1ed346394b2eee25bf6dbf3511f727.tar.gz
kernel-bec324f33d1ed346394b2eee25bf6dbf3511f727.zip
ceph: fix race condition where r_parent becomes stale before sending message
When the parent directory's i_rwsem is not locked, req->r_parent may become stale due to concurrent operations (e.g. rename) between dentry lookup and message creation. Validate that r_parent matches the encoded parent inode and update to the correct inode if a mismatch is detected. [ idryomov: folded a follow-up fix from Alex to drop extra reference from ceph_get_reply_dir() in ceph_fill_trace(): ceph_get_reply_dir() may return a different, referenced inode when r_parent is stale and the parent directory lock is not held. ceph_fill_trace() used that inode but failed to drop the reference when it differed from req->r_parent, leaking an inode reference. Keep the directory inode in a local variable and iput() it at function end if it does not match req->r_parent. ] Cc: [email protected] Signed-off-by: Alex Markuze <[email protected]> Reviewed-by: Viacheslav Dubeyko <[email protected]> Signed-off-by: Ilya Dryomov <[email protected]>
Diffstat (limited to 'fs/btrfs/dev-replace.c')
0 files changed, 0 insertions, 0 deletions