public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: linux-btrfs@vger.kernel.org
Cc: David Sterba <dsterba@suse.cz>,
	Dulshani Gunawardhana <dulshani.gunawardhana89@gmail.com>,
	<stable@vger.kernel.org>
Subject: [PATCH] btrfs: fix reversed warning condition in btrfs_delayed_inode_reserve_metadata
Date: Wed,  2 Apr 2014 19:13:00 +0200	[thread overview]
Message-ID: <1396458780-10923-1-git-send-email-dsterba@suse.cz> (raw)

Commit fae7f21cece9a4c181 ("btrfs: Use WARN_ON()'s return value in place of
WARN_ON(1)") cleaned up WARN_ON usage and in one place reversed the condition
that led to loads of warnings that were not supposed to occur.

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))

CC: Dulshani Gunawardhana <dulshani.gunawardhana89@gmail.com>
CC: <stable@vger.kernel.org> # 3.13
Reported-by: Liu Bo <bo.li.liu@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
---
 fs/btrfs/delayed-inode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/btrfs/delayed-inode.c b/fs/btrfs/delayed-inode.c
index 451b00c86f6c..098af20abd88 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(!ret))
 			goto out;
 
 		/*
-- 
1.9.0


             reply	other threads:[~2014-04-02 17:13 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-02 17:13 David Sterba [this message]
2014-04-03  1:49 ` [PATCH] btrfs: fix reversed warning condition in btrfs_delayed_inode_reserve_metadata Liu Bo
2014-04-03  5:34 ` Liu Bo
2014-04-03 16:18   ` David Sterba
2014-04-04  3:03     ` Liu Bo
2014-04-04 13:40       ` David Sterba

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1396458780-10923-1-git-send-email-dsterba@suse.cz \
    --to=dsterba@suse.cz \
    --cc=dulshani.gunawardhana89@gmail.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox