Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 359579
b: refs/heads/master
c: d78b650
h: refs/heads/master
i:
  359577: 02b46cf
  359575: f51d92c
v: v3
  • Loading branch information
Alex Elder committed Jan 17, 2013
1 parent 64424ba commit 3901d8c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b395e8b5b8f06399e3fe3ee016c9cf41ff665efc
refs/heads/master: d78b650a595e23e5a115d332e3c37e019baf7703
9 changes: 5 additions & 4 deletions trunk/drivers/block/rbd.c
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ struct rbd_device {
spinlock_t lock; /* queue lock */

struct rbd_image_header header;
bool exists;
atomic_t exists;
struct rbd_spec *spec;

char *header_name;
Expand Down Expand Up @@ -751,7 +751,7 @@ static int rbd_dev_set_mapping(struct rbd_device *rbd_dev)
goto done;
rbd_dev->mapping.read_only = true;
}
rbd_dev->exists = true;
atomic_set(&rbd_dev->exists, 1);
done:
return ret;
}
Expand Down Expand Up @@ -1671,7 +1671,7 @@ static void rbd_rq_fn(struct request_queue *q)
/* Grab a reference to the snapshot context */

down_read(&rbd_dev->header_rwsem);
if (rbd_dev->exists) {
if (atomic_read(&rbd_dev->exists)) {
snapc = ceph_get_snap_context(rbd_dev->header.snapc);
rbd_assert(snapc != NULL);
}
Expand Down Expand Up @@ -2294,6 +2294,7 @@ struct rbd_device *rbd_dev_create(struct rbd_client *rbdc,
return NULL;

spin_lock_init(&rbd_dev->lock);
atomic_set(&rbd_dev->exists, 0);
INIT_LIST_HEAD(&rbd_dev->node);
INIT_LIST_HEAD(&rbd_dev->snaps);
init_rwsem(&rbd_dev->header_rwsem);
Expand Down Expand Up @@ -2918,7 +2919,7 @@ static int rbd_dev_snaps_update(struct rbd_device *rbd_dev)
/* Existing snapshot not in the new snap context */

if (rbd_dev->spec->snap_id == snap->id)
rbd_dev->exists = false;
atomic_set(&rbd_dev->exists, 0);
rbd_remove_snap_dev(snap);
dout("%ssnap id %llu has been removed\n",
rbd_dev->spec->snap_id == snap->id ?
Expand Down

0 comments on commit 3901d8c

Please sign in to comment.