1. 16 Jul, 2012 2 commits
    • Anders Kaseorg's avatar
      fifo: Do not restart open() if it already found a partner · 05d290d6
      Anders Kaseorg authored
      If a parent and child process open the two ends of a fifo, and the
      child immediately exits, the parent may receive a SIGCHLD before its
      open() returns.  In that case, we need to make sure that open() will
      return successfully after the SIGCHLD handler returns, instead of
      throwing EINTR or being restarted.  Otherwise, the restarted open()
      would incorrectly wait for a second partner on the other end.
      
      The following test demonstrates the EINTR that was wrongly thrown from
      the parent’s open().  Change .sa_flags = 0 to .sa_flags = SA_RESTART
      to see a deadlock instead, in which the restarted open() waits for a
      second reader that will never come.  (On my systems, this happens
      pretty reliably within about 5 to 500 iterations.  Others report that
      it manages to loop ~forever sometimes; YMMV.)
      
        #include <sys/stat.h>
        #include <sys/types.h>
        #include <sys/wait.h>
        #include <fcntl.h>
        #include <signal.h>
        #include <stdio.h>
        #include <stdlib.h>
        #include <unistd.h>
      
        #define CHECK(x) do if ((x) == -1) {perror(#x); abort();} while(0)
      
        void handler(int signum) {}
      
        int main()
        {
            struct sigaction act = {.sa_handler = handler, .sa_flags = 0};
            CHECK(sigaction(SIGCHLD, &act, NULL));
            CHECK(mknod("fifo", S_IFIFO | S_IRWXU, 0));
            for (;;) {
                int fd;
                pid_t pid;
                putc('.', stderr);
                CHECK(pid = fork());
                if (pid == 0) {
                    CHECK(fd = open("fifo", O_RDONLY));
                    _exit(0);
                }
                CHECK(fd = open("fifo", O_WRONLY));
                CHECK(close(fd));
                CHECK(waitpid(pid, NULL, 0));
            }
        }
      
      This is what I suspect was causing the Git test suite to fail in
      t9010-svn-fe.sh:
      
      	http://bugs.debian.org/678852Signed-off-by: default avatarAnders Kaseorg <andersk@mit.edu>
      Reviewed-by: default avatarJonathan Nieder <jrnieder@gmail.com>
      Cc: stable@kernel.org
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      05d290d6
    • Linus Torvalds's avatar
      Merge tag 'fixes-for-v3.5-rc6' of... · 1694a0a0
      Linus Torvalds authored
      Merge tag 'fixes-for-v3.5-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl
      
      Pull late pinctrl fixes from Linus Walleij:
      - Two fixes to the i.MX driver
      
      * tag 'fixes-for-v3.5-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl:
        pinctrl: pinctrl-imx6q: add missed mux function for USBOTG_ID
        pinctrl: pinctrl-imx: only print debug message when DEBUG is defined
      1694a0a0
  2. 14 Jul, 2012 13 commits
  3. 13 Jul, 2012 19 commits
  4. 12 Jul, 2012 5 commits
  5. 11 Jul, 2012 1 commit