Comment 18 for bug 1659111

Revision history for this message
bugproxy (bugproxy) wrote : backported patches

------- Comment on attachment From <email address hidden> 2017-04-05 12:17 EDT-------

Hello Canonical,

Here is an mbox file that can be used with git-am, containing all patches needed to fix this bug backported on top of tag Ubuntu-4.4.0-67.88. Most of the commits didn't have any conflicts, and the ones that did were simple to resolve. Each patch mentions the hash of the upstream commit it was cherry-picked from.

Lekshmi ran an I/O stress-test on them for more than 72h and didn't find any problem.

To fix this bug it's necessary to fix several issues with lifetime of structures in the block subsystem, as well as a number of related race conditions. Therefore, a number of patches needed to be backported:

The "BDI lifetime fix" v3 series?, which was already merged into Linus' tree:

f44f1ab5a2dc block: Unhash block device inodes on gendisk destruction
dc3b17cc8bf2 block: Use pointer to backing_dev_info from request_queue
d03f6cdc1fc4 block: Dynamically allocate and refcount backing_dev_info
b1d2dc5659b4 block: Make blk_get_backing_dev_info() safe without open bdev
efa7c9f97e3e block: Get rid of blk_get_backing_dev_info()

A follow up fix was merged for commits dc3b17cc8bf and b1d2dc5659b4:

a5a79d00017c block: Initialize bd_bdi on inode initialization

The first 4 patches from the "block: Fix block device shutdown related races" v2 series? were also merged:

4b8c861a7c79 block: Move bdev_unhash_inode() after invalidate_partition()
d06e05c026ab block: Unhash also block device inode for the whole device
cccd9fb9ec96 block: Revalidate i_bdev reference in bd_aquire()
165a5e22fafb block: Move bdi_unregister() to del_gendisk()

A few follow up fixes? were also merged for commit 165a5e22fafb:

b6f8fec4448a block: Allow bdi re-registration
df23de55615f bdi: Fix use-after-free in wb_congested_put()
90f16fddcc28 block: Make del_gendisk() safer for disks without queues

Commit df23de55615f depends on the following commit:

5f478e4ea5c5 block: fix double-free in the failure path of cgwb_bdi_init()

In addition to the commits mentioned above, we also need the patches from the "block: Fix block device shutdown related races" v5, which are queued for v4.12 in linux-block/for-4.12/block?:

03e262798884 block: Fix bdi assignment to bdev inode when racing with disk delete
b7d680d7bf58 bdi: Mark congested->bdi as internal
810df54a64fb bdi: Make wb->bdi a proper reference
e8cb72b322cf bdi: Unify bdi->wb_list handling for root wb_writeback
5318ce7d4686 bdi: Shutdown writeback on all cgwbs in cgwb_bdi_destroy()
4514451e79ae bdi: Do not wait for cgwbs release in bdi_unregister()
b1c51afc00f1 bdi: Rename cgwb_bdi_destroy() to cgwb_bdi_unregister()
f759741d9d91 block: Fix oops in locked_inode_to_wb_and_lock_list()
c70c176ff8c3 kobject: Export kobject_get_unless_zero()
d01b2dcb441b block: Fix oops scsi_disk_get()

--
? https://marc.info/?l=linux-block&m=148604743126356&w=2
? https://marc.info/?l=linux-block&m=148769705431982&w=2
? https://marc.info/?l=linux-block&m=148905459526037&w=2
? https://marc.info/?l=linux-block&m=149023527505174&w=2