Skip to contentSkip to conversation

NFS: flush signals before taking down callback thread

PATCH In review Jeff Layton 3 participants 6 messages Feb 19, 2008 – Feb 20, 2008 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 NFS: flush signals before taking down callback thread

Now that the reference counting on the callback thread is working as expected, it uncovers another problem. Peter Staubach noticed while testing that patch on an older kernel that he would occasionally see this printk in rpc_register fire:

"RPC: failed to contact portmap (errno -512).

The NFSv4 callback thread is signaled by nfs_callback_down(), but never flushes that signal. All of the shutdown processing is done with that signal pending. This makes it fail the call to unregister the port with the portmapper.

In actuality, this rpc_register call isn't necessary at all since the port isn't actually registered with the portmapper anymore. Regardless, there doesn't seem to be any reason to leave the signal pending while the thread is being shut down and flushing it should generally silence that printk.

---
 fs/nfs/callback.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
fs/nfs/callback.c +1 -0
index ecc06c6..0d784f6 100644
@@ -93,6 +93,7 @@ static void nfs_callback_svc(struct svc_rqst *rqstp)
 		svc_process(rqstp);
 	}
 
+	flush_signals(current);
 	svc_exit_thread(rqstp);
 	nfs_callback_info.pid = 0;
 	complete(&nfs_callback_info.stopped);
Signature · 1 line
1.5.3.8
#1 lore raw
Quoted 12 lines · Jeff Layton

Now that the reference counting on the callback thread is working as expected, it uncovers another problem. Peter Staubach noticed while testing that patch on an older kernel that he would occasionally see this printk in rpc_register fire:

"RPC: failed to contact portmap (errno -512).

The NFSv4 callback thread is signaled by nfs_callback_down(), but never flushes that signal. All of the shutdown processing is done with that signal pending. This makes it fail the call to unregister the port with the portmapper.

Quoted 5 lines

In actuality, this rpc_register call isn't necessary at all since the port isn't actually registered with the portmapper anymore. Regardless, there doesn't seem to be any reason to leave the signal pending while the thread is being shut down and flushing it should generally silence that printk.

Wouldn't it be better to not allow for signals to this thread at all? The code really begs for a similar kthread conversion as the lockd one.

#2 lore raw
Quoted 2 lines · Christoph Hellwig

Wouldn't it be better to not allow for signals to this thread at all? The code really begs for a similar kthread conversion as the lockd one.

I'd tend to prefer that solution too.

Cheers
Trond

A message that is not in the archive (sent off-list or not yet received): 1203461010.13265.12.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org

#4 lore raw
Quoted 8 lines · On Tue, 19 Feb 2008 17:43:30 -0500 Trond Myklebust…
Quoted 3 lines · Christoph Hellwig

Wouldn't it be better to not allow for signals to this thread at all? The code really begs for a similar kthread conversion as the lockd one.

I'd tend to prefer that solution too.

I did a bit of smoke testing on that patch this morning and just sent it out to the list. The only problem is that that patch depends on a couple of other patches currently in Bruce's tree and that are slated for 2.6.26. It might be reasonable in the interim to go ahead and take the patch to flush_signals() in the existing code.

Thanks,

Signature · 1 line
Jeff Layton <[email protected]>

A message that is not in the archive (sent off-list or not yet received): 20080220090110.5658c78e-xSBYVWDuneFaJnirhKH9O4GKTjYczspe@public.gmane.org

#6 lore raw
Quoted 5 lines · Jeff Layton

I did a bit of smoke testing on that patch this morning and just sent it out to the list. The only problem is that that patch depends on a couple of other patches currently in Bruce's tree and that are slated for 2.6.26. It might be reasonable in the interim to go ahead and take the patch to flush_signals() in the existing code.

OK. I'll push that patch to Linus some time in the next few days.

Trond

#7 lore raw
In reply to Christoph Hellwig
Quoted 13 lines · On Tue, 19 Feb 2008 17:22:26 -0500 Christoph Hellwig <[email protected]> wrote:
Quoted 12 lines · Jeff Layton

Now that the reference counting on the callback thread is working as expected, it uncovers another problem. Peter Staubach noticed while testing that patch on an older kernel that he would occasionally see this printk in rpc_register fire:

"RPC: failed to contact portmap (errno -512).

The NFSv4 callback thread is signaled by nfs_callback_down(), but never flushes that signal. All of the shutdown processing is done with that signal pending. This makes it fail the call to unregister the port with the portmapper.

Quoted 8 lines
Quoted 5 lines

In actuality, this rpc_register call isn't necessary at all since the port isn't actually registered with the portmapper anymore. Regardless, there doesn't seem to be any reason to leave the signal pending while the thread is being shut down and flushing it should generally silence that printk.

Wouldn't it be better to not allow for signals to this thread at all? The code really begs for a similar kthread conversion as the lockd one.

Yep, and I have such a patch already. I just need to test it out a bit more before I send it out. I mainly sent this out to get the existing code into shape before we do the conversion. That way if we have to revert that conversion later, we won't be reverting to something broken.

But if Trond would rather not worry about it we can probably skip this patch and I'll just send out the kthread conversion once I have some more time to test it out.

Signature · 1 line
Jeff Layton <[email protected]>