git: sbin/hammer: Fix writeback against readonly fd

Tomohiro Kusumi tkusumi at
Sat Mar 19 14:27:44 PDT 2016

commit d4cbc307463efaefacabb1dfe36d7c4b215839a1
Author: Tomohiro Kusumi <kusumi.tomohiro at>
Date:   Thu Mar 10 00:03:02 2016 +0900

    sbin/hammer: Fix writeback against readonly fd
    writehammerbuf() needs to return 0 before it attempts to write
    if the fd is readonly. Without this check flush_all_volumes()
    may fail before all modified volume headers are written back
    to the backing storage.
    The only reason this hasn't become an issue so far is because
    no existing hammer command creates readonly volume_info while
    there are rw volume_info that need to be written back, which
    could happen depending on the purpose of commands.

Summary of changes:
 sbin/hammer/hammer_util.h | 2 ++
 sbin/hammer/ondisk.c      | 4 ++++
 2 files changed, 6 insertions(+)

DragonFly BSD source repository

More information about the Commits mailing list