public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Tilman Schmidt <tilman@imap.cc>
To: Linux Kernel <linux-kernel@vger.kernel.org>
Subject: [2.6.22.1] spurious (?) message "BUG: lock held at task exit time"
Date: Wed, 18 Jul 2007 16:30:17 +0200	[thread overview]
Message-ID: <469E23F9.2080304@imap.cc> (raw)

[-- Attachment #1: Type: text/plain, Size: 1773 bytes --]

When testing the serial Gigaset driver with kernel release 2.6.22.1
I get a kernel BUG message:

=====================================
[ BUG: lock held at task exit time! ]
-------------------------------------
gigasetm101d/5970 is exiting with locks still held!
1 lock held by gigasetm101d/5970:
 #0:  (&cs->hw.ser->dead_mutex){--..}, at: [<c02d8bc7>] mutex_lock+0x1c/0x1f

which is all well and true except the process that has exited is the
grandfather process of a daemon() call, and the daemonized grandchild
process is still running happily, keeping the serial device open and
ensuring the line discipline stays loaded, and therefore legally
holding the dead_mutex:

ts@xenon:~> ps lw 5992
F   UID   PID  PPID PRI  NI    VSZ   RSS WCHAN  STAT TTY        TIME COMMAND
1     0  5992     1  16   0   1432   168 pause  S    ?          0:00 ./gigaset/driver/daemon/gigasetm101d /dev/ttyS0

The structure of gigasetm101d is basically:

    if ((tty_fd = open(dev, O_RDWR|O_NOCTTY)) < 0) {
        fprintf(stderr, "%s: cannot open %s: %s\n", prog, dev, strerror(errno));
        exit(EXIT_FAILURE);
    }
    if (ioctl(tty_fd, TIOCSETD, &ldisc) < 0)
    {
        fprintf(stderr, "%s: cannot set line discipline: %s\n",
                prog, strerror(errno));
        exit(EXIT_FAILURE);
    }
    if (daemon (0, 0) != 0)
    {
        fprintf(stderr, "%s: cannot daemonize: %s\n",
                prog, strerror(errno));
        exit(EXIT_FAILURE);
    }
    pause();
    exit(EXIT_SUCCESS);

Who is at fault here?

Thanks,
Tilman

-- 
Tilman Schmidt                    E-Mail: tilman@imap.cc
Bonn, Germany
Diese Nachricht besteht zu 100% aus wiederverwerteten Bits.
Ungeöffnet mindestens haltbar bis: (siehe Rückseite)


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 250 bytes --]

             reply	other threads:[~2007-07-18 14:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-18 14:30 Tilman Schmidt [this message]
2007-12-13 21:14 ` [2.6.22.1] spurious (?) message "BUG: lock held at task exit time" Tilman Schmidt

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=469E23F9.2080304@imap.cc \
    --to=tilman@imap.cc \
    --cc=linux-kernel@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