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>
This commit is contained in:
@ -848,7 +848,7 @@ struct drbd_tconn { /* is a resource from the config file */
|
|||||||
struct list_head out_of_sequence_requests;
|
struct list_head out_of_sequence_requests;
|
||||||
|
|
||||||
struct crypto_hash *cram_hmac_tfm;
|
struct crypto_hash *cram_hmac_tfm;
|
||||||
struct crypto_hash *integrity_tfm; /* checksums we compute */
|
struct crypto_hash *integrity_tfm; /* checksums we compute, updates protected by tconn->data->mutex */
|
||||||
struct crypto_hash *peer_integrity_tfm; /* checksums we verify */
|
struct crypto_hash *peer_integrity_tfm; /* checksums we verify */
|
||||||
struct crypto_hash *csums_tfm;
|
struct crypto_hash *csums_tfm;
|
||||||
struct crypto_hash *verify_tfm;
|
struct crypto_hash *verify_tfm;
|
||||||
|
@ -1720,11 +1720,11 @@ int drbd_send_dblock(struct drbd_conf *mdev, struct drbd_request *req)
|
|||||||
int dgs;
|
int dgs;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
|
sock = &mdev->tconn->data;
|
||||||
|
p = drbd_prepare_command(mdev, sock);
|
||||||
dgs = (mdev->tconn->agreed_pro_version >= 87 && mdev->tconn->integrity_tfm) ?
|
dgs = (mdev->tconn->agreed_pro_version >= 87 && mdev->tconn->integrity_tfm) ?
|
||||||
crypto_hash_digestsize(mdev->tconn->integrity_tfm) : 0;
|
crypto_hash_digestsize(mdev->tconn->integrity_tfm) : 0;
|
||||||
|
|
||||||
sock = &mdev->tconn->data;
|
|
||||||
p = drbd_prepare_command(mdev, sock);
|
|
||||||
if (!p)
|
if (!p)
|
||||||
return -EIO;
|
return -EIO;
|
||||||
p->sector = cpu_to_be64(req->i.sector);
|
p->sector = cpu_to_be64(req->i.sector);
|
||||||
@ -1793,11 +1793,12 @@ int drbd_send_block(struct drbd_conf *mdev, enum drbd_packet cmd,
|
|||||||
int err;
|
int err;
|
||||||
int dgs;
|
int dgs;
|
||||||
|
|
||||||
|
sock = &mdev->tconn->data;
|
||||||
|
p = drbd_prepare_command(mdev, sock);
|
||||||
|
|
||||||
dgs = (mdev->tconn->agreed_pro_version >= 87 && mdev->tconn->integrity_tfm) ?
|
dgs = (mdev->tconn->agreed_pro_version >= 87 && mdev->tconn->integrity_tfm) ?
|
||||||
crypto_hash_digestsize(mdev->tconn->integrity_tfm) : 0;
|
crypto_hash_digestsize(mdev->tconn->integrity_tfm) : 0;
|
||||||
|
|
||||||
sock = &mdev->tconn->data;
|
|
||||||
p = drbd_prepare_command(mdev, sock);
|
|
||||||
if (!p)
|
if (!p)
|
||||||
return -EIO;
|
return -EIO;
|
||||||
p->sector = cpu_to_be64(peer_req->i.sector);
|
p->sector = cpu_to_be64(peer_req->i.sector);
|
||||||
|
Reference in New Issue
Block a user