The branch main has been updated by rew:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=20123b25ee51e9b122676a30d45c21a506bf1461
commit 20123b25ee51e9b122676a30d45c21a506bf1461
Author:     Robert Wing <r...@freebsd.org>
AuthorDate: 2021-05-20 20:53:52 +0000
Commit:     Robert Wing <r...@freebsd.org>
CommitDate: 2021-05-22 19:03:36 +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
---
 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));
_______________________________________________
dev-commits-src-main@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main
To unsubscribe, send any mail to "dev-commits-src-main-unsubscr...@freebsd.org"

Reply via email to