Skip to content

Commit

Permalink
rbd: initialize snap_rwsem in rbd_add()
Browse files Browse the repository at this point in the history
New rbd device structures get initialized in rbd_add().  Many of
the fields rely on being initially zero-filled.  However we lockdep
was noticing that the rw_semaphore embedded in the header field
was not getting properly initialized.  Fix that.

Signed-off-by: Alex Elder <elder@dreamhost.com>
Signed-off-by: Sage Weil <sage@newdream.net>
  • Loading branch information
Alex Elder authored and Sage Weil committed Jan 12, 2012
1 parent a40dc6c commit 0e805a1
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/block/rbd.c
Original file line number Diff line number Diff line change
Expand Up @@ -2184,6 +2184,8 @@ static ssize_t rbd_add(struct bus_type *bus,
INIT_LIST_HEAD(&rbd_dev->node);
INIT_LIST_HEAD(&rbd_dev->snaps);

init_rwsem(&rbd_dev->header.snap_rwsem);

/* generate unique id: find highest unique id, add one */
mutex_lock_nested(&ctl_mutex, SINGLE_DEPTH_NESTING);

Expand Down

0 comments on commit 0e805a1

Please sign in to comment.