]> www.infradead.org Git - users/jedix/linux-maple.git/commit
block: fix bdi vs gendisk lifetime mismatch
authorShan Hai <shan.hai@oracle.com>
Fri, 30 Nov 2018 00:56:52 +0000 (08:56 +0800)
committerBrian Maly <brian.maly@oracle.com>
Tue, 4 Dec 2018 18:15:13 +0000 (13:15 -0500)
commit8cb3e03c37591f10a6ace2e02903ce6d6d685850
tree40638b1b4d481a89cd973f885ad9c880e535f69b
parent9ec205afdc75c37dbadf25d999bea3e15574b1ee
block: fix bdi vs gendisk lifetime mismatch

Orabug: 28945039

Inspired by upstream commit df08c32ce3be5be138c1dbfcba203314a3a7cd6f

The kABI breakage caused by the above upstream commit cannot be fixed
by the uek_abi facilities because it extends a data structure which is
embedded inside other data structures in block and filesystem codes.

This patch fixes the breakage by moving the "owner" field from
backing_dev_info to request_queue structure, it's safe to do this for
below reasons:
o the purpose of the upstream commit is just hold a reference to
  the gendisk in backing_dev_info to sync their lifetimes
o the backing_dev_info is embedded into the request_queue, which
  means their lifetimes are in sync
o so the lifetime of gendisk can be synced with any of request_queue
  or backing_dev_info
o syncing with request_queue does not break kABI
o we extended the request_queue structure previously and no third
  party binary driver breakage was reported

The reason why crafted another patch instead of cherry-picking the
upstream commit directly is that because including of blkdev.h
in mm/backing_dev.c broke kABI too, note it's just inclusion without
other changes.

Open coded the get/set of owner field of request_queue to reduce the
impact on blkdev.h to avoid other potential kABI breakage.

v2:
  o move put owner after bdi_destroy(), followed the suggestion from
    Ashish Samant <ashish.samant@oracle.com>
  o update inline comment

Signed-off-by: Shan Hai <shan.hai@oracle.com>
Reviewed-by: Ashish Samant <ashish.samant@oracle.com>
Signed-off-by: Brian Maly <brian.maly@oracle.com>
block/blk-core.c
block/genhd.c
include/linux/blkdev.h