mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-07-16 14:30:06 -04:00
Merge tag 'for-linus-20180906' of git://git.kernel.dk/linux-block
Pull block fixes from Jens Axboe:
"Small collection of fixes that should go into this release. This
contains:
- Small series that fixes a race between blkcg teardown and writeback
(Dennis Zhou)
- Fix disallowing invalid block size settings from the nbd ioctl (me)
- BFQ fix for a use-after-free on last release of a bfqg (Konstantin
Khlebnikov)
- Fix for the "don't warn for flush" fix (Mikulas)"
* tag 'for-linus-20180906' of git://git.kernel.dk/linux-block:
block: bfq: swap puts in bfqg_and_blkg_put
block: don't warn when doing fsync on read-only devices
nbd: don't allow invalid blocksize settings
blkcg: use tryget logic when associating a blkg with a bio
blkcg: delay blkg destruction until after writeback has finished
Revert "blk-throttle: fix race between blkcg_bio_issue_check() and cgroup_rmdir()"
This commit is contained in:
@@ -56,6 +56,7 @@ struct blkcg {
|
||||
struct list_head all_blkcgs_node;
|
||||
#ifdef CONFIG_CGROUP_WRITEBACK
|
||||
struct list_head cgwb_list;
|
||||
refcount_t cgwb_refcnt;
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -89,7 +90,6 @@ struct blkg_policy_data {
|
||||
/* the blkg and policy id this per-policy data belongs to */
|
||||
struct blkcg_gq *blkg;
|
||||
int plid;
|
||||
bool offline;
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -387,6 +387,49 @@ static inline struct blkcg *cpd_to_blkcg(struct blkcg_policy_data *cpd)
|
||||
return cpd ? cpd->blkcg : NULL;
|
||||
}
|
||||
|
||||
extern void blkcg_destroy_blkgs(struct blkcg *blkcg);
|
||||
|
||||
#ifdef CONFIG_CGROUP_WRITEBACK
|
||||
|
||||
/**
|
||||
* blkcg_cgwb_get - get a reference for blkcg->cgwb_list
|
||||
* @blkcg: blkcg of interest
|
||||
*
|
||||
* This is used to track the number of active wb's related to a blkcg.
|
||||
*/
|
||||
static inline void blkcg_cgwb_get(struct blkcg *blkcg)
|
||||
{
|
||||
refcount_inc(&blkcg->cgwb_refcnt);
|
||||
}
|
||||
|
||||
/**
|
||||
* blkcg_cgwb_put - put a reference for @blkcg->cgwb_list
|
||||
* @blkcg: blkcg of interest
|
||||
*
|
||||
* This is used to track the number of active wb's related to a blkcg.
|
||||
* When this count goes to zero, all active wb has finished so the
|
||||
* blkcg can continue destruction by calling blkcg_destroy_blkgs().
|
||||
* This work may occur in cgwb_release_workfn() on the cgwb_release
|
||||
* workqueue.
|
||||
*/
|
||||
static inline void blkcg_cgwb_put(struct blkcg *blkcg)
|
||||
{
|
||||
if (refcount_dec_and_test(&blkcg->cgwb_refcnt))
|
||||
blkcg_destroy_blkgs(blkcg);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
static inline void blkcg_cgwb_get(struct blkcg *blkcg) { }
|
||||
|
||||
static inline void blkcg_cgwb_put(struct blkcg *blkcg)
|
||||
{
|
||||
/* wb isn't being accounted, so trigger destruction right away */
|
||||
blkcg_destroy_blkgs(blkcg);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* blkg_path - format cgroup path of blkg
|
||||
* @blkg: blkg of interest
|
||||
|
||||
Reference in New Issue
Block a user