Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 11 Jun 2021 16:53:58 GMT
From:      Robert Wing <rew@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 157a960058c2 - stable/13 - fsck_ffs(8): fix divide by zero when debug messages are enabled
Message-ID:  <202106111653.15BGrwwG035418@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by rew:

URL: https://cgit.FreeBSD.org/src/commit/?id=157a960058c221bda068c902ba9ccf216fa2fbaa

commit 157a960058c221bda068c902ba9ccf216fa2fbaa
Author:     Robert Wing <rew@FreeBSD.org>
AuthorDate: 2021-05-20 20:53:52 +0000
Commit:     Robert Wing <rew@FreeBSD.org>
CommitDate: 2021-06-11 16:44:29 +0000

    fsck_ffs(8): fix divide by zero when debug messages are enabled
    
    Only print buffer cache debug message when a cache lookup has been done.
    
    When running `fsck_ffs -d` on a gjournal'ed filesystem, it's possible
    that totalreads is greater than zero when no cache lookup has been
    done - causing a divide by zero. This commit fixes the following error:
    
        Floating point exception (core dumped)
    
    Reviewed by:    mckusick
    Differential Revision:  https://reviews.freebsd.org/D30370
    
    (cherry picked from commit 20123b25ee51e9b122676a30d45c21a506bf1461)
---
 sbin/fsck_ffs/fsutil.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sbin/fsck_ffs/fsutil.c b/sbin/fsck_ffs/fsutil.c
index b13ba4c54bde..db22ee5b20cf 100644
--- a/sbin/fsck_ffs/fsutil.c
+++ b/sbin/fsck_ffs/fsutil.c
@@ -576,7 +576,7 @@ ckfini(int markclean)
 			rerun = 1;
 		}
 	}
-	if (debug && totalreads > 0)
+	if (debug && cachelookups > 0)
 		printf("cache with %d buffers missed %d of %d (%d%%)\n",
 		    numbufs, cachereads, cachelookups,
 		    (int)(cachereads * 100 / cachelookups));



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202106111653.15BGrwwG035418>