Commit ca42800c authored by Hiroya Nozaki's avatar Hiroya Nozaki Committed by Greg Kroah-Hartman

staging: lustre: llite: ll_write_begin/end not passing on errors

Because of a implementation of generic_perform_write(), write(2)
may return 0 with no errno even if EDQUOT or ENOSPC actually
happened in it. This patch fixes the issue with setting a proper
errno to ci_result.
Signed-off-by: default avatarHiroya Nozaki <nozaki.hiroya@jp.fujitsu.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6732
Reviewed-on: http://review.whamcloud.com/15302Reviewed-by: default avatarBobi Jam <bobijam@hotmail.com>
Reviewed-by: default avatarAndreas Dilger <andreas.dilger@intel.com>
Reviewed-by: default avatarOleg Drokin <oleg.drokin@intel.com>
Signed-off-by: default avatarJames Simmons <jsimmons@infradead.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 6bf18cd3
...@@ -478,6 +478,7 @@ static int ll_write_begin(struct file *file, struct address_space *mapping, ...@@ -478,6 +478,7 @@ static int ll_write_begin(struct file *file, struct address_space *mapping,
lcc = ll_cl_find(file); lcc = ll_cl_find(file);
if (!lcc) { if (!lcc) {
io = NULL;
result = -EIO; result = -EIO;
goto out; goto out;
} }
...@@ -558,6 +559,8 @@ static int ll_write_begin(struct file *file, struct address_space *mapping, ...@@ -558,6 +559,8 @@ static int ll_write_begin(struct file *file, struct address_space *mapping,
lu_ref_del(&page->cp_reference, "cl_io", io); lu_ref_del(&page->cp_reference, "cl_io", io);
cl_page_put(env, page); cl_page_put(env, page);
} }
if (io)
io->ci_result = result;
} else { } else {
*pagep = vmpage; *pagep = vmpage;
*fsdata = lcc; *fsdata = lcc;
...@@ -627,6 +630,8 @@ static int ll_write_end(struct file *file, struct address_space *mapping, ...@@ -627,6 +630,8 @@ static int ll_write_end(struct file *file, struct address_space *mapping,
file->f_flags & O_SYNC || IS_SYNC(file_inode(file))) file->f_flags & O_SYNC || IS_SYNC(file_inode(file)))
result = vvp_io_write_commit(env, io); result = vvp_io_write_commit(env, io);
if (result < 0)
io->ci_result = result;
return result >= 0 ? copied : result; return result >= 0 ? copied : result;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment