Skip to content

Commit 052bb34

Browse files
committed
ceph: add missing locking to protect i_snap_realm_item during split
All ci->i_snap_realm_item/realm->inodes_with_caps manipulation should be protected by realm->inodes_with_caps_lock. This bug would have only bit us in a rare race with a realm split (during some snap creations). Signed-off-by: Sage Weil <sage@newdream.net>
1 parent 978097c commit 052bb34

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

‎fs/ceph/snap.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -818,7 +818,9 @@ void ceph_handle_snap(struct ceph_mds_client *mdsc,
818818
* queued (again) by ceph_update_snap_trace()
819819
* below. Queue it _now_, under the old context.
820820
*/
821+
spin_lock(&realm->inodes_with_caps_lock);
821822
list_del_init(&ci->i_snap_realm_item);
823+
spin_unlock(&realm->inodes_with_caps_lock);
822824
spin_unlock(&inode->i_lock);
823825

824826
ceph_queue_cap_snap(ci,

0 commit comments

Comments
 (0)