summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorJosh Durgin <josh.durgin@dreamhost.com>2011-12-05 10:47:13 -0800
committerAlex Elder <elder@dreamhost.com>2012-05-14 12:12:46 -0500
commit403f24d3d51760a8b9368d595fa5f48c309f1a0f (patch)
tree672324db44b12186b91235f293b971bb00cf377d /drivers
parent50f7c4c967d0b5acd8e7ba6ab654dc4a7ac869ac (diff)
rbd: protect read of snapshot sequence number
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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/block/rbd.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index a75fe93a25b1..5ab9f55d3e0c 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -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: