NFS client fixes for 2.6.18-rc3
Subsystems (3)
Hi Linus,
Please pull from the repository at
git pull git://git.linux-nfs.org/pub/linux/nfs-2.6.git fixes
This will update the following files through the appended changesets.
Cheers,
Trond
----
fs/lockd/svclock.c | 12 ++-------- fs/nfs/namespace.c | 4 ++- fs/nfs/read.c | 2 +- fs/nfs/write.c | 2 +- include/linux/lockd/lockd.h | 1 - include/linux/nfs_fs.h | 6 ++--- include/linux/sunrpc/xprt.h | 2 +- net/sunrpc/clnt.c | 52 ++++++++++++++++++++++++------------------- net/sunrpc/rpc_pipe.c | 6 +++-- net/sunrpc/xprt.c | 21 ++--------------- net/sunrpc/xprtsock.c | 29 +++++++++++++++++++++++- 11 files changed, 75 insertions(+), 62 deletions(-)
commit 5c3e985a2c1908aa97221d3806f85ce7e2fbfa88
Author: Trond Myklebust <[email protected]> Date: Sat Jul 29 17:37:40 2006 -0400
SUNRPC: Fix obvious refcounting bugs in rpc_pipefs.
Doh!
(cherry picked from 496f408f2f0e7ee5481a7c2222189be6c4f5aa6c commit)
commit e0ab53deaa91293a7958d63d5a2cf4c5645ad6f0
Author: Trond Myklebust <[email protected]> Date: Thu Jul 27 17:22:50 2006 -0400
RPC: Ensure that we disconnect TCP socket when client requests error out
If we're part way through transmitting a TCP request, and the client errors, then we need to disconnect and reconnect the TCP socket in order to avoid confusing the server.
(cherry picked from 031a50c8b9ea82616abd4a4e18021a25848941ce commit)
commit f3d43c769d14b7065da7f62ec468b1fcb8cd6e06
Author: J. Bruce Fields <[email protected]> Date: Thu Aug 3 15:07:47 2006 -0400
NLM/lockd: remove b_done
We never actually set the b_done field any more; it's always zero.
(cherry picked from af8412d4283ef91356e65e0ed9b025b376aebded commit)
commit e4e20512cfe0bacec0764b4925889d1fa94644f9
Author: Adrian Bunk <[email protected]> Date: Thu Aug 3 15:07:47 2006 -0400
NFS: make 2 functions static
nfs_writedata_free() and nfs_readdata_free() can now become static.
(cherry picked from 5e1ce40f0c3c8f67591aff17756930d7a18ceb1a commit)
commit ce510193272c295b891e45525a83b543ae3207c1
Author: Josh Triplett <[email protected]> Date: Mon Jul 24 16:30:00 2006 -0700
NFS: Release dcache_lock in an error path of nfs_path
In one of the error paths of nfs_path, it may return with dcache_lock still held; fix this by adding and using a new error path Elong_unlock which unlocks dcache_lock.
(cherry picked from f4b90b43677fb23297c56802c3056fc304f988d9 commit)
fs/lockd/svclock.c +3 -9
@@ -638,9 +638,6 @@ static void nlmsvc_grant_callback(structif (task->tk_status <0 ) {/* RPC error: Re-insert for retransmission */ timeout =10 *HZ ; - }else if (block->b_done) { -/* Block already removed, kill it for real */ - timeout =0 ; }else {/* Call was successful, now wait for client callback */ timeout =60 *HZ ;
@@ -709,13 +706,10 @@ nlmsvc_retry_blocked(void)break ;if (time_after (block->b_when,jiffies))break ; -dprintk ("nlmsvc_retry_blocked(%p, when=%ld, done=%d)\n" , - block, block->b_when, block->b_done); +dprintk ("nlmsvc_retry_blocked(%p, when=%ld)\n" , + block, block->b_when);kref_get (&block->b_count); -if (block->b_done) -nlmsvc_unlink_block (block); -else -nlmsvc_grant_blocked (block); +nlmsvc_grant_blocked (block);nlmsvc_release_block (block); }
fs/nfs/namespace.c +3 -1
@@ -51,7 +51,7 @@ char *nfs_path(const char *base, const s namelen = dentry->d_name.len; buflen -= namelen +1 ;if (buflen <0 ) - goto Elong; + goto Elong_unlock; end -= namelen;memcpy (end, dentry->d_name.name, namelen); *--end ='/' ;
@@ -68,6 +68,8 @@ char *nfs_path(const char *base, const s end -= namelen;memcpy (end, base, namelen);return end; +Elong_unlock: +spin_unlock (&dcache_lock); Elong:return ERR_PTR (-ENAMETOOLONG ); }
fs/nfs/read.c +1 -1
@@ -63,7 +63,7 @@ struct nfs_read_data *nfs_readdata_allocreturn p; } -void nfs_readdata_free (struct nfs_read_data *p) +static void nfs_readdata_free (struct nfs_read_data *p) {if (p && (p->pagevec != &p->page_array[0 ]))kfree (p->pagevec);
fs/nfs/write.c +1 -1
@@ -137,7 +137,7 @@ struct nfs_write_data *nfs_writedata_allreturn p; } -void nfs_writedata_free (struct nfs_write_data *p) +static void nfs_writedata_free (struct nfs_write_data *p) {if (p && (p->pagevec != &p->page_array[0 ]))kfree (p->pagevec);
include/linux/lockd/lockd.h +0 -1
@@ -123,7 +123,6 @@ struct nlm_block {unsigned int b_id;/* block id */ unsigned char b_queued;/* re-queued */ unsigned char b_granted;/* VFS granted lock */ -unsigned char b_done;/* callback complete */ struct nlm_file * b_file;/* file in question */ };
include/linux/nfs_fs.h +2 -4
@@ -476,10 +476,9 @@ static inline int nfs_wb_page(struct ino }/* -* Allocate and free nfs_write_data structures +* Allocate nfs_write_data structures */ extern struct nfs_write_data *nfs_writedata_alloc (unsigned int pagecount); -extern void nfs_writedata_free (struct nfs_write_data *p);/* * linux/fs/nfs/read.c
@@ -491,10 +490,9 @@ extern int nfs_readpage_result(struct rextern void nfs_readdata_release (void *data);/* -* Allocate and free nfs_read_data structures +* Allocate nfs_read_data structures */ extern struct nfs_read_data *nfs_readdata_alloc (unsigned int pagecount); -extern void nfs_readdata_free (struct nfs_read_data *p);/* * linux/fs/nfs3proc.c
include/linux/sunrpc/xprt.h +1 -1
@@ -229,7 +229,7 @@ int xprt_reserve_xprt(struct rpc_taskint xprt_reserve_xprt_cong (struct rpc_task *task);int xprt_prepare_transmit (struct rpc_task *task);void xprt_transmit (struct rpc_task *task); -void xprt_abort_transmit (struct rpc_task *task); +void xprt_end_transmit (struct rpc_task *task);int xprt_adjust_timeout (struct rpc_rqst *req);void xprt_release_xprt (struct rpc_xprt *xprt,struct rpc_task *task);void xprt_release_xprt_cong (struct rpc_xprt *xprt,struct rpc_task *task);
net/sunrpc/clnt.c +29 -23
73 lines not on this page · raw message
net/sunrpc/rpc_pipe.c +4 -2
@@ -667,10 +667,11 @@ rpc_mkdir(char *path, struct rpc_clnt *r RPCAUTH_info, RPCAUTH_EOF);if (error) goto err_depopulate; +dget (dentry); out:mutex_unlock (&dir->i_mutex);rpc_release_path (&nd); -return dget (dentry); +return dentry; err_depopulate:rpc_depopulate (dentry);__rpc_rmdir (dir, dentry);
@@ -731,10 +732,11 @@ rpc_mkpipe(char *path, void *private, st rpci->flags = flags; rpci->ops = ops;inode_dir_notify (dir,DN_CREATE ); +dget (dentry); out:mutex_unlock (&dir->i_mutex);rpc_release_path (&nd); -return dget (dentry); +return dentry; err_dput:dput (dentry); dentry =ERR_PTR (-ENOMEM );
net/sunrpc/xprt.c +3 -18
@@ -707,12 +707,9 @@ out_unlock:return err; } -void -xprt_abort_transmit (struct rpc_task *task) +void xprt_end_transmit (struct rpc_task *task) { -struct rpc_xprt *xprt = task->tk_xprt; - -xprt_release_write (xprt, task); +xprt_release_write (task->tk_xprt, task); }/**
@@ -761,8 +758,6 @@ void xprt_transmit(struct rpc_task *task task->tk_status = -ENOTCONN ; else if (!req->rq_received)rpc_sleep_on (&xprt->pending, task,NULL , xprt_timer); - - xprt->ops->release_xprt (xprt, task);spin_unlock_bh (&xprt->transport_lock);return ; }
@@ -772,18 +767,8 @@ void xprt_transmit(struct rpc_task *task* schedq, and being picked up by a parallel run of rpciod(). */ task->tk_status = status; - -switch (status) { -case -ECONNREFUSED : +if (status == -ECONNREFUSED )rpc_sleep_on (&xprt->sending, task,NULL ,NULL ); -case -EAGAIN : -case -ENOTCONN : -return ; -default : -break ; - } -xprt_release_write (xprt, task); -return ; }static inline void do_xprt_reserve (struct rpc_task *task)
net/sunrpc/xprtsock.c +28 -1
@@ -414,6 +414,33 @@ static int xs_tcp_send_request(struct rp }/** +* xs_tcp_release_xprt - clean up after a tcp transmission +* @xprt: transport +* @task: rpc task +* +* This cleans up if an error causes us to abort the transmission of a request. +* In this case, the socket may need to be reset in order to avoid confusing +* the server. +*/ +static void xs_tcp_release_xprt (struct rpc_xprt *xprt,struct rpc_task *task) +{ +struct rpc_rqst *req; + +if (task != xprt->snd_task) +return ; +if (task ==NULL ) + goto out_release; + req = task->tk_rqstp; +if (req->rq_bytes_sent ==0 ) + goto out_release; +if (req->rq_bytes_sent == req->rq_snd_buf.len) + goto out_release; +set_bit (XPRT_CLOSE_WAIT , &task->tk_xprt->state); +out_release: +xprt_release_xprt (xprt, task); +} + +/** * xs_close - close a socket * @xprt: transport *
@@ -1250,7 +1277,7 @@ static struct rpc_xprt_ops xs_udp_ops =static struct rpc_xprt_ops xs_tcp_ops = { .reserve_xprt = xprt_reserve_xprt, - .release_xprt = xprt_release_xprt, + .release_xprt = xs_tcp_release_xprt, .set_port = xs_set_port, .connect = xs_connect, .buf_alloc = rpc_malloc,