Whamcloud - gitweb
LU-5260 llite: removing ll_cl_context when error occurs 55/10955/2
authorJinshan Xiong <jinshan.xiong@intel.com>
Wed, 2 Jul 2014 22:46:29 +0000 (15:46 -0700)
committerOleg Drokin <oleg.drokin@intel.com>
Tue, 8 Jul 2014 15:30:33 +0000 (15:30 +0000)
The bug is imported from commit f1b9122c of LU-5108.
It should have removed ll_cl_context from the list if failed to take
lli_write_mutex at:

if ((iot == CIT_WRITE) &&
    !(cio->cui_fd->fd_flags & LL_FILE_GROUP_LOCKED)) {
if (mutex_lock_interruptible(&lli->lli_write_mutex))
GOTO(out, result = -ERESTARTSYS);

Revise it to add ll_context right before cl_io_loop.

Signed-off-by: Jinshan Xiong <jinshan.xiong@intel.com>
Change-Id: I6532bb8919c13692bd0ceb1ba0d755c1417e5095
Reviewed-on: http://review.whamcloud.com/10955
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Patrick Farrell <paf@cray.com>
Reviewed-by: Bobi Jam <bobijam@gmail.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/llite/file.c

index 7f60bed..33c8e74 100644 (file)
@@ -1166,8 +1166,6 @@ restart:
                cio->cui_fd  = LUSTRE_FPRIVATE(file);
                vio->cui_io_subtype = args->via_io_subtype;
 
-               ll_cl_add(file, env, io);
-
                 switch (vio->cui_io_subtype) {
                 case IO_NORMAL:
                         cio->cui_iov = args->u.normal.via_iov;
@@ -1191,12 +1189,15 @@ restart:
                         CERROR("Unknow IO type - %u\n", vio->cui_io_subtype);
                         LBUG();
                 }
+
+               ll_cl_add(file, env, io);
                 result = cl_io_loop(env, io);
+               ll_cl_remove(file, env);
+
                if (args->via_io_subtype == IO_NORMAL)
                        up_read(&lli->lli_trunc_sem);
                if (write_mutex_locked)
                        mutex_unlock(&lli->lli_write_mutex);
-               ll_cl_remove(file, env);
         } else {
                 /* cl_io_rw_init() handled IO */
                 result = io->ci_result;