@@ -871,6 +871,7 @@ int cl_page_make_ready(const struct lu_env *env, struct cl_page *cp,
enum cl_req_type crt)
{
struct page *vmpage = cp->cp_vmpage;
+ bool unlock = false;
int rc = 0;
PASSERT(env, cp, crt == CRT_WRITE);
@@ -879,6 +880,7 @@ int cl_page_make_ready(const struct lu_env *env, struct cl_page *cp,
goto out;
lock_page(vmpage);
+ unlock = true;
if (clear_page_dirty_for_io(vmpage)) {
LASSERT(cp->cp_state == CPS_CACHED);
@@ -899,13 +901,15 @@ int cl_page_make_ready(const struct lu_env *env, struct cl_page *cp,
LBUG();
}
- unlock_page(vmpage);
out:
if (rc == 0) {
PASSERT(env, cp, cp->cp_state == CPS_CACHED);
cl_page_io_start(env, cp, crt);
}
+ if (unlock)
+ unlock_page(vmpage);
+
CL_PAGE_HEADER(D_TRACE, env, cp, "%d %d\n", crt, rc);
return rc;