17 Jul, 2017

1 commit

  • Firstly by applying the following with coccinelle's spatch:

    @@ expression SB; @@
    -SB->s_flags & MS_RDONLY
    +sb_rdonly(SB)

    to effect the conversion to sb_rdonly(sb), then by applying:

    @@ expression A, SB; @@
    (
    -(!sb_rdonly(SB)) && A
    +!sb_rdonly(SB) && A
    |
    -A != (sb_rdonly(SB))
    +A != sb_rdonly(SB)
    |
    -A == (sb_rdonly(SB))
    +A == sb_rdonly(SB)
    |
    -!(sb_rdonly(SB))
    +!sb_rdonly(SB)
    |
    -A && (sb_rdonly(SB))
    +A && sb_rdonly(SB)
    |
    -A || (sb_rdonly(SB))
    +A || sb_rdonly(SB)
    |
    -(sb_rdonly(SB)) != A
    +sb_rdonly(SB) != A
    |
    -(sb_rdonly(SB)) == A
    +sb_rdonly(SB) == A
    |
    -(sb_rdonly(SB)) && A
    +sb_rdonly(SB) && A
    |
    -(sb_rdonly(SB)) || A
    +sb_rdonly(SB) || A
    )

    @@ expression A, B, SB; @@
    (
    -(sb_rdonly(SB)) ? 1 : 0
    +sb_rdonly(SB)
    |
    -(sb_rdonly(SB)) ? A : B
    +sb_rdonly(SB) ? A : B
    )

    to remove left over excess bracketage and finally by applying:

    @@ expression A, SB; @@
    (
    -(A & MS_RDONLY) != sb_rdonly(SB)
    +(bool)(A & MS_RDONLY) != sb_rdonly(SB)
    |
    -(A & MS_RDONLY) == sb_rdonly(SB)
    +(bool)(A & MS_RDONLY) == sb_rdonly(SB)
    )

    to make comparisons against the result of sb_rdonly() (which is a bool)
    work correctly.

    Signed-off-by: David Howells

    David Howells
     

21 Apr, 2017

2 commits

  • Now that all bdi structures filesystems use are properly refcounted, we
    can remove the SB_I_DYNBDI flag.

    Reviewed-by: Christoph Hellwig
    Signed-off-by: Jan Kara
    Signed-off-by: Jens Axboe

    Jan Kara
     
  • Similarly to set_bdev_super() NILFS2 just used block device reference to
    bdi. Convert it to properly getting bdi reference. The reference will
    get automatically dropped on superblock destruction.

    CC: linux-nilfs@vger.kernel.org
    Reviewed-by: Christoph Hellwig
    Signed-off-by: Jan Kara
    Acked-by: Ryusuke Konishi
    Signed-off-by: Jens Axboe

    Jan Kara
     

02 Feb, 2017

1 commit

  • We will want to have struct backing_dev_info allocated separately from
    struct request_queue. As the first step add pointer to backing_dev_info
    to request_queue and convert all users touching it. No functional
    changes in this patch.

    Reviewed-by: Christoph Hellwig
    Signed-off-by: Jan Kara
    Signed-off-by: Jens Axboe

    Jan Kara
     

01 Nov, 2016

1 commit


03 Aug, 2016

