Message ID | 1396431670-9353-1-git-send-email-bo.li.liu@oracle.com (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
On Wed, Apr 02, 2014 at 05:41:10PM +0800, Liu Bo wrote: > When we nearly run out of global_block_rsv's reserved space, this WARNING will > be hit for thousands of times, which is not good because the kernel log has > nothing else. > > ret = btrfs_block_rsv_migrate(src_rsv, dst_rsv, num_bytes); > - if (!WARN_ON(ret)) > + if (!WARN_ON_ONCE(ret)) > goto out; The warning has been mistakenly added in fae7f21cece9a4c181 "btrfs: Use WARN_ON()'s return value in place of WARN_ON(1)" @@ -649,14 +649,13 @@ static int btrfs_delayed_inode_reserve_metadata( goto out; ret = btrfs_block_rsv_migrate(src_rsv, dst_rsv, num_bytes); - if (!ret) + if (!WARN_ON(ret)) goto out; [previous WARN_ON removed a few lines below] --- WARN_ON will trigger because it sees 'ret' though in the previous code did not reach the WARN_ON below. The correct pattern is - if (condition) + if (WARN_ON(condition)) I haven't spotted any other bugs from the same class in the patch. I'll send a fix and cc stable. -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/fs/btrfs/delayed-inode.c b/fs/btrfs/delayed-inode.c index 451b00c..32862f0 100644 --- a/fs/btrfs/delayed-inode.c +++ b/fs/btrfs/delayed-inode.c @@ -649,7 +649,7 @@ static int btrfs_delayed_inode_reserve_metadata( goto out; ret = btrfs_block_rsv_migrate(src_rsv, dst_rsv, num_bytes); - if (!WARN_ON(ret)) + if (!WARN_ON_ONCE(ret)) goto out; /*
When we nearly run out of global_block_rsv's reserved space, this WARNING will be hit for thousands of times, which is not good because the kernel log has nothing else. Signed-off-by: Liu Bo <bo.li.liu@oracle.com> --- fs/btrfs/delayed-inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)