Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

fs: ecryptfs: Use crypto_wait_req

This patch replaces the custom crypto completion function with
crypto_req_done.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Acked-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

+3 -27
+3 -27
fs/ecryptfs/crypto.c
··· 260 260 return i; 261 261 } 262 262 263 - struct extent_crypt_result { 264 - struct completion completion; 265 - int rc; 266 - }; 267 - 268 - static void extent_crypt_complete(struct crypto_async_request *req, int rc) 269 - { 270 - struct extent_crypt_result *ecr = req->data; 271 - 272 - if (rc == -EINPROGRESS) 273 - return; 274 - 275 - ecr->rc = rc; 276 - complete(&ecr->completion); 277 - } 278 - 279 263 /** 280 264 * crypt_scatterlist 281 265 * @crypt_stat: Pointer to the crypt_stat struct to initialize. ··· 277 293 unsigned char *iv, int op) 278 294 { 279 295 struct skcipher_request *req = NULL; 280 - struct extent_crypt_result ecr; 296 + DECLARE_CRYPTO_WAIT(ecr); 281 297 int rc = 0; 282 298 283 299 if (unlikely(ecryptfs_verbosity > 0)) { ··· 286 302 ecryptfs_dump_hex(crypt_stat->key, 287 303 crypt_stat->key_size); 288 304 } 289 - 290 - init_completion(&ecr.completion); 291 305 292 306 mutex_lock(&crypt_stat->cs_tfm_mutex); 293 307 req = skcipher_request_alloc(crypt_stat->tfm, GFP_NOFS); ··· 297 315 298 316 skcipher_request_set_callback(req, 299 317 CRYPTO_TFM_REQ_MAY_BACKLOG | CRYPTO_TFM_REQ_MAY_SLEEP, 300 - extent_crypt_complete, &ecr); 318 + crypto_req_done, &ecr); 301 319 /* Consider doing this once, when the file is opened */ 302 320 if (!(crypt_stat->flags & ECRYPTFS_KEY_SET)) { 303 321 rc = crypto_skcipher_setkey(crypt_stat->tfm, crypt_stat->key, ··· 316 334 skcipher_request_set_crypt(req, src_sg, dst_sg, size, iv); 317 335 rc = op == ENCRYPT ? crypto_skcipher_encrypt(req) : 318 336 crypto_skcipher_decrypt(req); 319 - if (rc == -EINPROGRESS || rc == -EBUSY) { 320 - struct extent_crypt_result *ecr = req->base.data; 321 - 322 - wait_for_completion(&ecr->completion); 323 - rc = ecr->rc; 324 - reinit_completion(&ecr->completion); 325 - } 337 + rc = crypto_wait_req(rc, &ecr); 326 338 out: 327 339 skcipher_request_free(req); 328 340 return rc;