Skip to content

Commit

Permalink
Merge tag 'dm-4.10-fixes' of git://git.kernel.org/pub/scm/linux/kerne…
Browse files Browse the repository at this point in the history
…l/git/device-mapper/linux-dm

Pull device mapper fixes from Mike Snitzer:

 - a fix for a race in .request_fn request-based DM request handling vs
   DM device destruction

 - an RCU fix for dm-crypt's kernel keyring support that was included in
   4.10-rc1

 - a -Wbool-operation warning fix for DM multipath

* tag 'dm-4.10-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm:
  dm crypt: replace RCU read-side section with rwsem
  dm rq: cope with DM device destruction while in dm_old_request_fn()
  dm mpath: cleanup -Wbool-operation warning in choose_pgpath()
  • Loading branch information
Linus Torvalds committed Feb 6, 2017
2 parents 72df5eb + f5b0cba commit 50dcb6c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
8 changes: 4 additions & 4 deletions drivers/md/dm-crypt.c
Original file line number Diff line number Diff line change
Expand Up @@ -1534,26 +1534,26 @@ static int crypt_set_keyring_key(struct crypt_config *cc, const char *key_string
return PTR_ERR(key);
}

rcu_read_lock();
down_read(&key->sem);

ukp = user_key_payload(key);
if (!ukp) {
rcu_read_unlock();
up_read(&key->sem);
key_put(key);
kzfree(new_key_string);
return -EKEYREVOKED;
}

if (cc->key_size != ukp->datalen) {
rcu_read_unlock();
up_read(&key->sem);
key_put(key);
kzfree(new_key_string);
return -EINVAL;
}

memcpy(cc->key, ukp->data, cc->key_size);

rcu_read_unlock();
up_read(&key->sem);
key_put(key);

/* clear the flag since following operations may invalidate previously valid key */
Expand Down
4 changes: 2 additions & 2 deletions drivers/md/dm-mpath.c
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ static struct pgpath *choose_pgpath(struct multipath *m, size_t nr_bytes)
unsigned long flags;
struct priority_group *pg;
struct pgpath *pgpath;
bool bypassed = true;
unsigned bypassed = 1;

if (!atomic_read(&m->nr_valid_paths)) {
clear_bit(MPATHF_QUEUE_IO, &m->flags);
Expand Down Expand Up @@ -466,7 +466,7 @@ static struct pgpath *choose_pgpath(struct multipath *m, size_t nr_bytes)
*/
do {
list_for_each_entry(pg, &m->priority_groups, list) {
if (pg->bypassed == bypassed)
if (pg->bypassed == !!bypassed)
continue;
pgpath = choose_path_in_pg(m, pg, nr_bytes);
if (!IS_ERR_OR_NULL(pgpath)) {
Expand Down
4 changes: 4 additions & 0 deletions drivers/md/dm-rq.c
Original file line number Diff line number Diff line change
Expand Up @@ -779,6 +779,10 @@ static void dm_old_request_fn(struct request_queue *q)
int srcu_idx;
struct dm_table *map = dm_get_live_table(md, &srcu_idx);

if (unlikely(!map)) {
dm_put_live_table(md, srcu_idx);
return;
}
ti = dm_table_find_target(map, pos);
dm_put_live_table(md, srcu_idx);
}
Expand Down

0 comments on commit 50dcb6c

Please sign in to comment.