6 commits

  • Move parser of snapshot mount option to a separate function
    nilfs_parse_snapshot_option(), replace simple_strtoull() with
    kstrtoull() to avoid checkpatch.pl warning "WARNING: simple_strtoull is
    obsolete, use kstrtoull instead", and refine the error message of the
    parser.

    Link: http://lkml.kernel.org/r/1464875891-5443-9-git-send-email-konishi.ryusuke@lab.ntt.co.jp
    Signed-off-by: Ryusuke Konishi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ryusuke Konishi
     
  • Use nilfs_msg() to output warning messages and get rid of
    nilfs_warning() function. This also removes function names from the
    messages unless we embed them explicitly in format strings. Instead,
    some messages are revised to clarify the context.

    [arnd@arndb.de: avoid warning about unused variables]
    Link: http://lkml.kernel.org/r/20160615201945.3348205-1-arnd@arndb.de
    Link: http://lkml.kernel.org/r/1464875891-5443-6-git-send-email-konishi.ryusuke@lab.ntt.co.jp
    Signed-off-by: Ryusuke Konishi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ryusuke Konishi
     
  • Replace most use of printk() in nilfs2 implementation with nilfs_msg(),
    and reduce the following checkpatch.pl warning:

    "WARNING: Prefer [subsystem eg: netdev]_crit([subsystem]dev, ...
    then dev_crit(dev, ... then pr_crit(... to printk(KERN_CRIT ..."

    This patch also fixes a minor checkpatch warning "WARNING: quoted string
    split across lines" that often accompanies the prior warning, and amends
    message format as needed.

    Link: http://lkml.kernel.org/r/1464875891-5443-5-git-send-email-konishi.ryusuke@lab.ntt.co.jp
    Signed-off-by: Ryusuke Konishi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ryusuke Konishi
     
  • Insert a back pointer to super block instance in nilfs object so that
    functions of nilfs2 easily refer to the super block instance. This
    simplifies replacement of printk() in the successive change.

    Link: http://lkml.kernel.org/r/1464875891-5443-4-git-send-email-konishi.ryusuke@lab.ntt.co.jp
    Signed-off-by: Ryusuke Konishi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ryusuke Konishi
     
  • Define an own output routine to replace bare use of printk() function.
    The output routine is implemented with a macro and a helper function,
    which are named nilfs_msg() and __nilfs_msg(), respectively.

    __nilfs_msg() formats a message like "NILFS (): ",
    prefixing it with a given log level, and terminates the statement with a
    newline. The "device-name" is optional to make it available in early
    stages; it will be omitted if a NULL pointer is passed to super block
    instance argument. nilfs_msg() wraps __nilfs_msg() and is removed if
    CONFIG_PRINTK is not set.

    Link: http://lkml.kernel.org/r/1464875891-5443-3-git-send-email-konishi.ryusuke@lab.ntt.co.jp
    Signed-off-by: Ryusuke Konishi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ryusuke Konishi
     
  • Simplify nilfs_error(), an output function used to report critical
    issues in file system. This renames the original nilfs_error() function
    to __nilfs_error() and redefines it as a macro to hide its function name
    argument within the macro.

    Every call site of nilfs_error() is changed to strip __func__ argument
    except nilfs_bmap_convert_error(); nilfs_bmap_convert_error() directly
    calls __nilfs_error() because it inherits caller's function name.

    Link: http://lkml.kernel.org/r/1464875891-5443-2-git-send-email-konishi.ryusuke@lab.ntt.co.jp
    Signed-off-by: Ryusuke Konishi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ryusuke Konishi
     

24 May, 2016

7 commits

  • This fixes checkpatch.pl warning "WARNING: suspect code indent for
    conditional statements".

    Link: http://lkml.kernel.org/r/1462886671-3521-4-git-send-email-konishi.ryusuke@lab.ntt.co.jp
    Signed-off-by: Ryusuke Konishi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ryusuke Konishi
     
  • This fixes the checkpatch.pl warning "WARNING: space prohibited before
    semicolon" at nilfs_store_magic_and_option().

    Link: http://lkml.kernel.org/r/1462886671-3521-3-git-send-email-konishi.ryusuke@lab.ntt.co.jp
    Signed-off-by: Ryusuke Konishi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ryusuke Konishi
     
  • Clean up checkpatch.pl warnings "WARNING: Missing a blank line after
    declarations" from nilfs2.

    Link: http://lkml.kernel.org/r/1461935747-10380-11-git-send-email-konishi.ryusuke@lab.ntt.co.jp
    Signed-off-by: Ryusuke Konishi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ryusuke Konishi
     
  • Refactor nilfs_clear_inode() and nilfs_i_callback() so that cleanup
    code or resource deallocation related to metadata file will be moved
    out to mdt.c.

    Link: http://lkml.kernel.org/r/1461935747-10380-9-git-send-email-konishi.ryusuke@lab.ntt.co.jp
    Signed-off-by: Ryusuke Konishi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ryusuke Konishi
     
  • E-mail addresses of osrg.net domain are no longer available. This
    removes them from authorship notices and prevents reporters from being
    confused.

    Link: http://lkml.kernel.org/r/1461935747-10380-5-git-send-email-konishi.ryusuke@lab.ntt.co.jp
    Signed-off-by: Ryusuke Konishi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ryusuke Konishi
     
  • This removes the extra paragraph which mentions FSF address in GPL
    notices from source code of nilfs2 and avoids the checkpatch.pl error
    related to it.

    Link: http://lkml.kernel.org/r/1461935747-10380-4-git-send-email-konishi.ryusuke@lab.ntt.co.jp
    Signed-off-by: Ryusuke Konishi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ryusuke Konishi
     
  • Fix the following checkpatch.pl error and warnings:

    ERROR: code indent should use tabs where possible
    #1317: FILE: super.c:1317:
    + ^I^Is_new = true;$

    WARNING: please, no space before tabs
    #1317: FILE: super.c:1317:
    + ^I^Is_new = true;$

    WARNING: please, no spaces at the start of a line
    #1317: FILE: super.c:1317:
    + ^I^Is_new = true;$

    Link: http://lkml.kernel.org/r/1461935747-10380-2-git-send-email-konishi.ryusuke@lab.ntt.co.jp
    Signed-off-by: Ryusuke Konishi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ryusuke Konishi
     

15 Jan, 2016

1 commit

  • Mark those kmem allocations that are known to be easily triggered from
    userspace as __GFP_ACCOUNT/SLAB_ACCOUNT, which makes them accounted to
    memcg. For the list, see below:

    - threadinfo
    - task_struct
    - task_delay_info
    - pid
    - cred
    - mm_struct
    - vm_area_struct and vm_region (nommu)
    - anon_vma and anon_vma_chain
    - signal_struct
    - sighand_struct
    - fs_struct
    - files_struct
    - fdtable and fdtable->full_fds_bits
    - dentry and external_name
    - inode for all filesystems. This is the most tedious part, because
    most filesystems overwrite the alloc_inode method.

    The list is far from complete, so feel free to add more objects.
    Nevertheless, it should be close to "account everything" approach and
    keep most workloads within bounds. Malevolent users will be able to
    breach the limit, but this was possible even with the former "account
    everything" approach (simply because it did not account everything in
    fact).

    [akpm@linux-foundation.org: coding-style fixes]
    Signed-off-by: Vladimir Davydov
    Acked-by: Johannes Weiner
    Acked-by: Michal Hocko
    Cc: Tejun Heo
    Cc: Greg Thelen
    Cc: Christoph Lameter
    Cc: Pekka Enberg
    Cc: David Rientjes
    Cc: Joonsoo Kim
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Vladimir Davydov
     

07 Jan, 2016

1 commit


07 Nov, 2015

2 commits

  • Some false positive warnings are reported for powerpc build.

    The following warnings are reported in
    http://kisskb.ellerman.id.au/kisskb/buildresult/12519703/

    CC fs/nilfs2/super.o
    fs/nilfs2/super.c: In function 'nilfs_resize_fs':
    fs/nilfs2/super.c:376:2: warning: 'blocknr' may be used uninitialized in this function [-Wuninitialized]
    fs/nilfs2/super.c:362:11: note: 'blocknr' was declared here
    CC fs/nilfs2/recovery.o
    fs/nilfs2/recovery.c: In function 'nilfs_salvage_orphan_logs':
    fs/nilfs2/recovery.c:631:21: warning: 'sum' may be used uninitialized in this function [-Wuninitialized]
    fs/nilfs2/recovery.c:585:32: note: 'sum' was declared here
    fs/nilfs2/recovery.c: In function 'nilfs_search_super_root':
    fs/nilfs2/recovery.c:873:11: warning: 'sum' may be used uninitialized in this function [-Wuninitialized]

    Another similar warning is reported in
    http://kisskb.ellerman.id.au/kisskb/buildresult/12520079/

    CC fs/nilfs2/btree.o
    fs/nilfs2/btree.c: In function 'nilfs_btree_convert_and_insert':
    include/asm-generic/bitops/non-atomic.h:105:20: warning: 'bh' may be used uninitialized in this function [-Wuninitialized]
    fs/nilfs2/btree.c:1859:22: note: 'bh' was declared here

    This cleans out these warnings by forcing the variables to be initialized.

    Signed-off-by: Ryusuke Konishi
    Reported-by: Geert Uytterhoeven
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ryusuke Konishi
     
  • Remove unneeded NULL test.

    The semantic patch that makes this change is as follows:
    (http://coccinelle.lip6.fr/)

    //
    @@ expression x; @@
    -if (x != NULL)
    \(kmem_cache_destroy\|mempool_destroy\|dma_pool_destroy\)(x);
    //

    Signed-off-by: Julia Lawall
    Signed-off-by: Ryusuke Konishi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Julia Lawall
     

27 Apr, 2015

1 commit

  • Pull fourth vfs update from Al Viro:
    "d_inode() annotations from David Howells (sat in for-next since before
    the beginning of merge window) + four assorted fixes"

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
    RCU pathwalk breakage when running into a symlink overmounting something
    fix I_DIO_WAKEUP definition
    direct-io: only inc/dec inode->i_dio_count for file systems
    fs/9p: fix readdir()
    VFS: assorted d_backing_inode() annotations
    VFS: fs/inode.c helpers: d_inode() annotations
    VFS: fs/cachefiles: d_backing_inode() annotations
    VFS: fs library helpers: d_inode() annotations
    VFS: assorted weird filesystems: d_inode() annotations
    VFS: normal filesystems (and lustre): d_inode() annotations
    VFS: security/: d_inode() annotations
    VFS: security/: d_backing_inode() annotations
    VFS: net/: d_inode() annotations
    VFS: net/unix: d_backing_inode() annotations
    VFS: kernel/: d_inode() annotations
    VFS: audit: d_backing_inode() annotations
    VFS: Fix up some ->d_inode accesses in the chelsio driver
    VFS: Cachefiles should perform fs modifications on the top layer only
    VFS: AF_UNIX sockets should call mknod on the top layer only

    Linus Torvalds
     

17 Apr, 2015

1 commit

  • Fix the following build warning:

    fs/nilfs2/super.c: In function 'nilfs_checkpoint_is_mounted':
    fs/nilfs2/super.c:1023:10: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
    if (cno < 0 || cno > nilfs->ns_cno)
    ^

    This warning indicates that the comparision "cno < 0" is useless because
    variable "cno" has an unsigned integer type "__u64".

    Signed-off-by: Ryusuke Konishi
    Reported-by: David Binderman
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ryusuke Konishi
     

16 Apr, 2015

1 commit


21 Jan, 2015

2 commits


14 Oct, 2014

1 commit

  • Under normal circumstances nilfs_sync_fs() writes out the super block,
    which causes a flush of the underlying block device. But this depends
    on the THE_NILFS_SB_DIRTY flag, which is only set if the pointer to the
    last segment crosses a segment boundary. So if only a small amount of
    data is written before the call to nilfs_sync_fs(), no flush of the
    block device occurs.

    In the above case an additional call to blkdev_issue_flush() is needed.
    To prevent unnecessary overhead, the new flag nilfs->ns_flushed_device
    is introduced, which is cleared whenever new logs are written and set
    whenever the block device is flushed. For convenience the function
    nilfs_flush_device() is added, which contains the above logic.

    Signed-off-by: Andreas Rohner
    Signed-off-by: Ryusuke Konishi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andreas Rohner
     

12 Aug, 2014

1 commit

  • Pull vfs updates from Al Viro:
    "Stuff in here:

    - acct.c fixes and general rework of mnt_pin mechanism. That allows
    to go for delayed-mntput stuff, which will permit mntput() on deep
    stack without worrying about stack overflows - fs shutdown will
    happen on shallow stack. IOW, we can do Eric's umount-on-rmdir
    series without introducing tons of stack overflows on new mntput()
    call chains it introduces.
    - Bruce's d_splice_alias() patches
    - more Miklos' rename() stuff.
    - a couple of regression fixes (stable fodder, in the end of branch)
    and a fix for API idiocy in iov_iter.c.

    There definitely will be another pile, maybe even two. I'd like to
    get Eric's series in this time, but even if we miss it, it'll go right
    in the beginning of for-next in the next cycle - the tricky part of
    prereqs is in this pile"

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (40 commits)
    fix copy_tree() regression
    __generic_file_write_iter(): fix handling of sync error after DIO
    switch iov_iter_get_pages() to passing maximal number of pages
    fs: mark __d_obtain_alias static
    dcache: d_splice_alias should detect loops
    exportfs: update Exporting documentation
    dcache: d_find_alias needn't recheck IS_ROOT && DCACHE_DISCONNECTED
    dcache: remove unused d_find_alias parameter
    dcache: d_obtain_alias callers don't all want DISCONNECTED
    dcache: d_splice_alias should ignore DCACHE_DISCONNECTED
    dcache: d_splice_alias mustn't create directory aliases
    dcache: close d_move race in d_splice_alias
    dcache: move d_splice_alias
    namei: trivial fix to vfs_rename_dir comment
    VFS: allow ->d_manage() to declare -EISDIR in rcu_walk mode.
    cifs: support RENAME_NOREPLACE
    hostfs: support rename flags
    shmem: support RENAME_EXCHANGE
    shmem: support RENAME_NOREPLACE
    btrfs: add RENAME_NOREPLACE
    ...

    Linus Torvalds
     

09 Aug, 2014

1 commit

  • This patch integrates creation of sysfs groups and
    attributes into NILFS file system driver.

    It was found the issue with nilfs_sysfs_{create/delete}_snapshot_group
    functions by Michael L Semon in the first
    version of the patch:

    BUG: sleeping function called from invalid context at kernel/locking/mutex.c:579
    in_atomic(): 1, irqs_disabled(): 0, pid: 32676, name: umount.nilfs2
    2 locks held by umount.nilfs2/32676:
    #0: (&type->s_umount_key#21){++++..}, at: [] deactivate_super+0x37/0x58
    #1: (&(&nilfs->ns_cptree_lock)->rlock){+.+...}, at: [] nilfs_put_root+0x23/0x5a
    Preemption disabled at:[] nilfs_put_root+0x23/0x5a

    CPU: 0 PID: 32676 Comm: umount.nilfs2 Not tainted 3.14.0+ #2
    Hardware name: Dell Computer Corporation Dimension 2350/07W080, BIOS A01 12/17/2002
    Call Trace:
    dump_stack+0x4b/0x75
    __might_sleep+0x111/0x16f
    mutex_lock_nested+0x1e/0x3ad
    kernfs_remove+0x12/0x26
    sysfs_remove_dir+0x3d/0x62
    kobject_del+0x13/0x38
    nilfs_sysfs_delete_snapshot_group+0xb/0xd
    nilfs_put_root+0x2a/0x5a
    nilfs_detach_log_writer+0x1ab/0x2c1
    nilfs_put_super+0x13/0x68
    generic_shutdown_super+0x60/0xd1
    kill_block_super+0x1d/0x60
    deactivate_locked_super+0x22/0x3f
    deactivate_super+0x3e/0x58
    mntput_no_expire+0xe2/0x141
    SyS_oldumount+0x70/0xa5
    syscall_call+0x7/0xb

    The reason of the issue was placement of
    nilfs_sysfs_{create/delete}_snapshot_group() call under
    nilfs->ns_cptree_lock protection. But this protection is unnecessary and
    wrong solution. The second version of the patch fixes this issue.

    [fengguang.wu@intel.com: nilfs_sysfs_create_mounted_snapshots_group can be static]
    Reported-by: Michael L. Semon
    Signed-off-by: Vyacheslav Dubeyko
    Cc: Vyacheslav Dubeyko
    Cc: Ryusuke Konishi
    Tested-by: Michael L. Semon
    Signed-off-by: Fengguang Wu
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Vyacheslav Dubeyko
     

08 Aug, 2014

1 commit

  • There are a few d_obtain_alias callers that are using it to get the
    root of a filesystem which may already have an alias somewhere else.

    This is not the same as the filehandle-lookup case, and none of them
    actually need DCACHE_DISCONNECTED set.

    It isn't really a serious problem, but it would really be clearer if we
    reserved DCACHE_DISCONNECTED for those cases where it's actually needed.

    In the btrfs case this was causing a spurious printk from
    nfsd/nfsfh.c:fh_verify when it found an unexpected DCACHE_DISCONNECTED
    dentry. Josef worked around this by unsetting DCACHE_DISCONNECTED
    manually in 3a0dfa6a12e "Btrfs: unset DCACHE_DISCONNECTED when mounting
    default subvol", and this replaces that workaround.

    Cc: Josef Bacik
    Signed-off-by: J. Bruce Fields
    Signed-off-by: Al Viro

    J. Bruce Fields
     

13 Mar, 2014

1 commit

  • Previously, the no-op "mount -o mount /dev/xxx" operation when the
    file system is already mounted read-write causes an implied,
    unconditional syncfs(). This seems pretty stupid, and it's certainly
    documented or guaraunteed to do this, nor is it particularly useful,
    except in the case where the file system was mounted rw and is getting
    remounted read-only.

    However, it's possible that there might be some file systems that are
    actually depending on this behavior. In most file systems, it's
    probably fine to only call sync_filesystem() when transitioning from
    read-write to read-only, and there are some file systems where this is
    not needed at all (for example, for a pseudo-filesystem or something
    like romfs).

    Signed-off-by: "Theodore Ts'o"
    Cc: linux-fsdevel@vger.kernel.org
    Cc: Christoph Hellwig
    Cc: Artem Bityutskiy
    Cc: Adrian Hunter
    Cc: Evgeniy Dushistov
    Cc: Jan Kara
    Cc: OGAWA Hirofumi
    Cc: Anders Larsen
    Cc: Phillip Lougher
    Cc: Kees Cook
    Cc: Mikulas Patocka
    Cc: Petr Vandrovec
    Cc: xfs@oss.sgi.com
    Cc: linux-btrfs@vger.kernel.org
    Cc: linux-cifs@vger.kernel.org
    Cc: samba-technical@lists.samba.org
    Cc: codalist@coda.cs.cmu.edu
    Cc: linux-ext4@vger.kernel.org
    Cc: linux-f2fs-devel@lists.sourceforge.net
    Cc: fuse-devel@lists.sourceforge.net
    Cc: cluster-devel@redhat.com
    Cc: linux-mtd@lists.infradead.org
    Cc: jfs-discussion@lists.sourceforge.net
    Cc: linux-nfs@vger.kernel.org
    Cc: linux-nilfs@vger.kernel.org
    Cc: linux-ntfs-dev@lists.sourceforge.net
    Cc: ocfs2-devel@oss.oracle.com
    Cc: reiserfs-devel@vger.kernel.org

    Theodore Ts'o
     

04 Sep, 2013

1 commit


05 Jul, 2013

1 commit


04 Jul, 2013

2 commits

  • The cp_inodes_count and cp_blocks_count are represented as __le64 type in
    on-disk structure (struct nilfs_checkpoint). But analogous fields in
    in-core structure (struct nilfs_root) are represented by atomic_t type.

    This patch replaces atomic_t on atomic64_t type in representation of
    inodes_count and blocks_count fields in struct nilfs_root.

    Signed-off-by: Vyacheslav Dubeyko
    Acked-by: Ryusuke Konishi
    Acked-by: Joern Engel
    Cc: Clemens Eisserer
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Vyacheslav Dubeyko
     
  • Currently, NILFS2 returns 0 as free inodes count (f_ffree) and current
    used inodes count as total file nodes in file system (f_files):

    df -i
    Filesystem Inodes IUsed IFree IUse% Mounted on
    /dev/loop0 2 2 0 100% /mnt/nilfs2

    This patch implements real calculation of free inodes count. First of
    all, it is calculated total file nodes in file system as
    (desc_blocks_count * groups_per_desc_block * entries_per_group). Then, it
    is calculated free inodes count as difference the total file nodes and
    used inodes count. As a result, we have such output for NILFS2:

    df -i
    Filesystem Inodes IUsed IFree IUse% Mounted on
    /dev/loop0 4194304 2114701 2079603 51% /mnt/nilfs2

    Reported-by: Clemens Eisserer
    Signed-off-by: Vyacheslav Dubeyko
    Signed-off-by: Ryusuke Konishi
    Tested-by: Vyacheslav Dubeyko
    Cc: Joern Engel
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Vyacheslav Dubeyko
     

04 Mar, 2013

1 commit

  • Modify the request_module to prefix the file system type with "fs-"
    and add aliases to all of the filesystems that can be built as modules
    to match.

    A common practice is to build all of the kernel code and leave code
    that is not commonly needed as modules, with the result that many
    users are exposed to any bug anywhere in the kernel.

    Looking for filesystems with a fs- prefix limits the pool of possible
    modules that can be loaded by mount to just filesystems trivially
    making things safer with no real cost.

    Using aliases means user space can control the policy of which
    filesystem modules are auto-loaded by editing /etc/modprobe.d/*.conf
    with blacklist and alias directives. Allowing simple, safe,
    well understood work-arounds to known problematic software.

    This also addresses a rare but unfortunate problem where the filesystem
    name is not the same as it's module name and module auto-loading
    would not work. While writing this patch I saw a handful of such
    cases. The most significant being autofs that lives in the module
    autofs4.

    This is relevant to user namespaces because we can reach the request
    module in get_fs_type() without having any special permissions, and
    people get uncomfortable when a user specified string (in this case
    the filesystem type) goes all of the way to request_module.

    After having looked at this issue I don't think there is any
    particular reason to perform any filtering or permission checks beyond
    making it clear in the module request that we want a filesystem
    module. The common pattern in the kernel is to call request_module()
    without regards to the users permissions. In general all a filesystem
    module does once loaded is call register_filesystem() and go to sleep.
    Which means there is not much attack surface exposed by loading a
    filesytem module unless the filesystem is mounted. In a user
    namespace filesystems are not mounted unless .fs_flags = FS_USERNS_MOUNT,
    which most filesystems do not set today.

    Acked-by: Serge Hallyn
    Acked-by: Kees Cook
    Reported-by: Kees Cook
    Signed-off-by: "Eric W. Biederman"

    Eric W. Biederman
     

03 Oct, 2012

1 commit

  • There's no reason to call rcu_barrier() on every
    deactivate_locked_super(). We only need to make sure that all delayed rcu
    free inodes are flushed before we destroy related cache.

    Removing rcu_barrier() from deactivate_locked_super() affects some fast
    paths. E.g. on my machine exit_group() of a last process in IPC
    namespace takes 0.07538s. rcu_barrier() takes 0.05188s of that time.

    Signed-off-by: Kirill A. Shutemov
    Cc: Al Viro
    Signed-off-by: Andrew Morton
    Signed-off-by: Al Viro

    Kirill A. Shutemov
     

04 Aug, 2012

1 commit


31 Jul, 2012

1 commit

  • An fs-thaw ioctl causes deadlock with a chcp or mkcp -s command:

    chcp D ffff88013870f3d0 0 1325 1324 0x00000004
    ...
    Call Trace:
    nilfs_transaction_begin+0x11c/0x1a0 [nilfs2]
    wake_up_bit+0x20/0x20
    copy_from_user+0x18/0x30 [nilfs2]
    nilfs_ioctl_change_cpmode+0x7d/0xcf [nilfs2]
    nilfs_ioctl+0x252/0x61a [nilfs2]
    do_page_fault+0x311/0x34c
    get_unmapped_area+0x132/0x14e
    do_vfs_ioctl+0x44b/0x490
    __set_task_blocked+0x5a/0x61
    vm_mmap_pgoff+0x76/0x87
    __set_current_blocked+0x30/0x4a
    sys_ioctl+0x4b/0x6f
    system_call_fastpath+0x16/0x1b
    thaw D ffff88013870d890 0 1352 1351 0x00000004
    ...
    Call Trace:
    rwsem_down_failed_common+0xdb/0x10f
    call_rwsem_down_write_failed+0x13/0x20
    down_write+0x25/0x27
    thaw_super+0x13/0x9e
    do_vfs_ioctl+0x1f5/0x490
    vm_mmap_pgoff+0x76/0x87
    sys_ioctl+0x4b/0x6f
    filp_close+0x64/0x6c
    system_call_fastpath+0x16/0x1b

    where the thaw ioctl deadlocked at thaw_super() when called while chcp was
    waiting at nilfs_transaction_begin() called from
    nilfs_ioctl_change_cpmode(). This deadlock is 100% reproducible.

    This is because nilfs_ioctl_change_cpmode() first locks sb->s_umount in
    read mode and then waits for unfreezing in nilfs_transaction_begin(),
    whereas thaw_super() locks sb->s_umount in write mode. The locking of
    sb->s_umount here was intended to make snapshot mounts and the downgrade
    of snapshots to checkpoints exclusive.

    This fixes the deadlock issue by replacing the sb->s_umount usage in
    nilfs_ioctl_change_cpmode() with a dedicated mutex which protects snapshot
    mounts.

    Signed-off-by: Ryusuke Konishi
    Cc: Fernando Luis Vazquez Cao
    Tested-by: Ryusuke Konishi
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ryusuke Konishi