<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/block/blk-map.c, branch v5.10</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v5.10</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v5.10'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2020-09-23T15:18:39Z</updated>
<entry>
<title>block: fix bmd-&gt;is_null_mapped initialization</title>
<updated>2020-09-23T15:18:39Z</updated>
<author>
<name>Christoph Hellwig</name>
<email>hch@lst.de</email>
</author>
<published>2020-09-23T15:07:13Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=0385971754f0aa0507ecd7f0a0f4a48781906eda'/>
<id>urn:sha1:0385971754f0aa0507ecd7f0a0f4a48781906eda</id>
<content type='text'>
bmd is allocated using kmalloc in bio_alloc_map_data, so make sure
is_null_mapped is properly initialized to false for the !null_mapped
case.

Fixes: f3256075ba49 ("block: remove the BIO_NULL_MAPPED flag")
Reported-by: Marc Hartmayer &lt;mhartmay@linux.ibm.com&gt;
Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>block: remove the BIO_USER_MAPPED flag</title>
<updated>2020-09-01T22:49:26Z</updated>
<author>
<name>Christoph Hellwig</name>
<email>hch@lst.de</email>
</author>
<published>2020-08-27T15:37:48Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=3310eebafe6f9a872c1f757b3d822dafae9c0cd8'/>
<id>urn:sha1:3310eebafe6f9a872c1f757b3d822dafae9c0cd8</id>
<content type='text'>
Just check if there is private data, in which case the bio must have
originated from bio_copy_user_iov.

Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>block: remove __blk_rq_map_user_iov</title>
<updated>2020-09-01T22:49:25Z</updated>
<author>
<name>Christoph Hellwig</name>
<email>hch@lst.de</email>
</author>
<published>2020-08-27T15:37:47Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=7589ad6729d6a707c6ce97693106d42cbb121b42'/>
<id>urn:sha1:7589ad6729d6a707c6ce97693106d42cbb121b42</id>
<content type='text'>
Just duplicate a small amount of code in the low-level map into the bio
and copy to the bio routines, leading to much easier to follow and
maintain code, and better shared error handling.

Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>block: remove __blk_rq_unmap_user</title>
<updated>2020-09-01T22:49:25Z</updated>
<author>
<name>Christoph Hellwig</name>
<email>hch@lst.de</email>
</author>
<published>2020-08-27T15:37:46Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=7b63c052a580d7d5ed83a6e2a327e85881fa679a'/>
<id>urn:sha1:7b63c052a580d7d5ed83a6e2a327e85881fa679a</id>
<content type='text'>
Open code __blk_rq_unmap_user in the two callers.  Both never pass a NULL
bio, and one of them can use an existing local variable instead of the bio
flag.

Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>block: remove the BIO_NULL_MAPPED flag</title>
<updated>2020-09-01T22:49:25Z</updated>
<author>
<name>Christoph Hellwig</name>
<email>hch@lst.de</email>
</author>
<published>2020-08-27T15:37:45Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=f3256075ba49d80835b601bfbff350a2140b2924'/>
<id>urn:sha1:f3256075ba49d80835b601bfbff350a2140b2924</id>
<content type='text'>
We can simply use a boolean flag in the bio_map_data data structure
instead.

Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>block: Inline encryption support for blk-mq</title>
<updated>2020-05-14T15:47:53Z</updated>
<author>
<name>Satya Tangirala</name>
<email>satyat@google.com</email>
</author>
<published>2020-05-14T00:37:18Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=a892c8d52c02284076fbbacae6692aa5c5807d11'/>
<id>urn:sha1:a892c8d52c02284076fbbacae6692aa5c5807d11</id>
<content type='text'>
We must have some way of letting a storage device driver know what
encryption context it should use for en/decrypting a request. However,
it's the upper layers (like the filesystem/fscrypt) that know about and
manages encryption contexts. As such, when the upper layer submits a bio
to the block layer, and this bio eventually reaches a device driver with
support for inline encryption, the device driver will need to have been
told the encryption context for that bio.

We want to communicate the encryption context from the upper layer to the
storage device along with the bio, when the bio is submitted to the block
layer. To do this, we add a struct bio_crypt_ctx to struct bio, which can
represent an encryption context (note that we can't use the bi_private
field in struct bio to do this because that field does not function to pass
information across layers in the storage stack). We also introduce various
functions to manipulate the bio_crypt_ctx and make the bio/request merging
logic aware of the bio_crypt_ctx.

We also make changes to blk-mq to make it handle bios with encryption
contexts. blk-mq can merge many bios into the same request. These bios need
to have contiguous data unit numbers (the necessary changes to blk-merge
are also made to ensure this) - as such, it suffices to keep the data unit
number of just the first bio, since that's all a storage driver needs to
infer the data unit number to use for each data block in each bio in a
request. blk-mq keeps track of the encryption context to be used for all
the bios in a request with the request's rq_crypt_ctx. When the first bio
is added to an empty request, blk-mq will program the encryption context
of that bio into the request_queue's keyslot manager, and store the
returned keyslot in the request's rq_crypt_ctx. All the functions to
operate on encryption contexts are in blk-crypto.c.

Upper layers only need to call bio_crypt_set_ctx with the encryption key,
algorithm and data_unit_num; they don't have to worry about getting a
keyslot for each encryption context, as blk-mq/blk-crypto handles that.
Blk-crypto also makes it possible for request-based layered devices like
dm-rq to make use of inline encryption hardware by cloning the
rq_crypt_ctx and programming a keyslot in the new request_queue when
necessary.

