Whamcloud - gitweb
LU-15811 llite: Unify range unlock
[fs/lustre-release.git] / lustre / llite / file.c
index ba5e959..cd440c3 100644 (file)
@@ -1736,19 +1736,12 @@ restart:
                ll_cl_add(inode, env, io, LCC_RW);
                rc = cl_io_loop(env, io);
                ll_cl_remove(inode, env);
-
-               if (range_locked && !is_parallel_dio) {
-                       CDEBUG(D_VFSTRACE, "Range unlock "RL_FMT"\n",
-                              RL_PARA(&range));
-                       range_unlock(&lli->lli_write_tree, &range);
-                       range_locked = false;
-               }
        } else {
                /* cl_io_rw_init() handled IO */
                rc = io->ci_result;
        }
 
-       if (is_parallel_dio) {
+       if (io->ci_dio_aio && !is_aio) {
                struct cl_sync_io *anchor = &io->ci_dio_aio->cda_sync;
 
                /* for dio, EIOCBQUEUED is an implementation detail,
@@ -1765,11 +1758,13 @@ restart:
                rc2 = cl_sync_io_wait_recycle(env, anchor, 0, 0);
                if (rc2 < 0)
                        rc = rc2;
+       }
 
-               if (range_locked) {
-                       range_unlock(&lli->lli_write_tree, &range);
+       if (range_locked) {
+               CDEBUG(D_VFSTRACE, "Range unlock "RL_FMT"\n",
+                      RL_PARA(&range));
+               range_unlock(&lli->lli_write_tree, &range);
                        range_locked = false;
-               }
        }
 
        /*