aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorPavel Shilovsky <pshilov@microsoft.com>2019-01-28 12:09:02 -0800
committerSteve French <stfrench@microsoft.com>2019-03-05 18:10:04 -0600
commitc4b8f657d55b4ed60cb0a2187e940706de23f2b2 (patch)
treeaa25689ce087de0e4241b064ebf5dbe0d555ec51 /fs
parentCIFS: Move unlocking pages from wdata_send_pages() (diff)
downloadlinux-dev-c4b8f657d55b4ed60cb0a2187e940706de23f2b2.tar.xz
linux-dev-c4b8f657d55b4ed60cb0a2187e940706de23f2b2.zip
CIFS: Move open file handling to writepages
Currently we check for an open file existence in wdata_send_pages() which doesn't provide an easy way to handle error codes that will be returned from find_writable_filehandle() once it is changed. Move the check to writepages. Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com> Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/cifs/file.c29
1 files changed, 14 insertions, 15 deletions
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index 1141514864fc..8d5fec497792 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -2076,11 +2076,12 @@ wdata_prepare_pages(struct cifs_writedata *wdata, unsigned int found_pages,
}
static int
-wdata_send_pages(struct TCP_Server_Info *server, struct cifs_writedata *wdata,
- unsigned int nr_pages, struct address_space *mapping,
- struct writeback_control *wbc)
+wdata_send_pages(struct cifs_writedata *wdata, unsigned int nr_pages,
+ struct address_space *mapping, struct writeback_control *wbc)
{
int rc;
+ struct TCP_Server_Info *server =
+ tlink_tcon(wdata->cfile->tlink)->ses->server;
wdata->sync_mode = wbc->sync_mode;
wdata->nr_pages = nr_pages;
@@ -2090,22 +2091,16 @@ wdata_send_pages(struct TCP_Server_Info *server, struct cifs_writedata *wdata,
page_offset(wdata->pages[nr_pages - 1]),
(loff_t)PAGE_SIZE);
wdata->bytes = ((nr_pages - 1) * PAGE_SIZE) + wdata->tailsz;
+ wdata->pid = wdata->cfile->pid;
rc = adjust_credits(server, &wdata->credits, wdata->bytes);
if (rc)
return rc;
- if (!wdata->cfile) {
- cifs_dbg(VFS, "No writable handle in writepages\n");
- rc = -EBADF;
- } else {
- wdata->pid = wdata->cfile->pid;
- if (wdata->cfile->invalidHandle)
- rc = -EAGAIN;
- else
- rc = server->ops->async_writev(wdata,
- cifs_writedata_release);
- }
+ if (wdata->cfile->invalidHandle)
+ rc = -EAGAIN;
+ else
+ rc = server->ops->async_writev(wdata, cifs_writedata_release);
return rc;
}
@@ -2193,7 +2188,11 @@ retry:
wdata->cfile = cfile;
cfile = NULL;
- rc = wdata_send_pages(server, wdata, nr_pages, mapping, wbc);
+ if (!wdata->cfile) {
+ cifs_dbg(VFS, "No writable handle in writepages\n");
+ rc = -EBADF;
+ } else
+ rc = wdata_send_pages(wdata, nr_pages, mapping, wbc);
for (i = 0; i < nr_pages; ++i)
unlock_page(wdata->pages[i]);