Whamcloud - gitweb
LU-12536 llite: release active extent on sync write commit 72/35472/5
authorAnn Koehler <amk@cray.com>
Thu, 11 Jul 2019 20:35:18 +0000 (15:35 -0500)
committerOleg Drokin <green@whamcloud.com>
Sat, 27 Jul 2019 00:22:09 +0000 (00:22 +0000)
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
lustre/llite/file.c
lustre/llite/llite_internal.h
lustre/llite/rw.c

index 5ef17a3..05b0d73 100644 (file)
@@ -2660,8 +2660,8 @@ direct_io_2args, [
 #
 # LC_GENERIC_WRITE_SYNC_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],
 #
 AC_DEFUN([LC_GENERIC_WRITE_SYNC_2ARGS], [
 LB_CHECK_COMPILE([if 'generic_write_sync()' taken 2 arguments],
index e36bb37..97e871f 100644 (file)
@@ -1378,7 +1378,8 @@ static bool file_is_noatime(const struct file *file)
        return false;
 }
 
        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);
 {
        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));
                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)) {
        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);
 
 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) {
        io->ci_ndelay_tried = retried;
 
        if (cl_io_rw_init(env, io, iot, *ppos, count) == 0) {
index 5dcee4b..a154abd 100644 (file)
@@ -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);
 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);
 #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;
 }
 
        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);
 /* llite/llite_mmap.c */
 
 int ll_teardown_mmaps(struct address_space *mapping, __u64 first, __u64 last);
index c4e06bb..27442a4 100644 (file)
@@ -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);
                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)
 
        rc = ll_readahead_file_kms(env, io, &kms);
        if (rc != 0)