Commit a18e491c authored by Colin Ian King's avatar Colin Ian King Committed by Kleber Sacilotto de Souza

UBUNTU: SAUCE: Fix non-prefaulted page deadlock (LP: #1754584)

BugLink: https://bugs.launchpad.net/bugs/1754584

Fix mmap'd libaio read on non-prefaulted page deadlock. This is a hot fix
from ZFS upstream that ensure pages do not deadlock and replaces the original
fix as it is a far better solution.

Performing a read with the target data in a mmap'd page that is map'd into
the same blocks that are being read causes a lock on the page and a further
lock on the same page when the page is being faulted in, causing deadlock.

This is an improved fix from the original fix which ensures the pages don't
deadlock and removes the original potentially racy pre-faulting fix
Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
Acked-by: default avatarStefan Bader <stefan.bader@canonical.com>
Acked-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
parent 26ed558c
......@@ -2,7 +2,7 @@ Meta: 1
Name: zfs
Branch: 1.0
Version: 0.6.5.6
Release: 0ubuntu19
Release: 0ubuntu20
Release-Tags: relext
License: CDDL
Author: OpenZFS on Linux
......@@ -177,6 +177,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \
$(top_srcdir)/config/user-arch.m4 \
$(top_srcdir)/config/user-dracut.m4 \
$(top_srcdir)/config/user-frame-larger-than.m4 \
$(top_srcdir)/config/user-libaio.m4 \
$(top_srcdir)/config/user-libblkid.m4 \
$(top_srcdir)/config/user-libuuid.m4 \
$(top_srcdir)/config/user-runstatedir.m4 \
......@@ -404,6 +405,7 @@ KERNELCPPFLAGS = @KERNELCPPFLAGS@
KERNELMAKE_PARAMS = @KERNELMAKE_PARAMS@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBAIO = @LIBAIO@
LIBBLKID = @LIBBLKID@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
......
......@@ -1283,6 +1283,7 @@ m4_include([config/mount-helper.m4])
m4_include([config/user-arch.m4])
m4_include([config/user-dracut.m4])
m4_include([config/user-frame-larger-than.m4])
m4_include([config/user-libaio.m4])
m4_include([config/user-libblkid.m4])
m4_include([config/user-libuuid.m4])
m4_include([config/user-runstatedir.m4])
......
dnl #
dnl # Check for libaio - only used for libaiot test cases.
dnl #
AC_DEFUN([ZFS_AC_CONFIG_USER_LIBAIO], [
LIBAIO=
AC_CHECK_HEADER([libaio.h], [
user_libaio=yes
AC_SUBST([LIBAIO], ["-laio"])
AC_DEFINE([HAVE_LIBAIO], 1, [Define if you have libaio])
], [
user_libaio=no
])
])
......@@ -5,6 +5,7 @@ AC_DEFUN([ZFS_AC_CONFIG_USER], [
ZFS_AC_DKMS_INHIBIT
ZFS_AC_CONFIG_USER_MOUNT_HELPER
ZFS_AC_CONFIG_USER_UDEV
ZFS_AC_CONFIG_USER_LIBAIO
ZFS_AC_CONFIG_USER_SYSTEMD
ZFS_AC_CONFIG_USER_SYSVINIT
ZFS_AC_CONFIG_USER_DRACUT
......
......@@ -103,6 +103,8 @@ AC_DEFUN([ZFS_AC_CONFIG], [
AM_CONDITIONAL([CONFIG_KERNEL],
[test "$ZFS_CONFIG" = kernel -o "$ZFS_CONFIG" = all] &&
[test "x$enable_linux_builtin" != xyes ])
AM_CONDITIONAL([WANT_DEVNAME2DEVID], [test "x$user_libudev" = xyes ])
AM_CONDITIONAL([WANT_MMAP_LIBAIO], [test "x$user_libaio" = xyes ])
])
dnl #
......
......@@ -636,6 +636,10 @@ DEBUG_DMU_TX
DEBUG_ZFS
DEBUG_STACKFLAGS
DEBUG_CFLAGS
WANT_MMAP_LIBAIO_FALSE
WANT_MMAP_LIBAIO_TRUE
WANT_DEVNAME2DEVID_FALSE
WANT_DEVNAME2DEVID_TRUE
CONFIG_KERNEL_FALSE
CONFIG_KERNEL_TRUE
CONFIG_USER_FALSE
......@@ -661,6 +665,7 @@ systemdpresetdir
systemdunitdir
ZFS_MODULE_LOAD
ZFS_INIT_SYSTEMD
LIBAIO
udevruledir
udevdir
mounthelperdir
......@@ -12900,6 +12905,27 @@ fi
$as_echo "$udevdir;$udevruledir" >&6; }
LIBAIO=
ac_fn_c_check_header_mongrel "$LINENO" "libaio.h" "ac_cv_header_libaio_h" "$ac_includes_default"
if test "x$ac_cv_header_libaio_h" = xyes; then :
user_libaio=yes
LIBAIO="-laio"
$as_echo "#define HAVE_LIBAIO 1" >>confdefs.h
else
user_libaio=no
fi
# Check whether --enable-systemd was given.
if test "${enable_systemd+set}" = set; then :
enableval=$enable_systemd;
......@@ -32417,6 +32443,27 @@ fi
$as_echo "$udevdir;$udevruledir" >&6; }
LIBAIO=
ac_fn_c_check_header_mongrel "$LINENO" "libaio.h" "ac_cv_header_libaio_h" "$ac_includes_default"
if test "x$ac_cv_header_libaio_h" = xyes; then :
user_libaio=yes
LIBAIO="-laio"
$as_echo "#define HAVE_LIBAIO 1" >>confdefs.h
else
user_libaio=no
fi
# Check whether --enable-systemd was given.
if test "${enable_systemd+set}" = set; then :
enableval=$enable_systemd;
......@@ -33094,6 +33141,22 @@ else
CONFIG_KERNEL_FALSE=
fi
if test "x$user_libudev" = xyes ; then
WANT_DEVNAME2DEVID_TRUE=
WANT_DEVNAME2DEVID_FALSE='#'
else
WANT_DEVNAME2DEVID_TRUE='#'
WANT_DEVNAME2DEVID_FALSE=
fi
if test "x$user_libaio" = xyes ; then
WANT_MMAP_LIBAIO_TRUE=
WANT_MMAP_LIBAIO_FALSE='#'
else
WANT_MMAP_LIBAIO_TRUE='#'
WANT_MMAP_LIBAIO_FALSE=
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether debugging is enabled" >&5
......@@ -33315,6 +33378,14 @@ if test -z "${CONFIG_KERNEL_TRUE}" && test -z "${CONFIG_KERNEL_FALSE}"; then
as_fn_error $? "conditional \"CONFIG_KERNEL\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${WANT_DEVNAME2DEVID_TRUE}" && test -z "${WANT_DEVNAME2DEVID_FALSE}"; then
as_fn_error $? "conditional \"WANT_DEVNAME2DEVID\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${WANT_MMAP_LIBAIO_TRUE}" && test -z "${WANT_MMAP_LIBAIO_FALSE}"; then
as_fn_error $? "conditional \"WANT_MMAP_LIBAIO\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
: "${CONFIG_STATUS=./config.status}"
ac_write_fail=0
......
......@@ -166,6 +166,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \
$(top_srcdir)/config/user-arch.m4 \
$(top_srcdir)/config/user-dracut.m4 \
$(top_srcdir)/config/user-frame-larger-than.m4 \
$(top_srcdir)/config/user-libaio.m4 \
$(top_srcdir)/config/user-libblkid.m4 \
$(top_srcdir)/config/user-libuuid.m4 \
$(top_srcdir)/config/user-runstatedir.m4 \
......@@ -322,6 +323,7 @@ KERNELCPPFLAGS = @KERNELCPPFLAGS@
KERNELMAKE_PARAMS = @KERNELMAKE_PARAMS@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBAIO = @LIBAIO@
LIBBLKID = @LIBBLKID@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
......
......@@ -167,6 +167,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \
$(top_srcdir)/config/user-arch.m4 \
$(top_srcdir)/config/user-dracut.m4 \
$(top_srcdir)/config/user-frame-larger-than.m4 \
$(top_srcdir)/config/user-libaio.m4 \
$(top_srcdir)/config/user-libblkid.m4 \
$(top_srcdir)/config/user-libuuid.m4 \
$(top_srcdir)/config/user-runstatedir.m4 \
......@@ -265,6 +266,7 @@ KERNELCPPFLAGS = @KERNELCPPFLAGS@
KERNELMAKE_PARAMS = @KERNELMAKE_PARAMS@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBAIO = @LIBAIO@
LIBBLKID = @LIBBLKID@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
......
......@@ -167,6 +167,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \
$(top_srcdir)/config/user-arch.m4 \
$(top_srcdir)/config/user-dracut.m4 \
$(top_srcdir)/config/user-frame-larger-than.m4 \
$(top_srcdir)/config/user-libaio.m4 \
$(top_srcdir)/config/user-libblkid.m4 \
$(top_srcdir)/config/user-libuuid.m4 \
$(top_srcdir)/config/user-runstatedir.m4 \
......@@ -293,6 +294,7 @@ KERNELCPPFLAGS = @KERNELCPPFLAGS@
KERNELMAKE_PARAMS = @KERNELMAKE_PARAMS@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBAIO = @LIBAIO@
LIBBLKID = @LIBBLKID@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
......
......@@ -166,6 +166,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \
$(top_srcdir)/config/user-arch.m4 \
$(top_srcdir)/config/user-dracut.m4 \
$(top_srcdir)/config/user-frame-larger-than.m4 \
$(top_srcdir)/config/user-libaio.m4 \
$(top_srcdir)/config/user-libblkid.m4 \
$(top_srcdir)/config/user-libuuid.m4 \
$(top_srcdir)/config/user-runstatedir.m4 \
......@@ -323,6 +324,7 @@ KERNELCPPFLAGS = @KERNELCPPFLAGS@
KERNELMAKE_PARAMS = @KERNELMAKE_PARAMS@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBAIO = @LIBAIO@
LIBBLKID = @LIBBLKID@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
......
......@@ -167,6 +167,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \
$(top_srcdir)/config/user-arch.m4 \
$(top_srcdir)/config/user-dracut.m4 \
$(top_srcdir)/config/user-frame-larger-than.m4 \
$(top_srcdir)/config/user-libaio.m4 \
$(top_srcdir)/config/user-libblkid.m4 \
$(top_srcdir)/config/user-libuuid.m4 \
$(top_srcdir)/config/user-runstatedir.m4 \
......@@ -293,6 +294,7 @@ KERNELCPPFLAGS = @KERNELCPPFLAGS@
KERNELMAKE_PARAMS = @KERNELMAKE_PARAMS@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBAIO = @LIBAIO@
LIBBLKID = @LIBBLKID@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
......
......@@ -167,6 +167,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \
$(top_srcdir)/config/user-arch.m4 \
$(top_srcdir)/config/user-dracut.m4 \
$(top_srcdir)/config/user-frame-larger-than.m4 \
$(top_srcdir)/config/user-libaio.m4 \
$(top_srcdir)/config/user-libblkid.m4 \
$(top_srcdir)/config/user-libuuid.m4 \
$(top_srcdir)/config/user-runstatedir.m4 \
......@@ -376,6 +377,7 @@ KERNELCPPFLAGS = @KERNELCPPFLAGS@
KERNELMAKE_PARAMS = @KERNELMAKE_PARAMS@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBAIO = @LIBAIO@
LIBBLKID = @LIBBLKID@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
......
......@@ -167,6 +167,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \
$(top_srcdir)/config/user-arch.m4 \
$(top_srcdir)/config/user-dracut.m4 \
$(top_srcdir)/config/user-frame-larger-than.m4 \
$(top_srcdir)/config/user-libaio.m4 \
$(top_srcdir)/config/user-libblkid.m4 \
$(top_srcdir)/config/user-libuuid.m4 \
$(top_srcdir)/config/user-runstatedir.m4 \
......@@ -318,6 +319,7 @@ KERNELCPPFLAGS = @KERNELCPPFLAGS@
KERNELMAKE_PARAMS = @KERNELMAKE_PARAMS@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBAIO = @LIBAIO@
LIBBLKID = @LIBBLKID@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
......
......@@ -167,6 +167,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \
$(top_srcdir)/config/user-arch.m4 \
$(top_srcdir)/config/user-dracut.m4 \
$(top_srcdir)/config/user-frame-larger-than.m4 \
$(top_srcdir)/config/user-libaio.m4 \
$(top_srcdir)/config/user-libblkid.m4 \
$(top_srcdir)/config/user-libuuid.m4 \
$(top_srcdir)/config/user-runstatedir.m4 \
......@@ -550,6 +551,7 @@ KERNELCPPFLAGS = @KERNELCPPFLAGS@
KERNELMAKE_PARAMS = @KERNELMAKE_PARAMS@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBAIO = @LIBAIO@
LIBBLKID = @LIBBLKID@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
......
......@@ -167,6 +167,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \
$(top_srcdir)/config/user-arch.m4 \
$(top_srcdir)/config/user-dracut.m4 \
$(top_srcdir)/config/user-frame-larger-than.m4 \
$(top_srcdir)/config/user-libaio.m4 \
$(top_srcdir)/config/user-libblkid.m4 \
$(top_srcdir)/config/user-libuuid.m4 \
$(top_srcdir)/config/user-runstatedir.m4 \
......@@ -358,6 +359,7 @@ KERNELCPPFLAGS = @KERNELCPPFLAGS@
KERNELMAKE_PARAMS = @KERNELMAKE_PARAMS@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBAIO = @LIBAIO@
LIBBLKID = @LIBBLKID@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
......
......@@ -167,6 +167,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \
$(top_srcdir)/config/user-arch.m4 \
$(top_srcdir)/config/user-dracut.m4 \
$(top_srcdir)/config/user-frame-larger-than.m4 \
$(top_srcdir)/config/user-libaio.m4 \
$(top_srcdir)/config/user-libblkid.m4 \
$(top_srcdir)/config/user-libuuid.m4 \
$(top_srcdir)/config/user-runstatedir.m4 \
......@@ -314,6 +315,7 @@ KERNELCPPFLAGS = @KERNELCPPFLAGS@
KERNELMAKE_PARAMS = @KERNELMAKE_PARAMS@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBAIO = @LIBAIO@
LIBBLKID = @LIBBLKID@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
......
......@@ -167,6 +167,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/always-no-bool-compare.m4 \
$(top_srcdir)/config/user-arch.m4 \
$(top_srcdir)/config/user-dracut.m4 \
$(top_srcdir)/config/user-frame-larger-than.m4 \
$(top_srcdir)/config/user-libaio.m4 \
$(top_srcdir)/config/user-libblkid.m4 \
$(top_srcdir)/config/user-libuuid.m4 \
$(top_srcdir)/config/user-runstatedir.m4 \
......@@ -314,6 +315,7 @@ KERNELCPPFLAGS = @KERNELCPPFLAGS@
KERNELMAKE_PARAMS = @KERNELMAKE_PARAMS@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBAIO = @LIBAIO@
LIBBLKID = @LIBBLKID@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
......
......@@ -391,6 +391,7 @@ mappedread(struct inode *ip, int nbytes, uio_t *uio)
pp = find_lock_page(mp, start >> PAGE_CACHE_SHIFT);
if (pp) {
ASSERT(PageUptodate(pp));
unlock_page(pp);
pb = kmap(pp);
error = uiomove(pb + off, bytes, UIO_READ, uio);
......@@ -400,7 +401,6 @@ mappedread(struct inode *ip, int nbytes, uio_t *uio)
flush_dcache_page(pp);
mark_page_accessed(pp);
unlock_page(pp);
page_cache_release(pp);
} else {
error = dmu_read_uio_dbuf(sa_get_db(zp->z_sa_hdl),
......
......@@ -213,6 +213,9 @@
/* kernel defines KOBJ_NAME_LEN */
#undef HAVE_KOBJ_NAME_LEN
/* Define if you have libaio */
#undef HAVE_LIBAIO
/* Define if you have libblkid */
#undef HAVE_LIBBLKID
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment