Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'ceph-for-4.14-rc2' of git://github.com/ceph/ceph-client

Pull ceph fixes from Ilya Dryomov:
"Two small but important fixes: RADOS semantic change in upcoming v12.2.1
release and a rare NULL dereference in create_session_open_msg()"

* tag 'ceph-for-4.14-rc2' of git://github.com/ceph/ceph-client:
ceph: avoid panic in create_session_open_msg() if utsname() returns NULL
libceph: don't allow bidirectional swap of pg-upmap-items

+31 -12
+4 -3
fs/ceph/mds_client.c
··· 7 7 #include <linux/sched.h> 8 8 #include <linux/debugfs.h> 9 9 #include <linux/seq_file.h> 10 - #include <linux/utsname.h> 11 10 #include <linux/ratelimit.h> 12 11 13 12 #include "super.h" ··· 883 884 void *p; 884 885 885 886 const char* metadata[][2] = { 886 - {"hostname", utsname()->nodename}, 887 - {"kernel_version", utsname()->release}, 887 + {"hostname", mdsc->nodename}, 888 + {"kernel_version", init_utsname()->release}, 888 889 {"entity_id", opt->name ? : ""}, 889 890 {"root", fsopt->server_path ? : "/"}, 890 891 {NULL, NULL} ··· 3538 3539 init_rwsem(&mdsc->pool_perm_rwsem); 3539 3540 mdsc->pool_perm_tree = RB_ROOT; 3540 3541 3542 + strncpy(mdsc->nodename, utsname()->nodename, 3543 + sizeof(mdsc->nodename) - 1); 3541 3544 return 0; 3542 3545 } 3543 3546
+3
fs/ceph/mds_client.h
··· 8 8 #include <linux/rbtree.h> 9 9 #include <linux/spinlock.h> 10 10 #include <linux/refcount.h> 11 + #include <linux/utsname.h> 11 12 12 13 #include <linux/ceph/types.h> 13 14 #include <linux/ceph/messenger.h> ··· 369 368 370 369 struct rw_semaphore pool_perm_rwsem; 371 370 struct rb_root pool_perm_tree; 371 + 372 + char nodename[__NEW_UTS_LEN + 1]; 372 373 }; 373 374 374 375 extern const char *ceph_mds_op_name(int op);
+24 -9
net/ceph/osdmap.c
··· 2445 2445 2446 2446 pg = lookup_pg_mapping(&osdmap->pg_upmap_items, pgid); 2447 2447 if (pg) { 2448 - for (i = 0; i < raw->size; i++) { 2449 - for (j = 0; j < pg->pg_upmap_items.len; j++) { 2450 - int from = pg->pg_upmap_items.from_to[j][0]; 2451 - int to = pg->pg_upmap_items.from_to[j][1]; 2448 + /* 2449 + * Note: this approach does not allow a bidirectional swap, 2450 + * e.g., [[1,2],[2,1]] applied to [0,1,2] -> [0,2,1]. 2451 + */ 2452 + for (i = 0; i < pg->pg_upmap_items.len; i++) { 2453 + int from = pg->pg_upmap_items.from_to[i][0]; 2454 + int to = pg->pg_upmap_items.from_to[i][1]; 2455 + int pos = -1; 2456 + bool exists = false; 2452 2457 2453 - if (from == raw->osds[i]) { 2454 - if (!(to != CRUSH_ITEM_NONE && 2455 - to < osdmap->max_osd && 2456 - osdmap->osd_weight[to] == 0)) 2457 - raw->osds[i] = to; 2458 + /* make sure replacement doesn't already appear */ 2459 + for (j = 0; j < raw->size; j++) { 2460 + int osd = raw->osds[j]; 2461 + 2462 + if (osd == to) { 2463 + exists = true; 2458 2464 break; 2459 2465 } 2466 + /* ignore mapping if target is marked out */ 2467 + if (osd == from && pos < 0 && 2468 + !(to != CRUSH_ITEM_NONE && 2469 + to < osdmap->max_osd && 2470 + osdmap->osd_weight[to] == 0)) { 2471 + pos = j; 2472 + } 2460 2473 } 2474 + if (!exists && pos >= 0) 2475 + raw->osds[pos] = to; 2461 2476 } 2462 2477 } 2463 2478 }