All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] btrfs: Remove logically dead code from btrfs_orphan_cleanup
@ 2018-09-13  8:35 Nikolay Borisov
  2018-09-13  8:42 ` Lu Fengqi
  2018-09-14 13:55 ` David Sterba
  0 siblings, 2 replies; 3+ messages in thread
From: Nikolay Borisov @ 2018-09-13  8:35 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Nikolay Borisov

In btrfs_orphan_cleanup the final 'if (ret) goto out' cannot ever be
executed. This is due to the last assignment to 'ret' depending on
the return value of btrfs_iget. If an error other than -ENOENT is
returned then the loop is prematurely terminated by 'goto out'.
On the other hand, if the error value is ENOENT then a subsequent
if branch is executed that always re-assigns 'ret' and in case it's
an error just terminates the loop. No functional changes.

CID: 1437392
Signed-off-by: Nikolay Borisov <nborisov@suse.com>
---
 fs/btrfs/inode.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 3f03fec06a3a..64df0378a22f 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -3471,8 +3471,6 @@ int btrfs_orphan_cleanup(struct btrfs_root *root)
 
 		/* this will do delete_inode and everything for us */
 		iput(inode);
-		if (ret)
-			goto out;
 	}
 	/* release the path since we're done with it */
 	btrfs_release_path(path);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] btrfs: Remove logically dead code from btrfs_orphan_cleanup
  2018-09-13  8:35 [PATCH] btrfs: Remove logically dead code from btrfs_orphan_cleanup Nikolay Borisov
@ 2018-09-13  8:42 ` Lu Fengqi
  2018-09-14 13:55 ` David Sterba
  1 sibling, 0 replies; 3+ messages in thread
From: Lu Fengqi @ 2018-09-13  8:42 UTC (permalink / raw)
  To: Nikolay Borisov; +Cc: linux-btrfs

On Thu, Sep 13, 2018 at 11:35:00AM +0300, Nikolay Borisov wrote:
>In btrfs_orphan_cleanup the final 'if (ret) goto out' cannot ever be
>executed. This is due to the last assignment to 'ret' depending on
>the return value of btrfs_iget. If an error other than -ENOENT is
>returned then the loop is prematurely terminated by 'goto out'.
>On the other hand, if the error value is ENOENT then a subsequent
>if branch is executed that always re-assigns 'ret' and in case it's
>an error just terminates the loop. No functional changes.
>
>CID: 1437392
>Signed-off-by: Nikolay Borisov <nborisov@suse.com>

Reviewed-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com>

>---
> fs/btrfs/inode.c | 2 --
> 1 file changed, 2 deletions(-)
>
>diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
>index 3f03fec06a3a..64df0378a22f 100644
>--- a/fs/btrfs/inode.c
>+++ b/fs/btrfs/inode.c
>@@ -3471,8 +3471,6 @@ int btrfs_orphan_cleanup(struct btrfs_root *root)
> 
> 		/* this will do delete_inode and everything for us */
> 		iput(inode);
>-		if (ret)
>-			goto out;
> 	}
> 	/* release the path since we're done with it */
> 	btrfs_release_path(path);
>-- 
>2.7.4
>
>
>

-- 
Thanks,
Lu

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] btrfs: Remove logically dead code from btrfs_orphan_cleanup
  2018-09-13  8:35 [PATCH] btrfs: Remove logically dead code from btrfs_orphan_cleanup Nikolay Borisov
  2018-09-13  8:42 ` Lu Fengqi
@ 2018-09-14 13:55 ` David Sterba
  1 sibling, 0 replies; 3+ messages in thread
From: David Sterba @ 2018-09-14 13:55 UTC (permalink / raw)
  To: Nikolay Borisov; +Cc: linux-btrfs

On Thu, Sep 13, 2018 at 11:35:00AM +0300, Nikolay Borisov wrote:
> In btrfs_orphan_cleanup the final 'if (ret) goto out' cannot ever be
> executed. This is due to the last assignment to 'ret' depending on
> the return value of btrfs_iget. If an error other than -ENOENT is
> returned then the loop is prematurely terminated by 'goto out'.
> On the other hand, if the error value is ENOENT then a subsequent
> if branch is executed that always re-assigns 'ret' and in case it's
> an error just terminates the loop. No functional changes.
> 
> CID: 1437392
> Signed-off-by: Nikolay Borisov <nborisov@suse.com>

Reviewed-by: David Sterba <dsterba@suse.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-09-14 19:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-13  8:35 [PATCH] btrfs: Remove logically dead code from btrfs_orphan_cleanup Nikolay Borisov
2018-09-13  8:42 ` Lu Fengqi
2018-09-14 13:55 ` David Sterba

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.