From: Ann Koehler Date: Thu, 11 Jul 2019 20:35:18 +0000 (-0500) Subject: LU-12536 llite: release active extent on sync write commit X-Git-Tag: 2.12.57~86 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=a9af7100ce72ece9c7a37c4d2c28b54fcf68b562 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 Change-Id: I03fd3f17c0c21bcb176730a0edf449d2e5e0c108 Reviewed-on: https://review.whamcloud.com/35472 Tested-by: jenkins Reviewed-by: Patrick Farrell Reviewed-by: Andreas Dilger Tested-by: Maloo Reviewed-by: Oleg Drokin --- diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4 index 5ef17a3..05b0d73 100644 --- a/lustre/autoconf/lustre-core.m4 +++ b/lustre/autoconf/lustre-core.m4 @@ -2660,8 +2660,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], diff --git a/lustre/llite/file.c b/lustre/llite/file.c index e36bb37..97e871f 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -1378,7 +1378,8 @@ static bool file_is_noatime(const struct file *file) return false; } -void ll_io_init(struct cl_io *io, struct file *file, enum cl_io_type iot) +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); @@ -1391,7 +1392,13 @@ void ll_io_init(struct cl_io *io, struct file *file, enum cl_io_type iot) 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)) { @@ -1465,7 +1472,7 @@ ll_file_io_generic(const struct lu_env *env, struct vvp_io_args *args, 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) { diff --git a/lustre/llite/llite_internal.h b/lustre/llite/llite_internal.h index 5dcee4b..a154abd 100644 --- a/lustre/llite/llite_internal.h +++ b/lustre/llite/llite_internal.h @@ -914,7 +914,6 @@ int ll_md_real_close(struct inode *inode, fmode_t fmode); extern void ll_rw_stats_tally(struct ll_sb_info *sbi, pid_t pid, struct ll_file_data *file, loff_t pos, size_t count, int rw); -void ll_io_init(struct cl_io *io, struct file *file, enum cl_io_type iot); #ifdef HAVE_INODEOPS_ENHANCED_GETATTR int ll_getattr(const struct path *path, struct kstat *stat, u32 request_mask, unsigned int flags); @@ -1129,6 +1128,9 @@ static inline struct vvp_io_args *ll_env_args(const struct lu_env *env, return via; } +void ll_io_init(struct cl_io *io, struct file *file, enum cl_io_type iot, + struct vvp_io_args *args); + /* llite/llite_mmap.c */ int ll_teardown_mmaps(struct address_space *mapping, __u64 first, __u64 last); diff --git a/lustre/llite/rw.c b/lustre/llite/rw.c index c4e06bb..27442a4 100644 --- a/lustre/llite/rw.c +++ b/lustre/llite/rw.c @@ -494,7 +494,7 @@ static void ll_readahead_handle_work(struct work_struct *wq) GOTO(out_free_work, rc = PTR_ERR(env)); io = vvp_env_thread_io(env); - ll_io_init(io, file, CIT_READ); + ll_io_init(io, file, CIT_READ, NULL); rc = ll_readahead_file_kms(env, io, &kms); if (rc != 0)