1. 01 Nov, 2008 1 commit
    • Al Viro's avatar
      saner FASYNC handling on file close · 233e70f4
      Al Viro authored
      
      As it is, all instances of ->release() for files that have ->fasync()
      need to remember to evict file from fasync lists; forgetting that
      creates a hole and we actually have a bunch that *does* forget.
      
      So let's keep our lives simple - let __fput() check FASYNC in
      file->f_flags and call ->fasync() there if it's been set.  And lose that
      crap in ->release() instances - leaving it there is still valid, but we
      don't have to bother anymore.
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      233e70f4
  2. 02 Oct, 2008 1 commit
  3. 26 Jul, 2008 2 commits
  4. 24 Jul, 2008 3 commits
    • Ulrich Drepper's avatar
      flag parameters: check magic constants · e38b36f3
      Ulrich Drepper authored
      
      This patch adds test that ensure the boundary conditions for the various
      constants introduced in the previous patches is met.  No code is generated.
      
      [akpm@linux-foundation.org: fix alpha]
      Signed-off-by: default avatarUlrich Drepper <drepper@redhat.com>
      Acked-by: default avatarDavide Libenzi <davidel@xmailserver.org>
      Cc: Michael Kerrisk <mtk.manpages@googlemail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      e38b36f3
    • Ulrich Drepper's avatar
      flag parameters: NONBLOCK in inotify_init · 510df2dd
      Ulrich Drepper authored
      
      This patch adds non-blocking support for inotify_init1.  The
      additional changes needed are minimal.
      
      The following test must be adjusted for architectures other than x86 and
      x86-64 and in case the syscall numbers changed.
      
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      #include <fcntl.h>
      #include <stdio.h>
      #include <unistd.h>
      #include <sys/syscall.h>
      
      #ifndef __NR_inotify_init1
      # ifdef __x86_64__
      #  define __NR_inotify_init1 294
      # elif defined __i386__
      #  define __NR_inotify_init1 332
      # else
      #  error "need __NR_inotify_init1"
      # endif
      #endif
      
      #define IN_NONBLOCK O_NONBLOCK
      
      int
      main (void)
      {
        int fd = syscall (__NR_inotify_init1, 0);
        if (fd == -1)
          {
            puts ("inotify_init1(0) failed");
            return 1;
          }
        int fl = fcntl (fd, F_GETFL);
        if (fl == -1)
          {
            puts ("fcntl failed");
            return 1;
          }
        if (fl & O_NONBLOCK)
          {
            puts ("inotify_init1(0) set non-blocking mode");
            return 1;
          }
        close (fd);
      
        fd = syscall (__NR_inotify_init1, IN_NONBLOCK);
        if (fd == -1)
          {
            puts ("inotify_init1(IN_NONBLOCK) failed");
            return 1;
          }
        fl = fcntl (fd, F_GETFL);
        if (fl == -1)
          {
            puts ("fcntl failed");
            return 1;
          }
        if ((fl & O_NONBLOCK) == 0)
          {
            puts ("inotify_init1(IN_NONBLOCK) set non-blocking mode");
            return 1;
          }
        close (fd);
      
        puts ("OK");
      
        return 0;
      }
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      Signed-off-by: default avatarUlrich Drepper <drepper@redhat.com>
      Acked-by: default avatarDavide Libenzi <davidel@xmailserver.org>
      Cc: Michael Kerrisk <mtk.manpages@googlemail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      510df2dd
    • Ulrich Drepper's avatar
      flag parameters: inotify_init · 4006553b
      Ulrich Drepper authored
      
      This patch introduces the new syscall inotify_init1 (note: the 1 stands for
      the one parameter the syscall takes, as opposed to no parameter before).  The
      values accepted for this parameter are function-specific and defined in the
      inotify.h header.  Here the values must match the O_* flags, though.  In this
      patch CLOEXEC support is introduced.
      
      The following test must be adjusted for architectures other than x86 and
      x86-64 and in case the syscall numbers changed.
      
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      #include <fcntl.h>
      #include <stdio.h>
      #include <unistd.h>
      #include <sys/syscall.h>
      
      #ifndef __NR_inotify_init1
      # ifdef __x86_64__
      #  define __NR_inotify_init1 294
      # elif defined __i386__
      #  define __NR_inotify_init1 332
      # else
      #  error "need __NR_inotify_init1"
      # endif
      #endif
      
      #define IN_CLOEXEC O_CLOEXEC
      
      int
      main (void)
      {
        int fd;
        fd = syscall (__NR_inotify_init1, 0);
        if (fd == -1)
          {
            puts ("inotify_init1(0) failed");
            return 1;
          }
        int coe = fcntl (fd, F_GETFD);
        if (coe == -1)
          {
            puts ("fcntl failed");
            return 1;
          }
        if (coe & FD_CLOEXEC)
          {
            puts ("inotify_init1(0) set close-on-exit");
            return 1;
          }
        close (fd);
      
        fd = syscall (__NR_inotify_init1, IN_CLOEXEC);
        if (fd == -1)
          {
            puts ("inotify_init1(IN_CLOEXEC) failed");
            return 1;
          }
        coe = fcntl (fd, F_GETFD);
        if (coe == -1)
          {
            puts ("fcntl failed");
            return 1;
          }
        if ((coe & FD_CLOEXEC) == 0)
          {
            puts ("inotify_init1(O_CLOEXEC) does not set close-on-exit");
            return 1;
          }
        close (fd);
      
        puts ("OK");
      
        return 0;
      }
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      
      [akpm@linux-foundation.org: add sys_ni stub]
      Signed-off-by: default avatarUlrich Drepper <drepper@redhat.com>
      Acked-by: default avatarDavide Libenzi <davidel@xmailserver.org>
      Cc: Michael Kerrisk <mtk.manpages@googlemail.com>
      Cc: <linux-arch@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      4006553b
  5. 29 Apr, 2008 1 commit
  6. 15 Feb, 2008 2 commits
  7. 14 Feb, 2008 1 commit
  8. 08 Feb, 2008 1 commit
  9. 06 Feb, 2008 2 commits
  10. 17 Oct, 2007 1 commit
  11. 19 Jul, 2007 1 commit
    • Paul Mundt's avatar
      mm: Remove slab destructors from kmem_cache_create(). · 20c2df83
      Paul Mundt authored
      Slab destructors were no longer supported after Christoph's
      c59def9f
      
       change. They've been
      BUGs for both slab and slub, and slob never supported them
      either.
      
      This rips out support for the dtor pointer from kmem_cache_create()
      completely and fixes up every single callsite in the kernel (there were
      about 224, not including the slab allocator definitions themselves,
      or the documentation references).
      Signed-off-by: default avatarPaul Mundt <lethal@linux-sh.org>
      20c2df83
  12. 12 Feb, 2007 1 commit
    • Nick Piggin's avatar
      [PATCH] inotify: read return val fix · f9e4acf3
      Nick Piggin authored
      
      Fix for inotify read bug (bugzilla.kernel.org #6999)
      
      Problem Description:
      When reading from an inotify device with an insufficient sized buffer, read(2)
      will return 0 with no errno set. This is because of an logically incorrect
      action from the user program thus should return an more logical value. My
      suggestion is return -EINVAL as for bind(2).
      
      This patch is based on the proposal from Ryan <wolf0403@hotmail.com>, and
      feedback from John McCutchan <john@johnmccutchan.com>.
      
      Return -EINVAL if we have not passed in enough buffer space to read a single
      inotify event, rather than 0 which indicates that there is nothing to read.
      Signed-off-by: default avatarNick Piggin <npiggin@suse.de>
      Acked-by: default avatar"John McCutchan" <john@johnmccutchan.com>
      Cc: Ryan <wolf0403@hotmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      f9e4acf3
  13. 08 Dec, 2006 1 commit
  14. 07 Dec, 2006 1 commit
  15. 31 Jul, 2006 1 commit
    • Arjan van de Ven's avatar
      [PATCH] inotify: fix deadlock found by lockdep · 5b6509aa
      Arjan van de Ven authored
      
      This is a real deadlock, a nice complex one:
      (warning: long explanation follows so that Andrew can have a complete
      patch description)
      
      it's an ABCDA deadlock:
      
      A iprune_mutex
      B inode->inotify_mutex
      C ih->mutex
      D dev->ev_mutex
      
      The AB relationship comes straight from invalidate_inodes()
      
      int invalidate_inodes(struct super_block * sb)
      {
              int busy;
              LIST_HEAD(throw_away);
      
              mutex_lock(&iprune_mutex);
              spin_lock(&inode_lock);
              inotify_unmount_inodes(&sb->s_inodes);
      
      where inotify_umount_inodes() takes the
                      mutex_lock(&inode->inotify_mutex);
      
      The BC relationship comes directly from inotify_find_update_watch():
      s32 inotify_find_update_watch(struct inotify_handle *ih, struct inode *inode,
                                    u32 mask)
      {
         ...
              mutex_lock(&inode->inotify_mutex);
              mutex_lock(&ih->mutex);
      
      The CD relationship comes from inotify_rm_wd:
      inotify_rm_wd does
              mutex_lock(&inode->inotify_mutex);
              mutex_lock(&ih->mutex)
      and then calls inotify_remove_watch_locked() which calls
      notify_dev_queue_event() which does
      	        mutex_lock(&dev->ev_mutex);
      
      (this strictly is a BCD relationship)
      
      The DA relationship comes from the most interesting part:
      
        [<ffffffff8022d9f2>] shrink_icache_memory+0x42/0x270
        [<ffffffff80240dc4>] shrink_slab+0x11d/0x1c9
        [<ffffffff802b5104>] try_to_free_pages+0x187/0x244
        [<ffffffff8020efed>] __alloc_pages+0x1cd/0x2e0
        [<ffffffff8025e1f8>] cache_alloc_refill+0x3f8/0x821
        [<ffffffff8020a5e5>] kmem_cache_alloc+0x85/0xcb
        [<ffffffff802db027>] kernel_event+0x2e/0x122
        [<ffffffff8021d61c>] inotify_dev_queue_event+0xcc/0x140
      
      inotify_dev_queue_event schedules a kernel_event which does a
      kmem_cache_alloc( , GFP_KERNEL) which may try to shrink slabs, including
      the inode cache .. which then takes iprune_mutex.
      
      And voila, there is an AB, a BC, a CD relationship (even a direct BCD),
      and also now a DA relationship -> a circular type AB-BA deadlock but
      involving 4 locks.
      
      The solution is simple: kernel_event() is NOT allowed to use GFP_KERNEL,
      but must use GFP_NOFS to not cause recursion into the VFS.
      Signed-off-by: default avatarArjan van de Ven <arjan@linux.intel.com>
      Acked-by: default avatarIngo Molnar <mingo@elte.hu>
      Acked-by: default avatarRobert Love <rml@novell.com>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      5b6509aa
  16. 23 Jun, 2006 1 commit
    • David Howells's avatar
      [PATCH] VFS: Permit filesystem to override root dentry on mount · 454e2398
      David Howells authored
      
      Extend the get_sb() filesystem operation to take an extra argument that
      permits the VFS to pass in the target vfsmount that defines the mountpoint.
      
      The filesystem is then required to manually set the superblock and root dentry
      pointers.  For most filesystems, this should be done with simple_set_mnt()
      which will set the superblock pointer and then set the root dentry to the
      superblock's s_root (as per the old default behaviour).
      
      The get_sb() op now returns an integer as there's now no need to return the
      superblock pointer.
      
      This patch permits a superblock to be implicitly shared amongst several mount
      points, such as can be done with NFS to avoid potential inode aliasing.  In
      such a case, simple_set_mnt() would not be called, and instead the mnt_root
      and mnt_sb would be set directly.
      
      The patch also makes the following changes:
      
       (*) the get_sb_*() convenience functions in the core kernel now take a vfsmount
           pointer argument and return an integer, so most filesystems have to change
           very little.
      
       (*) If one of the convenience function is not used, then get_sb() should
           normally call simple_set_mnt() to instantiate the vfsmount. This will
           always return 0, and so can be tail-called from get_sb().
      
       (*) generic_shutdown_super() now calls shrink_dcache_sb() to clean up the
           dcache upon superblock destruction rather than shrink_dcache_anon().
      
           This is required because the superblock may now have multiple trees that
           aren't actually bound to s_root, but that still need to be cleaned up. The
           currently called functions assume that the whole tree is rooted at s_root,
           and that anonymous dentries are not the roots of trees which results in
           dentries being left unculled.
      
           However, with the way NFS superblock sharing are currently set to be
           implemented, these assumptions are violated: the root of the filesystem is
           simply a dummy dentry and inode (the real inode for '/' may well be
           inaccessible), and all the vfsmounts are rooted on anonymous[*] dentries
           with child trees.
      
           [*] Anonymous until discovered from another tree.
      
       (*) The documentation has been adjusted, including the additional bit of
           changing ext2_* into foo_* in the documentation.
      
      [akpm@osdl.org: convert ipath_fs, do other stuff]
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Acked-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      Cc: Nathan Scott <nathans@sgi.com>
      Cc: Roland Dreier <rolandd@cisco.com>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      454e2398
  17. 20 Jun, 2006 3 commits