1. 13 Nov, 2010 6 commits
    • Tejun Heo's avatar
      block: check bdev_read_only() from blkdev_get() · 75f1dc0d
      Tejun Heo authored
      bdev read-only status can be queried using bdev_read_only() and may
      change while the device is being opened.  Enforce it by checking it
      from blkdev_get() after open succeeds.
      
      This makes bdev_read_only() check in open_bdev_exclusive() and
      fsg_lun_open() unnecessary.  Drop them.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Cc: David Brownell <dbrownell@users.sourceforge.net>
      Cc: linux-usb@vger.kernel.org
      75f1dc0d
    • Tejun Heo's avatar
      block: reorganize claim/release implementation · 6a027eff
      Tejun Heo authored
      With claim/release rolled into blkdev_get/put(), there's no reason to
      keep bd_abort/finish_claim(), __bd_claim() and bd_release() as
      separate functions.  It only makes the code difficult to follow.
      Collapse them into blkdev_get/put().  This will ease future changes
      around claim/release.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      6a027eff
    • Tejun Heo's avatar
      block: make blkdev_get/put() handle exclusive access · e525fd89
      Tejun Heo authored
      Over time, block layer has accumulated a set of APIs dealing with bdev
      open, close, claim and release.
      
      * blkdev_get/put() are the primary open and close functions.
      
      * bd_claim/release() deal with exclusive open.
      
      * open/close_bdev_exclusive() are combination of open and claim and
        the other way around, respectively.
      
      * bd_link/unlink_disk_holder() to create and remove holder/slave
        symlinks.
      
      * open_by_devnum() wraps bdget() + blkdev_get().
      
      The interface is a bit confusing and the decoupling of open and claim
      makes it impossible to properly guarantee exclusive access as
      in-kernel open + claim sequence can disturb the existing exclusive
      open even before the block layer knows the current open if for another
      exclusive access.  Reorganize the interface such that,
      
      * blkdev_get() is extended to include exclusive access management.
        @holder argument is added and, if is @FMODE_EXCL specified, it will
        gain exclusive access atomically w.r.t. other exclusive accesses.
      
      * blkdev_put() is similarly extended.  It now takes @mode argument and
        if @FMODE_EXCL is set, it releases an exclusive access.  Also, when
        the last exclusive claim is released, the holder/slave symlinks are
        removed automatically.
      
      * bd_claim/release() and close_bdev_exclusive() are no longer
        necessary and either made static or removed.
      
      * bd_link_disk_holder() remains the same but bd_unlink_disk_holder()
        is no longer necessary and removed.
      
      * open_bdev_exclusive() becomes a simple wrapper around lookup_bdev()
        and blkdev_get().  It also has an unexpected extra bdev_read_only()
        test which probably should be moved into blkdev_get().
      
      * open_by_devnum() is modified to take @holder argument and pass it to
        blkdev_get().
      
      Most of bdev open/close operations are unified into blkdev_get/put()
      and most exclusive accesses are tested atomically at the open time (as
      it should).  This cleans up code and removes some, both valid and
      invalid, but unnecessary all the same, corner cases.
      
      open_bdev_exclusive() and open_by_devnum() can use further cleanup -
      rename to blkdev_get_by_path() and blkdev_get_by_devt() and drop
      special features.  Well, let's leave them for another day.
      
      Most conversions are straight-forward.  drbd conversion is a bit more
      involved as there was some reordering, but the logic should stay the
      same.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Acked-by: default avatarNeil Brown <neilb@suse.de>
      Acked-by: default avatarRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
      Acked-by: default avatarMike Snitzer <snitzer@redhat.com>
      Acked-by: default avatarPhilipp Reisner <philipp.reisner@linbit.com>
      Cc: Peter Osterlund <petero2@telia.com>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Jan Kara <jack@suse.cz>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Andreas Dilger <adilger.kernel@dilger.ca>
      Cc: "Theodore Ts'o" <tytso@mit.edu>
      Cc: Mark Fasheh <mfasheh@suse.com>
      Cc: Joel Becker <joel.becker@oracle.com>
      Cc: Alex Elder <aelder@sgi.com>
      Cc: Christoph Hellwig <hch@infradead.org>
      Cc: dm-devel@redhat.com
      Cc: drbd-dev@lists.linbit.com
      Cc: Leo Chen <leochen@broadcom.com>
      Cc: Scott Branden <sbranden@broadcom.com>
      Cc: Chris Mason <chris.mason@oracle.com>
      Cc: Steven Whitehouse <swhiteho@redhat.com>
      Cc: Dave Kleikamp <shaggy@linux.vnet.ibm.com>
      Cc: Joern Engel <joern@logfs.org>
      Cc: reiserfs-devel@vger.kernel.org
      Cc: Alexander Viro <viro@zeniv.linux.org.uk>
      e525fd89
    • Tejun Heo's avatar
      block: simplify holder symlink handling · e09b457b
      Tejun Heo authored
      Code to manage symlinks in /sys/block/*/{holders|slaves} are overly
      complex with multiple holder considerations, redundant extra
      references to all involved kobjects, unused generic kobject holder
      support and unnecessary mixup with bd_claim/release functionalities.
      
      Strip it down to what's necessary (single gendisk holder) and make it
      use a separate interface.  This is a step for cleaning up
      bd_claim/release.  This patch makes dm-table slightly more complex but
      it will be simplified again with further changes.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Acked-by: default avatarNeil Brown <neilb@suse.de>
      Acked-by: default avatarMike Snitzer <snitzer@redhat.com>
      Cc: dm-devel@redhat.com
      e09b457b
    • Tejun Heo's avatar
      btrfs: close_bdev_exclusive() should use the same @flags as the matching open_bdev_exclusive() · 37004c42
      Tejun Heo authored
      In the failure path of __btrfs_open_devices(), close_bdev_exclusive()
      is called with @flags which doesn't match the one used during
      open_bdev_exclusive().  Fix it.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Cc: Chris Mason <chris.mason@oracle.com>
      37004c42
    • Tejun Heo's avatar
      mtd: fix bdev exclusive open bugs in block2mtd::add_device() · 731edacb
      Tejun Heo authored
      There are two bdev exclusive open bugs.
      
      * open_bdev_exclusive() must not be called with NULL holder.  Use dev
        as the holder.
      
      * open_by_devnum() doesn't open the bdev exclusively but
        block2mtd_free_device() always assumes it.  Explicitly claim the
        bdev.
      
      The latter is rather clumsy but will be simplified with future
      blkdev_get/put() cleanups.
      
      - Updated to use local variable @mode to cache FMODE_* masks as
        suggested by Artem Bityutskiy.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Cc: linux-mtd@lists.infradead.org
      Cc: Artem Bityutskiy <dedekind1@gmail.com>
      731edacb
  2. 09 Nov, 2010 5 commits
  3. 08 Nov, 2010 17 commits
  4. 06 Nov, 2010 7 commits
  5. 05 Nov, 2010 5 commits
    • Linus Torvalds's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6 · 4b4a2700
      Linus Torvalds authored
      * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6: (41 commits)
        inet_diag: Make sure we actually run the same bytecode we audited.
        netlink: Make nlmsg_find_attr take a const nlmsghdr*.
        fib: fib_result_assign() should not change fib refcounts
        netfilter: ip6_tables: fix information leak to userspace
        cls_cgroup: Fix crash on module unload
        memory corruption in X.25 facilities parsing
        net dst: fix percpu_counter list corruption and poison overwritten
        rds: Remove kfreed tcp conn from list
        rds: Lost locking in loop connection freeing
        de2104x: fix panic on load
        atl1 : fix panic on load
        netxen: remove unused firmware exports
        caif: Remove noisy printout when disconnecting caif socket
        caif: SPI-driver bugfix - incorrect padding.
        caif: Bugfix for socket priority, bindtodev and dbg channel.
        smsc911x: Set Ethernet EEPROM size to supported device's size
        ipv4: netfilter: ip_tables: fix information leak to userland
        ipv4: netfilter: arp_tables: fix information leak to userland
        cxgb4vf: remove call to stop TX queues at load time.
        cxgb4: remove call to stop TX queues at load time.
        ...
      4b4a2700
    • Linus Torvalds's avatar
      Merge branch 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394-2.6 · f69fa764
      Linus Torvalds authored
      * 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394-2.6:
        firewire: ohci: fix race when reading count in AR descriptor
        firewire: ohci: avoid reallocation of AR buffers
        firewire: ohci: fix race in AR split packet handling
        firewire: ohci: fix buffer overflow in AR split packet handling
      f69fa764
    • Linus Torvalds's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/sfrench/cifs-2.6 · 2e5c3672
      Linus Torvalds authored
      * git://git.kernel.org/pub/scm/linux/kernel/git/sfrench/cifs-2.6:
        cifs: make cifs_set_oplock_level() take a cifsInodeInfo pointer
        cifs: dereferencing first then checking
        cifs: trivial comment fix: tlink_tree is now a rbtree
        [CIFS] Cleanup unused variable build warning
        cifs: convert tlink_tree to a rbtree
        cifs: store pointer to master tlink in superblock (try #2)
        cifs: trivial doc fix: note setlease implemented
        CIFS: Add cifs_set_oplock_level
        FS: cifs, remove unneeded NULL tests
      2e5c3672
    • Oleg Nesterov's avatar
      posix-cpu-timers: workaround to suppress the problems with mt exec · e0a70217
      Oleg Nesterov authored
      posix-cpu-timers.c correctly assumes that the dying process does
      posix_cpu_timers_exit_group() and removes all !CPUCLOCK_PERTHREAD
      timers from signal->cpu_timers list.
      
      But, it also assumes that timer->it.cpu.task is always the group
      leader, and thus the dead ->task means the dead thread group.
      
      This is obviously not true after de_thread() changes the leader.
      After that almost every posix_cpu_timer_ method has problems.
      
      It is not simple to fix this bug correctly. First of all, I think
      that timer->it.cpu should use struct pid instead of task_struct.
      Also, the locking should be reworked completely. In particular,
      tasklist_lock should not be used at all. This all needs a lot of
      nontrivial and hard-to-test changes.
      
      Change __exit_signal() to do posix_cpu_timers_exit_group() when
      the old leader dies during exec. This is not the fix, just the
      temporary hack to hide the problem for 2.6.37 and stable. IOW,
      this is obviously wrong but this is what we currently have anyway:
      cpu timers do not work after mt exec.
      
      In theory this change adds another race. The exiting leader can
      detach the timers which were attached to the new leader. However,
      the window between de_thread() and release_task() is small, we
      can pretend that sys_timer_create() was called before de_thread().
      Signed-off-by: default avatarOleg Nesterov <oleg@redhat.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      e0a70217
    • Linus Torvalds's avatar
      Merge branch 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/staging · b312e131
      Linus Torvalds authored
      * 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/staging:
        hwmon: (ltc4261) Fix error message format
        hwmon: (ltc4261) Add missing newline in debug message
      b312e131