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>
This commit is contained in:
parent
50f7c4c967
commit
403f24d3d5
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue