提交 1788c208 编写于 作者: L Linus Torvalds

Merge branch 'bugfixes' of git://git.linux-nfs.org/projects/trondmy/nfs-2.6

* 'bugfixes' of git://git.linux-nfs.org/projects/trondmy/nfs-2.6:
  NFS: Ensure that rpc_release_resources_task() can be called twice.
  NFS: Don't leak RPC clients in NFSv4 secinfo negotiation
  NFS: Fix a hang in the writeback path
...@@ -192,13 +192,15 @@ static rpc_authflavor_t nfs_lookup_with_sec(struct nfs_server *server, struct de ...@@ -192,13 +192,15 @@ static rpc_authflavor_t nfs_lookup_with_sec(struct nfs_server *server, struct de
auth = rpcauth_create(flavor, clone); auth = rpcauth_create(flavor, clone);
if (!auth) { if (!auth) {
flavor = -EIO; flavor = -EIO;
goto out; goto out_shutdown;
} }
err = server->nfs_client->rpc_ops->lookup(clone, parent->d_inode, err = server->nfs_client->rpc_ops->lookup(clone, parent->d_inode,
&path->dentry->d_name, &path->dentry->d_name,
fh, fattr); fh, fattr);
if (err < 0) if (err < 0)
flavor = err; flavor = err;
out_shutdown:
rpc_shutdown_client(clone);
out: out:
return flavor; return flavor;
} }
......
...@@ -135,14 +135,14 @@ void nfs_clear_page_tag_locked(struct nfs_page *req) ...@@ -135,14 +135,14 @@ void nfs_clear_page_tag_locked(struct nfs_page *req)
nfs_unlock_request(req); nfs_unlock_request(req);
} }
/** /*
* nfs_clear_request - Free up all resources allocated to the request * nfs_clear_request - Free up all resources allocated to the request
* @req: * @req:
* *
* Release page and open context resources associated with a read/write * Release page and open context resources associated with a read/write
* request after it has completed. * request after it has completed.
*/ */
void nfs_clear_request(struct nfs_page *req) static void nfs_clear_request(struct nfs_page *req)
{ {
struct page *page = req->wb_page; struct page *page = req->wb_page;
struct nfs_open_context *ctx = req->wb_context; struct nfs_open_context *ctx = req->wb_context;
......
...@@ -389,11 +389,8 @@ static int nfs_inode_add_request(struct inode *inode, struct nfs_page *req) ...@@ -389,11 +389,8 @@ static int nfs_inode_add_request(struct inode *inode, struct nfs_page *req)
spin_lock(&inode->i_lock); spin_lock(&inode->i_lock);
error = radix_tree_insert(&nfsi->nfs_page_tree, req->wb_index, req); error = radix_tree_insert(&nfsi->nfs_page_tree, req->wb_index, req);
BUG_ON(error); BUG_ON(error);
if (!nfsi->npages) { if (!nfsi->npages && nfs_have_delegation(inode, FMODE_WRITE))
igrab(inode); nfsi->change_attr++;
if (nfs_have_delegation(inode, FMODE_WRITE))
nfsi->change_attr++;
}
set_bit(PG_MAPPED, &req->wb_flags); set_bit(PG_MAPPED, &req->wb_flags);
SetPagePrivate(req->wb_page); SetPagePrivate(req->wb_page);
set_page_private(req->wb_page, (unsigned long)req); set_page_private(req->wb_page, (unsigned long)req);
...@@ -423,11 +420,7 @@ static void nfs_inode_remove_request(struct nfs_page *req) ...@@ -423,11 +420,7 @@ static void nfs_inode_remove_request(struct nfs_page *req)
clear_bit(PG_MAPPED, &req->wb_flags); clear_bit(PG_MAPPED, &req->wb_flags);
radix_tree_delete(&nfsi->nfs_page_tree, req->wb_index); radix_tree_delete(&nfsi->nfs_page_tree, req->wb_index);
nfsi->npages--; nfsi->npages--;
if (!nfsi->npages) { spin_unlock(&inode->i_lock);
spin_unlock(&inode->i_lock);
iput(inode);
} else
spin_unlock(&inode->i_lock);
nfs_release_request(req); nfs_release_request(req);
} }
......
...@@ -78,7 +78,6 @@ extern struct nfs_page *nfs_create_request(struct nfs_open_context *ctx, ...@@ -78,7 +78,6 @@ extern struct nfs_page *nfs_create_request(struct nfs_open_context *ctx,
struct page *page, struct page *page,
unsigned int offset, unsigned int offset,
unsigned int count); unsigned int count);
extern void nfs_clear_request(struct nfs_page *req);
extern void nfs_release_request(struct nfs_page *req); extern void nfs_release_request(struct nfs_page *req);
......
...@@ -860,8 +860,10 @@ static void rpc_release_resources_task(struct rpc_task *task) ...@@ -860,8 +860,10 @@ static void rpc_release_resources_task(struct rpc_task *task)
{ {
if (task->tk_rqstp) if (task->tk_rqstp)
xprt_release(task); xprt_release(task);
if (task->tk_msg.rpc_cred) if (task->tk_msg.rpc_cred) {
put_rpccred(task->tk_msg.rpc_cred); put_rpccred(task->tk_msg.rpc_cred);
task->tk_msg.rpc_cred = NULL;
}
rpc_task_release_client(task); rpc_task_release_client(task);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册