diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2006-08-25 01:29:46 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-08-25 01:29:46 -0400 |
commit | 62250b3bb596ffbae17c4b3d865fecd6329ce8b3 (patch) | |
tree | 8f18da918c319a1f0be6c4011b60091bb29dc007 /net | |
parent | 428a7e3e46a465a6cfe7ccbe15d7ea03a043a95a (diff) | |
parent | a969fd5a4e162c4485ae8f3e49d674656a18fa36 (diff) |
Merge branch 'fixes' of git://git.linux-nfs.org/pub/linux/nfs-2.6
Diffstat (limited to 'net')
-rw-r--r-- | net/sunrpc/auth_gss/auth_gss.c | 3 | ||||
-rw-r--r-- | net/sunrpc/clnt.c | 30 | ||||
-rw-r--r-- | net/sunrpc/rpc_pipe.c | 55 |
3 files changed, 41 insertions, 47 deletions
diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c index 4a9aa9393b97..ef1cf5b476c8 100644 --- a/net/sunrpc/auth_gss/auth_gss.c +++ b/net/sunrpc/auth_gss/auth_gss.c | |||
@@ -718,8 +718,7 @@ gss_destroy(struct rpc_auth *auth) | |||
718 | auth, auth->au_flavor); | 718 | auth, auth->au_flavor); |
719 | 719 | ||
720 | gss_auth = container_of(auth, struct gss_auth, rpc_auth); | 720 | gss_auth = container_of(auth, struct gss_auth, rpc_auth); |
721 | rpc_unlink(gss_auth->path); | 721 | rpc_unlink(gss_auth->dentry); |
722 | dput(gss_auth->dentry); | ||
723 | gss_auth->dentry = NULL; | 722 | gss_auth->dentry = NULL; |
724 | gss_mech_put(gss_auth->mech); | 723 | gss_mech_put(gss_auth->mech); |
725 | 724 | ||
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index d6409e757219..3e19d321067a 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c | |||
@@ -183,8 +183,7 @@ rpc_new_client(struct rpc_xprt *xprt, char *servname, | |||
183 | 183 | ||
184 | out_no_auth: | 184 | out_no_auth: |
185 | if (!IS_ERR(clnt->cl_dentry)) { | 185 | if (!IS_ERR(clnt->cl_dentry)) { |
186 | rpc_rmdir(clnt->cl_pathname); | 186 | rpc_rmdir(clnt->cl_dentry); |
187 | dput(clnt->cl_dentry); | ||
188 | rpc_put_mount(); | 187 | rpc_put_mount(); |
189 | } | 188 | } |
190 | out_no_path: | 189 | out_no_path: |
@@ -251,10 +250,8 @@ rpc_clone_client(struct rpc_clnt *clnt) | |||
251 | new->cl_autobind = 0; | 250 | new->cl_autobind = 0; |
252 | new->cl_oneshot = 0; | 251 | new->cl_oneshot = 0; |
253 | new->cl_dead = 0; | 252 | new->cl_dead = 0; |
254 | if (!IS_ERR(new->cl_dentry)) { | 253 | if (!IS_ERR(new->cl_dentry)) |
255 | dget(new->cl_dentry); | 254 | dget(new->cl_dentry); |
256 | rpc_get_mount(); | ||
257 | } | ||
258 | rpc_init_rtt(&new->cl_rtt_default, clnt->cl_xprt->timeout.to_initval); | 255 | rpc_init_rtt(&new->cl_rtt_default, clnt->cl_xprt->timeout.to_initval); |
259 | if (new->cl_auth) | 256 | if (new->cl_auth) |
260 | atomic_inc(&new->cl_auth->au_count); | 257 | atomic_inc(&new->cl_auth->au_count); |
@@ -317,11 +314,15 @@ rpc_destroy_client(struct rpc_clnt *clnt) | |||
317 | clnt->cl_auth = NULL; | 314 | clnt->cl_auth = NULL; |
318 | } | 315 | } |
319 | if (clnt->cl_parent != clnt) { | 316 | if (clnt->cl_parent != clnt) { |
317 | if (!IS_ERR(clnt->cl_dentry)) | ||
318 | dput(clnt->cl_dentry); | ||
320 | rpc_destroy_client(clnt->cl_parent); | 319 | rpc_destroy_client(clnt->cl_parent); |
321 | goto out_free; | 320 | goto out_free; |
322 | } | 321 | } |
323 | if (clnt->cl_pathname[0]) | 322 | if (!IS_ERR(clnt->cl_dentry)) { |
324 | rpc_rmdir(clnt->cl_pathname); | 323 | rpc_rmdir(clnt->cl_dentry); |
324 | rpc_put_mount(); | ||
325 | } | ||
325 | if (clnt->cl_xprt) { | 326 | if (clnt->cl_xprt) { |
326 | xprt_destroy(clnt->cl_xprt); | 327 | xprt_destroy(clnt->cl_xprt); |
327 | clnt->cl_xprt = NULL; | 328 | clnt->cl_xprt = NULL; |
@@ -331,10 +332,6 @@ rpc_destroy_client(struct rpc_clnt *clnt) | |||
331 | out_free: | 332 | out_free: |
332 | rpc_free_iostats(clnt->cl_metrics); | 333 | rpc_free_iostats(clnt->cl_metrics); |
333 | clnt->cl_metrics = NULL; | 334 | clnt->cl_metrics = NULL; |
334 | if (!IS_ERR(clnt->cl_dentry)) { | ||
335 | dput(clnt->cl_dentry); | ||
336 | rpc_put_mount(); | ||
337 | } | ||
338 | kfree(clnt); | 335 | kfree(clnt); |
339 | return 0; | 336 | return 0; |
340 | } | 337 | } |
@@ -1184,6 +1181,17 @@ call_verify(struct rpc_task *task) | |||
1184 | u32 *p = iov->iov_base, n; | 1181 | u32 *p = iov->iov_base, n; |
1185 | int error = -EACCES; | 1182 | int error = -EACCES; |
1186 | 1183 | ||
1184 | if ((task->tk_rqstp->rq_rcv_buf.len & 3) != 0) { | ||
1185 | /* RFC-1014 says that the representation of XDR data must be a | ||
1186 | * multiple of four bytes | ||
1187 | * - if it isn't pointer subtraction in the NFS client may give | ||
1188 | * undefined results | ||
1189 | */ | ||
1190 | printk(KERN_WARNING | ||
1191 | "call_verify: XDR representation not a multiple of" | ||
1192 | " 4 bytes: 0x%x\n", task->tk_rqstp->rq_rcv_buf.len); | ||
1193 | goto out_eio; | ||
1194 | } | ||
1187 | if ((len -= 3) < 0) | 1195 | if ((len -= 3) < 0) |
1188 | goto out_overflow; | 1196 | goto out_overflow; |
1189 | p += 1; /* skip XID */ | 1197 | p += 1; /* skip XID */ |
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c index a3bd2db2e024..0b1a1ac8a4bc 100644 --- a/net/sunrpc/rpc_pipe.c +++ b/net/sunrpc/rpc_pipe.c | |||
@@ -539,6 +539,7 @@ repeat: | |||
539 | rpc_close_pipes(dentry->d_inode); | 539 | rpc_close_pipes(dentry->d_inode); |
540 | simple_unlink(dir, dentry); | 540 | simple_unlink(dir, dentry); |
541 | } | 541 | } |
542 | inode_dir_notify(dir, DN_DELETE); | ||
542 | dput(dentry); | 543 | dput(dentry); |
543 | } while (n); | 544 | } while (n); |
544 | goto repeat; | 545 | goto repeat; |
@@ -610,8 +611,8 @@ __rpc_rmdir(struct inode *dir, struct dentry *dentry) | |||
610 | int error; | 611 | int error; |
611 | 612 | ||
612 | shrink_dcache_parent(dentry); | 613 | shrink_dcache_parent(dentry); |
613 | if (dentry->d_inode) | 614 | if (d_unhashed(dentry)) |
614 | rpc_close_pipes(dentry->d_inode); | 615 | return 0; |
615 | if ((error = simple_rmdir(dir, dentry)) != 0) | 616 | if ((error = simple_rmdir(dir, dentry)) != 0) |
616 | return error; | 617 | return error; |
617 | if (!error) { | 618 | if (!error) { |
@@ -684,28 +685,20 @@ err_dput: | |||
684 | } | 685 | } |
685 | 686 | ||
686 | int | 687 | int |
687 | rpc_rmdir(char *path) | 688 | rpc_rmdir(struct dentry *dentry) |
688 | { | 689 | { |
689 | struct nameidata nd; | 690 | struct dentry *parent; |
690 | struct dentry *dentry; | ||
691 | struct inode *dir; | 691 | struct inode *dir; |
692 | int error; | 692 | int error; |
693 | 693 | ||
694 | if ((error = rpc_lookup_parent(path, &nd)) != 0) | 694 | parent = dget_parent(dentry); |
695 | return error; | 695 | dir = parent->d_inode; |
696 | dir = nd.dentry->d_inode; | ||
697 | mutex_lock_nested(&dir->i_mutex, I_MUTEX_PARENT); | 696 | mutex_lock_nested(&dir->i_mutex, I_MUTEX_PARENT); |
698 | dentry = lookup_one_len(nd.last.name, nd.dentry, nd.last.len); | ||
699 | if (IS_ERR(dentry)) { | ||
700 | error = PTR_ERR(dentry); | ||
701 | goto out_release; | ||
702 | } | ||
703 | rpc_depopulate(dentry); | 697 | rpc_depopulate(dentry); |
704 | error = __rpc_rmdir(dir, dentry); | 698 | error = __rpc_rmdir(dir, dentry); |
705 | dput(dentry); | 699 | dput(dentry); |
706 | out_release: | ||
707 | mutex_unlock(&dir->i_mutex); | 700 | mutex_unlock(&dir->i_mutex); |
708 | rpc_release_path(&nd); | 701 | dput(parent); |
709 | return error; | 702 | return error; |
710 | } | 703 | } |
711 | 704 | ||
@@ -746,32 +739,26 @@ err_dput: | |||
746 | } | 739 | } |
747 | 740 | ||
748 | int | 741 | int |
749 | rpc_unlink(char *path) | 742 | rpc_unlink(struct dentry *dentry) |
750 | { | 743 | { |
751 | struct nameidata nd; | 744 | struct dentry *parent; |
752 | struct dentry *dentry; | ||
753 | struct inode *dir; | 745 | struct inode *dir; |
754 | int error; | 746 | int error = 0; |
755 | 747 | ||
756 | if ((error = rpc_lookup_parent(path, &nd)) != 0) | 748 | parent = dget_parent(dentry); |
757 | return error; | 749 | dir = parent->d_inode; |
758 | dir = nd.dentry->d_inode; | ||
759 | mutex_lock_nested(&dir->i_mutex, I_MUTEX_PARENT); | 750 | mutex_lock_nested(&dir->i_mutex, I_MUTEX_PARENT); |
760 | dentry = lookup_one_len(nd.last.name, nd.dentry, nd.last.len); | 751 | if (!d_unhashed(dentry)) { |
761 | if (IS_ERR(dentry)) { | 752 | d_drop(dentry); |
762 | error = PTR_ERR(dentry); | 753 | if (dentry->d_inode) { |
763 | goto out_release; | 754 | rpc_close_pipes(dentry->d_inode); |
764 | } | 755 | error = simple_unlink(dir, dentry); |
765 | d_drop(dentry); | 756 | } |
766 | if (dentry->d_inode) { | 757 | inode_dir_notify(dir, DN_DELETE); |
767 | rpc_close_pipes(dentry->d_inode); | ||
768 | error = simple_unlink(dir, dentry); | ||
769 | } | 758 | } |
770 | dput(dentry); | 759 | dput(dentry); |
771 | inode_dir_notify(dir, DN_DELETE); | ||
772 | out_release: | ||
773 | mutex_unlock(&dir->i_mutex); | 760 | mutex_unlock(&dir->i_mutex); |
774 | rpc_release_path(&nd); | 761 | dput(parent); |
775 | return error; | 762 | return error; |
776 | } | 763 | } |
777 | 764 | ||