diff options
author | Christoph Hellwig <hch@lst.de> | 2020-05-04 15:47:56 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-08-08 09:54:29 +0300 |
commit | d6c434ae9d3b5cd1fcb8e3aa28172f3d79d81641 (patch) | |
tree | 194bc9a73bf569e36942e5e7afe9ac21faeb1ec8 /mm/backing-dev.c | |
parent | 19a845e19ded4f81dad2a0941f44fb668ed25564 (diff) | |
download | linux-d6c434ae9d3b5cd1fcb8e3aa28172f3d79d81641.tar.xz |
bdi: add a ->dev_name field to struct backing_dev_info
[ Upstream commit 6bd87eec23cbc9ed222bed0f5b5b02bf300e9a8d ]
Cache a copy of the name for the life time of the backing_dev_info
structure so that we can reference it even after unregistering.
Fixes: 68f23b89067f ("memcg: fix a crash in wb_workfn when a device disappears")
Reported-by: Yufen Yu <yuyufen@huawei.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Jan Kara <jack@suse.cz>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'mm/backing-dev.c')
-rw-r--r-- | mm/backing-dev.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/mm/backing-dev.c b/mm/backing-dev.c index 8501b033bca8..1d37c80d023a 100644 --- a/mm/backing-dev.c +++ b/mm/backing-dev.c @@ -880,7 +880,8 @@ int bdi_register_va(struct backing_dev_info *bdi, const char *fmt, va_list args) if (bdi->dev) /* The driver needs to use separate queues per device */ return 0; - dev = device_create_vargs(bdi_class, NULL, MKDEV(0, 0), bdi, fmt, args); + vsnprintf(bdi->dev_name, sizeof(bdi->dev_name), fmt, args); + dev = device_create(bdi_class, NULL, MKDEV(0, 0), bdi, bdi->dev_name); if (IS_ERR(dev)) return PTR_ERR(dev); @@ -980,7 +981,7 @@ const char *bdi_dev_name(struct backing_dev_info *bdi) { if (!bdi || !bdi->dev) return bdi_unknown_name; - return dev_name(bdi->dev); + return bdi->dev_name; } EXPORT_SYMBOL_GPL(bdi_dev_name); |