08 Jun, 2018

1 commit

  • The warning is invalid because the parameter chunksize passed from
    ocfs2_info_freefrag_scan_chain-->ocfs2_info_update_ffg is guaranteed to
    be positive. So __ilog2_u32 cannot return -1.

    fs/ocfs2/ioctl.c: In function 'ocfs2_info_update_ffg':
    fs/ocfs2/ioctl.c:411:17: warning: array subscript is below array bounds [-Warray-bounds]
    hist->fc_chunks[index]++;
    ^
    fs/ocfs2/ioctl.c:411:17: warning: array subscript is below array bounds [-Warray-bounds]

    Link: http://lkml.kernel.org/r/1524655799-12112-1-git-send-email-thunder.leizhen@huawei.com
    Signed-off-by: Zhen Lei
    Reviewed-by: Andrew Morton
    Cc: Mark Fasheh
    Cc: Joel Becker
    Cc: Junxiao Bi
    Cc: Joseph Qi
    Cc: Changwei Ge
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Zhen Lei
     

02 Nov, 2017

1 commit

  • Many source files in the tree are missing licensing information, which
    makes it harder for compliance tools to determine the correct license.

    By default all files without license information are under the default
    license of the kernel, which is GPL version 2.

    Update the files which contain no license information with the 'GPL-2.0'
    SPDX license identifier. The SPDX identifier is a legally binding
    shorthand, which can be used instead of the full boiler plate text.

    This patch is based on work done by Thomas Gleixner and Kate Stewart and
    Philippe Ombredanne.

    How this work was done:

    Patches were generated and checked against linux-4.14-rc6 for a subset of
    the use cases:
    - file had no licensing information it it.
    - file was a */uapi/* one with no licensing information in it,
    - file was a */uapi/* one with existing licensing information,

    Further patches will be generated in subsequent months to fix up cases
    where non-standard license headers were used, and references to license
    had to be inferred by heuristics based on keywords.

    The analysis to determine which SPDX License Identifier to be applied to
    a file was done in a spreadsheet of side by side results from of the
    output of two independent scanners (ScanCode & Windriver) producing SPDX
    tag:value files created by Philippe Ombredanne. Philippe prepared the
    base worksheet, and did an initial spot review of a few 1000 files.

    The 4.13 kernel was the starting point of the analysis with 60,537 files
    assessed. Kate Stewart did a file by file comparison of the scanner
    results in the spreadsheet to determine which SPDX license identifier(s)
    to be applied to the file. She confirmed any determination that was not
    immediately clear with lawyers working with the Linux Foundation.

    Criteria used to select files for SPDX license identifier tagging was:
    - Files considered eligible had to be source code files.
    - Make and config files were included as candidates if they contained >5
    lines of source
    - File already had some variant of a license header in it (even if
    Reviewed-by: Philippe Ombredanne
    Reviewed-by: Thomas Gleixner
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

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
     

15 Jan, 2016

1 commit


10 Jul, 2015

1 commit

  • The FITRIM ioctl has the same arguments on 32-bit and 64-bit
    architectures, so we can add it to the list of compatible ioctls and
    drop it from compat_ioctl method of various filesystems.

    Signed-off-by: Mikulas Patocka
    Cc: Al Viro
    Cc: Ted Ts'o
    Signed-off-by: Linus Torvalds

    Mikulas Patocka
     

30 Aug, 2014

1 commit

  • If we failed to copy from the structure, writing back the flags leaks 31
    bits of kernel memory (the rest of the ir_flags field).

    In any case, if we cannot copy from/to the structure, why should we
    expect putting just the flags to work?

    Also make sure ocfs2_info_handle_freeinode() returns the right error
    code if the copy_to_user() fails.

    Fixes: ddee5cdb70e6 ('Ocfs2: Add new OCFS2_IOC_INFO ioctl for ocfs2 v8.')
    Signed-off-by: Ben Hutchings
    Cc: Joel Becker
    Acked-by: Mark Fasheh
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ben Hutchings
     

05 Jun, 2014

1 commit


04 Apr, 2014

1 commit

  • In ocfs2_info_handle_freeinode() and ocfs2_test_inode_bit() func, after
    calls ocfs2_get_system_file_inode() to get inode ref, if calls
    ocfs2_info_scan_inode_alloc() or ocfs2_inode_lock() failed, we should
    iput inode alloc to avoid leaking the inode.

    Signed-off-by: jiangyiwen
    Reviewed-by: Joseph Qi
    Cc: Mark Fasheh
    Cc: Joel Becker
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    jiangyiwen
     

22 Jan, 2014

2 commits

  • Adjust minlen with discard_granularity for FITRIM ioctl(2) if the given
    minimum size in bytes is less than it because, discard granularity is
    used to tell us that the minimum size of extent that can be discarded by
    the storage device.

    This is inspired by ext4 commit 5c2ed62fd447 ("ext4: Adjust minlen with
    discard_granularity in the FITRIM ioctl") from Lukas Czerner.

    Signed-off-by: Jie Liu
    Cc: Mark Fasheh
    Cc: Joel Becker
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jie Liu
     
  • For FITRIM ioctl(2), we should return EOPNOTSUPP to inform the user that
    the storage device does not support discard if it is, otherwise return
    success would confuse the user even though there is no free blocks were
    trimmed at all.

    Signed-off-by: Jie Liu
    Cc: Mark Fasheh
    Cc: Joel Becker
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jie Liu
     

12 Sep, 2013

1 commit

  • Though ocfs2 uses inode->i_mutex to protect i_size, there are both
    i_size_read/write() and direct accesses. Clean up all direct access to
    eliminate confusion.

    Signed-off-by: Junxiao Bi
    Cc: Jie Liu
    Cc: Mark Fasheh
    Cc: Joel Becker
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Junxiao Bi
     

30 Apr, 2013

2 commits


23 Feb, 2013

1 commit


31 Jul, 2012

1 commit

  • Protect ocfs2_page_mkwrite() and ocfs2_file_aio_write() using the new freeze
    protection. We also protect several ioctl entry points which were missing the
    protection. Finally, we add freeze protection to the journaling mechanism so
    that iput() of unlinked inode cannot modify a frozen filesystem.

    CC: Mark Fasheh
    CC: Joel Becker
    CC: ocfs2-devel@oss.oracle.com
    Acked-by: Joel Becker
    Signed-off-by: Jan Kara
    Signed-off-by: Al Viro

    Jan Kara
     

30 May, 2012

1 commit


01 Apr, 2012

1 commit


04 Jan, 2012

2 commits


17 Nov, 2011

1 commit

  • There are three cases found that in error cases, journal transactions are not
    committed nor aborted. We should take care of these case by committing the
    transactions. Otherwise, there would left a journal handle which will lead to
    , in same process context, the comming ocfs2_start_trans() gets wrong credits.

    Signed-off-by: Wengang Wang
    Signed-off-by: Joel Becker

    Wengang Wang
     

01 Jun, 2011

1 commit


26 May, 2011

1 commit


25 May, 2011

4 commits

  • the basic logic of moving extents for a file is pretty like punching-hole
    sequence, walk the extents within the range as user specified, calculating
    an appropriate len to defrag/move, then let ocfs2_defrag/move_extent() to
    do the actual moving.

    This func ends up setting 'OCFS2_MOVE_EXT_FL_COMPLETE' to userpace if operation
    gets done successfully.

    Signed-off-by: Tristan Ye

    Tristan Ye
     
  • This new code is a bit more complicated than former ones, the goal is to
    show user all statistics required to take a deep insight into filesystem
    on how the disk is being fragmentaed.

    The goal is achieved by scaning global bitmap from (cluster)group to group
    to figure out following factors in the filesystem:

    - How many free chunks in a fixed size as user requested.
    - How many real free chunks in all size.
    - Min/Max/Avg size(in) clusters of free chunks.
    - How do free chunks distribute(in size) in terms of a histogram,
    just like following:
    ---------------------------------------------------------
    Extent Size Range : Free extents Free Clusters Percent
    32K... 64K- : 1 1 0.00%
    1M... 2M- : 9 288 0.03%
    8M... 16M- : 2 831 0.09%
    32M... 64M- : 1 2047 0.23%
    128M... 256M- : 1 8191 0.92%
    256M... 512M- : 2 21706 2.43%
    512M... 1024M- : 27 858623 96.29%
    ---------------------------------------------------------

    Userspace ioctl() call eventually gets the above info returned by passing
    a 'struct ocfs2_info_freefrag' with the chunk_size being specified first.

    Signed-off-by: Tristan Ye

    Tristan Ye
     
  • The new code is dedicated to calculate free inodes number of all inode_allocs,
    then return the info to userpace in terms of an array.

    Specially, flag 'OCFS2_INFO_FL_NON_COHERENT', manipulated by '--cluster-coherent'
    from userspace, is now going to be involved. setting the flag on means no cluster
    coherency considered, usually, userspace tools choose none-coherency strategy by
    default for the sake of performace.

    Signed-off-by: Tristan Ye

    Tristan Ye
     
  • It just removes some macros for the sake of typechecking gains.

    Signed-off-by: Tristan Ye

    Tristan Ye
     

24 May, 2011

1 commit


29 Mar, 2011

2 commits

  • * 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jlbec/ocfs2: (39 commits)
    Treat writes as new when holes span across page boundaries
    fs,ocfs2: Move o2net_get_func_run_time under CONFIG_OCFS2_FS_STATS.
    ocfs2/dlm: Move kmalloc() outside the spinlock
    ocfs2: Make the left masklogs compat.
    ocfs2: Remove masklog ML_AIO.
    ocfs2: Remove masklog ML_UPTODATE.
    ocfs2: Remove masklog ML_BH_IO.
    ocfs2: Remove masklog ML_JOURNAL.
    ocfs2: Remove masklog ML_EXPORT.
    ocfs2: Remove masklog ML_DCACHE.
    ocfs2: Remove masklog ML_NAMEI.
    ocfs2: Remove mlog(0) from fs/ocfs2/dir.c
    ocfs2: remove NAMEI from symlink.c
    ocfs2: Remove masklog ML_QUOTA.
    ocfs2: Remove mlog(0) from quota_local.c.
    ocfs2: Remove masklog ML_RESERVATIONS.
    ocfs2: Remove masklog ML_XATTR.
    ocfs2: Remove masklog ML_SUPER.
    ocfs2: Remove mlog(0) from fs/ocfs2/heartbeat.c
    ocfs2: Remove mlog(0) from fs/ocfs2/slot_map.c
    ...

    Fix up trivial conflict in fs/ocfs2/super.c

    Linus Torvalds
     
  • Joel Becker
     

24 Mar, 2011

1 commit


07 Mar, 2011

1 commit

  • mlog_exit is used to record the exit status of a function.
    But because it is added in so many functions, if we enable it,
    the system logs get filled up quickly and cause too much I/O.
    So actually no one can open it for a production system or even
    for a test.

    This patch just try to remove it or change it. So:
    1. if all the error paths already use mlog_errno, it is just removed.
    Otherwise, it will be replaced by mlog_errno.
    2. if it is used to print some return value, it is replaced with
    mlog(0,...).
    mlog_exit_ptr is changed to mlog(0.
    All those mlog(0,...) will be replaced with trace events later.

    Signed-off-by: Tao Ma

    Tao Ma
     

21 Feb, 2011

1 commit


20 Feb, 2011

1 commit


10 Sep, 2010

1 commit

  • The reason why we need this ioctl is to offer the none-privileged
    end-user a possibility to get filesys info gathering.

    We use OCFS2_IOC_INFO to manipulate the new ioctl, userspace passes a
    structure to kernel containing an array of request pointers and request
    count, such as,

    * From userspace:

    struct ocfs2_info_blocksize oib = {
    .ib_req = {
    .ir_magic = OCFS2_INFO_MAGIC,
    .ir_code = OCFS2_INFO_BLOCKSIZE,
    ...
    }
    ...
    }

    struct ocfs2_info_clustersize oic = {
    ...
    }

    uint64_t reqs[2] = {(unsigned long)&oib,
    (unsigned long)&oic};

    struct ocfs2_info info = {
    .oi_requests = reqs,
    .oi_count = 2,
    }

    ret = ioctl(fd, OCFS2_IOC_INFO, &info);

    * In kernel:

    Get the request pointers from *info*, then handle each request one bye one.

    Idea here is to make the spearated request small enough to guarantee
    a better backward&forward compatibility since a small piece of request
    would be less likely to be broken if filesys on raw disk get changed.

    Currently, the following 7 requests are supported per the requirement from
    userspace tool o2info, and I believe it will grow over time:-)

    OCFS2_INFO_CLUSTERSIZE
    OCFS2_INFO_BLOCKSIZE
    OCFS2_INFO_MAXSLOTS
    OCFS2_INFO_LABEL
    OCFS2_INFO_UUID
    OCFS2_INFO_FS_FEATURES
    OCFS2_INFO_JOURNAL_SIZE

    This ioctl is only specific to OCFS2.

    Signed-off-by: Tristan Ye
    Signed-off-by: Joel Becker

    Tristan Ye
     

03 Feb, 2010

1 commit

  • Although we use u64 to pass userspace pointers to the kernel
    to avoid compat_ioctl, it doesn't work in some ppc platform.
    So wrap them with compat_ptr and add compat_ioctl.

    The detailed discussion about compat_ptr can be found in thread
    http://lkml.org/lkml/2009/10/27/423.

    We indeed met with a bug when testing on ppc(-EFAULT is returned
    when using old_path). This patch try to fix this.
    I have tested in ppc64(with 32 bit reflink) and x86_64(with i686
    reflink), both works.

    Signed-off-by: Tao Ma
    Signed-off-by: Joel Becker

    Tao Ma
     

24 Sep, 2009

1 commit

  • * 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jlbec/ocfs2: (85 commits)
    ocfs2: Use buffer IO if we are appending a file.
    ocfs2: add spinlock protection when dealing with lockres->purge.
    dlmglue.c: add missed mlog lines
    ocfs2: __ocfs2_abort() should not enable panic for local mounts
    ocfs2: Add ioctl for reflink.
    ocfs2: Enable refcount tree support.
    ocfs2: Implement ocfs2_reflink.
    ocfs2: Add preserve to reflink.
    ocfs2: Create reflinked file in orphan dir.
    ocfs2: Use proper parameter for some inode operation.
    ocfs2: Make transaction extend more efficient.
    ocfs2: Don't merge in 1st refcount ops of reflink.
    ocfs2: Modify removing xattr process for refcount.
    ocfs2: Add reflink support for xattr.
    ocfs2: Create an xattr indexed block if needed.
    ocfs2: Call refcount tree remove process properly.
    ocfs2: Attach xattr clusters to refcount tree.
    ocfs2: Abstract ocfs2 xattr tree extend rec iteration process.
    ocfs2: Abstract the creation of xattr block.
    ocfs2: Remove inode from ocfs2_xattr_bucket_get_name_value.
    ...

    Linus Torvalds
     

23 Sep, 2009

1 commit


13 Jul, 2009

1 commit

  • * Remove smp_lock.h from files which don't need it (including some headers!)
    * Add smp_lock.h to files which do need it
    * Make smp_lock.h include conditional in hardirq.h
    It's needed only for one kernel_locked() usage which is under CONFIG_PREEMPT

    This will make hardirq.h inclusion cheaper for every PREEMPT=n config
    (which includes allmodconfig/allyesconfig, BTW)

    Signed-off-by: Alexey Dobriyan
    Signed-off-by: Linus Torvalds

    Alexey Dobriyan
     

14 Oct, 2008

1 commit


19 Apr, 2008

1 commit