aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/file.c
diff options
context:
space:
mode:
authorPavel Shilovsky <pshilov@microsoft.com>2019-01-28 11:57:00 -0800
committerSteve French <stfrench@microsoft.com>2019-03-05 18:10:04 -0600
commit258f0603beb869ba5f6a05713a1508d991baae43 (patch)
treee2f1e1c314d6c614730a980ba51aa0dc29eb2285 /fs/cifs/file.c
parentCIFS: Find and reopen a file before get MTU credits in writepages (diff)
downloadlinux-dev-258f0603beb869ba5f6a05713a1508d991baae43.tar.xz
linux-dev-258f0603beb869ba5f6a05713a1508d991baae43.zip
CIFS: Move unlocking pages from wdata_send_pages()
Currently wdata_send_pages() unlocks pages after sending. This complicates further refactoring and doesn't align with the function name. Move unlocking to writepages. Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com> Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'fs/cifs/file.c')
-rw-r--r--fs/cifs/file.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index 4de7af04e732..1141514864fc 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -2080,8 +2080,7 @@ wdata_send_pages(struct TCP_Server_Info *server, struct cifs_writedata *wdata,
unsigned int nr_pages, struct address_space *mapping,
struct writeback_control *wbc)
{
- int rc = 0;
- unsigned int i;
+ int rc;
wdata->sync_mode = wbc->sync_mode;
wdata->nr_pages = nr_pages;
@@ -2094,7 +2093,7 @@ wdata_send_pages(struct TCP_Server_Info *server, struct cifs_writedata *wdata,
rc = adjust_credits(server, &wdata->credits, wdata->bytes);
if (rc)
- goto send_pages_out;
+ return rc;
if (!wdata->cfile) {
cifs_dbg(VFS, "No writable handle in writepages\n");
@@ -2108,10 +2107,6 @@ wdata_send_pages(struct TCP_Server_Info *server, struct cifs_writedata *wdata,
cifs_writedata_release);
}
-send_pages_out:
- for (i = 0; i < nr_pages; ++i)
- unlock_page(wdata->pages[i]);
-
return rc;
}
@@ -2200,6 +2195,9 @@ retry:
rc = wdata_send_pages(server, wdata, nr_pages, mapping, wbc);
+ for (i = 0; i < nr_pages; ++i)
+ unlock_page(wdata->pages[i]);
+
/* send failure -- clean up the mess */
if (rc != 0) {
add_credits_and_wake_if(server, &wdata->credits, 0);