History

Merge tag 'ceph-for-6.10-rc8' of https://github.com/ceph/ceph-client

Pull ceph fixes from Ilya Dryomov: "A fix for a possible use-after-free following "rbd unmap" or "umount" marked for stable and two kernel-doc fixups" * tag 'ceph-for-6.10-rc8' of https://github.com/ceph/ceph-client: libceph: fix crush_choose_firstn() kernel-doc warnings libceph: suppress crush_choose_indep() kernel-doc warnings libceph: fix race between delayed_work() and ceph_monc_stop()

Linus Torvalds committed 2 years ago

Commit a52ff902 parents ac6a9e0 359bc012 files · +17 −4Browse files

Unified · Split

2 files
  1. net/ceph/crush/mapper.c +5 −2
  2. net/ceph/mon_client.c +12 −2
net/ceph/crush/mapper.c+5−2
@@ -429,7 +429,10 @@ static int is_out(const struct crush_map *map, · 428 unmodified lines
429429 /**
430430 * crush_choose_firstn - choose numrep distinct items of given type
431431 * @map: the crush_map
432+ * @work: working space initialized by crush_init_workspace()
432433 * @bucket: the bucket we are choose an item from
434+ * @weight: weight vector (for map leaves)
435+ * @weight_max: size of weight vector
433436 * @x: crush input value
434437 * @numrep: the number of items to choose
435438 * @type: the type of item to choose
@@ -445,6 +448,7 @@ static int is_out(const struct crush_map *map, · 9 unmodified lines
445448 * @vary_r: pass r to recursive calls
446449 * @out2: second output vector for leaf items (if @recurse_to_leaf)
447450 * @parent_r: r value passed from the parent
451+ * @choose_args: weights and ids for each known bucket
448452 */
449453 static int crush_choose_firstn(const struct crush_map *map,
450454 struct crush_work *work,
@@ -636,9 +640,8 @@ reject: · 185 unmodified lines
636640 }
637641
638642
639−/**
643+/*
640644 * crush_choose_indep: alternative breadth-first positionally stable mapping
641− *
642645 */
643646 static void crush_choose_indep(const struct crush_map *map,
644647 struct crush_work *work,
net/ceph/mon_client.c+12−2
@@ -1085,13 +1085,19 @@ static void delayed_work(struct work_struct *work) · 1084 unmodified lines
10851085 struct ceph_mon_client *monc =
10861086 container_of(work, struct ceph_mon_client, delayed_work.work);
10871087
1088− dout("monc delayed_work\n");
10891088 mutex_lock(&monc->mutex);
1089+ dout("%s mon%d\n", __func__, monc->cur_mon);
1090+ if (monc->cur_mon < 0) {
1091+ goto out;
1092+ }
1093+
10901094 if (monc->hunting) {
10911095 dout("%s continuing hunt\n", __func__);
10921096 reopen_session(monc);
10931097 } else {
10941098 int is_auth = ceph_auth_is_authenticated(monc->auth);
1099+
1100+ dout("%s is_authed %d\n", __func__, is_auth);
10951101 if (ceph_con_keepalive_expired(&monc->con,
10961102 CEPH_MONC_PING_TIMEOUT)) {
10971103 dout("monc keepalive timeout\n");
@@ -1116,6 +1122,8 @@ static void delayed_work(struct work_struct *work) · 18 unmodified lines
11161122 }
11171123 }
11181124 __schedule_delayed(monc);
1125+
1126+out:
11191127 mutex_unlock(&monc->mutex);
11201128 }
11211129
@@ -1232,13 +1240,15 @@ EXPORT_SYMBOL(ceph_monc_init); · 110 unmodified lines
12321240 void ceph_monc_stop(struct ceph_mon_client *monc)
12331241 {
12341242 dout("stop\n");
1235− cancel_delayed_work_sync(&monc->delayed_work);
12361243
12371244 mutex_lock(&monc->mutex);
12381245 __close_session(monc);
1246+ monc->hunting = false;
12391247 monc->cur_mon = -1;
12401248 mutex_unlock(&monc->mutex);
12411249
1250+ cancel_delayed_work_sync(&monc->delayed_work);
1251+
12421252 /*
12431253 * flush msgr queue before we destroy ourselves to ensure that:
12441254 * - any work that references our embedded con is finished.