<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/net/sunrpc, branch linux-2.6.34.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-2.6.34.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-2.6.34.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2014-02-10T21:11:34Z</updated>
<entry>
<title>svcrpc: fix svc_xprt_enqueue/svc_recv busy-looping</title>
<updated>2014-02-10T21:11:34Z</updated>
<author>
<name>J. Bruce Fields</name>
</author>
<published>2012-08-17T21:31:53Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=2b718efa69f2431de9df4b35e725316fa25d5310'/>
<id>urn:sha1:2b718efa69f2431de9df4b35e725316fa25d5310</id>
<content type='text'>
commit d10f27a750312ed5638c876e4bd6aa83664cccd8 upstream.

The rpc server tries to ensure that there will be room to send a reply
before it receives a request.

It does this by tracking, in xpt_reserved, an upper bound on the total
size of the replies that is has already committed to for the socket.

Currently it is adding in the estimate for a new reply *before* it
checks whether there is space available.  If it finds that there is not
space, it then subtracts the estimate back out.

This may lead the subsequent svc_xprt_enqueue to decide that there is
space after all.

The results is a svc_recv() that will repeatedly return -EAGAIN, causing
server threads to loop without doing any actual work.

Reported-by: Michael Tokarev &lt;mjt@tls.msk.ru&gt;
Tested-by: Michael Tokarev &lt;mjt@tls.msk.ru&gt;
Signed-off-by: J. Bruce Fields &lt;bfields@redhat.com&gt;
Signed-off-by: Paul Gortmaker &lt;paul.gortmaker@windriver.com&gt;
</content>
</entry>
<entry>
<title>svcrpc: sends on closed socket should stop immediately</title>
<updated>2014-02-10T21:11:34Z</updated>
<author>
<name>J. Bruce Fields</name>
</author>
<published>2012-08-20T20:04:40Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=c8af16321375a4d6b4bc2cf874292d5943586d91'/>
<id>urn:sha1:c8af16321375a4d6b4bc2cf874292d5943586d91</id>
<content type='text'>
commit f06f00a24d76e168ecb38d352126fd203937b601 upstream.

svc_tcp_sendto sets XPT_CLOSE if we fail to transmit the entire reply.
However, the XPT_CLOSE won't be acted on immediately.  Meanwhile other
threads could send further replies before the socket is really shut
down.  This can manifest as data corruption: for example, if a truncated
read reply is followed by another rpc reply, that second reply will look
to the client like further read data.

Symptoms were data corruption preceded by svc_tcp_sendto logging
something like

	kernel: rpc-srv/tcp: nfsd: sent only 963696 when sending 1048708 bytes - shutting down socket

Reported-by: Malahal Naineni &lt;malahal@us.ibm.com&gt;
Tested-by: Malahal Naineni &lt;malahal@us.ibm.com&gt;
Signed-off-by: J. Bruce Fields &lt;bfields@redhat.com&gt;
Signed-off-by: Paul Gortmaker &lt;paul.gortmaker@windriver.com&gt;
</content>
</entry>
<entry>
<title>kernel panic when mount NFSv4</title>
<updated>2014-02-10T21:11:02Z</updated>
<author>
<name>Trond Myklebust</name>
</author>
<published>2010-12-20T21:19:26Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=529f9e4e99ad59a789803620d7a66a6ee7e9e2ab'/>
<id>urn:sha1:529f9e4e99ad59a789803620d7a66a6ee7e9e2ab</id>
<content type='text'>
commit beb0f0a9fba1fa98b378329a9a5b0a73f25097ae upstream.

On Tue, 2010-12-14 at 16:58 +0800, Mi Jinlong wrote:
&gt; Hi,
&gt;
&gt; When testing NFSv4 at RHEL6 with kernel 2.6.32, I got a kernel panic
&gt; at NFS client's __rpc_create_common function.
&gt;
&gt; The panic place is:
&gt;   rpc_mkpipe
&gt;     __rpc_lookup_create()          &lt;=== find pipefile *idmap*
&gt;     __rpc_mkpipe()                 &lt;=== pipefile is *idmap*
&gt;       __rpc_create_common()
&gt;        ******  BUG_ON(!d_unhashed(dentry)); ******    *panic*
&gt;
&gt; It means that the dentry's d_flags have be set DCACHE_UNHASHED,
&gt; but it should not be set here.
&gt;
&gt; Is someone known this bug? or give me some idea?
&gt;
&gt; A reproduce program is append, but it can't reproduce the bug every time.
&gt; the export is: "/nfsroot       *(rw,no_root_squash,fsid=0,insecure)"
&gt;
&gt; And the panic message is append.
&gt;
&gt; ============================================================================
&gt; #!/bin/sh
&gt;
&gt; LOOPTOTAL=768
&gt; LOOPCOUNT=0
&gt; ret=0
&gt;
&gt; while [ $LOOPCOUNT -ne $LOOPTOTAL ]
&gt; do
&gt; 	((LOOPCOUNT += 1))
&gt; 	service nfs restart
&gt; 	/usr/sbin/rpc.idmapd
&gt; 	mount -t nfs4 127.0.0.1:/ /mnt|| return 1;
&gt; 	ls -l /var/lib/nfs/rpc_pipefs/nfs/*/
&gt; 	umount /mnt
&gt; 	echo $LOOPCOUNT
&gt; done
&gt;
&gt; ===============================================================================
&gt; Code: af 60 01 00 00 89 fa 89 f0 e8 64 cf 89 f0 e8 5c 7c 64 cf 31 c0 8b 5c 24 10 8b
&gt; 74 24 14 8b 7c 24 18 8b 6c 24 1c 83 c4 20 c3 &lt;0f&gt; 0b eb fc 8b 46 28 c7 44 24 08 20
&gt; de ee f0 c7 44 24 04 56 ea
&gt; EIP:[&lt;f0ee92ea&gt;] __rpc_create_common+0x8a/0xc0 [sunrpc] SS:ESP 0068:eccb5d28
&gt; ---[ end trace 8f5606cd08928ed2]---
&gt; Kernel panic - not syncing: Fatal exception
&gt; Pid:7131, comm: mount.nfs4 Tainted: G     D   -------------------2.6.32 #1
&gt; Call Trace:
&gt;  [&lt;c080ad18&gt;] ? panic+0x42/0xed
&gt;  [&lt;c080e42c&gt;] ? oops_end+0xbc/0xd0
&gt;  [&lt;c040b090&gt;] ? do_invalid_op+0x0/0x90
&gt;  [&lt;c040b10f&gt;] ? do_invalid_op+0x7f/0x90
&gt;  [&lt;f0ee92ea&gt;] ? __rpc_create_common+0x8a/0xc0[sunrpc]
&gt;  [&lt;f0edc433&gt;] ? rpc_free_task+0x33/0x70[sunrpc]
&gt;  [&lt;f0ed6508&gt;] ? prc_call_sync+0x48/0x60[sunrpc]
&gt;  [&lt;f0ed656e&gt;] ? rpc_ping+0x4e/0x60[sunrpc]
&gt;  [&lt;f0ed6eaf&gt;] ? rpc_create+0x38f/0x4f0[sunrpc]
&gt;  [&lt;c080d80b&gt;] ? error_code+0x73/0x78
&gt;  [&lt;f0ee92ea&gt;] ? __rpc_create_common+0x8a/0xc0[sunrpc]
&gt;  [&lt;c0532bda&gt;] ? d_lookup+0x2a/0x40
&gt;  [&lt;f0ee94b1&gt;] ? rpc_mkpipe+0x111/0x1b0[sunrpc]
&gt;  [&lt;f10a59f4&gt;] ? nfs_create_rpc_client+0xb4/0xf0[nfs]
&gt;  [&lt;f10d6c6d&gt;] ? nfs_fscache_get_client_cookie+0x1d/0x50[nfs]
&gt;  [&lt;f10d3fcb&gt;] ? nfs_idmap_new+0x7b/0x140[nfs]
&gt;  [&lt;c05e76aa&gt;] ? strlcpy+0x3a/0x60
&gt;  [&lt;f10a60ca&gt;] ? nfs4_set_client+0xea/0x2b0[nfs]
&gt;  [&lt;f10a6d0c&gt;] ? nfs4_create_server+0xac/0x1b0[nfs]
&gt;  [&lt;c04f1400&gt;] ? krealloc+0x40/0x50
&gt;  [&lt;f10b0e8b&gt;] ? nfs4_remote_get_sb+0x6b/0x250[nfs]
&gt;  [&lt;c04f14ec&gt;] ? kstrdup+0x3c/0x60
&gt;  [&lt;c0520739&gt;] ? vfs_kern_mount+0x69/0x170
&gt;  [&lt;f10b1a3c&gt;] ? nfs_do_root_mount+0x6c/0xa0[nfs]
&gt;  [&lt;f10b1b47&gt;] ? nfs4_try_mount+0x37/0xa0[nfs]
&gt;  [&lt;f10afe6d&gt;] ? nfs4_validate_text_mount_data+-x7d/0xf0[nfs]
&gt;  [&lt;f10b1c42&gt;] ? nfs4_get_sb+0x92/0x2f0
&gt;  [&lt;c0520739&gt;] ? vfs_kern_mount+0x69/0x170
&gt;  [&lt;c05366d2&gt;] ? get_fs_type+0x32/0xb0
&gt;  [&lt;c052089f&gt;] ? do_kern_mount+0x3f/0xe0
&gt;  [&lt;c053954f&gt;] ? do_mount+0x2ef/0x740
&gt;  [&lt;c0537740&gt;] ? copy_mount_options+0xb0/0x120
&gt;  [&lt;c0539a0e&gt;] ? sys_mount+0x6e/0xa0

Hi,

Does the following patch fix the problem?

Cheers
  Trond

--------------------------
SUNRPC: Fix a BUG in __rpc_create_common

From: Trond Myklebust &lt;Trond.Myklebust@netapp.com&gt;

Mi Jinlong reports:

When testing NFSv4 at RHEL6 with kernel 2.6.32, I got a kernel panic
at NFS client's __rpc_create_common function.

The panic place is:
  rpc_mkpipe
      __rpc_lookup_create()          &lt;=== find pipefile *idmap*
      __rpc_mkpipe()                 &lt;=== pipefile is *idmap*
        __rpc_create_common()
         ******  BUG_ON(!d_unhashed(dentry)); ****** *panic*

The test is wrong: we can find ourselves with a hashed negative dentry here
if the idmapper tried to look up the file before we got round to creating
it.

Just replace the BUG_ON() with a d_drop(dentry).

Reported-by: Mi Jinlong &lt;mijinlong@cn.fujitsu.com&gt;
Signed-off-by: Trond Myklebust &lt;Trond.Myklebust@netapp.com&gt;
Signed-off-by: Paul Gortmaker &lt;paul.gortmaker@windriver.com&gt;
</content>
</entry>
<entry>
<title>SUNRPC: Ensure we return EAGAIN in xs_nospace if congestion is cleared</title>
<updated>2013-01-16T21:44:58Z</updated>
<author>
<name>Trond Myklebust</name>
</author>
<published>2011-11-22T12:44:28Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=30c42309ea65847d822101fe4fa4d0bce177769e'/>
<id>urn:sha1:30c42309ea65847d822101fe4fa4d0bce177769e</id>
<content type='text'>
commit 24ca9a847791fd53d9b217330b15f3c285827a18 upstream.

By returning '0' instead of 'EAGAIN' when the tests in xs_nospace() fail
to find evidence of socket congestion, we are making the RPC engine believe
that the message was incorrectly sent and so it disconnects the socket
instead of just retrying.

The bug appears to have been introduced by commit
5e3771ce2d6a69e10fcc870cdf226d121d868491 (SUNRPC: Ensure that xs_nospace
return values are propagated).

Reported-by: Andrew Cooper &lt;andrew.cooper3@citrix.com&gt;
Signed-off-by: Trond Myklebust &lt;Trond.Myklebust@netapp.com&gt;
Tested-by: Andrew Cooper &lt;andrew.cooper3@citrix.com&gt;
Signed-off-by: Paul Gortmaker &lt;paul.gortmaker@windriver.com&gt;
</content>
</entry>
<entry>
<title>NFS/sunrpc: don't use a credential with extra groups.</title>
<updated>2012-08-17T19:35:51Z</updated>
<author>
<name>NeilBrown</name>
</author>
<published>2011-10-24T23:25:49Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=64a211ecd8c813da236aef72eab7e76a8de4592f'/>
<id>urn:sha1:64a211ecd8c813da236aef72eab7e76a8de4592f</id>
<content type='text'>
commit dc6f55e9f8dac4b6479be67c5c9128ad37bb491f upstream.

The sunrpc layer keeps a cache of recently used credentials and
'unx_match' is used to find the credential which matches the current
process.

However unx_match allows a match when the cached credential has extra
groups at the end of uc_gids list which are not in the process group list.

So if a process with a list of (say) 4 group accesses a file and gains
access because of the last group in the list, then another process
with the same uid and gid, and a gid list being the first tree of the
gids of the original process tries to access the file, it will be
granted access even though it shouldn't as the wrong rpc credential
will be used.

Signed-off-by: NeilBrown &lt;neilb@suse.de&gt;
Signed-off-by: Trond Myklebust &lt;Trond.Myklebust@netapp.com&gt;
Signed-off-by: Paul Gortmaker &lt;paul.gortmaker@windriver.com&gt;
</content>
</entry>
<entry>
<title>NLM: Don't hang forever on NLM unlock requests</title>
<updated>2012-08-17T19:35:41Z</updated>
<author>
<name>Trond Myklebust</name>
</author>
<published>2011-05-31T19:15:34Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=ce838ded70a01b09d8429c62a63741cd000abb06'/>
<id>urn:sha1:ce838ded70a01b09d8429c62a63741cd000abb06</id>
<content type='text'>
commit 0b760113a3a155269a3fba93a409c640031dd68f upstream.

If the NLM daemon is killed on the NFS server, we can currently end up
hanging forever on an 'unlock' request, instead of aborting. Basically,
if the rpcbind request fails, or the server keeps returning garbage, we
really want to quit instead of retrying.

Tested-by: Vasily Averin &lt;vvs@sw.ru&gt;
Signed-off-by: Trond Myklebust &lt;Trond.Myklebust@netapp.com&gt;
[PG: struct rpc_task in sched.h slightly different layout vs. v3.0]
Signed-off-by: Paul Gortmaker &lt;paul.gortmaker@windriver.com&gt;
</content>
</entry>
<entry>
<title>svcrpc: fix list-corrupting race on nfsd shutdown</title>
<updated>2012-05-17T15:21:21Z</updated>
<author>
<name>J. Bruce Fields</name>
</author>
<published>2011-06-29T20:49:04Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=893a36baacd2825a02d3b7e6135a73db1e469aea'/>
<id>urn:sha1:893a36baacd2825a02d3b7e6135a73db1e469aea</id>
<content type='text'>
commit ebc63e531cc6a457595dd110b07ac530eae788c3 upstream.

After commit 3262c816a3d7fb1eaabce633caa317887ed549ae "[PATCH] knfsd:
split svc_serv into pools", svc_delete_xprt (then svc_delete_socket) no
longer removed its xpt_ready (then sk_ready) field from whatever list it
was on, noting that there was no point since the whole list was about to
be destroyed anyway.

That was mostly true, but forgot that a few svc_xprt_enqueue()'s might
still be hanging around playing with the about-to-be-destroyed list, and
could get themselves into trouble writing to freed memory if we left
this xprt on the list after freeing it.

(This is actually functionally identical to a patch made first by Ben
Greear, but with more comments.)

Cc: gnb@fmeh.org
Reported-by: Ben Greear &lt;greearb@candelatech.com&gt;
Tested-by: Ben Greear &lt;greearb@candelatech.com&gt;
Signed-off-by: J. Bruce Fields &lt;bfields@redhat.com&gt;
Signed-off-by: Paul Gortmaker &lt;paul.gortmaker@windriver.com&gt;
</content>
</entry>
<entry>
<title>SUNRPC: Fix use of static variable in rpcb_getport_async</title>
<updated>2012-05-17T15:21:11Z</updated>
<author>
<name>Ben Greear</name>
</author>
<published>2011-07-12T17:27:55Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=6df3d28f699821fc6fe47ef7a6ace0e3eccc1790'/>
<id>urn:sha1:6df3d28f699821fc6fe47ef7a6ace0e3eccc1790</id>
<content type='text'>
commit ec0dd267bf7d08cb30e321e45a75fd40edd7e528 upstream.

Because struct rpcbind_args *map was declared static, if two
threads entered this method at the same time, the values
assigned to map could be sent two two differen tasks.
This could cause all sorts of problems, include use-after-free
and double-free of memory.

Fix this by removing the static declaration so that the map
pointer is on the stack.

Signed-off-by: Ben Greear &lt;greearb@candelatech.com&gt;
Signed-off-by: Trond Myklebust &lt;Trond.Myklebust@netapp.com&gt;
Signed-off-by: Paul Gortmaker &lt;paul.gortmaker@windriver.com&gt;
</content>
</entry>
<entry>
<title>SUNRPC: Fix a race between work-queue and rpc_killall_tasks</title>
<updated>2012-05-17T15:21:10Z</updated>
<author>
<name>Trond Myklebust</name>
</author>
<published>2011-07-06T23:58:23Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=050dc70ca582d414cabcb24126cb5abac36b4f99'/>
<id>urn:sha1:050dc70ca582d414cabcb24126cb5abac36b4f99</id>
<content type='text'>
commit b55c59892e1f3b6c7d4b9ccffb4263e1486fb990 upstream.

Since rpc_killall_tasks may modify the rpc_task's tk_action field
without any locking, we need to be careful when dereferencing it.

Reported-by: Ben Greear &lt;greearb@candelatech.com&gt;
Tested-by: Ben Greear &lt;greearb@candelatech.com&gt;
Signed-off-by: Trond Myklebust &lt;Trond.Myklebust@netapp.com&gt;
Signed-off-by: Paul Gortmaker &lt;paul.gortmaker@windriver.com&gt;
</content>
</entry>
<entry>
<title>SUNRPC: Ensure the RPC client only quits on fatal signals</title>
<updated>2012-05-17T15:21:02Z</updated>
<author>
<name>Trond Myklebust</name>
</author>
<published>2011-06-17T14:14:59Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=f3d5950607bccc215ce4db7d39168ef0a9034e41'/>
<id>urn:sha1:f3d5950607bccc215ce4db7d39168ef0a9034e41</id>
<content type='text'>
commit 5afa9133cfe67f1bfead6049a9640c9262a7101c upstream.

Fix a couple of instances where we were exiting the RPC client on
arbitrary signals. We should only do so on fatal signals.

Signed-off-by: Trond Myklebust &lt;Trond.Myklebust@netapp.com&gt;
Signed-off-by: Paul Gortmaker &lt;paul.gortmaker@windriver.com&gt;
</content>
</entry>
</feed>
