diff options
author | Jeff Layton <jlayton@redhat.com> | 2012-05-16 07:13:17 -0400 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2012-05-16 21:13:30 -0400 |
commit | 6993f74a5bf836210e7f253d5ad3f76d73a95f51 (patch) | |
tree | 6b0cf7d6aed03e9d7d0b705cf7ba79792ab062a2 /fs/cifs/cifssmb.c | |
parent | 8d5ce4d23c79e0f9861b19fc534f5b2dc636f79c (diff) |
cifs: add refcounting to cifs_readdata structures
This isn't strictly necessary for the async readpages code, but the
uncached version will need to be able to collect the replies after
issuing the calls. Add a kref to cifs_readdata and use change the
code to take and put references appropriately.
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Diffstat (limited to 'fs/cifs/cifssmb.c')
-rw-r--r-- | fs/cifs/cifssmb.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index 3aa1fcc15156..45633da461a8 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c | |||
@@ -1635,12 +1635,15 @@ cifs_async_readv(struct cifs_readdata *rdata) | |||
1635 | rdata->iov[0].iov_base = smb; | 1635 | rdata->iov[0].iov_base = smb; |
1636 | rdata->iov[0].iov_len = be32_to_cpu(smb->hdr.smb_buf_length) + 4; | 1636 | rdata->iov[0].iov_len = be32_to_cpu(smb->hdr.smb_buf_length) + 4; |
1637 | 1637 | ||
1638 | kref_get(&rdata->refcount); | ||
1638 | rc = cifs_call_async(tcon->ses->server, rdata->iov, 1, | 1639 | rc = cifs_call_async(tcon->ses->server, rdata->iov, 1, |
1639 | cifs_readv_receive, cifs_readv_callback, | 1640 | cifs_readv_receive, cifs_readv_callback, |
1640 | rdata, false); | 1641 | rdata, false); |
1641 | 1642 | ||
1642 | if (rc == 0) | 1643 | if (rc == 0) |
1643 | cifs_stats_inc(&tcon->num_reads); | 1644 | cifs_stats_inc(&tcon->num_reads); |
1645 | else | ||
1646 | kref_put(&rdata->refcount, cifs_readdata_release); | ||
1644 | 1647 | ||
1645 | cifs_small_buf_release(smb); | 1648 | cifs_small_buf_release(smb); |
1646 | return rc; | 1649 | return rc; |