* Re: [PATCH] CIFS: make cifsd (more)
@ 2007-06-25 22:25 Steve French
2007-06-26 6:09 ` Christoph Hellwig
2007-06-30 8:42 ` Christoph Hellwig
0 siblings, 2 replies; 5+ messages in thread
From: Steve French @ 2007-06-25 22:25 UTC (permalink / raw)
To: linux-fsdevel, jlayton, linux-kernel, linux-cifs-client
Jeff,
Not seeing any objections to your revised approach (to not allowing
signals for cifsd kernel thread), I just merged something similar to
your patch to the cifs-2.6.git tree (also fixed some nearby lines that
went past 80 columns).
Thanks
Signed-off-by: Jeff Layton <jlayton@redhat.com>
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index f4e9266..27c1ebe 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -348,7 +348,6 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
int isMultiRsp;
int reconnect;
- allow_signal(SIGKILL);
current->flags |= PF_MEMALLOC;
server->tsk = current; /* save process info to wake at shutdown */
cFYI(1, ("Demultiplex PID: %d", current->pid));
@@ -2074,7 +2073,7 @@ cifs_mount(struct super_block *sb, struct
cifs_sb_info *cifs_sb,
always wake up processes blocked in
tcp in recv_mesg then we could remove the
send_sig call */
- send_sig(SIGKILL,srvTcp->tsk,1);
+ force_sig(SIGKILL,srvTcp->tsk);
tsk = srvTcp->tsk;
if(tsk)
kthread_stop(tsk);
@@ -2093,7 +2092,7 @@ cifs_mount(struct super_block *sb, struct
cifs_sb_info *cifs_sb,
if ((temp_rc == -ESHUTDOWN) &&
(pSesInfo->server) && (pSesInfo->server->tsk)) {
struct task_struct *tsk;
- send_sig(SIGKILL,pSesInfo->server->tsk,1);
+ force_sig(SIGKILL,pSesInfo->server->tsk);
tsk = pSesInfo->server->tsk;
if (tsk)
kthread_stop(tsk);
@@ -3345,7 +3344,7 @@ cifs_umount(struct super_block *sb, struct
cifs_sb_info *cifs_sb)
} else if (rc == -ESHUTDOWN) {
cFYI(1,("Waking up socket by sending it signal"));
if (cifsd_task) {
- send_sig(SIGKILL,cifsd_task,1);
+ force_sig(SIGKILL,cifsd_task);
kthread_stop(cifsd_task);
}
rc = 0;
--
Thanks,
Steve
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH] CIFS: make cifsd (more)
2007-06-25 22:25 [PATCH] CIFS: make cifsd (more) Steve French
@ 2007-06-26 6:09 ` Christoph Hellwig
2007-06-30 8:42 ` Christoph Hellwig
1 sibling, 0 replies; 5+ messages in thread
From: Christoph Hellwig @ 2007-06-26 6:09 UTC (permalink / raw)
To: Steve French; +Cc: linux-fsdevel, jlayton, linux-kernel, linux-cifs-client
On Mon, Jun 25, 2007 at 05:25:00PM -0500, Steve French wrote:
> Jeff,
> Not seeing any objections to your revised approach (to not allowing
> signals for cifsd kernel thread), I just merged something similar to
> your patch to the cifs-2.6.git tree (also fixed some nearby lines that
> went past 80 columns).
Yes, I still object to it. I'll come back to the implementation discussion
once I get a little more time.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] CIFS: make cifsd (more)
2007-06-25 22:25 [PATCH] CIFS: make cifsd (more) Steve French
2007-06-26 6:09 ` Christoph Hellwig
@ 2007-06-30 8:42 ` Christoph Hellwig
2007-06-30 11:15 ` Jeff Layton
1 sibling, 1 reply; 5+ messages in thread
From: Christoph Hellwig @ 2007-06-30 8:42 UTC (permalink / raw)
To: Steve French
Cc: linux-fsdevel, jlayton, linux-kernel, linux-cifs-client, netdev
On Mon, Jun 25, 2007 at 05:25:00PM -0500, Steve French wrote:
> Jeff,
> Not seeing any objections to your revised approach (to not allowing
> signals for cifsd kernel thread), I just merged something similar to
> your patch to the cifs-2.6.git tree (also fixed some nearby lines that
> went past 80 columns).
Ok, I'm back to this.
As I said mixing force_sig with the kthread infrastructure is a bad idea.
The proper short-term (aka 2.6.22) fix is to revert the kthread conversion
for this particular thread. Just go back to what worked before.
Now the right fix is a lot more complicated and involved:
Stop using blocking recvmsg (or read) in kernel threads!
If you look at what the other consumers of networking reads from kernel
threads do is they either use tcp_read_sock and hooks into the sk_ callbacks
which would be nice for high performance reads in cifs aswell, but probably
not the demultiplexer thread, or they use MSG_DONTWAIT to avoid this problems
and deal with the blocking behaviour on a higher level.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] CIFS: make cifsd (more)
2007-06-30 8:42 ` Christoph Hellwig
@ 2007-06-30 11:15 ` Jeff Layton
2007-06-30 13:32 ` Steve French
0 siblings, 1 reply; 5+ messages in thread
From: Jeff Layton @ 2007-06-30 11:15 UTC (permalink / raw)
To: Christoph Hellwig
Cc: Steve French, linux-fsdevel, linux-kernel, linux-cifs-client,
netdev
On Sat, 30 Jun 2007 09:42:09 +0100
Christoph Hellwig <hch@infradead.org> wrote:
> On Mon, Jun 25, 2007 at 05:25:00PM -0500, Steve French wrote:
> > Jeff,
> > Not seeing any objections to your revised approach (to not allowing
> > signals for cifsd kernel thread), I just merged something similar to
> > your patch to the cifs-2.6.git tree (also fixed some nearby lines that
> > went past 80 columns).
>
> Ok, I'm back to this.
>
> As I said mixing force_sig with the kthread infrastructure is a bad idea.
> The proper short-term (aka 2.6.22) fix is to revert the kthread conversion
> for this particular thread. Just go back to what worked before.
Could you clarify why this is? It looks like kthreads and signalling
should be more or less orthogonal. Or is it just an issue of the
complexity added when you mix signalling into kthreads?
Note that the problem of insulation from userspace signals predates the
conversion to using the kthreads interface for cifsd. So even if we
revert the switch of the demultiplexer thread to kthreads in the near
term, I'd like to keep the recent change to block all signals from
userspace and use force_sig in lieu of send_sig.
Does that sound reasonable?
>
> Now the right fix is a lot more complicated and involved:
>
> Stop using blocking recvmsg (or read) in kernel threads!
>
> If you look at what the other consumers of networking reads from kernel
> threads do is they either use tcp_read_sock and hooks into the sk_ callbacks
> which would be nice for high performance reads in cifs aswell, but probably
> not the demultiplexer thread, or they use MSG_DONTWAIT to avoid this problems
> and deal with the blocking behaviour on a higher level.
--
Jeff Layton <jlayton@redhat.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] CIFS: make cifsd (more)
2007-06-30 11:15 ` Jeff Layton
@ 2007-06-30 13:32 ` Steve French
0 siblings, 0 replies; 5+ messages in thread
From: Steve French @ 2007-06-30 13:32 UTC (permalink / raw)
To: Jeff Layton
Cc: Christoph Hellwig, linux-fsdevel, linux-kernel, linux-cifs-client,
netdev
The reason that cifs switched from wait_for_completion to the kthread
call to cifs_demultiplex_thread in the first place is because without
use of kthread it won't work with a linux-vserver. See the thread:
http://marc.info/?l=linux-cifs-client&m=117552761703381&w=2
If we take out the kthread call, we break those guys.
I agree that using sk_callbacks is worth looking into - I only found
ocfs2 and SunRPC (NFS) though that used it. Is there a better
example though? The NFS socket handling code is huge
(net/sunrpc/xprtsck.c) - something seems wrong when replacing a few
lines of code with a new 1675 line file. There must be a better
example of doing what you suggest...
I am tempted to drop the socket timeout (which cifs sets to 7 seconds)
to a smaller number and not use signals at all rather than add that
much complexity
On 6/30/07, Jeff Layton <jlayton@redhat.com> wrote:
> On Sat, 30 Jun 2007 09:42:09 +0100
> Christoph Hellwig <hch@infradead.org> wrote:
>
> > On Mon, Jun 25, 2007 at 05:25:00PM -0500, Steve French wrote:
> > > Jeff,
> > > Not seeing any objections to your revised approach (to not allowing
> > > signals for cifsd kernel thread), I just merged something similar to
> > > your patch to the cifs-2.6.git tree (also fixed some nearby lines that
> > > went past 80 columns).
> >
> > Ok, I'm back to this.
> >
> > As I said mixing force_sig with the kthread infrastructure is a bad idea.
> > The proper short-term (aka 2.6.22) fix is to revert the kthread conversion
> > for this particular thread. Just go back to what worked before.
>
> Could you clarify why this is? It looks like kthreads and signalling
> should be more or less orthogonal. Or is it just an issue of the
> complexity added when you mix signalling into kthreads?
>
> Note that the problem of insulation from userspace signals predates the
> conversion to using the kthreads interface for cifsd. So even if we
> revert the switch of the demultiplexer thread to kthreads in the near
> term, I'd like to keep the recent change to block all signals from
> userspace and use force_sig in lieu of send_sig.
>
> Does that sound reasonable?
>
> >
> > Now the right fix is a lot more complicated and involved:
> >
> > Stop using blocking recvmsg (or read) in kernel threads!
> >
> > If you look at what the other consumers of networking reads from kernel
> > threads do is they either use tcp_read_sock and hooks into the sk_ callbacks
> > which would be nice for high performance reads in cifs aswell, but probably
> > not the demultiplexer thread, or they use MSG_DONTWAIT to avoid this problems
> > and deal with the blocking behaviour on a higher level.
>
> --
> Jeff Layton <jlayton@redhat.com>
>
--
Thanks,
Steve
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2007-06-30 13:32 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-25 22:25 [PATCH] CIFS: make cifsd (more) Steve French
2007-06-26 6:09 ` Christoph Hellwig
2007-06-30 8:42 ` Christoph Hellwig
2007-06-30 11:15 ` Jeff Layton
2007-06-30 13:32 ` Steve French
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).