Note that any user of the block layer can submit bios with an
encryption context, such as filesystems, device-mapper targets, etc.

Signed-off-by: Satya Tangirala &lt;satyat@google.com&gt;
Reviewed-by: Eric Biggers &lt;ebiggers@google.com&gt;
Reviewed-by: Christoph Hellwig &lt;hch@lst.de&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>block: rename __bio_add_pc_page to bio_add_hw_page</title>
<updated>2020-05-13T02:36:28Z</updated>
<author>
<name>Christoph Hellwig</name>
<email>hch@lst.de</email>
</author>
<published>2020-05-12T08:55:46Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=e4581105771b3523ced88f781eb2672195d217aa'/>
<id>urn:sha1:e4581105771b3523ced88f781eb2672195d217aa</id>
<content type='text'>
Rename __bio_add_pc_page() to bio_add_hw_page() and explicitly pass in a
max_sectors argument.

This max_sectors argument can be used to specify constraints from the
hardware.

Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
[ jth: rebased and made public for blk-map.c ]
Signed-off-by: Johannes Thumshirn &lt;johannes.thumshirn@wdc.com&gt;
Reviewed-by: Daniel Wagner &lt;dwagner@suse.de&gt;
Reviewed-by: Martin K. Petersen &lt;martin.petersen@oracle.com&gt;
Reviewed-by: Hannes Reinecke &lt;hare@suse.de&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>block: remove RQF_COPY_USER</title>
<updated>2020-04-22T16:47:06Z</updated>
<author>
<name>Christoph Hellwig</name>
<email>hch@lst.de</email>
</author>
<published>2020-04-14T07:42:21Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=e64a0e16928415648d53d721b3d6fc3635eddf92'/>
<id>urn:sha1:e64a0e16928415648d53d721b3d6fc3635eddf92</id>
<content type='text'>
The RQF_COPY_USER is set for bio where the passthrough request mapping
helpers decided that bounce buffering is required.  It is then used to
pad scatterlist for drivers that required it.  But given that
non-passthrough requests are per definition aligned, and directly mapped
pass-through request must be aligned it is not actually required at all.

Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>block: move bio_map_* to blk-map.c</title>
<updated>2020-03-27T18:04:34Z</updated>
<author>
<name>Christoph Hellwig</name>
<email>hch@lst.de</email>
</author>
<published>2020-03-27T17:48:37Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=130879f1ee0e25b0391b8c78b3baac6fe41f4d38'/>
<id>urn:sha1:130879f1ee0e25b0391b8c78b3baac6fe41f4d38</id>
<content type='text'>
The bio_map_* helpers are just the low-level helpers for the
blk_rq_map_* APIs.  Move them together for better logical grouping,
as no there isn't much overlap with other code in bio.c.

Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>block: fix memleak when __blk_rq_map_user_iov() is failed</title>
<updated>2019-12-20T18:52:01Z</updated>
<author>
<name>Yang Yingliang</name>
<email>yangyingliang@huawei.com</email>
</author>
<published>2019-12-18T08:44:04Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=3b7995a98ad76da5597b488fa84aa5a56d43b608'/>
<id>urn:sha1:3b7995a98ad76da5597b488fa84aa5a56d43b608</id>
<content type='text'>
When I doing fuzzy test, get the memleak report:

BUG: memory leak
unreferenced object 0xffff88837af80000 (size 4096):
  comm "memleak", pid 3557, jiffies 4294817681 (age 112.499s)
  hex dump (first 32 bytes):
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    20 00 00 00 10 01 00 00 00 00 00 00 01 00 00 00   ...............
  backtrace:
    [&lt;000000001c894df8&gt;] bio_alloc_bioset+0x393/0x590
    [&lt;000000008b139a3c&gt;] bio_copy_user_iov+0x300/0xcd0
    [&lt;00000000a998bd8c&gt;] blk_rq_map_user_iov+0x2f1/0x5f0
    [&lt;000000005ceb7f05&gt;] blk_rq_map_user+0xf2/0x160
    [&lt;000000006454da92&gt;] sg_common_write.isra.21+0x1094/0x1870
    [&lt;00000000064bb208&gt;] sg_write.part.25+0x5d9/0x950
    [&lt;000000004fc670f6&gt;] sg_write+0x5f/0x8c
    [&lt;00000000b0d05c7b&gt;] __vfs_write+0x7c/0x100
    [&lt;000000008e177714&gt;] vfs_write+0x1c3/0x500
    [&lt;0000000087d23f34&gt;] ksys_write+0xf9/0x200
    [&lt;000000002c8dbc9d&gt;] do_syscall_64+0x9f/0x4f0
    [&lt;00000000678d8e9a&gt;] entry_SYSCALL_64_after_hwframe+0x49/0xbe

If __blk_rq_map_user_iov() is failed in blk_rq_map_user_iov(),
the bio(s) which is allocated before this failing will leak. The
refcount of the bio(s) is init to 1 and increased to 2 by calling
bio_get(), but __blk_rq_unmap_user() only decrease it to 1, so
the bio cannot be freed. Fix it by calling blk_rq_unmap_user().

Reviewed-by: Bob Liu &lt;bob.liu@oracle.com&gt;
Reported-by: Hulk Robot &lt;hulkci@huawei.com&gt;
Signed-off-by: Yang Yingliang &lt;yangyingliang@huawei.com&gt;
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
</feed>
