]> git.baikalelectronics.ru Git - kernel.git/commit
rbd: read image size for discard check safely
authorJosh Durgin <josh.durgin@inktank.com>
Fri, 4 Apr 2014 19:06:32 +0000 (12:06 -0700)
committerIlya Dryomov <idryomov@redhat.com>
Tue, 14 Oct 2014 17:03:32 +0000 (21:03 +0400)
commited9addf3f84ffb29de04c4702d74d2a957395272
tree2e03d9e6e1d75a8558610fcee226f6e1f9fe6fc4
parent0bed804a67b65b4a7e651f6a5ae14c2755a43dbd
rbd: read image size for discard check safely

In rbd_img_request_fill() the image size is only checked to determine
whether we can truncate an object instead of zeroing it for discard
requests. Take rbd_dev->header_rwsem while reading the image size, and
move this read into the discard check, so that non-discard ops don't
need to take the semaphore in this function.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
drivers/block/rbd.c