diff mbox series

[1/4] xfs_db: fix nlink usage in check

Message ID 159736124295.3063459.16896525594275470708.stgit@magnolia (mailing list archive)
State Accepted
Headers show
Series xfsprogs: various small enhancements | expand

Commit Message

Darrick J. Wong Aug. 13, 2020, 11:27 p.m. UTC
From: Darrick J. Wong <darrick.wong@oracle.com>

process_inode uses a local convenience variable to abstract the
differences between the ondisk nlink fields in a v1 inode and a v2
inode.  Use this variable for checking and reporting errors.

Fixes: 6526f30e4801 ("xfs_db: stop misusing an onstack inode")
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
---
 db/check.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Christoph Hellwig Aug. 17, 2020, 6:53 a.m. UTC | #1
On Thu, Aug 13, 2020 at 04:27:22PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> process_inode uses a local convenience variable to abstract the
> differences between the ondisk nlink fields in a v1 inode and a v2
> inode.  Use this variable for checking and reporting errors.

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>
Carlos Maiolino Aug. 17, 2020, 11:25 a.m. UTC | #2
On Thu, Aug 13, 2020 at 04:27:22PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> process_inode uses a local convenience variable to abstract the
> differences between the ondisk nlink fields in a v1 inode and a v2
> inode.  Use this variable for checking and reporting errors.
> 
> Fixes: 6526f30e4801 ("xfs_db: stop misusing an onstack inode")
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> Reviewed-by: Eric Sandeen <sandeen@redhat.com>
> ---
>  db/check.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)


Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>


> 
> 
> diff --git a/db/check.c b/db/check.c
> index c2233a0d1ba7..ef0e82d4efa1 100644
> --- a/db/check.c
> +++ b/db/check.c
> @@ -2797,10 +2797,10 @@ process_inode(
>  					be64_to_cpu(dip->di_nblocks), ino);
>  			error++;
>  		}
> -		if (dip->di_nlink != 0) {
> +		if (nlink != 0) {
>  			if (v)
>  				dbprintf(_("bad nlink %d for free inode %lld\n"),
> -					be32_to_cpu(dip->di_nlink), ino);
> +					nlink, ino);
>  			error++;
>  		}
>  		if (dip->di_mode != 0) {
>
diff mbox series

Patch

diff --git a/db/check.c b/db/check.c
index c2233a0d1ba7..ef0e82d4efa1 100644
--- a/db/check.c
+++ b/db/check.c
@@ -2797,10 +2797,10 @@  process_inode(
 					be64_to_cpu(dip->di_nblocks), ino);
 			error++;
 		}
-		if (dip->di_nlink != 0) {
+		if (nlink != 0) {
 			if (v)
 				dbprintf(_("bad nlink %d for free inode %lld\n"),
-					be32_to_cpu(dip->di_nlink), ino);
+					nlink, ino);
 			error++;
 		}
 		if (dip->di_mode != 0) {