Skip to content

Commit

Permalink
Remove the bio_empty_barrier() check.
Browse files Browse the repository at this point in the history
To determine whether the kernel is capable of handling empty barrier
BIOs, we check for the presence of the bio_empty_barrier() macro,
which was introduced in 2.6.24. If this macro is defined, then we can
flush disk vdevs; if it isn't, then flushing is disabled.

Unfortunately, the bio_empty_barrier() macro was removed in 2.6.37,
even though the kernel is still capable of handling empty barrier BIOs.

As a result, flushing is effectively disabled on kernels >= 2.6.37,
meaning that starting from this kernel version, zfs doesn't use
barriers to guarantee on-disk data consistency. This is quite bad and
can lead to potential data corruption on power failures.

This patch fixes the issue by removing the configure check for
bio_empty_barrier(), as we don't support kernels <= 2.6.24 anymore.

Thanks to Richard Kojedzinszky for catching this nasty bug.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #1318
  • Loading branch information
dechamps authored and behlendorf committed Feb 24, 2013
1 parent d75af3c commit d9b0ebb
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 29 deletions.
19 changes: 0 additions & 19 deletions config/kernel-bio-empty-barrier.m4

This file was deleted.

1 change: 0 additions & 1 deletion config/kernel.m4
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [
ZFS_AC_KERNEL_INVALIDATE_BDEV_ARGS
ZFS_AC_KERNEL_BDEV_LOGICAL_BLOCK_SIZE
ZFS_AC_KERNEL_BDEV_PHYSICAL_BLOCK_SIZE
ZFS_AC_KERNEL_BIO_EMPTY_BARRIER
ZFS_AC_KERNEL_BIO_FAILFAST
ZFS_AC_KERNEL_BIO_FAILFAST_DTD
ZFS_AC_KERNEL_REQ_FAILFAST_MASK
Expand Down
9 changes: 0 additions & 9 deletions module/zfs/vdev_disk.c
Original file line number Diff line number Diff line change
Expand Up @@ -604,8 +604,6 @@ vdev_disk_physio(struct block_device *bdev, caddr_t kbuf,
return __vdev_disk_physio(bdev, NULL, kbuf, size, offset, flags);
}

/* 2.6.24 API change */
#ifdef HAVE_BIO_EMPTY_BARRIER
BIO_END_IO_PROTO(vdev_disk_io_flush_completion, bio, size, rc)
{
zio_t *zio = bio->bi_private;
Expand Down Expand Up @@ -646,13 +644,6 @@ vdev_disk_io_flush(struct block_device *bdev, zio_t *zio)

return 0;
}
#else
static int
vdev_disk_io_flush(struct block_device *bdev, zio_t *zio)
{
return ENOTSUP;
}
#endif /* HAVE_BIO_EMPTY_BARRIER */

static int
vdev_disk_io_start(zio_t *zio)
Expand Down

0 comments on commit d9b0ebb

Please sign in to comment.