浏览代码

dm crypt: move dec_pending on error into write_io_submit

Make kcryptd_crypt_write_io_submit() responsible for decrementing
the pending count after an error.

Also fixes a bug in the async path that forgot to decrement it.

Signed-off-by: Milan Broz <mbroz@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Milan Broz 17 年之前
父节点
当前提交
6c031f41db
共有 1 个文件被更改,包括 2 次插入3 次删除
  1. 2 3
      drivers/md/dm-crypt.c

+ 2 - 3
drivers/md/dm-crypt.c

@@ -674,6 +674,7 @@ static void kcryptd_crypt_write_io_submit(struct dm_crypt_io *io,
 		crypt_free_buffer_pages(cc, clone);
 		crypt_free_buffer_pages(cc, clone);
 		bio_put(clone);
 		bio_put(clone);
 		io->error = -EIO;
 		io->error = -EIO;
+		crypt_dec_pending(io);
 		return;
 		return;
 	}
 	}
 
 
@@ -724,10 +725,8 @@ static void kcryptd_crypt_write_convert(struct dm_crypt_io *io)
 			/* processed, no running async crypto  */
 			/* processed, no running async crypto  */
 			crypt_inc_pending(io);
 			crypt_inc_pending(io);
 			kcryptd_crypt_write_io_submit(io, r, 0);
 			kcryptd_crypt_write_io_submit(io, r, 0);
-			if (unlikely(r < 0)) {
-				crypt_dec_pending(io);
+			if (unlikely(r < 0))
 				break;
 				break;
-			}
 		} else
 		} else
 			crypt_inc_pending(io);
 			crypt_inc_pending(io);