|
@@ -126,12 +126,16 @@ void nfs_writedata_release(struct nfs_write_data *wdata)
|
|
|
put_nfs_open_context(wdata->args.context);
|
|
|
if (wdata->pages.pagevec != wdata->pages.page_array)
|
|
|
kfree(wdata->pages.pagevec);
|
|
|
- if (wdata != &write_header->rpc_data)
|
|
|
- kfree(wdata);
|
|
|
- else
|
|
|
+ if (wdata == &write_header->rpc_data) {
|
|
|
wdata->header = NULL;
|
|
|
+ wdata = NULL;
|
|
|
+ }
|
|
|
if (atomic_dec_and_test(&hdr->refcnt))
|
|
|
hdr->completion_ops->completion(hdr);
|
|
|
+ /* Note: we only free the rpc_task after callbacks are done.
|
|
|
+ * See the comment in rpc_free_task() for why
|
|
|
+ */
|
|
|
+ kfree(wdata);
|
|
|
}
|
|
|
EXPORT_SYMBOL_GPL(nfs_writedata_release);
|
|
|
|