<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Hi Joseph,<br>
</div>
<blockquote cite="mid:5170a92c-caaf-be47-3ef8-ab9803e7a6c4@suse.com"
type="cite">
<blockquote type="cite">
<blockquote type="cite">In ocfs2_write_begin_nolock(), we first
grab the pages and then
<br>
allocate disk space for this write;
ocfs2_try_to_free_truncate_log()
<br>
will be called if ENOSPC is turned; if we're lucky to get
enough clusters,
<br>
which is usually the case, we start over again. But in
ocfs2_free_write_ctxt()
<br>
the target page isn't unlocked, so we will deadlock when
trying to grab
<br>
the target page again.
<br>
</blockquote>
IMO, in ocfs2_grab_pages_for_write, mmap_page is mapping to
w_pages and
<br>
w_target_locked is set to true, and then will be unlocked by
<br>
ocfs2_unlock_pages in ocfs2_free_write_ctxt.
<br>
So I'm not getting the case "page isn't unlock". Could you
please explain
<br>
it in more detail?
<br>
</blockquote>
Thanks for review;-) Follow up the calling chain:
<br>
<br>
ocfs2_free_write_ctxt()
<br>
->ocfs2_unlock_pages()
<br>
<br>
in ocfs2_unlock_pages
(<a class="moz-txt-link-freetext" href="https://github.com/torvalds/linux/blob/master/fs/ocfs2/aops.c#L793">https://github.com/torvalds/linux/blob/master/fs/ocfs2/aops.c#L793</a>),
we
<br>
can see the code just put_page(target_page), but not unlock it.
<br>
</blockquote>
Did this answer your question?<br>
<br>
Thanks,<br>
Eric<br>
<blockquote cite="mid:5170a92c-caaf-be47-3ef8-ab9803e7a6c4@suse.com"
type="cite">
<br>
Yeah, I will think this a bit more like:
<br>
why not unlock the target_page there? Is there other potential
problems if the "ret" is not "-ENOSPC" but
<br>
other possible error code?
<br>
<br>
Thanks,
<br>
Eric
<br>
<br>
<blockquote type="cite">
<br>
Thanks,
<br>
Joseph
<br>
<br>
<blockquote type="cite">Fix this issue by unlocking the target
page after we fail to allocate
<br>
enough space at the first time.
<br>
<br>
Jan Kara helps me clear out the JBD2 part, and suggest the
hint for root cause.
<br>
<br>
Signed-off-by: Eric Ren <a class="moz-txt-link-rfc2396E" href="mailto:zren@suse.com"><zren@suse.com></a>
<br>
---
<br>
fs/ocfs2/aops.c | 7 +++++++
<br>
1 file changed, 7 insertions(+)
<br>
<br>
diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c
<br>
index 98d3654..78d1d67 100644
<br>
--- a/fs/ocfs2/aops.c
<br>
+++ b/fs/ocfs2/aops.c
<br>
@@ -1860,6 +1860,13 @@ out:
<br>
*/
<br>
try_free = 0;
<br>
+ /*
<br>
+ * Unlock mmap_page because the page has been locked
when we
<br>
+ * are here.
<br>
+ */
<br>
+ if (mmap_page)
<br>
+ unlock_page(mmap_page);
<br>
+
<br>
ret1 = ocfs2_try_to_free_truncate_log(osb,
clusters_need);
<br>
if (ret1 == 1)
<br>
goto try_again;
<br>
<br>
</blockquote>
<br>
<br>
</blockquote>
<br>
<br>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Ocfs2-devel mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Ocfs2-devel@oss.oracle.com">Ocfs2-devel@oss.oracle.com</a>
<a class="moz-txt-link-freetext" href="https://oss.oracle.com/mailman/listinfo/ocfs2-devel">https://oss.oracle.com/mailman/listinfo/ocfs2-devel</a></pre>
</blockquote>
<p><br>
</p>
</body>
</html>