mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-03-16 12:14:06 +00:00
ocfs2: clearly handle ocfs2_grab_pages_for_write() return value
ocfs2_grab_pages_for_write() may return -EAGAIN if write context type is mmap and it could not lock the target page. In this case, we exit with no error and no target page. And then trigger the caller page_mkwrite() to retry. Since there are other caller types, e.g. buffer and direct io, make the return value handling more clear. Link: https://lkml.kernel.org/r/20211206065051.103353-1-joseph.qi@linux.alibaba.com Signed-off-by: Joseph Qi <joseph.qi@linux.alibaba.com> Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Cc: Mark Fasheh <mark@fasheh.com> Cc: Joel Becker <jlbec@evilplan.org> Cc: Junxiao Bi <junxiao.bi@oracle.com> Cc: Changwei Ge <gechangwei@live.cn> Cc: Gang He <ghe@suse.com> Cc: Jun Piao <piaojun@huawei.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
783cc68d61
commit
e07bf00c40
1 changed files with 13 additions and 13 deletions
|
@ -1799,20 +1799,20 @@ try_again:
|
|||
*/
|
||||
ret = ocfs2_grab_pages_for_write(mapping, wc, wc->w_cpos, pos, len,
|
||||
cluster_of_pages, mmap_page);
|
||||
if (ret && ret != -EAGAIN) {
|
||||
mlog_errno(ret);
|
||||
goto out_quota;
|
||||
}
|
||||
if (ret) {
|
||||
/*
|
||||
* ocfs2_grab_pages_for_write() returns -EAGAIN if it could not lock
|
||||
* the target page. In this case, we exit with no error and no target
|
||||
* page. This will trigger the caller, page_mkwrite(), to re-try
|
||||
* the operation.
|
||||
*/
|
||||
if (type == OCFS2_WRITE_MMAP && ret == -EAGAIN) {
|
||||
BUG_ON(wc->w_target_page);
|
||||
ret = 0;
|
||||
goto out_quota;
|
||||
}
|
||||
|
||||
/*
|
||||
* ocfs2_grab_pages_for_write() returns -EAGAIN if it could not lock
|
||||
* the target page. In this case, we exit with no error and no target
|
||||
* page. This will trigger the caller, page_mkwrite(), to re-try
|
||||
* the operation.
|
||||
*/
|
||||
if (ret == -EAGAIN) {
|
||||
BUG_ON(wc->w_target_page);
|
||||
ret = 0;
|
||||
mlog_errno(ret);
|
||||
goto out_quota;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue