aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/scm.h
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2011-09-16 19:34:00 -0400
committerDavid S. Miller <davem@davemloft.net>2011-09-16 19:34:00 -0400
commitf78a5fda9116525809d088917638be912b85f838 (patch)
treeab6d7edaa915cea74d6c664c3e39a5ad15bab0f8 /include/net/scm.h
parent473e64ee4603671efa1e0785418e56e9ffdfc47b (diff)
Revert "Scm: Remove unnecessary pid & credential references in Unix socket's send and receive path"
This reverts commit 0856a304091b33a8e8f9f9c98e776f425af2b625. As requested by Eric Dumazet, it has various ref-counting problems and has introduced regressions. Eric will add a more suitable version of this performance fix. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/scm.h')
-rw-r--r--include/net/scm.h22
1 files changed, 3 insertions, 19 deletions
diff --git a/include/net/scm.h b/include/net/scm.h
index 68e1e481658e..745460fa2f02 100644
--- a/include/net/scm.h
+++ b/include/net/scm.h
@@ -53,14 +53,6 @@ static __inline__ void scm_set_cred(struct scm_cookie *scm,
53 cred_to_ucred(pid, cred, &scm->creds); 53 cred_to_ucred(pid, cred, &scm->creds);
54} 54}
55 55
56static __inline__ void scm_set_cred_noref(struct scm_cookie *scm,
57 struct pid *pid, const struct cred *cred)
58{
59 scm->pid = pid;
60 scm->cred = cred;
61 cred_to_ucred(pid, cred, &scm->creds);
62}
63
64static __inline__ void scm_destroy_cred(struct scm_cookie *scm) 56static __inline__ void scm_destroy_cred(struct scm_cookie *scm)
65{ 57{
66 put_pid(scm->pid); 58 put_pid(scm->pid);
@@ -78,15 +70,6 @@ static __inline__ void scm_destroy(struct scm_cookie *scm)
78 __scm_destroy(scm); 70 __scm_destroy(scm);
79} 71}
80 72
81static __inline__ void scm_release(struct scm_cookie *scm)
82{
83 /* keep ref on pid and cred */
84 scm->pid = NULL;
85 scm->cred = NULL;
86 if (scm->fp)
87 __scm_destroy(scm);
88}
89
90static __inline__ int scm_send(struct socket *sock, struct msghdr *msg, 73static __inline__ int scm_send(struct socket *sock, struct msghdr *msg,
91 struct scm_cookie *scm) 74 struct scm_cookie *scm)
92{ 75{
@@ -125,14 +108,15 @@ static __inline__ void scm_recv(struct socket *sock, struct msghdr *msg,
125 if (!msg->msg_control) { 108 if (!msg->msg_control) {
126 if (test_bit(SOCK_PASSCRED, &sock->flags) || scm->fp) 109 if (test_bit(SOCK_PASSCRED, &sock->flags) || scm->fp)
127 msg->msg_flags |= MSG_CTRUNC; 110 msg->msg_flags |= MSG_CTRUNC;
128 if (scm && scm->fp) 111 scm_destroy(scm);
129 __scm_destroy(scm);
130 return; 112 return;
131 } 113 }
132 114
133 if (test_bit(SOCK_PASSCRED, &sock->flags)) 115 if (test_bit(SOCK_PASSCRED, &sock->flags))
134 put_cmsg(msg, SOL_SOCKET, SCM_CREDENTIALS, sizeof(scm->creds), &scm->creds); 116 put_cmsg(msg, SOL_SOCKET, SCM_CREDENTIALS, sizeof(scm->creds), &scm->creds);
135 117
118 scm_destroy_cred(scm);
119
136 scm_passec(sock, msg, scm); 120 scm_passec(sock, msg, scm);
137 121
138 if (!scm->fp) 122 if (!scm->fp)