30 May, 2018

1 commit

  • commit 1e2e547a93a00ebc21582c06ca3c6cfea2a309ee upstream.

    For anything NFS-exported we do _not_ want to unlock new inode
    before it has grown an alias; original set of fixes got the
    ordering right, but missed the nasty complication in case of
    lockdep being enabled - unlock_new_inode() does
    lockdep_annotate_inode_mutex_key(inode)
    which can only be done before anyone gets a chance to touch
    ->i_mutex. Unfortunately, flipping the order and doing
    unlock_new_inode() before d_instantiate() opens a window when
    mkdir can race with open-by-fhandle on a guessed fhandle, leading
    to multiple aliases for a directory inode and all the breakage
    that follows from that.

    Correct solution: a new primitive (d_instantiate_new())
    combining these two in the right order - lockdep annotate, then
    d_instantiate(), then the rest of unlock_new_inode(). All
    combinations of d_instantiate() with unlock_new_inode() should
    be converted to that.

    Cc: stable@kernel.org # 2.6.29 and later
    Tested-by: Mike Marshall
    Reviewed-by: Andreas Dilger
    Signed-off-by: Al Viro
    Signed-off-by: Greg Kroah-Hartman

    Al Viro
     

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
     

11 Oct, 2016

1 commit


28 Sep, 2016

1 commit

  • CURRENT_TIME_SEC is not y2038 safe. current_time() will
    be transitioned to use 64 bit time along with vfs in a
    separate patch.
    There is no plan to transistion CURRENT_TIME_SEC to use
    y2038 safe time interfaces.

    current_time() will also be extended to use superblock
    range checking parameters when range checking is introduced.

    This works because alloc_super() fills in the the s_time_gran
    in super block to NSEC_PER_SEC.

    Signed-off-by: Deepa Dinamani
    Acked-by: Jan Kara
    Signed-off-by: Al Viro

    Deepa Dinamani
     

27 Sep, 2016

2 commits

  • Generated patch:

    sed -i "s/\.rename2\t/\.rename\t\t/" `git grep -wl rename2`
    sed -i "s/\brename2\b/rename/g" `git grep -wl rename2`

    Signed-off-by: Miklos Szeredi

    Miklos Szeredi
     
  • This is trivial to do:

    - add flags argument to foo_rename()
    - check if flags doesn't have any other than RENAME_NOREPLACE
    - assign foo_rename() to .rename2 instead of .rename

    Filesystems converted:

    affs, bfs, exofs, ext2, hfs, hfsplus, jffs2, jfs, logfs, minix, msdos,
    nilfs2, omfs, reiserfs, sysvfs, ubifs, udf, ufs, vfat.

    Signed-off-by: Miklos Szeredi
    Acked-by: Boaz Harrosh
    Acked-by: Richard Weinberger
    Acked-by: Bob Copeland
    Acked-by: Jan Kara
    Cc: Theodore Ts'o
    Cc: Jaegeuk Kim
    Cc: OGAWA Hirofumi
    Cc: Mikulas Patocka
    Cc: David Woodhouse
    Cc: Dave Kleikamp
    Cc: Ryusuke Konishi
    Cc: Christoph Hellwig

    Miklos Szeredi
     

05 Apr, 2016

1 commit

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

    - << (PAGE_CACHE_SHIFT - PAGE_SHIFT) -> ;

    - >> (PAGE_CACHE_SHIFT - PAGE_SHIFT) -> ;

    - 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: Kirill A. Shutemov
    Acked-by: Michal Hocko
    Signed-off-by: Linus Torvalds

    Kirill A. Shutemov
     

09 Dec, 2015

1 commit

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

    Al Viro
     

07 Dec, 2015

1 commit

  • It was to needed for a couple of months in 2010, until UFS
    quota support got dropped. Since then it's equivalent to
    simple_setattr() (i.e. the default) for everything except the
    regular files. And dropping it there allows to convert all
    UFS symlinks to {page,simple}_symlink_inode_operations, getting
    rid of fs/ufs/symlink.c completely.

    Signed-off-by: Al Viro

    Al Viro
     

18 Jun, 2015

1 commit


16 Jun, 2015

4 commits

  • See "ext2: Do not update mtime of a moved directory" (and followup in
    "ext2: fix unbalanced kmap()/kunmap()") for background; this is UFS
    equivalent - the same problem exists here.

    Signed-off-by: Al Viro

    Al Viro
     
  • We are already serialized by ->i_mutex and operations on different
    directories are independent. These calls are just rudiments of
    blind BKL conversion and they should've been removed back then.

    Signed-off-by: Al Viro

    Al Viro
     
  • Commit e4502c63f56aeca88 (ufs: deal with nfsd/iget races) made ufs
    create inodes with I_NEW flag set. However ufs_mkdir() never cleared
    this flag. Thus if someone ever tried to lookup the directory by inode
    number, he would deadlock waiting for I_NEW to be cleared. Luckily this
    mostly happens only if the filesystem is exported over NFS since
    otherwise we have the inode attached to dentry and don't look it up by
    inode number. In rare cases dentry can get freed without inode being
    freed and then we'd hit the deadlock even without NFS export.

    Fix the problem by clearing I_NEW before instantiating new directory
    inode.

    Fixes: e4502c63f56aeca887ced37f24e0def1ef11cec8
    Reported-by: Fabian Frederick
    Signed-off-by: Jan Kara
    Signed-off-by: Al Viro

    Jan Kara
     
  • Commit e4502c63f56aeca88 (ufs: deal with nfsd/iget races) introduced
    unlock_new_inode() call into ufs_add_nondir(). However that function
    gets called also from ufs_link() which hands it already initialized
    inode and thus unlock_new_inode() complains. The problem is harmless but
    annoying.

    Fix the problem by opencoding necessary stuff in ufs_link()

    Fixes: e4502c63f56aeca887ced37f24e0def1ef11cec8
    Signed-off-by: Jan Kara
    Signed-off-by: Al Viro

    Jan Kara
     

