linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@redhat.com>
To: linux-fsdevel@vger.kernel.org
Subject: [PATCH] have cifs_reconnect handle signals appropriately
Date: Wed, 30 May 2007 17:46:51 -0400	[thread overview]
Message-ID: <20070530174651.2af67a97.jlayton@redhat.com> (raw)

This case is the result of a fairly long, drawn-out case. The problem
goes something like this:

1) mount a samba share using CIFS
2) start some continuous I/O on the mount (a loop that creates a
tarball on the mount and removes it seems to work)
3) shut down the samba server
4) suspend the process doing I/O (via ^z)
5) kill -9 pid_of_cifsd_kthread (I have no idea why they're doing this,
but bear with me)
6) umount -l the mount
7) start up samba again

after this, you cannot remount the samba share. mount attempts all
return either -ENOTDIR or -EAGAIN. The only fix seems to be to reboot
the box.

While the steps for this reproducer are pathological, I think they
expose a problem with how cifsd handles signals. If we're in
cifs_reconnect and cifsd is signalled, then the connect calls will all
start returning -ERESTARTSYS and we'll never exit from the while loop.

I *think* the following patch (or something like it) might be
appropriate. I've tested a similar patch on Steve's backported 1.48a
CIFS code and it seems to fix the problem there, but that code doesn't
have the kthread changes. Does this look reasonable, or am I missing
something important? :-)
-- 
Jeff Layton <jlayton@redhat.com>

diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index f4e9266..d369dd0 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -197,6 +197,11 @@ cifs_reconnect(struct TCP_Server_Info *server)
 					server->server_RFC1001_name);
 		}
 		if(rc) {
+			if (rc == -ERESTARTSYS) {
+				cFYI(1,("reconnect interrupted by signal"));
+				kthread_stop(server->tsk);
+				continue;
+			}
 			cFYI(1,("reconnect error %d",rc));
 			msleep(3000);
 		} else {

                 reply	other threads:[~2007-05-30 21:46 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070530174651.2af67a97.jlayton@redhat.com \
    --to=jlayton@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).