mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-24 05:40:55 +07:00
fs/block_dev.c: Remove WARN_ON() when inode writeback fails
If a block device is hot removed and later last reference to device is put, we try to writeback the dirty inode. But device is gone and that writeback fails. Currently we do a WARN_ON() which does not seem to be the right thing. Convert it to a ratelimited kernel warning. Reported-by: Andi Kleen <andi@firstfloor.org> Signed-off-by: Vivek Goyal <vgoyal@redhat.com> Acked-by: Tejun Heo <tj@kernel.org> [jmoyer@redhat.com: get rid of unnecessary name initialization, 80 cols] Signed-off-by: Jeff Moyer <jmoyer@redhat.com> Signed-off-by: Jens Axboe <axboe@fb.com>
This commit is contained in:
parent
c74dc7801d
commit
dbd3ca5075
@ -50,12 +50,21 @@ struct block_device *I_BDEV(struct inode *inode)
|
|||||||
}
|
}
|
||||||
EXPORT_SYMBOL(I_BDEV);
|
EXPORT_SYMBOL(I_BDEV);
|
||||||
|
|
||||||
static void bdev_write_inode(struct inode *inode)
|
static void bdev_write_inode(struct block_device *bdev)
|
||||||
{
|
{
|
||||||
|
struct inode *inode = bdev->bd_inode;
|
||||||
|
int ret;
|
||||||
|
|
||||||
spin_lock(&inode->i_lock);
|
spin_lock(&inode->i_lock);
|
||||||
while (inode->i_state & I_DIRTY) {
|
while (inode->i_state & I_DIRTY) {
|
||||||
spin_unlock(&inode->i_lock);
|
spin_unlock(&inode->i_lock);
|
||||||
WARN_ON_ONCE(write_inode_now(inode, true));
|
ret = write_inode_now(inode, true);
|
||||||
|
if (ret) {
|
||||||
|
char name[BDEVNAME_SIZE];
|
||||||
|
pr_warn_ratelimited("VFS: Dirty inode writeback failed "
|
||||||
|
"for block device %s (err=%d).\n",
|
||||||
|
bdevname(bdev, name), ret);
|
||||||
|
}
|
||||||
spin_lock(&inode->i_lock);
|
spin_lock(&inode->i_lock);
|
||||||
}
|
}
|
||||||
spin_unlock(&inode->i_lock);
|
spin_unlock(&inode->i_lock);
|
||||||
@ -1504,7 +1513,7 @@ static void __blkdev_put(struct block_device *bdev, fmode_t mode, int for_part)
|
|||||||
* ->release can cause the queue to disappear, so flush all
|
* ->release can cause the queue to disappear, so flush all
|
||||||
* dirty data before.
|
* dirty data before.
|
||||||
*/
|
*/
|
||||||
bdev_write_inode(bdev->bd_inode);
|
bdev_write_inode(bdev);
|
||||||
}
|
}
|
||||||
if (bdev->bd_contains == bdev) {
|
if (bdev->bd_contains == bdev) {
|
||||||
if (disk->fops->release)
|
if (disk->fops->release)
|
||||||
|
Loading…
Reference in New Issue
Block a user