summaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorAndrey Markovytch <andreym@codeaurora.org>2016-09-13 18:45:47 +0300
committerGerrit - the friendly Code Review server <code-review@localhost>2016-09-15 00:36:43 -0700
commita8059e6d39ecfab6c90abc8a7502652907cdf258 (patch)
tree11d54be9862c3e7c0941e53f72a6b9a876319393 /block
parent9b82a4c5896632b62140d1ddda55638fea254007 (diff)
ext4 crypto: enable HW based encryption with ICE
Numerous changes were introduced to various layers: Block: removed dependency on selinux module for decision on bio merge EXT4: Added feature controlled support for HW encryption PFK: Major re-factoring, separation to eCryptfs and EXT4 sub-layers Change-Id: I9256c8736e1c16175fe3f94733dda430ccc57980 Signed-off-by: Andrey Markovytch <andreym@codeaurora.org>
Diffstat (limited to 'block')
-rw-r--r--block/blk-merge.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/block/blk-merge.c b/block/blk-merge.c
index 6e189a49dca6..2b27747b46d3 100644
--- a/block/blk-merge.c
+++ b/block/blk-merge.c
@@ -6,7 +6,8 @@
#include <linux/bio.h>
#include <linux/blkdev.h>
#include <linux/scatterlist.h>
-#include <linux/security.h>
+#include <linux/pfk.h>
+#include <linux/pft.h>
#include "blk.h"
@@ -729,6 +730,12 @@ static void blk_account_io_merge(struct request *req)
}
}
+static bool crypto_not_mergeable(const struct bio *bio, const struct bio *nxt)
+{
+ return (!pft_allow_merge_bio(bio, nxt) ||
+ !pfk_allow_merge_bio(bio, nxt));
+}
+
/*
* Has to be called with the request spinlock acquired
*/
@@ -756,6 +763,9 @@ static int attempt_merge(struct request_queue *q, struct request *req,
!blk_write_same_mergeable(req->bio, next->bio))
return 0;
+ if (crypto_not_mergeable(req->bio, next->bio))
+ return 0;
+
/*
* If we are allowed to merge, then append bio list
* from next to rq and release next. merge_requests_fn
@@ -860,11 +870,9 @@ bool blk_rq_merge_ok(struct request *rq, struct bio *bio)
!blk_write_same_mergeable(rq->bio, bio))
return false;
- /* Don't merge bios of files with different encryption */
- if (!security_allow_merge_bio(rq->bio, bio))
+ if (crypto_not_mergeable(rq->bio, bio))
return false;
-
return true;
}