aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/cifssmb.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/cifs/cifssmb.c')
-rw-r--r--fs/cifs/cifssmb.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index 4d881c35eeca..f3264bd7a83d 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -1910,7 +1910,7 @@ cifs_writev_requeue(struct cifs_writedata *wdata)
1910 1910
1911 do { 1911 do {
1912 server = tlink_tcon(wdata->cfile->tlink)->ses->server; 1912 server = tlink_tcon(wdata->cfile->tlink)->ses->server;
1913 rc = server->ops->async_writev(wdata); 1913 rc = server->ops->async_writev(wdata, cifs_writedata_release);
1914 } while (rc == -EAGAIN); 1914 } while (rc == -EAGAIN);
1915 1915
1916 for (i = 0; i < wdata->nr_pages; i++) { 1916 for (i = 0; i < wdata->nr_pages; i++) {
@@ -1962,15 +1962,9 @@ cifs_writedata_alloc(unsigned int nr_pages, work_func_t complete)
1962{ 1962{
1963 struct cifs_writedata *wdata; 1963 struct cifs_writedata *wdata;
1964 1964
1965 /* this would overflow */
1966 if (nr_pages == 0) {
1967 cifs_dbg(VFS, "%s: called with nr_pages == 0!\n", __func__);
1968 return NULL;
1969 }
1970
1971 /* writedata + number of page pointers */ 1965 /* writedata + number of page pointers */
1972 wdata = kzalloc(sizeof(*wdata) + 1966 wdata = kzalloc(sizeof(*wdata) +
1973 sizeof(struct page *) * (nr_pages - 1), GFP_NOFS); 1967 sizeof(struct page *) * nr_pages, GFP_NOFS);
1974 if (wdata != NULL) { 1968 if (wdata != NULL) {
1975 kref_init(&wdata->refcount); 1969 kref_init(&wdata->refcount);
1976 INIT_LIST_HEAD(&wdata->list); 1970 INIT_LIST_HEAD(&wdata->list);
@@ -2031,7 +2025,8 @@ cifs_writev_callback(struct mid_q_entry *mid)
2031 2025
2032/* cifs_async_writev - send an async write, and set up mid to handle result */ 2026/* cifs_async_writev - send an async write, and set up mid to handle result */
2033int 2027int
2034cifs_async_writev(struct cifs_writedata *wdata) 2028cifs_async_writev(struct cifs_writedata *wdata,
2029 void (*release)(struct kref *kref))
2035{ 2030{
2036 int rc = -EACCES; 2031 int rc = -EACCES;
2037 WRITE_REQ *smb = NULL; 2032 WRITE_REQ *smb = NULL;
@@ -2105,7 +2100,7 @@ cifs_async_writev(struct cifs_writedata *wdata)
2105 if (rc == 0) 2100 if (rc == 0)
2106 cifs_stats_inc(&tcon->stats.cifs_stats.num_writes); 2101 cifs_stats_inc(&tcon->stats.cifs_stats.num_writes);
2107 else 2102 else
2108 kref_put(&wdata->refcount, cifs_writedata_release); 2103 kref_put(&wdata->refcount, release);
2109 2104
2110async_writev_out: 2105async_writev_out:
2111 cifs_small_buf_release(smb); 2106 cifs_small_buf_release(smb);