Skip to content

Commit

Permalink
rbd: protect read of snapshot sequence number
Browse files Browse the repository at this point in the history
This is updated whenever a snapshot is added or deleted, and the
snapc pointer is changed with every refresh of the header.

Signed-off-by: Josh Durgin <josh.durgin@dreamhost.com>
Reviewed-by: Alex Elder <elder@dreamhost.com>
Reviewed-by: Yehuda Sadeh <yehuda@hq.newdream.net>
  • Loading branch information
Josh Durgin authored and Alex Elder committed May 14, 2012
1 parent 50f7c4c commit 403f24d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/block/rbd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1684,7 +1684,9 @@ static int rbd_header_add_snap(struct rbd_device *dev,
if (ret < 0)
return ret;

dev->header.snapc->seq = new_snapid;
down_write(&dev->header_rwsem);
dev->header.snapc->seq = new_snapid;
up_write(&dev->header_rwsem);

return 0;
bad:
Expand Down

0 comments on commit 403f24d

Please sign in to comment.