mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-10 23:29:46 +00:00
Two small but important fixes: RADOS semantic change in upcoming v12.2.1
release and a rare NULL dereference in create_session_open_msg(). -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAABCAAGBQJZxQ4tAAoJEEp/3jgCEfOLnrEH+wXHfoLTTFPRfHtvp3E1X0j0 FGBYg/AuOejMOxXrP824XURjaPSV5GiNJA6g62GXf31Va7lmYfI5u+70XbdVluEm j1e8fT/qNfCizKq+dv8LyiPse6QDi+0siuxbLo7sMmJYODzrhKFWpbPsXabafCBc XFc3sk6J6wPoZynPsd2QtxXhrZpmQ7Xq+Us2u+pA7DZvtiZCRn0unqUPWV0vFl0j 7cPqPBX5LOSJoLNHmffXMQBqAWq1mErNs8islm+DIJvookhdlc0J5Qsu2a8lGrkP 57Sln1nr1vNJ2f2qUj2feOm02+Vcy2HFBuLL82kFAGJAVAvlDH7tiFlO3WdFvx4= =b0uS -----END PGP SIGNATURE----- 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
This commit is contained in:
commit
b03fcfaef3
@ -7,7 +7,6 @@
|
||||
#include <linux/sched.h>
|
||||
#include <linux/debugfs.h>
|
||||
#include <linux/seq_file.h>
|
||||
#include <linux/utsname.h>
|
||||
#include <linux/ratelimit.h>
|
||||
|
||||
#include "super.h"
|
||||
@ -884,8 +883,8 @@ static struct ceph_msg *create_session_open_msg(struct ceph_mds_client *mdsc, u6
|
||||
void *p;
|
||||
|
||||
const char* metadata[][2] = {
|
||||
{"hostname", utsname()->nodename},
|
||||
{"kernel_version", utsname()->release},
|
||||
{"hostname", mdsc->nodename},
|
||||
{"kernel_version", init_utsname()->release},
|
||||
{"entity_id", opt->name ? : ""},
|
||||
{"root", fsopt->server_path ? : "/"},
|
||||
{NULL, NULL}
|
||||
@ -3539,6 +3538,8 @@ int ceph_mdsc_init(struct ceph_fs_client *fsc)
|
||||
init_rwsem(&mdsc->pool_perm_rwsem);
|
||||
mdsc->pool_perm_tree = RB_ROOT;
|
||||
|
||||
strncpy(mdsc->nodename, utsname()->nodename,
|
||||
sizeof(mdsc->nodename) - 1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include <linux/rbtree.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/refcount.h>
|
||||
#include <linux/utsname.h>
|
||||
|
||||
#include <linux/ceph/types.h>
|
||||
#include <linux/ceph/messenger.h>
|
||||
@ -368,6 +369,8 @@ struct ceph_mds_client {
|
||||
|
||||
struct rw_semaphore pool_perm_rwsem;
|
||||
struct rb_root pool_perm_tree;
|
||||
|
||||
char nodename[__NEW_UTS_LEN + 1];
|
||||
};
|
||||
|
||||
extern const char *ceph_mds_op_name(int op);
|
||||
|
@ -2445,19 +2445,34 @@ static void apply_upmap(struct ceph_osdmap *osdmap,
|
||||
|
||||
pg = lookup_pg_mapping(&osdmap->pg_upmap_items, pgid);
|
||||
if (pg) {
|
||||
for (i = 0; i < raw->size; i++) {
|
||||
for (j = 0; j < pg->pg_upmap_items.len; j++) {
|
||||
int from = pg->pg_upmap_items.from_to[j][0];
|
||||
int to = pg->pg_upmap_items.from_to[j][1];
|
||||
/*
|
||||
* Note: this approach does not allow a bidirectional swap,
|
||||
* e.g., [[1,2],[2,1]] applied to [0,1,2] -> [0,2,1].
|
||||
*/
|
||||
for (i = 0; i < pg->pg_upmap_items.len; i++) {
|
||||
int from = pg->pg_upmap_items.from_to[i][0];
|
||||
int to = pg->pg_upmap_items.from_to[i][1];
|
||||
int pos = -1;
|
||||
bool exists = false;
|
||||
|
||||
if (from == raw->osds[i]) {
|
||||
if (!(to != CRUSH_ITEM_NONE &&
|
||||
to < osdmap->max_osd &&
|
||||
osdmap->osd_weight[to] == 0))
|
||||
raw->osds[i] = to;
|
||||
/* make sure replacement doesn't already appear */
|
||||
for (j = 0; j < raw->size; j++) {
|
||||
int osd = raw->osds[j];
|
||||
|
||||
if (osd == to) {
|
||||
exists = true;
|
||||
break;
|
||||
}
|
||||
/* ignore mapping if target is marked out */
|
||||
if (osd == from && pos < 0 &&
|
||||
!(to != CRUSH_ITEM_NONE &&
|
||||
to < osdmap->max_osd &&
|
||||
osdmap->osd_weight[to] == 0)) {
|
||||
pos = j;
|
||||
}
|
||||
}
|
||||
if (!exists && pos >= 0)
|
||||
raw->osds[pos] = to;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user