14 Jun, 2015

1 commit

  • This reverts commit 9ef7db7f38d0 ("ufs: fix deadlocks introduced by sb
    mutex merge") That patch tried to solve commit 0244756edc4b98c ("ufs: sb
    mutex merge + mutex_destroy") which is itself partially reverted due to
    multiple deadlocks.

    Signed-off-by: Fabian Frederick
    Suggested-by: Jan Kara
    Cc: Ian Campbell
    Cc: Evgeniy Dushistov
    Cc: Alexey Khoroshilov
    Cc: Roger Pau Monne
    Cc: Ian Jackson
    Cc: Al Viro
    Cc:
    Signed-off-by: Andrew Morton

    Fabian Frederick
     

11 May, 2015

1 commit


16 Apr, 2015

1 commit


27 Sep, 2014

1 commit


08 Sep, 2014

1 commit

  • Commit 0244756edc4b ("ufs: sb mutex merge + mutex_destroy") introduces
    deadlocks in ufs_new_inode() and ufs_free_inode().
    Most callers of that functions acqure the mutex by themselves and
    ufs_{new,free}_inode() do that via lock_ufs(),
    i.e we have an unavoidable double lock.

    The patch proposes to resolve the issue by making sure that
    ufs_{new,free}_inode() are not called with the mutex held.

    Found by Linux Driver Verification project (linuxtesting.org).

    Cc: stable@vger.kernel.org # 3.16
    Signed-off-by: Alexey Khoroshilov
    Signed-off-by: Al Viro

    Alexey Khoroshilov
     

14 Jul, 2012

2 commits

  • boolean "does it have to be exclusive?" flag is passed instead;
    Local filesystem should just ignore it - the object is guaranteed
    not to be there yet.

    Signed-off-by: Al Viro

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

    Al Viro
     

21 Mar, 2012

1 commit


04 Jan, 2012

3 commits


20 Jul, 2011

1 commit


18 Jul, 2011

1 commit


28 May, 2011

1 commit


26 May, 2011

2 commits


17 Mar, 2011

1 commit


03 Mar, 2011

2 commits

  • Signed-off-by: Al Viro

    Al Viro
     
  • This introduces a new per-superblock mutex in UFS to replace
    the big kernel lock. I have been careful to avoid nested
    calls to lock_ufs and to get the lock order right with
    respect to other mutexes, in particular lock_super.

    I did not make any attempt to prove that the big kernel
    lock is not needed in a particular place in the code,
    which is very possible.

    The mutex has a significant performance impact, so it is only
    used on SMP or PREEMPT configurations.

    As Nick Piggin noticed, any allocation inside of the lock
    may end up deadlocking when we get to ufs_getfrag_block
    in the reclaim task, so we now use GFP_NOFS.

    Signed-off-by: Arnd Bergmann
    Tested-by: Nick Bowler
    Cc: Evgeniy Dushistov
    Cc: Nick Piggin

    Arnd Bergmann
     

26 Oct, 2010

1 commit


24 May, 2010

1 commit

  • UFS quota is non-functional at least since 2.6.12 because dq_op was set
    to NULL. Since the filesystem exists mainly to allow cooperation with Solaris
    and quota format isn't standard, just remove the dead code.

    CC: Evgeniy Dushistov
    Signed-off-by: Jan Kara

    Jan Kara
     

22 May, 2010

1 commit


05 Mar, 2010

2 commits

  • Get rid of the initialize dquot operation - it is now always called from
    the filesystem and if a filesystem really needs it's own (which none
    currently does) it can just call into it's own routine directly.

    Rename the now static low-level dquot_initialize helper to __dquot_initialize
    and vfs_dq_init to dquot_initialize to have a consistent namespace.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Jan Kara

    Christoph Hellwig
     
  • Currently various places in the VFS call vfs_dq_init directly. This means
    we tie the quota code into the VFS. Get rid of that and make the
    filesystem responsible for the initialization. For most metadata operations
    this is a straight forward move into the methods, but for truncate and
    open it's a bit more complicated.

    For truncate we currently only call vfs_dq_init for the sys_truncate case
    because open already takes care of it for ftruncate and open(O_TRUNC) - the
    new code causes an additional vfs_dq_init for those which is harmless.

    For open the initialization is moved from do_filp_open into the open method,
    which means it happens slightly earlier now, and only for regular files.
    The latter is fine because we don't need to initialize it for operations
    on special files, and we already do it as part of the namespace operations
    for directories.

    Add a dquot_file_open helper that filesystems that support generic quotas
    can use to fill in ->open.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Jan Kara

    Christoph Hellwig
     

16 Dec, 2009

1 commit


28 Mar, 2009

1 commit

  • Copy symlink data into the union member it is accessed through. Although
    this shouldn't make a difference to behaviour it makes the code easier
    to follow and grep through. It may also prevent problems if the
    struct/union definitions change in the future.

    Signed-off-by: Duane Griffin
    Signed-off-by: Al Viro

    Duane Griffin