diff options
author | Steve French <smfrench@gmail.com> | 2014-02-07 21:45:12 -0500 |
---|---|---|
committer | Steve French <smfrench@gmail.com> | 2014-02-07 21:47:00 -0500 |
commit | 4a5c80d7b5615be8098f9d5da97d166afc318abc (patch) | |
tree | ff3e40a816442722056805cc0cc1844051a30988 /fs/cifs/smb2pdu.c | |
parent | 26c8f0d601f5d4c0d9f4bc8c5151539aae5dc26a (diff) |
[CIFS] clean up page array when uncached write send fails
In the event that a send fails in an uncached write, or we end up
needing to reissue it (-EAGAIN case), we'll kfree the wdata but
the pages currently leak.
Fix this by adding a new kref release routine for uncached writedata
that releases the pages, and have the uncached codepaths use that.
[original patch by Jeff modified to fix minor formatting problems]
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Reviewed-by: Pavel Shilovsky <piastry@etersoft.ru>
Signed-off-by: Steve French <smfrench@gmail.com>
Diffstat (limited to 'fs/cifs/smb2pdu.c')
-rw-r--r-- | fs/cifs/smb2pdu.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c index 2013234b73ad..a3f7a9c3cc69 100644 --- a/fs/cifs/smb2pdu.c +++ b/fs/cifs/smb2pdu.c | |||
@@ -1890,7 +1890,8 @@ smb2_writev_callback(struct mid_q_entry *mid) | |||
1890 | 1890 | ||
1891 | /* smb2_async_writev - send an async write, and set up mid to handle result */ | 1891 | /* smb2_async_writev - send an async write, and set up mid to handle result */ |
1892 | int | 1892 | int |
1893 | smb2_async_writev(struct cifs_writedata *wdata) | 1893 | smb2_async_writev(struct cifs_writedata *wdata, |
1894 | void (*release)(struct kref *kref)) | ||
1894 | { | 1895 | { |
1895 | int rc = -EACCES; | 1896 | int rc = -EACCES; |
1896 | struct smb2_write_req *req = NULL; | 1897 | struct smb2_write_req *req = NULL; |
@@ -1938,7 +1939,7 @@ smb2_async_writev(struct cifs_writedata *wdata) | |||
1938 | smb2_writev_callback, wdata, 0); | 1939 | smb2_writev_callback, wdata, 0); |
1939 | 1940 | ||
1940 | if (rc) { | 1941 | if (rc) { |
1941 | kref_put(&wdata->refcount, cifs_writedata_release); | 1942 | kref_put(&wdata->refcount, release); |
1942 | cifs_stats_fail_inc(tcon, SMB2_WRITE_HE); | 1943 | cifs_stats_fail_inc(tcon, SMB2_WRITE_HE); |
1943 | } | 1944 | } |
1944 | 1945 | ||