1. 01 10月, 2006 1 次提交
  2. 30 9月, 2006 2 次提交
    • J
      [PATCH] block_dev.c mutex_lock_nested() fix · 87d7c8ac
      Jason Baron 提交于
      In the case below we are locking the whole disk not a partition.  This
      change simply brings the code in line with the piece above where when we
      are the 'first' opener, and we are a partition.
      Signed-off-by: NJason Baron <jbaron@redhat.com>
      Acked-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      87d7c8ac
    • A
      [PATCH] blockdev.c: check driver layer errors · 4d7dd8fd
      Andrew Morton 提交于
      Check driver layer errors.
      
      Fix from: "Jun'ichi Nomura" <j-nomura@ce.jp.nec.com>
      
      In blockdevc-check-errors.patch, add_bd_holder() is modified to return error
      values when some of its operation failed.  Among them, it returns -EEXIST when
      a given bd_holder object already exists in the list.
      
      However, in this case, the function completed its work successfully and need
      no action by its caller other than freeing unused bd_holder object.  So I
      think it's better to return success after freeing by itself.
      
      Otherwise, bd_claim-ing with same claim pointer will fail.
      Typically, lvresize will fails with following message:
        device-mapper: reload ioctl failed: Invalid argument
      and you'll see messages like below in kernel log:
        device-mapper: table: 254:13: linear: dm-linear: Device lookup failed
        device-mapper: ioctl: error adding target to table
      
      Similarly, it should not add bd_holder to the list if either one of symlinking
      fails.  I don't have a test case for this to happen but it should cause
      dereference of freed pointer.
      
      If a matching bd_holder is found in bd_holder_list, add_bd_holder() completes
      its job by just incrementing the reference count.  In this case, it should be
      considered as success but it used to return 'fail' to let the caller free
      temporary bd_holder.  Fixed it to return success and free given object by
      itself.
      
      Also, if either one of symlinking fails, the bd_holder should not be added to
      the list so that it can be discarded later.  Otherwise, the caller will free
      bd_holder which is in the list.
      Signed-off-by: NJun'ichi Nomura <j-nomura@ce.jp.nec.com>
      Cc: "Randy.Dunlap" <rdunlap@xenotime.net>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      4d7dd8fd
  3. 28 8月, 2006 1 次提交
    • P
      [PATCH] lockdep: fix blkdev_open() warning · 6946bd63
      Peter Zijlstra 提交于
      On Wed, 2006-08-09 at 07:57 +0200, Rolf Eike Beer wrote:
      > =============================================
      > [ INFO: possible recursive locking detected ]
      > ---------------------------------------------
      > parted/7929 is trying to acquire lock:
      >  (&bdev->bd_mutex){--..}, at: [<c105eb8d>] __blkdev_put+0x1e/0x13c
      >
      > but task is already holding lock:
      >  (&bdev->bd_mutex){--..}, at: [<c105eec6>] do_open+0x72/0x3a8
      >
      > other info that might help us debug this:
      > 1 lock held by parted/7929:
      >  #0:  (&bdev->bd_mutex){--..}, at: [<c105eec6>] do_open+0x72/0x3a8
      > stack backtrace:
      >  [<c1003aad>] show_trace_log_lvl+0x58/0x15b
      >  [<c100495f>] show_trace+0xd/0x10
      >  [<c1004979>] dump_stack+0x17/0x1a
      >  [<c102dee5>] __lock_acquire+0x753/0x99c
      >  [<c102e3b0>] lock_acquire+0x4a/0x6a
      >  [<c1204501>] mutex_lock_nested+0xc8/0x20c
      >  [<c105eb8d>] __blkdev_put+0x1e/0x13c
      >  [<c105ecc4>] blkdev_put+0xa/0xc
      >  [<c105f18a>] do_open+0x336/0x3a8
      >  [<c105f21b>] blkdev_open+0x1f/0x4c
      >  [<c1057b40>] __dentry_open+0xc7/0x1aa
      >  [<c1057c91>] nameidata_to_filp+0x1c/0x2e
      >  [<c1057cd1>] do_filp_open+0x2e/0x35
      >  [<c1057dd7>] do_sys_open+0x38/0x68
      >  [<c1057e33>] sys_open+0x16/0x18
      >  [<c1002845>] sysenter_past_esp+0x56/0x8d
      
      OK, I'm having a look here; its all new to me so bear with me.
      
      blkdev_open() calls
        do_open(bdev, ...,BD_MUTEX_NORMAL) and takes
          mutex_lock_nested(&bdev->bd_mutex, BD_MUTEX_NORMAL)
      
      then something fails, and we're thrown to:
      
      out_first: where
          if (bdev != bdev->bd_contains)
            blkdev_put(bdev->bd_contains) which is
              __blkdev_put(bdev->bd_contains, BD_MUTEX_NORMAL) which does
                mutex_lock_nested(&bdev->bd_contains->bd_mutex, BD_MUTEX_NORMAL) <--- lockdep trigger
      
      When going to out_first, dbev->bd_contains is either bdev or whole, and
      since we take the branch it must be whole. So it seems to me the
      following patch would be the right one:
      
      [akpm@osdl.org: compile fix]
      Signed-off-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Arjan van de Ven <arjan@linux.intel.com>
      Acked-by: NNeilBrown <neilb@suse.de>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      6946bd63
  4. 04 7月, 2006 1 次提交
    • I
      [PATCH] lockdep: annotate blkdev nesting · 663d440e
      Ingo Molnar 提交于
      Teach special (recursive) locking code to the lock validator.
      
      Effects on non-lockdep kernels:
      
      - the introduction of the following function variants:
      
        extern struct block_device *open_partition_by_devnum(dev_t, unsigned);
      
        extern int blkdev_put_partition(struct block_device *);
      
        static int
        blkdev_get_whole(struct block_device *bdev, mode_t mode, unsigned flags);
      
       which on non-lockdep are the same as open_by_devnum(), blkdev_put()
       and blkdev_get().
      
      - a subclass parameter to do_open(). [unused on non-lockdep]
      
      - a subclass parameter to __blkdev_put(), which is a new internal
        function for the main blkdev_put*() functions. [parameter unused
        on non-lockdep kernels, except for two sanity check WARN_ON()s]
      
      these functions carry no semantical difference - they only express
      object dependencies towards the lockdep subsystem.
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      Signed-off-by: NArjan van de Ven <arjan@linux.intel.com>
      Cc: Neil Brown <neilb@cse.unsw.edu.au>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      663d440e
  5. 01 7月, 2006 1 次提交
  6. 29 6月, 2006 1 次提交
  7. 27 6月, 2006 1 次提交
  8. 23 6月, 2006 2 次提交
    • D
      [PATCH] VFS: Permit filesystem to override root dentry on mount · 454e2398
      David Howells 提交于
      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: NDavid Howells <dhowells@redhat.com>
      Acked-by: NAl Viro <viro@zeniv.linux.org.uk>
      Cc: Nathan Scott <nathans@sgi.com>
      Cc: Roland Dreier <rolandd@cisco.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      454e2398
    • O
      [PATCH] Fix a race condition between ->i_mapping and iput() · 09d967c6
      OGAWA Hirofumi 提交于
      This race became a cause of oops, and can reproduce by the following.
      
          while true; do
      	dd if=/dev/zero of=/dev/.static/dev/hdg1 bs=512 count=1000 & sync
          done
      
      This race condition was between __sync_single_inode() and iput().
      
                cpu0 (fs's inode)                 cpu1 (bdev's inode)
                -----------------                 -------------------
                                             close("/dev/hda2")
                                             [...]
      __sync_single_inode()
         /* copy the bdev's ->i_mapping */
         mapping = inode->i_mapping;
      
                                             generic_forget_inode()
                                                bdev_clear_inode()
      					     /* restre the fs's ->i_mapping */
      				             inode->i_mapping = &inode->i_data;
      				          /* bdev's inode was freed */
                                                destroy_inode(inode);
      
         if (wait) {
            /* dereference a freed bdev's mapping->host */
            filemap_fdatawait(mapping);  /* Oops */
      
      Since __sync_single_inode() is only taking a ref-count of fs's inode, the
      another process can be close() and freeing the bdev's inode while writing
      fs's inode.  So, __sync_signle_inode() accesses the freed ->i_mapping,
      oops.
      
      This patch takes a ref-count on the bdev's inode for the fs's inode before
      setting a ->i_mapping, and the clear_inode() of the fs's inode does iput() on
      the bdev's inode.  So if the fs's inode is still living, bdev's inode
      shouldn't be freed.
      Signed-off-by: NOGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      09d967c6
  9. 02 5月, 2006 1 次提交
  10. 29 3月, 2006 1 次提交
  11. 28 3月, 2006 2 次提交
  12. 27 3月, 2006 2 次提交
  13. 24 3月, 2006 3 次提交
    • C
      [PATCH] sb_set_blocksize cleanup · 38885bd4
      Coywolf Qi Hunt 提交于
      sb_set_blocksize() cleanup: make sb_set_blocksize() use blksize_bits().
      Signed-off-by: NCoywolf Qi Hunt <qiyong@fc-cn.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      38885bd4
    • P
      [PATCH] cpuset memory spread: slab cache format · fffb60f9
      Paul Jackson 提交于
      Rewrap the overly long source code lines resulting from the previous
      patch's addition of the slab cache flag SLAB_MEM_SPREAD.  This patch
      contains only formatting changes, and no function change.
      Signed-off-by: NPaul Jackson <pj@sgi.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      fffb60f9
    • P
      [PATCH] cpuset memory spread: slab cache filesystems · 4b6a9316
      Paul Jackson 提交于
      Mark file system inode and similar slab caches subject to SLAB_MEM_SPREAD
      memory spreading.
      
      If a slab cache is marked SLAB_MEM_SPREAD, then anytime that a task that's
      in a cpuset with the 'memory_spread_slab' option enabled goes to allocate
      from such a slab cache, the allocations are spread evenly over all the
      memory nodes (task->mems_allowed) allowed to that task, instead of favoring
      allocation on the node local to the current cpu.
      
      The following inode and similar caches are marked SLAB_MEM_SPREAD:
      
          file                               cache
          ====                               =====
          fs/adfs/super.c                    adfs_inode_cache
          fs/affs/super.c                    affs_inode_cache
          fs/befs/linuxvfs.c                 befs_inode_cache
          fs/bfs/inode.c                     bfs_inode_cache
          fs/block_dev.c                     bdev_cache
          fs/cifs/cifsfs.c                   cifs_inode_cache
          fs/coda/inode.c                    coda_inode_cache
          fs/dquot.c                         dquot
          fs/efs/super.c                     efs_inode_cache
          fs/ext2/super.c                    ext2_inode_cache
          fs/ext2/xattr.c (fs/mbcache.c)     ext2_xattr
          fs/ext3/super.c                    ext3_inode_cache
          fs/ext3/xattr.c (fs/mbcache.c)     ext3_xattr
          fs/fat/cache.c                     fat_cache
          fs/fat/inode.c                     fat_inode_cache
          fs/freevxfs/vxfs_super.c           vxfs_inode
          fs/hpfs/super.c                    hpfs_inode_cache
          fs/isofs/inode.c                   isofs_inode_cache
          fs/jffs/inode-v23.c                jffs_fm
          fs/jffs2/super.c                   jffs2_i
          fs/jfs/super.c                     jfs_ip
          fs/minix/inode.c                   minix_inode_cache
          fs/ncpfs/inode.c                   ncp_inode_cache
          fs/nfs/direct.c                    nfs_direct_cache
          fs/nfs/inode.c                     nfs_inode_cache
          fs/ntfs/super.c                    ntfs_big_inode_cache_name
          fs/ntfs/super.c                    ntfs_inode_cache
          fs/ocfs2/dlm/dlmfs.c               dlmfs_inode_cache
          fs/ocfs2/super.c                   ocfs2_inode_cache
          fs/proc/inode.c                    proc_inode_cache
          fs/qnx4/inode.c                    qnx4_inode_cache
          fs/reiserfs/super.c                reiser_inode_cache
          fs/romfs/inode.c                   romfs_inode_cache
          fs/smbfs/inode.c                   smb_inode_cache
          fs/sysv/inode.c                    sysv_inode_cache
          fs/udf/super.c                     udf_inode_cache
          fs/ufs/super.c                     ufs_inode_cache
          net/socket.c                       sock_inode_cache
          net/sunrpc/rpc_pipe.c              rpc_inode_cache
      
      The choice of which slab caches to so mark was quite simple.  I marked
      those already marked SLAB_RECLAIM_ACCOUNT, except for fs/xfs, dentry_cache,
      inode_cache, and buffer_head, which were marked in a previous patch.  Even
      though SLAB_RECLAIM_ACCOUNT is for a different purpose, it marks the same
      potentially large file system i/o related slab caches as we need for memory
      spreading.
      
      Given that the rule now becomes "wherever you would have used a
      SLAB_RECLAIM_ACCOUNT slab cache flag before (usually the inode cache), use
      the SLAB_MEM_SPREAD flag too", this should be easy enough to maintain.
      Future file system writers will just copy one of the existing file system
      slab cache setups and tend to get it right without thinking.
      Signed-off-by: NPaul Jackson <pj@sgi.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      4b6a9316
  14. 23 3月, 2006 1 次提交
  15. 10 1月, 2006 1 次提交
  16. 24 6月, 2005 1 次提交
    • A
      [PATCH] block: add unlocked_ioctl support for block devices · bb93e3a5
      Arnd Bergmann 提交于
      This patch allows block device drivers to convert their ioctl functions to
      unlocked_ioctl() like character devices and other subsystems.  All
      functions that were called with the BKL held before are still used that
      way, but I would not be surprised if it could be removed from the ioctl
      functions in drivers/block/ioctl.c themselves.
      
      As a side note, I found that compat_blkdev_ioctl() acquires the BKL as
      well, which looks like a bug.  I have checked that every user of
      disk->fops->compat_ioctl() in the current git tree gets the BKL itself, so
      it could easily be removed from compat_blkdev_ioctl().
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      bb93e3a5
  17. 06 5月, 2005 1 次提交
  18. 17 4月, 2005 1 次提交
    • L
      Linux-2.6.12-rc2 · 1da177e4
      Linus Torvalds 提交于
      Initial git repository build. I'm not bothering with the full history,
      even though we have it. We can create a separate "historical" git
      archive of that later if we want to, and in the meantime it's about
      3.2GB when imported into git - space that would just make the early
      git days unnecessarily complicated, when we don't have a lot of good
      infrastructure for it.
      
      Let it rip!
      1da177e4