diff options
author | Philipp Reisner <philipp.reisner@linbit.com> | 2011-05-16 06:57:15 -0400 |
---|---|---|
committer | Philipp Reisner <philipp.reisner@linbit.com> | 2012-11-08 10:55:52 -0500 |
commit | 46e1ce4177aac86b8e39bc7bb5763e9d040ae5cb (patch) | |
tree | a5d277ef1bd84a141edd7e7ad8597ac7fda24176 /drivers/block/drbd/drbd_main.c | |
parent | dcb20d1a8e7d9602e52a9b673ae4d7f746d2cbb2 (diff) |
drbd: protect updates to integrits_tfm by tconn->data->mutex
Since we need to hold that mutex anyways to make sure the peer
gets that change in the right position in the data stream,
it makes a lot of sense to use the same mutex to ensure existence
of the tfm.
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
Diffstat (limited to 'drivers/block/drbd/drbd_main.c')
-rw-r--r-- | drivers/block/drbd/drbd_main.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c index 26d7763d5255..bca599a3c1e1 100644 --- a/drivers/block/drbd/drbd_main.c +++ b/drivers/block/drbd/drbd_main.c | |||
@@ -1720,11 +1720,11 @@ int drbd_send_dblock(struct drbd_conf *mdev, struct drbd_request *req) | |||
1720 | int dgs; | 1720 | int dgs; |
1721 | int err; | 1721 | int err; |
1722 | 1722 | ||
1723 | sock = &mdev->tconn->data; | ||
1724 | p = drbd_prepare_command(mdev, sock); | ||
1723 | dgs = (mdev->tconn->agreed_pro_version >= 87 && mdev->tconn->integrity_tfm) ? | 1725 | dgs = (mdev->tconn->agreed_pro_version >= 87 && mdev->tconn->integrity_tfm) ? |
1724 | crypto_hash_digestsize(mdev->tconn->integrity_tfm) : 0; | 1726 | crypto_hash_digestsize(mdev->tconn->integrity_tfm) : 0; |
1725 | 1727 | ||
1726 | sock = &mdev->tconn->data; | ||
1727 | p = drbd_prepare_command(mdev, sock); | ||
1728 | if (!p) | 1728 | if (!p) |
1729 | return -EIO; | 1729 | return -EIO; |
1730 | p->sector = cpu_to_be64(req->i.sector); | 1730 | p->sector = cpu_to_be64(req->i.sector); |
@@ -1793,11 +1793,12 @@ int drbd_send_block(struct drbd_conf *mdev, enum drbd_packet cmd, | |||
1793 | int err; | 1793 | int err; |
1794 | int dgs; | 1794 | int dgs; |
1795 | 1795 | ||
1796 | sock = &mdev->tconn->data; | ||
1797 | p = drbd_prepare_command(mdev, sock); | ||
1798 | |||
1796 | dgs = (mdev->tconn->agreed_pro_version >= 87 && mdev->tconn->integrity_tfm) ? | 1799 | dgs = (mdev->tconn->agreed_pro_version >= 87 && mdev->tconn->integrity_tfm) ? |
1797 | crypto_hash_digestsize(mdev->tconn->integrity_tfm) : 0; | 1800 | crypto_hash_digestsize(mdev->tconn->integrity_tfm) : 0; |
1798 | 1801 | ||
1799 | sock = &mdev->tconn->data; | ||
1800 | p = drbd_prepare_command(mdev, sock); | ||
1801 | if (!p) | 1802 | if (!p) |
1802 | return -EIO; | 1803 | return -EIO; |
1803 | p->sector = cpu_to_be64(peer_req->i.sector); | 1804 | p->sector = cpu_to_be64(peer_req->i.sector); |