Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1259584 > unrolled thread

[PATCH v2] fs/block_dev.c: Remove WARN_ON() when inode writeback fails

Started byJeff Moyer <jmoyer@redhat.com>
First post2015-10-30 16:40 +0100
Last post2015-11-02 16:00 +0100
Articles 3 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH v2] fs/block_dev.c: Remove WARN_ON() when inode writeback fails Jeff Moyer <jmoyer@redhat.com> - 2015-10-30 16:40 +0100
    Re: [PATCH v2] fs/block_dev.c: Remove WARN_ON() when inode writeback  fails Jens Axboe <axboe@kernel.dk> - 2015-10-31 00:50 +0100
      Re: [PATCH v2] fs/block_dev.c: Remove WARN_ON() when inode writeback fails Jeff Moyer <jmoyer@redhat.com> - 2015-11-02 16:00 +0100

#1259584 — [PATCH v2] fs/block_dev.c: Remove WARN_ON() when inode writeback fails

FromJeff Moyer <jmoyer@redhat.com>
Date2015-10-30 16:40 +0100
Subject[PATCH v2] fs/block_dev.c: Remove WARN_ON() when inode writeback fails
Message-ID<qpjWz-7ym-29@gated-at.bofh.it>
From: Vivek Goyal <vgoyal@redhat.com>

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>

---

Jens, we're still getting reports of this problem in Fedora:
  https://bugzilla.redhat.com/show_bug.cgi?id=1196089

Here's the last posting and discussion of this patch for reference:
  https://lkml.org/lkml/2015/6/22/487

diff --git a/fs/block_dev.c b/fs/block_dev.c
index 073bb57..d9d3039 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -50,12 +50,21 @@ struct block_device *I_BDEV(struct inode *inode)
 }
 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);
 	while (inode->i_state & I_DIRTY) {
 		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_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
 		 * dirty data before.
 		 */
-		bdev_write_inode(bdev->bd_inode);
+		bdev_write_inode(bdev);
 	}
 	if (bdev->bd_contains == bdev) {
 		if (disk->fops->release)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1259861 — Re: [PATCH v2] fs/block_dev.c: Remove WARN_ON() when inode writeback fails

FromJens Axboe <axboe@kernel.dk>
Date2015-10-31 00:50 +0100
SubjectRe: [PATCH v2] fs/block_dev.c: Remove WARN_ON() when inode writeback fails
Message-ID<qprAJ-3Lv-3@gated-at.bofh.it>
In reply to#1259584
On 10/30/2015 09:34 AM, Jeff Moyer wrote:
> From: Vivek Goyal <vgoyal@redhat.com>
>
> 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.

Any concerns with putting this into 4.4 and marking it for stable? Would 
be awesome to have a "Fixes:" in here too.

-- 
Jens Axboe

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1260702

FromJeff Moyer <jmoyer@redhat.com>
Date2015-11-02 16:00 +0100
Message-ID<qqoKv-6yI-27@gated-at.bofh.it>
In reply to#1259861
Jens Axboe <axboe@kernel.dk> writes:

> On 10/30/2015 09:34 AM, Jeff Moyer wrote:
>> From: Vivek Goyal <vgoyal@redhat.com>
>>
>> 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.
>
> Any concerns with putting this into 4.4 and marking it for stable?

No, that sounds fine to me.

> Would be awesome to have a "Fixes:" in here too.

OK.  I don't know which commit introduced the problem.  Do you want
something like this?

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1196089
or
Fixes: https://www.redhat.com/archives/dm-devel/2015-June/msg00111.html

I know some folks don't like mailing list archive links in the commit
messages.

Cheers,
Jeff
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web