1. 02 Nov, 2017 1 commit
    • Greg Kroah-Hartman's avatar
      License cleanup: add SPDX GPL-2.0 license identifier to files with no license · b2441318
      Greg Kroah-Hartman authored
      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 <5
         lines).
      
      All documentation files were explicitly excluded.
      
      The following heuristics were used to determine which SPDX license
      identifiers to apply.
      
       - when both scanners couldn't find any license traces, file was
         considered to have no license information in it, and the top level
         COPYING file license applied.
      
         For non */uapi/* files that summary was:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|-------
         GPL-2.0                                              11139
      
         and resulted in the first patch in this series.
      
         If that file was a */uapi/* path one, it was "GPL-2.0 WITH
         Linux-syscall-note" otherwise it was "GPL-2.0".  Results of that was:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|-------
         GPL-2.0 WITH Linux-syscall-note                        930
      
         and resulted in the second patch in this series.
      
       - if a file had some form of licensing information in it, and was one
         of the */uapi/* ones, it was denoted with the Linux-syscall-note if
         any GPL family license was found in the file or had no licensing in
         it (per prior point).  Results summary:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|------
         GPL-2.0 WITH Linux-syscall-note                       270
         GPL-2.0+ WITH Linux-syscall-note                      169
         ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause)    21
         ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)    17
         LGPL-2.1+ WITH Linux-syscall-note                      15
         GPL-1.0+ WITH Linux-syscall-note                       14
         ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause)    5
         LGPL-2.0+ WITH Linux-syscall-note                       4
         LGPL-2.1 WITH Linux-syscall-note                        3
         ((GPL-2.0 WITH Linux-syscall-note) OR MIT)              3
         ((GPL-2.0 WITH Linux-syscall-note) AND MIT)             1
      
         and that resulted in the third patch in this series.
      
       - when the two scanners agreed on the detected license(s), that became
         the concluded license(s).
      
       - when there was disagreement between the two scanners (one detected a
         license but the other didn't, or they both detected different
         licenses) a manual inspection of the file occurred.
      
       - In most cases a manual inspection of the information in the file
         resulted in a clear resolution of the license that should apply (and
         which scanner probably needed to revisit its heuristics).
      
       - When it was not immediately clear, the license identifier was
         confirmed with lawyers working with the Linux Foundation.
      
       - If there was any question as to the appropriate license identifier,
         the file was flagged for further research and to be revisited later
         in time.
      
      In total, over 70 hours of logged manual review was done on the
      spreadsheet to determine the SPDX license identifiers to apply to the
      source files by Kate, Philippe, Thomas and, in some cases, confirmation
      by lawyers working with the Linux Foundation.
      
      Kate also obtained a third independent scan of the 4.13 code base from
      FOSSology, and compared selected files where the other two scanners
      disagreed against that SPDX file, to see if there was new insights.  The
      Windriver scanner is based on an older version of FOSSology in part, so
      they are related.
      
      Thomas did random spot checks in about 500 files from the spreadsheets
      for the uapi headers and agreed with SPDX license identifier in the
      files he inspected. For the non-uapi files Thomas did random spot checks
      in about 15000 files.
      
      In initial set of patches against 4.14-rc6, 3 files were found to have
      copy/paste license identifier errors, and have been fixed to reflect the
      correct identifier.
      
      Additionally Philippe spent 10 hours this week doing a detailed manual
      inspection and review of the 12,461 patched files from the initial patch
      version early this week with:
       - a full scancode scan run, collecting the matched texts, detected
         license ids and scores
       - reviewing anything where there was a license detected (about 500+
         files) to ensure that the applied SPDX license was correct
       - reviewing anything where there was no detection but the patch license
         was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
         SPDX license was correct
      
      This produced a worksheet with 20 files needing minor correction.  This
      worksheet was then exported into 3 different .csv files for the
      different types of files to be modified.
      
      These .csv files were then reviewed by Greg.  Thomas wrote a script to
      parse the csv files and add the proper SPDX tag to the file, in the
      format that the file expected.  This script was further refined by Greg
      based on the output to detect more types of files automatically and to
      distinguish between header and source .c files (which need different
      comment types.)  Finally Greg ran the script using the .csv files to
      generate the patches.
      Reviewed-by: 's avatarKate Stewart <kstewart@linuxfoundation.org>
      Reviewed-by: 's avatarPhilippe Ombredanne <pombredanne@nexb.com>
      Reviewed-by: 's avatarThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: 's avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b2441318
  2. 01 Aug, 2017 1 commit
    • Jeff Layton's avatar
      fs: convert a pile of fsync routines to errseq_t based reporting · 3b49c9a1
      Jeff Layton authored
      This patch converts most of the in-kernel filesystems that do writeback
      out of the pagecache to report errors using the errseq_t-based
      infrastructure that was recently added. This allows them to report
      errors once for each open file description.
      
      Most filesystems have a fairly straightforward fsync operation. They
      call filemap_write_and_wait_range to write back all of the data and
      wait on it, and then (sometimes) sync out the metadata.
      
      For those filesystems this is a straightforward conversion from calling
      filemap_write_and_wait_range in their fsync operation to calling
      file_write_and_wait_range.
      Acked-by: 's avatarJan Kara <jack@suse.cz>
      Acked-by: 's avatarDave Kleikamp <dave.kleikamp@oracle.com>
      Signed-off-by: 's avatarJeff Layton <jlayton@redhat.com>
      3b49c9a1
  3. 02 Mar, 2017 1 commit
  4. 08 Oct, 2016 1 commit
  5. 28 Sep, 2016 1 commit
  6. 22 Sep, 2016 1 commit
  7. 29 May, 2016 1 commit
  8. 13 May, 2016 1 commit
    • Al Viro's avatar
      hfsplus: switch to ->iterate_shared() · 323ee8fc
      Al Viro authored
      We need to protect the list of hfsplus_readdir_data against parallel
      insertions (in readdir) and removals (in release).  Add a spinlock
      for that.  Note that it has nothing to do with protection of
      hfsplus_readdir_data->key - we have an exclusion between hfsplus_readdir()
      and hfsplus_delete_cat() on directory lock and between several
      hfsplus_readdir() for the same struct file on ->f_pos_lock.  The spinlock
      is strictly for list changes.
      Signed-off-by: 's avatarAl Viro <viro@zeniv.linux.org.uk>
      323ee8fc
  9. 01 May, 2016 1 commit
  10. 04 Apr, 2016 1 commit
    • Kirill A. Shutemov's avatar
      mm, fs: get rid of PAGE_CACHE_* and page_cache_{get,release} macros · 09cbfeaf
      Kirill A. Shutemov authored
      PAGE_CACHE_{SIZE,SHIFT,MASK,ALIGN} macros were introduced *long* time
      ago with promise that one day it will be possible to implement page
      cache with bigger chunks than PAGE_SIZE.
      
      This promise never materialized.  And unlikely will.
      
      We have many places where PAGE_CACHE_SIZE assumed to be equal to
      PAGE_SIZE.  And it's constant source of confusion on whether
      PAGE_CACHE_* or PAGE_* constant should be used in a particular case,
      especially on the border between fs and mm.
      
      Global switching to PAGE_CACHE_SIZE != PAGE_SIZE would cause to much
      breakage to be doable.
      
      Let's stop pretending that pages in page cache are special.  They are
      not.
      
      The changes are pretty straight-forward:
      
       - <foo> << (PAGE_CACHE_SHIFT - PAGE_SHIFT) -> <foo>;
      
       - <foo> >> (PAGE_CACHE_SHIFT - PAGE_SHIFT) -> <foo>;
      
       - PAGE_CACHE_{SIZE,SHIFT,MASK,ALIGN} -> PAGE_{SIZE,SHIFT,MASK,ALIGN};
      
       - page_cache_get() -> get_page();
      
       - page_cache_release() -> put_page();
      
      This patch contains automated changes generated with coccinelle using
      script below.  For some reason, coccinelle doesn't patch header files.
      I've called spatch for them manually.
      
      The only adjustment after coccinelle is revert of changes to
      PAGE_CAHCE_ALIGN definition: we are going to drop it later.
      
      There are few places in the code where coccinelle didn't reach.  I'll
      fix them manually in a separate patch.  Comments and documentation also
      will be addressed with the separate patch.
      
      virtual patch
      
      @@
      expression E;
      @@
      - E << (PAGE_CACHE_SHIFT - PAGE_SHIFT)
      + E
      
      @@
      expression E;
      @@
      - E >> (PAGE_CACHE_SHIFT - PAGE_SHIFT)
      + E
      
      @@
      @@
      - PAGE_CACHE_SHIFT
      + PAGE_SHIFT
      
      @@
      @@
      - PAGE_CACHE_SIZE
      + PAGE_SIZE
      
      @@
      @@
      - PAGE_CACHE_MASK
      + PAGE_MASK
      
      @@
      expression E;
      @@
      - PAGE_CACHE_ALIGN(E)
      + PAGE_ALIGN(E)
      
      @@
      expression E;
      @@
      - page_cache_get(E)
      + get_page(E)
      
      @@
      expression E;
      @@
      - page_cache_release(E)
      + put_page(E)
      Signed-off-by: 's avatarKirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Acked-by: 's avatarMichal Hocko <mhocko@suse.com>
      Signed-off-by: 's avatarLinus Torvalds <torvalds@linux-foundation.org>
      09cbfeaf
  11. 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: 's avatarAl Viro <viro@zeniv.linux.org.uk>
      5955102c
  12. 09 Dec, 2015 1 commit
    • Al Viro's avatar
      don't put symlink bodies in pagecache into highmem · 21fc61c7
      Al Viro authored
      kmap() in page_follow_link_light() needed to go - allowing to hold
      an arbitrary number of kmaps for long is a great way to deadlocking
      the system.
      
      new helper (inode_nohighmem(inode)) needs to be used for pagecache
      symlinks inodes; done for all in-tree cases.  page_follow_link_light()
      instrumented to yell about anything missed.
      Signed-off-by: 's avatarAl Viro <viro@zeniv.linux.org.uk>
      21fc61c7
  13. 17 Apr, 2015 1 commit
    • Sergei Antonov's avatar
      hfsplus: fix expand when not enough available space · 059a704c
      Sergei Antonov authored
      Fix a bug which is reproduced as follows. Create a file:
      
       echo abc > test_file
      
      Try to expand the file beyond available space:
      
       truncate --size=<size exceeding available space> test_file
      
      Since HFS+ does not support file size > allocated size, truncate should
      fail.  However, it ends successfully.  The driver returns success despite
      having been unable to allocate the requested space for the file.  Also
      filesystem check finds an error:
      
       Checking catalog file.
       Incorrect size for file test_file
       (It should be 469094400 instead of 1000000000)
      
      Add a piece of code analogous to code in the fat driver.  Now a proper
      error is returned and filesystem remains consistent.
      Signed-off-by: 's avatarSergei Antonov <saproj@gmail.com>
      Cc: Vyacheslav Dubeyko <slava@dubeyko.com>
      Cc: Hin-Tak Leung <htl10@users.sourceforge.net>
      Reviewed-by: 's avatarAnton Altaparmakov <anton@tuxera.com>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: Christoph Hellwig <hch@infradead.org>
      Cc: Sougata Santra <sougata@tuxera.com>
      Signed-off-by: 's avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: 's avatarLinus Torvalds <torvalds@linux-foundation.org>
      059a704c
  14. 15 Apr, 2015 1 commit
  15. 12 Apr, 2015 4 commits
  16. 26 Mar, 2015 1 commit
  17. 06 May, 2014 5 commits
  18. 11 Mar, 2014 1 commit
    • Sergei Antonov's avatar
      hfsplus: add HFSX subfolder count support · d7d673a5
      Sergei Antonov authored
      Adds support for HFSX 'HasFolderCount' flag and a corresponding
      'folderCount' field in folder records.  (For reference see
      HFS_FOLDERCOUNT and kHFSHasFolderCountBit/kHFSHasFolderCountMask in
      Apple's source code.)
      
      Ignoring subfolder count leads to fs errors found by Mac:
      
        ...
        Checking catalog hierarchy.
        HasFolderCount flag needs to be set (id = 105)
        (It should be 0x10 instead of 0)
        Incorrect folder count in a directory (id = 2)
        (It should be 7 instead of 6)
        ...
      
      Steps to reproduce:
       Format with "newfs_hfs -s /dev/diskXXX".
       Mount in Linux.
       Create a new directory in root.
       Unmount.
       Run "fsck_hfs /dev/diskXXX".
      
      The patch handles directory creation, deletion, and rename.
      Signed-off-by: 's avatarSergei Antonov <saproj@gmail.com>
      Reviewed-by: 's avatarVyacheslav Dubeyko <slava@dubeyko.com>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: Christoph Hellwig <hch@infradead.org>
      Signed-off-by: 's avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: 's avatarLinus Torvalds <torvalds@linux-foundation.org>
      d7d673a5
  19. 31 Jan, 2014 1 commit
  20. 26 Jan, 2014 1 commit
  21. 24 Jan, 2014 1 commit
    • Sougata Santra's avatar
      hfsplus: remove hfsplus_file_lookup() · d74a054f
      Sougata Santra authored
      HFS+ resource fork lookup breaks opendir() library function.  Since
      opendir first calls open() with O_DIRECTORY flag set.  O_DIRECTORY means
      "refuse to open if not a directory".  The open system call in the kernel
      does a check for inode->i_op->lookup and returns -ENOTDIR.  So if
      hfsplus_file_lookup is set it allows opendir() for plain files.
      
      Also resource fork lookup in HFS+ does not work.  Since it is never
      invoked after VFS permission checking.  It will always return with
      -EACCES.
      
      When we call opendir() on a file, it does not return NULL.  opendir()
      library call is based on open with O_DIRECTORY flag passed and then
      layered on top of getdents() system call.  O_DIRECTORY means "refuse to
      open if not a directory".
      
      The open() system call in the kernel does a check for: do_sys_open()
      -->..--> can_lookup() i.e it only checks inode->i_op->lookup and returns
      ENOTDIR if this function pointer is not set.
      
      In OSX, we can open "file/rsrc" to get the resource fork of "file".  This
      behavior is emulated inside hfsplus on Linux, which means that to some
      degree every file acts like a directory.  That is the reason lookup()
      inode operations is supported for files, and it is possible to do a lookup
      on this specific name.  As a result of this open succeeds without
      returning ENOTDIR for HFS+
      
      Please see the LKML discussion thread on this issue:
      http://marc.info/?l=linux-fsdevel&m=122823343730412&w=2
      
      I tried to test file/rsrc lookup in HFS+ driver and the feature does not
      work.  From OSX:
      
      $ touch test
      $ echo "1234" > test/..namedfork/rsrc
      $ ls -l test..namedfork/rsrc
      --rw-r--r-- 1 tuxera staff 5 10 dec 12:59 test/..namedfork/rsrc
      
      [sougata@ultrabook tmp]$ id
      uid=1000(sougata) gid=1000(sougata) groups=1000(sougata),5(tty),18(dialout),1001(vboxusers)
      
      [sougata@ultrabook tmp]$ mount
      /dev/sdb1 on /mnt/tmp type hfsplus (rw,relatime,umask=0,uid=1000,gid=1000,nls=utf8)
      
      [sougata@ultrabook tmp]$ ls -l test/rsrc
      ls: cannot access test/rsrc: Permission denied
      
      According to this LKML thread it is expected behavior.
      
      http://marc.info/?t=121139033800008&r=1&w=4
      
      I guess now that permission checking happens in vfs generic_permission() ?
       So it turns out that even though the lookup() inode_operation exists for
      HFS+ files.  It cannot really get invoked ?.  So if we can disable this
      feature to make opendir() work for HFS+.
      Signed-off-by: 's avatarSougata Santra <sougata@tuxera.com>
      Acked-by: 's avatarChristoph Hellwig <hch@lst.de>
      Cc: Vyacheslav Dubeyko <slava@dubeyko.com>
      Cc: Anton Altaparmakov <aia21@cam.ac.uk>
      Signed-off-by: 's avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: 's avatarLinus Torvalds <torvalds@linux-foundation.org>
      d74a054f
  22. 12 Sep, 2013 1 commit
  23. 11 Sep, 2013 1 commit
  24. 08 May, 2013 1 commit
  25. 01 May, 2013 1 commit
  26. 28 Feb, 2013 1 commit
  27. 23 Feb, 2013 1 commit
  28. 20 Dec, 2012 1 commit
  29. 21 Sep, 2012 1 commit
  30. 22 Jul, 2012 1 commit
    • Artem Bityutskiy's avatar
      hfsplus: get rid of write_super · 9e6c5829
      Artem Bityutskiy authored
      This patch makes hfsplus stop using the VFS '->write_super()' method along with
      the 's_dirt' superblock flag, because they are on their way out.
      
      The whole "superblock write-out" VFS infrastructure is served by the
      'sync_supers()' kernel thread, which wakes up every 5 (by default) seconds and
      writes out all dirty superblocks using the '->write_super()' call-back.  But the
      problem with this thread is that it wastes power by waking up the system every
      5 seconds, even if there are no diry superblocks, or there are no client
      file-systems which would need this (e.g., btrfs does not use
      '->write_super()'). So we want to kill it completely and thus, we need to make
      file-systems to stop using the '->write_super()' VFS service, and then remove
      it together with the kernel thread.
      
      Tested using fsstress from the LTP project.
      Signed-off-by: 's avatarArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
      Signed-off-by: 's avatarAl Viro <viro@zeniv.linux.org.uk>
      9e6c5829
  31. 14 Jul, 2012 1 commit
    • Al Viro's avatar
      stop passing nameidata to ->lookup() · 00cd8dd3
      Al Viro authored
      Just the flags; only NFS cares even about that, but there are
      legitimate uses for such argument.  And getting rid of that
      completely would require splitting ->lookup() into a couple
      of methods (at least), so let's leave that alone for now...
      Signed-off-by: 's avatarAl Viro <viro@zeniv.linux.org.uk>
      00cd8dd3
  32. 21 Mar, 2012 1 commit
  33. 04 Jan, 2012 1 commit