16 Sep, 2016

1 commit


10 Jul, 2016

1 commit

  • 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: Tal Shorer
    Signed-off-by: Christoph Hellwig

    Tal Shorer
     

30 Jun, 2016

1 commit

  • 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: Marek Vasut
    Cc: Geert Uytterhoeven
    Cc: Christoph Hellwig
    Cc: Pantelis Antoniou

    Marek Vasut
     

23 Jan, 2016

1 commit

  • 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: Al Viro

    Al Viro
     

04 Jan, 2016

1 commit

  • 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: Pantelis Antoniou
    [hch: folded a fix from Geert Uytterhoeven ]
    [hch: a few tiny updates based on review feedback]
    Signed-off-by: Christoph Hellwig

    Pantelis Antoniou
     

14 Oct, 2015

2 commits

  • Remove the old show_attribute and store_attribute methods and update
    the documentation. Also replace the two C samples with a single new
    one in the proper samples directory where people expect to find it.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Nicholas Bellinger

    Christoph Hellwig
     
  • Add methods to struct configfs_attribute to directly show and store
    attributes without adding boilerplate code to every user. In addition
    to the methods this also adds 3 helper macros to define read/write,
    read-only and write-only attributes with a single line of code.

    Signed-off-by: Christoph Hellwig
    Reviewed-by: Nicholas Bellinger
    Acked-by: Greg Kroah-Hartman
    Signed-off-by: Nicholas Bellinger

    Christoph Hellwig
     

16 Apr, 2015

1 commit


18 Feb, 2015

1 commit


04 Jul, 2013

1 commit

  • The difference between "count" and "len" is that "len" is capped at
    4095. Changing it like this makes it match how sysfs_write_file() is
    implemented.

    This is a static analysis patch. I haven't found any store_attribute()
    functions where this change makes a difference.

    Signed-off-by: Dan Carpenter
    Acked-by: Joel Becker
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Dan Carpenter
     

30 Apr, 2008

1 commit


26 Jan, 2008

1 commit

  • 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: [] configfs_add_file+0x2e/0x70

    but task is already holding lock:
    (&sb->s_type->i_mutex_key#3){--..}, at: [] 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: [] configfs_register_subsystem+0x55/0x130

    stack backtrace:
    Pid: 1, comm: swapper Not tainted 2.6.24-rc6 #145
    [] show_trace_log_lvl+0x1a/0x30
    [] show_trace+0x12/0x20
    [] dump_stack+0x6e/0x80
    [] __lock_acquire+0xe62/0x1120
    [] lock_acquire+0x82/0xa0
    [] mutex_lock_nested+0x98/0x2e0
    [] configfs_add_file+0x2e/0x70
    [] configfs_create_file+0x2c/0x40
    [] configfs_attach_item+0x139/0x220
    [] configfs_attach_group+0x14/0x140
    [] configfs_attach_group+0xc9/0x140
    [] configfs_register_subsystem+0xc6/0x130
    [] init_netconsole+0x2b6/0x300
    [] kernel_init+0x142/0x320
    [] kernel_thread_helper+0x7/0x14
    =======================

    Signed-off-by: Joonwoo Park
    Signed-off-by: Joel Becker
    Signed-off-by: Mark Fasheh

    Joonwoo Park
     

11 Jul, 2007

2 commits

  • Seems copied from sysfs, but I don't see a reason here nor there to use
    a semaphore instead of a mutex. Convert.

    Signed-off-by: Johannes Berg
    Signed-off-by: Joel Becker
    Signed-off-by: Mark Fasheh

    Johannes Berg
     
  • 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: Joel Becker
    Signed-off-by: Mark Fasheh

    Joel Becker
     

10 May, 2007

1 commit


08 Feb, 2007

1 commit

  • Attributes in configfs are text files. As such, most handlers expect to be
    able to call functions like simple_strtoul() without checking the bounds
    of the buffer. Change the call to zero terminate the buffer before calling
    the client's ->store() method. This does reduce the attribute size from
    PAGE_SIZE to PAGE_SIZE-1.

    Also, change get_zeroed_page() to alloc_page(), as we are handling the
    termination.

    Signed-off-by: Joel Becker
    Signed-off-by: Mark Fasheh

    Joel Becker
     

09 Dec, 2006

1 commit


21 Oct, 2006

1 commit


03 Oct, 2006

1 commit


27 Sep, 2006

1 commit


29 Mar, 2006

1 commit

  • This is a conversion to make the various file_operations structs in fs/
    const. Basically a regexp job, with a few manual fixups

    The goal is both to increase correctness (harder to accidentally write to
    shared datastructures) and reducing the false sharing of cachelines with
    things that get dirty in .data (while .rodata is nicely read only and thus
    cache clean)

    Signed-off-by: Arjan van de Ven
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Arjan van de Ven
     

04 Feb, 2006

1 commit


10 Jan, 2006

1 commit


04 Jan, 2006

1 commit