File 0038-LU-12536-llite-release-active-extent-on-sync-write-c.patch of Package lustre_2_12
From a9af7100ce72ece9c7a37c4d2c28b54fcf68b562 Mon Sep 17 00:00:00 2001
From: Ann Koehler <amk@cray.com>
Date: Thu, 11 Jul 2019 15:35:18 -0500
Subject: [PATCH] LU-12536 llite: release active extent on sync write commit
Processes can wait forever in osc_extent_wait() for the extent state
to change because the extent write is not started before the wait
begins. A 4.7 kernel change to generic_write_sync() modified it to
check IOCB_DSYNC instead of O_SYNC. Thus an active extent is not
released (written) in osc_io_commit_async() in the synchronous case.
Linux commit: dde0c2e79848298cc25621ad080d47f94dbd7cce
Cray-bug-id: LUS-7435
Signed-off-by: Ann Koehler <amk@cray.com>
Change-Id: I03fd3f17c0c21bcb176730a0edf449d2e5e0c108
Reviewed-on: https://review.whamcloud.com/35472
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Patrick Farrell <pfarrell@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
---
lustre/autoconf/lustre-core.m4 | 4 ++--
lustre/llite/file.c | 11 +++++++++--
2 files changed, 11 insertions(+), 4 deletions(-)
--- a/lustre/autoconf/lustre-core.m4
+++ b/lustre/autoconf/lustre-core.m4
@@ -2637,8 +2637,8 @@ direct_io_2args, [
#
# LC_GENERIC_WRITE_SYNC_2ARGS
#
-# Kernel version 4.7 commit c8b8e32d700fe943a935e435ae251364d016c497
-# direct-io: eliminate the offset argument to ->direct_IO
+# Kernel version 4.7 commit dde0c2e79848298cc25621ad080d47f94dbd7cce
+# fs: add IOCB_SYNC and IOCB_DSYNC
#
AC_DEFUN([LC_GENERIC_WRITE_SYNC_2ARGS], [
LB_CHECK_COMPILE([if 'generic_write_sync()' taken 2 arguments],
--- a/lustre/llite/file.c
+++ b/lustre/llite/file.c
@@ -1387,7 +1387,8 @@ static bool file_is_noatime(const struct
return false;
}
-static void ll_io_init(struct cl_io *io, struct file *file, enum cl_io_type iot)
+static void ll_io_init(struct cl_io *io, struct file *file, enum cl_io_type iot,
+ struct vvp_io_args *args)
{
struct inode *inode = file_inode(file);
struct ll_file_data *fd = LUSTRE_FPRIVATE(file);
@@ -1400,7 +1401,13 @@ static void ll_io_init(struct cl_io *io,
io->u.ci_wr.wr_sync = !!(file->f_flags & O_SYNC ||
file->f_flags & O_DIRECT ||
IS_SYNC(inode));
+#ifdef HAVE_GENERIC_WRITE_SYNC_2ARGS
+ io->u.ci_wr.wr_sync |= !!(args &&
+ args->via_io_subtype == IO_NORMAL &&
+ args->u.normal.via_iocb->ki_flags & IOCB_DSYNC);
+#endif
}
+
io->ci_obj = ll_i2info(inode)->lli_clob;
io->ci_lockreq = CILR_MAYBE;
if (ll_file_nolock(file)) {
@@ -1442,7 +1449,7 @@ ll_file_io_generic(const struct lu_env *
restart:
io = vvp_env_thread_io(env);
- ll_io_init(io, file, iot);
+ ll_io_init(io, file, iot, args);
io->ci_ndelay_tried = retried;
if (cl_io_rw_init(env, io, iot, *ppos, count) == 0) {