Skip to content

Commit 9f4057f

Browse files
ukernelidryomov
authored andcommitted
ceph: properly queue cap snap for newly created snap realm
commit 3ae0beb "ceph: queue cap snap only when snap realm's context changes" introduced a regression: we may not call queue_realm_cap_snaps() for newly created snap realm. This regression allows unflushed snapshot data to be overwritten. Link: http://tracker.ceph.com/issues/21483 Signed-off-by: "Yan, Zheng" <zyan@redhat.com> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
1 parent 9e66317 commit 9f4057f

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

fs/ceph/snap.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -374,12 +374,10 @@ static int build_snap_context(struct ceph_snap_realm *realm,
374374
realm->ino, realm, snapc, snapc->seq,
375375
(unsigned int) snapc->num_snaps);
376376

377-
if (realm->cached_context) {
378-
ceph_put_snap_context(realm->cached_context);
379-
/* queue realm for cap_snap creation */
380-
list_add_tail(&realm->dirty_item, dirty_realms);
381-
}
377+
ceph_put_snap_context(realm->cached_context);
382378
realm->cached_context = snapc;
379+
/* queue realm for cap_snap creation */
380+
list_add_tail(&realm->dirty_item, dirty_realms);
383381
return 0;
384382

385383
fail:

0 commit comments

Comments
 (0)