[Bug 212245] ZFS volume (zvol) does not honor fsync()

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Mon Aug 29 18:24:19 UTC 2016


            Bug ID: 212245
           Summary: ZFS volume (zvol) does not honor fsync()
           Product: Base System
           Version: 10.3-RELEASE
          Hardware: amd64
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: kern
          Assignee: freebsd-bugs at FreeBSD.org
          Reporter: lordcrc at gmail.com
                CC: freebsd-amd64 at FreeBSD.org
                CC: freebsd-amd64 at FreeBSD.org

Created attachment 174200
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=174200&action=edit
Program used to reproduce the issue

It seems that ZFS does not honor fsync() done on zvols.

This issue affects iSCSI targets backed by ZFS volumes, which are forced to run
with sync=always to ensure consistency. Running sync=always has a drastic
performance impact.

To reproduce:
- Log in via remote SSH console (important).
- Create a ZFS pool and a zvol.
- Format zvol with UFS.
- Mount zvol UFS partition.
- Cd into mount point.
- Compile and run the attached program.
- Physically remove power to the computer.
- Write down the last number shown in the SSH console window.
- Reboot computer and log in.
- Mount zvol partition if needed.
- Cd into mount point.
- Display contents of "output.txt"
- Compare last line of "output.txt" with last line shown in SSH console.

Expected output:
If the SSH console's last number was 11291, the last number in "output.txt"
should be 11291 or 11292.

Actual output:
The last line in "output.txt" is a lot further behind the output in the SSH

Here's the commands I used to set up the UFS partition:

History for 'tank0':
2016-08-29.19:39:35 zpool create tank0 /dev/ada0s2
2016-08-29.19:43:57 zpool import tank0
2016-08-29.19:44:50 zfs create -V 500M tank0/testvol

gpart add -t freebsd-ufs -a 1M /dev/zvol/tank0/testvol

newfs -U /dev/zvol/tank0/testvolp1

mkdir test

mount /dev/zvol/tank0/testvolp1 test

The supplied program shows the expected output if run directly on a "native"
UFS partition, as well as when run on a zvol using ZFS-on-Linux (on a Debian

You are receiving this mail because:
You are the assignee for the bug.

More information about the freebsd-bugs mailing list