1. 04 Sep, 2019 1 commit
    • Al Viro's avatar
      configfs: provide exclusion between IO and removals · b0841eef
      Al Viro authored
      Make sure that attribute methods are not called after the item
      has been removed from the tree.  To do so, we
      	* at the point of no return in removals, grab ->frag_sem
      exclusive and mark the fragment dead.
      	* call the methods of attributes with ->frag_sem taken
      shared and only after having verified that the fragment is still
      	The main benefit is for method instances - they are
      guaranteed that the objects they are accessing *and* all ancestors
      are still there.  Another win is that we don't need to bother
      with extra refcount on config_item when opening a file -
      the item will be alive for as long as it stays in the tree, and
      we won't touch it/attributes/any associated data after it's
      been removed from the tree.
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
  2. 02 Sep, 2019 2 commits
  3. 30 May, 2019 1 commit
  4. 19 Oct, 2017 1 commit
  5. 24 Dec, 2016 1 commit
  6. 16 Sep, 2016 1 commit
  7. 10 Jul, 2016 1 commit
    • Tal Shorer's avatar
      configfs: don't set buffer_needs_fill to zero if show() returns error · 3dc3afad
      Tal Shorer authored
      A confgifs attribute's show() callback is called once the first time
      the user attempts to read from it. If it returns an error, that
      error is returned to the user. However, the open file's
      buffer_needs_fill is still set to zero and consecutive read() calls
      will find an empty buffer that doesn't need filling and return 0 to
      the user. This could give the user the wrong impression that the
      attribute was read successfully.
      Fix this by not setting buffer_needs_fill if show() returns an error,
      making consecutive read() calls call show() again and either get an
      error again or get data.
      Signed-off-by: default avatarTal Shorer <tal.shorer@gmail.com>
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
  8. 30 Jun, 2016 1 commit
    • Marek Vasut's avatar
      configfs: Remove ppos increment in configfs_write_bin_file · f8608985
      Marek Vasut authored
      The simple_write_to_buffer() already increments the @ppos on success,
      see fs/libfs.c simple_write_to_buffer() comment:
      On success, the number of bytes written is returned and the offset @ppos
      advanced by this number, or negative value is returned on error.
      If the configfs_write_bin_file() is invoked with @count smaller than the
      total length of the written binary file, it will be invoked multiple times.
      Since configfs_write_bin_file() increments @ppos on success, after calling
      simple_write_to_buffer(), the @ppos is incremented twice.
      Subsequent invocation of configfs_write_bin_file() will result in the next
      piece of data being written to the offset twice as long as the length of
      the previous write, thus creating buffer with "holes" in it.
      The simple testcase using DTO follows:
        $ mkdir /sys/kernel/config/device-tree/overlays/1
        $ dd bs=1 if=foo.dtbo of=/sys/kernel/config/device-tree/overlays/1/dtbo
      Without this patch, the testcase will result in twice as big buffer in the
      kernel, which is then passed to the cfs_overlay_item_dtbo_write() .
      Signed-off-by: default avatarMarek Vasut <marex@denx.de>
      Cc: Geert Uytterhoeven <geert+renesas@glider.be>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
  9. 22 Jan, 2016 1 commit
    • Al Viro's avatar
      wrappers for ->i_mutex access · 5955102c
      Al Viro authored
      parallel to mutex_{lock,unlock,trylock,is_locked,lock_nested},
      inode_foo(inode) being mutex_foo(&inode->i_mutex).
      Please, use those for access to ->i_mutex; over the coming cycle
      ->i_mutex will become rwsem, with ->lookup() done with it held
      only shared.
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
  10. 04 Jan, 2016 1 commit
    • Pantelis Antoniou's avatar
      configfs: implement binary attributes · 03607ace
      Pantelis Antoniou authored
      ConfigFS lacked binary attributes up until now. This patch
      introduces support for binary attributes in a somewhat similar
      manner of sysfs binary attributes albeit with changes that
      fit the configfs usage model.
      Problems that configfs binary attributes fix are everything that
      requires a binary blob as part of the configuration of a resource,
      such as bitstream loading for FPGAs, DTBs for dynamically created
      devices etc.
      Look at Documentation/filesystems/configfs/configfs.txt for internals
      and howto use them.
      This patch is against linux-next as of today that contains
      Christoph's configfs rework.
      Signed-off-by: default avatarPantelis Antoniou <pantelis.antoniou@konsulko.com>
      [hch: folded a fix from Geert Uytterhoeven <geert+renesas@glider.be>]
      [hch: a few tiny updates based on review feedback]
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
  11. 14 Oct, 2015 2 commits
  12. 15 Apr, 2015 1 commit
  13. 18 Feb, 2015 1 commit
  14. 03 Jul, 2013 1 commit
  15. 30 Apr, 2008 1 commit
  16. 25 Jan, 2008 1 commit
    • Joonwoo Park's avatar
      configfs: file.c fix possible recursive locking · 116ba5d5
      Joonwoo Park authored
      configfs_register_subsystem() with default_groups triggers recursive locking.
      it seems that mutex_lock_nested is needed.
      [ INFO: possible recursive locking detected ]
      2.6.24-rc6 #145
      swapper/1 is trying to acquire lock:
       (&sb->s_type->i_mutex_key#3){--..}, at: [<c40c9a9e>] configfs_add_file+0x2e/0x70
      but task is already holding lock:
       (&sb->s_type->i_mutex_key#3){--..}, at: [<c40ca985>] configfs_register_subsystem+0x55/0x130
      other info that might help us debug this:
      1 lock held by swapper/1:
       #0:  (&sb->s_type->i_mutex_key#3){--..}, at: [<c40ca985>] configfs_register_subsystem+0x55/0x130
      stack backtrace:
      Pid: 1, comm: swapper Not tainted 2.6.24-rc6 #145
       [<c40053ba>] show_trace_log_lvl+0x1a/0x30
       [<c4005e82>] show_trace+0x12/0x20
       [<c400687e>] dump_stack+0x6e/0x80
       [<c404ec72>] __lock_acquire+0xe62/0x1120
       [<c404efb2>] lock_acquire+0x82/0xa0
       [<c43fda88>] mutex_lock_nested+0x98/0x2e0
       [<c40c9a9e>] configfs_add_file+0x2e/0x70
       [<c40c9b0c>] configfs_create_file+0x2c/0x40
       [<c40ca639>] configfs_attach_item+0x139/0x220
       [<c40ca734>] configfs_attach_group+0x14/0x140
       [<c40ca7e9>] configfs_attach_group+0xc9/0x140
       [<c40ca9f6>] configfs_register_subsystem+0xc6/0x130
       [<c45c8186>] init_netconsole+0x2b6/0x300
       [<c45a75f2>] kernel_init+0x142/0x320
       [<c4004fb3>] kernel_thread_helper+0x7/0x14
      Signed-off-by: default avatarJoonwoo Park <joonwpark81@gmail.com>
      Signed-off-by: default avatarJoel Becker <joel.becker@oracle.com>
      Signed-off-by: default avatarMark Fasheh <mark.fasheh@oracle.com>
  17. 11 Jul, 2007 1 commit
  18. 10 Jul, 2007 1 commit
    • Joel Becker's avatar
      configfs: consistent attribute size · b23cdde4
      Joel Becker authored
      The attribute store/show code currently limits attributes at PAGE_SIZE.
      This code comes from sysfs, where it still works that way.
      However, PAGE_SIZE is not constant.  A 16k attribute string works on
      ia64 but not on x86.  Really a subsystem shouldn't allow different
      attribute sizes based on platform.
      As such, limit all simple attributes to 4k.  This works on all
      platforms, and is consistent with all current code.
      Signed-off-by: default avatarJoel Becker <joel.becker@oracle.com>
      Signed-off-by: default avatarMark Fasheh <mark.fasheh@oracle.com>
  19. 09 May, 2007 1 commit
  20. 07 Feb, 2007 1 commit
  21. 08 Dec, 2006 1 commit
  22. 20 Oct, 2006 1 commit
  23. 03 Oct, 2006 1 commit
  24. 27 Sep, 2006 1 commit
  25. 28 Mar, 2006 1 commit
  26. 03 Feb, 2006 1 commit
  27. 09 Jan, 2006 1 commit
  28. 03 Jan, 2006 1 commit