1. 26 Sep, 2013 6 commits
    • Tejun Heo's avatar
      sysfs: clean up sysfs_get_dirent() · 388975cc
      Tejun Heo authored
      The pre-existing sysfs interfaces which take explicit namespace
      argument are weird in that they place the optional @ns in front of
      @name which is contrary to the established convention.  For example,
      we end up forcing vast majority of sysfs_get_dirent() users to do
      sysfs_get_dirent(parent, NULL, name), which is silly and error-prone
      especially as @ns and @name may be interchanged without causing
      compilation warning.
      This renames sysfs_get_dirent() to sysfs_get_dirent_ns() and swap the
      positions of @name and @ns, and sysfs_get_dirent() is now a wrapper
      around sysfs_get_dirent_ns().  This makes confusions a lot less
      There are other interfaces which take @ns before @name.  They'll be
      updated by following patches.
      This patch doesn't introduce any functional changes.
      v2: EXPORT_SYMBOL_GPL() wasn't updated leading to undefined symbol
          error on module builds.  Reported by build test robot.  Fixed.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Cc: Eric W. Biederman <ebiederm@xmission.com>
      Cc: Kay Sievers <kay@vrfy.org>
      Cc: Fengguang Wu <fengguang.wu@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    • Tejun Heo's avatar
      sysfs: drop kobj_ns_type handling · cb26a311
      Tejun Heo authored
      The way namespace tags are implemented in sysfs is more complicated
      than necessary.  As each tag is a pointer value and required to be
      non-NULL under a namespace enabled parent, there's no need to record
      separately what type each tag is or where namespace is enabled.
      If multiple namespace types are needed, which currently aren't, we can
      simply compare the tag to a set of allowed tags in the superblock
      assuming that the tags, being pointers, won't have the same value
      across multiple types.  Also, whether to filter by namespace tag or
      not can be trivially determined by whether the node has any tagged
      children or not.
      This patch rips out kobj_ns_type handling from sysfs.  sysfs no longer
      cares whether specific type of namespace is enabled or not.  If a
      sysfs_dirent has a non-NULL tag, the parent is marked as needing
      namespace filtering and the value is tested against the allowed set of
      tags for the superblock (currently only one but increasing this number
      isn't difficult) and the sysfs_dirent is ignored if it doesn't match.
      This removes most kobject namespace knowledge from sysfs proper which
      will enable proper separation and layering of sysfs.  The namespace
      sanity checks in fs/sysfs/dir.c are replaced by the new sanity check
      in kobject_namespace().  As this is the only place ktype->namespace()
      is called for sysfs, this doesn't weaken the sanity check
      significantly.  I omitted converting the sanity check in
      sysfs_do_create_link_sd().  While the check can be shifted to upper
      layer, mistakes there are well contained and should be easily visible
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Cc: Eric W. Biederman <ebiederm@xmission.com>
      Cc: Kay Sievers <kay@vrfy.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    • Tejun Heo's avatar
      sysfs: remove ktype->namespace() invocations in symlink code · 4b30ee58
      Tejun Heo authored
      There's no reason for sysfs to be calling ktype->namespace().  It is
      backwards, obfuscates what's going on and unnecessarily tangles two
      separate layers.
      There are two places where symlink code calls ktype->namespace().
      * sysfs_do_create_link_sd() calls it to find out the namespace tag of
        the target directory.  Unless symlinking races with cross-namespace
        renaming, this equals @target_sd->s_ns.
      * sysfs_rename_link() uses it to find out the new namespace to rename
        to and the new namespace can be different from the existing one.
        The function is renamed to sysfs_rename_link_ns() with an explicit
        @ns argument and the ktype->namespace() invocation is shifted to the
        device layer.
      While this patch replaces ktype->namespace() invocation with the
      recorded result in @target_sd, this shouldn't result in any behvior
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Cc: Eric W. Biederman <ebiederm@xmission.com>
      Cc: Kay Sievers <kay@vrfy.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    • Tejun Heo's avatar
      sysfs: remove ktype->namespace() invocations in directory code · e34ff490
      Tejun Heo authored
      For some unrecognizable reason, namespace information is communicated
      to sysfs through ktype->namespace() callback when there's *nothing*
      which needs the use of a callback.  The whole sequence of operations
      is completely synchronous and sysfs operations simply end up calling
      back into the layer which just invoked it in order to find out the
      namespace information, which is completely backwards, obfuscates
      what's going on and unnecessarily tangles two separate layers.
      This patch doesn't remove ktype->namespace() but shifts its handling
      to kobject layer.  We probably want to get rid of the callback in the
      long term.
      This patch adds an explicit param to sysfs_{create|rename|move}_dir()
      and renames them to sysfs_{create|rename|move}_dir_ns(), respectively.
      ktype->namespace() invocations are moved to the calling sites of the
      above functions.  A new helper kboject_namespace() is introduced which
      directly tests kobj_ns_type_operations->type which should give the
      same result as testing sysfs_fs_type(parent_sd) and returns @kobj's
      namespace tag as necessary.  kobject_namespace() is extern as it will
      be used from another file in the following patches.
      This patch should be an equivalent conversion without any functional
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Cc: Eric W. Biederman <ebiederm@xmission.com>
      Cc: Kay Sievers <kay@vrfy.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    • Tejun Heo's avatar
      sysfs: make attr namespace interface less convoluted · 58292cbe
      Tejun Heo authored
      sysfs ns (namespace) implementation became more convoluted than
      necessary while trying to hide ns information from visible interface.
      The relatively recent attr ns support is a good example.
      * attr ns tag is determined by sysfs_ops->namespace() callback while
        dir tag is determined by kobj_type->namespace().  The placement is
      * Instead of performing operations with explicit ns tag, the namespace
        callback is routed through sysfs_attr_ns(), sysfs_ops->namespace(),
        class_attr_namespace(), class_attr->namespace().  It's not simpler
        in any sense.  The only thing this convolution does is traversing
        the whole stack backwards.
      The namespace callbacks are unncessary because the operations involved
      are inherently synchronous.  The information can be provided in in
      straight-forward top-down direction and reversing that direction is
      unnecessary and against basic design principles.
      This backward interface is unnecessarily convoluted and hinders
      properly separating out sysfs from driver model / kobject for proper
      layering.  This patch updates attr ns support such that
      * sysfs_ops->namespace() and class_attr->namespace() are dropped.
      * sysfs_{create|remove}_file_ns(), which take explicit @ns param, are
        added and sysfs_{create|remove}_file() are now simple wrappers
        around the ns aware functions.
      * ns handling is dropped from sysfs_chmod_file().  Nobody uses it at
        this point.  sysfs_chmod_file_ns() can be added later if necessary.
      * Explicit @ns is propagated through class_{create|remove}_file_ns()
        and netdev_class_{create|remove}_file_ns().
      * driver/net/bonding which is currently the only user of attr
        namespace is updated to use netdev_class_{create|remove}_file_ns()
        with @bh->net as the ns tag instead of using the namespace callback.
      This patch should be an equivalent conversion without any functional
      difference.  It makes the code easier to follow, reduces lines of code
      a bit and helps proper separation and layering.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Cc: Eric W. Biederman <ebiederm@xmission.com>
      Cc: Kay Sievers <kay@vrfy.org>
      Acked-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    • Tejun Heo's avatar
      sysfs: drop semicolon from to_sysfs_dirent() definition · bcac3769
      Tejun Heo authored
      The expansion of to_sysfs_dirent() contains an unncessary trailing
      semicolon making it impossible to use in the middle of statements.
      Drop it.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
  2. 23 Sep, 2013 4 commits
    • Linus Torvalds's avatar
      Linux 3.12-rc2 · 4a10c2ac
      Linus Torvalds authored
    • Linus Torvalds's avatar
      Merge tag 'staging-3.12-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging · 9d23108d
      Linus Torvalds authored
      Pull staging fixes from Greg KH:
       "Here are a number of small staging tree and iio driver fixes.  Nothing
        major, just lots of little things"
      * tag 'staging-3.12-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (34 commits)
        iio:buffer_cb: Add missing iio_buffer_init()
        iio: Prevent race between IIO chardev opening and IIO device free
        iio: fix: Keep a reference to the IIO device for open file descriptors
        iio: Stop sampling when the device is removed
        iio: Fix crash when scan_bytes is computed with active_scan_mask == NULL
        iio: Fix mcp4725 dev-to-indio_dev conversion in suspend/resume
        iio: Fix bma180 dev-to-indio_dev conversion in suspend/resume
        iio: Fix tmp006 dev-to-indio_dev conversion in suspend/resume
        iio: iio_device_add_event_sysfs() bugfix
        staging: iio: ade7854-spi: Fix return value
        staging:iio:hmc5843: Fix measurement conversion
        iio: isl29018: Fix uninitialized value
        staging:iio:dummy fix kfifo_buf kconfig dependency issue if kfifo modular and buffer enabled for built in dummy driver.
        iio: at91: fix adc_clk overflow
        staging: line6: add bounds check in snd_toneport_source_put()
        Staging: comedi: Fix dependencies for drivers misclassified as PCI
        staging: r8188eu: Adjust RX gain
        staging: r8188eu: Fix smatch warning in core/rtw_ieee80211.
        staging: r8188eu: Fix smatch error in core/rtw_mlme_ext.c
        staging: r8188eu: Fix Smatch off-by-one warning in hal/rtl8188e_hal_init.c
    • Linus Torvalds's avatar
      Merge tag 'usb-3.12-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb · e04a0a5a
      Linus Torvalds authored
      Pull USB fixes from Greg KH:
       "Here are a number of small USB fixes for 3.12-rc2.
        One is a revert of a EHCI change that isn't quite ready for 3.12.
        Others are minor things, gadget fixes, Kconfig fixes, and some quirks
        and documentation updates.
        All have been in linux-next for a bit"
      * tag 'usb-3.12-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb:
        USB: pl2303: distinguish between original and cloned HX chips
        USB: Faraday fotg210: fix email addresses
        USB: fix typo in usb serial simple driver Kconfig
        Revert "USB: EHCI: support running URB giveback in tasklet context"
        usb: s3c-hsotg: do not disconnect gadget when receiving ErlySusp intr
        usb: s3c-hsotg: fix unregistration function
        usb: gadget: f_mass_storage: reset endpoint driver data when disabled
        usb: host: fsl-mph-dr-of: Staticize local symbols
        usb: gadget: f_eem: Staticize eem_alloc
        usb: gadget: f_ecm: Staticize ecm_alloc
        usb: phy: omap-usb3: Fix return value
        usb: dwc3: gadget: avoid memory leak when failing to allocate all eps
        usb: dwc3: remove extcon dependency
        usb: gadget: add '__ref' for rndis_config_register() and cdc_config_register()
        usb: dwc3: pci: add support for BayTrail
        usb: gadget: cdc2: fix conversion to new interface of f_ecm
        usb: gadget: fix a bug and a WARN_ON in dummy-hcd
        usb: gadget: mv_u3d_core: fix violation of locking discipline in mv_u3d_ep_disable()
    • Linus Torvalds's avatar
      Merge branch 'drm-fixes' of git://people.freedesktop.org/~airlied/linux · d8524ae9
      Linus Torvalds authored
      Pull drm fixes from Dave Airlie:
       - some small fixes for msm and exynos
       - a regression revert affecting nouveau users with old userspace
       - intel pageflip deadlock and gpu hang fixes, hsw modesetting hangs
      * 'drm-fixes' of git://people.freedesktop.org/~airlied/linux: (22 commits)
        Revert "drm: mark context support as a legacy subsystem"
        drm/i915: Don't enable the cursor on a disable pipe
        drm/i915: do not update cursor in crtc mode set
        drm/exynos: fix return value check in lowlevel_buffer_allocate()
        drm/exynos: Fix address space warnings in exynos_drm_fbdev.c
        drm/exynos: Fix address space warning in exynos_drm_buf.c
        drm/exynos: Remove redundant OF dependency
        drm/msm: drop unnecessary set_need_resched()
        drm/i915: kill set_need_resched
        drm/msm: fix potential NULL pointer dereference
        drm/i915/dvo: set crtc timings again for panel fixed modes
        drm/i915/sdvo: Robustify the dtd<->drm_mode conversions
        drm/msm: workaround for missing irq
        drm/msm: return -EBUSY if bo still active
        drm/msm: fix return value check in ERR_PTR()
        drm/msm: fix cmdstream size check
        drm/msm: hangcheck harder
        drm/msm: handle read vs write fences
        drm/i915/sdvo: Fully translate sync flags in the dtd->mode conversion
        drm/i915: Use proper print format for debug prints
  3. 22 Sep, 2013 3 commits
    • Linus Torvalds's avatar
      Merge branch 'for-3.12/core' of git://git.kernel.dk/linux-block · 68cf8d0c
      Linus Torvalds authored
      Pull block IO fixes from Jens Axboe:
       "After merge window, no new stuff this time only a collection of neatly
        confined and simple fixes"
      * 'for-3.12/core' of git://git.kernel.dk/linux-block:
        cfq: explicitly use 64bit divide operation for 64bit arguments
        block: Add nr_bios to block_rq_remap tracepoint
        If the queue is dying then we only call the rq->end_io callout. This leaves bios setup on the request, because the caller assumes when the blk_execute_rq_nowait/blk_execute_rq call has completed that the rq->bios have been cleaned up.
        bio-integrity: Fix use of bs->bio_integrity_pool after free
        blkcg: relocate root_blkg setting and clearing
        block: Convert kmalloc_node(...GFP_ZERO...) to kzalloc_node(...)
        block: trace all devices plug operation
    • Linus Torvalds's avatar
      Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs · 0fbf2cc9
      Linus Torvalds authored
      Pull btrfs fixes from Chris Mason:
       "These are mostly bug fixes and a two small performance fixes.  The
        most important of the bunch are Josef's fix for a snapshotting
        regression and Mark's update to fix compile problems on arm"
      * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs: (25 commits)
        Btrfs: create the uuid tree on remount rw
        btrfs: change extent-same to copy entire argument struct
        Btrfs: dir_inode_operations should use btrfs_update_time also
        btrfs: Add btrfs: prefix to kernel log output
        btrfs: refuse to remount read-write after abort
        Btrfs: btrfs_ioctl_default_subvol: Revert back to toplevel subvolume when arg is 0
        Btrfs: don't leak transaction in btrfs_sync_file()
        Btrfs: add the missing mutex unlock in write_all_supers()
        Btrfs: iput inode on allocation failure
        Btrfs: remove space_info->reservation_progress
        Btrfs: kill delay_iput arg to the wait_ordered functions
        Btrfs: fix worst case calculator for space usage
        Revert "Btrfs: rework the overcommit logic to be based on the total size"
        Btrfs: improve replacing nocow extents
        Btrfs: drop dir i_size when adding new names on replay
        Btrfs: replay dir_index items before other items
        Btrfs: check roots last log commit when checking if an inode has been logged
        Btrfs: actually log directory we are fsync()'ing
        Btrfs: actually limit the size of delalloc range
        Btrfs: allocate the free space by the existed max extent size when ENOSPC
    • Anatol Pomozov's avatar
      cfq: explicitly use 64bit divide operation for 64bit arguments · f3cff25f
      Anatol Pomozov authored
      'samples' is 64bit operant, but do_div() second parameter is 32.
      do_div silently truncates high 32 bits and calculated result
      is invalid.
      In case if low 32bit of 'samples' are zeros then do_div() produces
      kernel crash.
      Signed-off-by: default avatarAnatol Pomozov <anatol.pomozov@gmail.com>
      Acked-by: default avatarTejun Heo <tj@kernel.org>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
  4. 21 Sep, 2013 27 commits