26 Jun, 2015

1 commit

  • Pull UBI/UBIFS updates from Richard Weinberger:
    "Minor fixes for UBI and UBIFS"

    * tag 'upstream-4.2-rc1' of git://git.infradead.org/linux-ubifs:
    UBI: Remove unnecessary `\'
    UBI: Use static class and attribute groups
    UBI: add a helper function for updatting on-flash layout volumes
    UBI: Fastmap: Do not add vol if it already exists
    UBI: Init vol->reserved_pebs by assignment
    UBI: Fastmap: Rename variables to make them meaningful
    UBI: Fastmap: Remove unnecessary `\'
    UBI: Fastmap: Use max() to get the larger value
    ubifs: fix to check error code of register_shrinker
    UBI: block: Dynamically allocate minor numbers

    Linus Torvalds
     

02 Jun, 2015

1 commit

  • register_shrinker() in ubifs_init() can fail due to fail to call kzalloc.
    This patch fixes to check the return value of register_shrinker, otherwise
    our shrinker may be unregistered after ubifs initialized successfully.

    Signed-off-by: Chao Yu
    Signed-off-by: Artem Bityutskiy
    Signed-off-by: Richard Weinberger

    Chao Yu
     

11 May, 2015

1 commit


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
     

16 Apr, 2015

2 commits

  • Pull UBI/UBIFS updates from Richard Weinberger:
    "This pull request includes the following UBI/UBIFS changes:

    - powercut emulation for UBI
    - a huge update to UBI Fastmap
    - cleanups and bugfixes all over UBI and UBIFS"

    * tag 'upstream-4.1-rc1' of git://git.infradead.org/linux-ubifs: (50 commits)
    UBI: power cut emulation for testing
    UBIFS: fix output format of INUM_WATERMARK
    UBI: Fastmap: Fall back to scanning mode after ECC error
    UBI: Fastmap: Remove is_fm_block()
    UBI: Fastmap: Add blank line after declarations
    UBI: Fastmap: Remove else after return.
    UBI: Fastmap: Introduce may_reserve_for_fm()
    UBI: Fastmap: Introduce ubi_fastmap_init()
    UBI: Fastmap: Wire up WL accessor functions
    UBI: Add accessor functions for WL data structures
    UBI: Move fastmap specific functions out of wl.c
    UBI: Fastmap: Add new module parameter fm_debug
    UBI: Fastmap: Make self_check_eba() depend on fastmap self checking
    UBI: Fastmap: Add self check to detect absent PEBs
    UBI: Fix stale pointers in ubi->lookuptbl
    UBI: Fastmap: Enhance fastmap checking
    UBI: Add initial support for fastmap self checks
    UBI: Fastmap: Rework fastmap error paths
    UBI: Fastmap: Prepare for variable sized fastmaps
    UBI: Fastmap: Locking updates
    ...

    Linus Torvalds
     
  • that's the bulk of filesystem drivers dealing with inodes of their own

    Signed-off-by: David Howells
    Signed-off-by: Al Viro

    David Howells
     

13 Apr, 2015

1 commit

  • The INUM_WATERMARK is a unsigned 32bit value, `%d' prints it as negatave:
    [ 103.682255] UBIFS warning (ubi0:0 pid 691): ubifs_new_inode: running out of inode numbers (current 122763, max -256)

    Fix it as:
    [ 154.422940] UBIFS warning (ubi0:0 pid 688): ubifs_new_inode: running out of inode numbers (current 122765, max 4294967040)

    Signed-off-by: Sheng Yong
    Signed-off-by: Artem Bityutskiy

    Sheng Yong
     

12 Apr, 2015

1 commit

  • All places outside of core VFS that checked ->read and ->write for being NULL or
    called the methods directly are gone now, so NULL {read,write} with non-NULL
    {read,write}_iter will do the right thing in all cases.

    Signed-off-by: Al Viro

    Al Viro
     

26 Mar, 2015

1 commit


25 Mar, 2015

5 commits

  • In the case where we have more than one volumes on different UBI
    devices, it may be not that easy to tell which volume prints the
    messages. Add ubi number and volume id in ubifs_msg/warn/error
    to help debug. These two values are passed by struct ubifs_info.

    For those where ubifs_info is not initialized yet, ubifs_* is
    replaced by pr_*. For those where ubifs_info is not avaliable,
    ubifs_info is passed to the calling function as a const parameter.

    The output looks like,

    [ 95.444879] UBIFS (ubi0:1): background thread "ubifs_bgt0_1" started, PID 696
    [ 95.484688] UBIFS (ubi0:1): UBIFS: mounted UBI device 0, volume 1, name "test1"
    [ 95.484694] UBIFS (ubi0:1): LEB size: 126976 bytes (124 KiB), min./max. I/O unit sizes: 2048 bytes/2048 bytes
    [ 95.484699] UBIFS (ubi0:1): FS size: 30220288 bytes (28 MiB, 238 LEBs), journal size 1523712 bytes (1 MiB, 12 LEBs)
    [ 95.484703] UBIFS (ubi0:1): reserved for root: 1427378 bytes (1393 KiB)
    [ 95.484709] UBIFS (ubi0:1): media format: w4/r0 (latest is w4/r0), UUID 40DFFC0E-70BE-4193-8905-F7D6DFE60B17, small LPT model
    [ 95.489875] UBIFS (ubi1:0): background thread "ubifs_bgt1_0" started, PID 699
    [ 95.529713] UBIFS (ubi1:0): UBIFS: mounted UBI device 1, volume 0, name "test2"
    [ 95.529718] UBIFS (ubi1:0): LEB size: 126976 bytes (124 KiB), min./max. I/O unit sizes: 2048 bytes/2048 bytes
    [ 95.529724] UBIFS (ubi1:0): FS size: 19808256 bytes (18 MiB, 156 LEBs), journal size 1015809 bytes (0 MiB, 8 LEBs)
    [ 95.529727] UBIFS (ubi1:0): reserved for root: 935592 bytes (913 KiB)
    [ 95.529733] UBIFS (ubi1:0): media format: w4/r0 (latest is w4/r0), UUID EEB7779D-F419-4CA9-811B-831CAC7233D4, small LPT model

    [ 954.264767] UBIFS error (ubi1:0 pid 756): ubifs_read_node: bad node type (255 but expected 6)
    [ 954.367030] UBIFS error (ubi1:0 pid 756): ubifs_read_node: bad node at LEB 0:0, LEB mapping status 1

    Signed-off-by: Sheng Yong
    Signed-off-by: Artem Bityutskiy

    Sheng Yong
     
  • Directly return recover_head() and ubifs_leb_unmap()
    instead of storing value in err and testing it.

    Signed-off-by: Fabian Frederick
    Acked-by: Geert Uytterhoeven
    Signed-off-by: Artem Bityutskiy

    Fabian Frederick
     
  • Change 'comress' to 'compress'
    Change 'inteval' to 'interval'
    Change 'disabe' to 'disable'
    Change 'nenver' to 'never'

    Signed-off-by: Yannick Guerrini
    Signed-off-by: Artem Bityutskiy

    Yannick Guerrini
     
  • The commits 781c571 ("UBIFS: intialize LPT earlier") and 0980119 ("UBIFS:
    fix-up free space earlier") move some initialization before marking the
    master node dirty. But the modification changes the conditions of writing
    master.

    If unclean umount happens, ubifs may fail when mounting. But trying to
    mount it will write new master nodes on the flash. This is useless but
    increasing sqnum. So check need_recovery before writing master node, and
    don't create new master node if filesystem needs recovery.

    The behavour of the bug shows at:
    http://lists.infradead.org/pipermail/linux-mtd/2015-February/057712.html

    Signed-off-by: Sheng Yong
    Reviewed-by: Ben Gardiner
    Signed-off-by: Artem Bityutskiy

    Sheng Yong
     
  • When ubifs_init_security() fails, 'ui_mutex' is incorrectly
    unlocked and incorrectly restores 'i_size'. Fix this.

    Signed-off-by: Taesoo Kim
    Fixes: d7f0b70d30ff ("UBIFS: Add security.* XATTR support for the UBIFS")
    Reviewed-by: Ben Shelton
    Signed-off-by: Uwe Kleine-König
    Signed-off-by: Artem Bityutskiy

    Taesoo Kim
     

16 Feb, 2015

1 commit

  • Pull UBI and UBIFS updates from Richard Weinberger:
    - cleanups and bug fixes all over UBI and UBIFS
    - block-mq support for UBI Block
    - UBI volumes can now be renamed while they are in use
    - security.* XATTR support for UBIFS
    - a maintainer update

    * 'for-linus-v3.20' of git://git.infradead.org/linux-ubifs:
    UBI: block: Fix checking for NULL instead of IS_ERR()
    UBI: block: Continue creating ubiblocks after an initialization error
    UBIFS: return -EINVAL if log head is empty
    UBI: Block: Explain usage of blk_rq_map_sg()
    UBI: fix soft lockup in ubi_check_volume()
    UBI: Fastmap: Care about the protection queue
    UBIFS: add a couple of extra asserts
    UBI: do propagate positive error codes up
    UBI: clean-up printing helpers
    UBI: extend UBI layer debug/messaging capabilities - cosmetics
    UBIFS: add ubifs_err() to print error reason
    UBIFS: Add security.* XATTR support for the UBIFS
    UBIFS: Add xattr support for symlinks
    UBI: Block: Add blk-mq support
    UBI: Add initial support for scatter gather
    UBI: rename_volumes: Use UBI_METAONLY
    UBI: Implement UBI_METAONLY
    Add myself as UBI co-maintainer

    Linus Torvalds
     

13 Feb, 2015

1 commit

  • Pull backing device changes from Jens Axboe:
    "This contains a cleanup of how the backing device is handled, in
    preparation for a rework of the life time rules. In this part, the
    most important change is to split the unrelated nommu mmap flags from
    it, but also removing a backing_dev_info pointer from the
    address_space (and inode), and a cleanup of other various minor bits.

    Christoph did all the work here, I just fixed an oops with pages that
    have a swap backing. Arnd fixed a missing export, and Oleg killed the
    lustre backing_dev_info from staging. Last patch was from Al,
    unexporting parts that are now no longer needed outside"

    * 'for-3.20/bdi' of git://git.kernel.dk/linux-block:
    Make super_blocks and sb_lock static
    mtd: export new mtd_mmap_capabilities
    fs: make inode_to_bdi() handle NULL inode
    staging/lustre/llite: get rid of backing_dev_info
    fs: remove default_backing_dev_info
    fs: don't reassign dirty inodes to default_backing_dev_info
    nfs: don't call bdi_unregister
    ceph: remove call to bdi_unregister
    fs: remove mapping->backing_dev_info
    fs: export inode_to_bdi and use it in favor of mapping->backing_dev_info
    nilfs2: set up s_bdi like the generic mount_bdev code
    block_dev: get bdev inode bdi directly from the block device
    block_dev: only write bdev inode on close
    fs: introduce f_op->mmap_capabilities for nommu mmap support
    fs: kill BDI_CAP_SWAP_BACKED
    fs: deduplicate noop_backing_dev_info

    Linus Torvalds
     

11 Feb, 2015

1 commit


10 Feb, 2015

1 commit

  • CS node is recognized as a sign in UBIFS log replay mechanism.
    Log relaying during mount should find the CS node in log head
    at beginning and then replay the following uncommitted buds.

    Here is a bug in log replay path: If the log head, which is
    indicated by @log_lnum in mst_node, is empty, current UBIFS
    replay nothing and directly mount the partition without any
    warning. This action will put filesystem in an abnormal state,
    e.g. space management in LPT area is incorrect to the real
    space usage in main area.

    We reproduced this bug by fault injection: turn log head leb
    into all 0xFF. UBIFS driver mount the polluted partition
    normally. But errors occur while running fs_stress on this
    mount:

    [89068.055183] UBI error: ubi_io_read: error -74 (ECC error) while reading 59 bytes from PEB 711:33088, read 59 bytes
    [89068.179877] UBIFS error (pid 10517): ubifs_check_node: bad magic 0x101031, expected 0x6101831
    [89068.179882] UBIFS error (pid 10517): ubifs_check_node: bad node at LEB 591:28992
    [89068.179891] Not a node, first 24 bytes:
    [89068.179892] 00000000: 31 10 10 00 37 84 64 04 10 04 00 00 00 00 00 00 20 00 00 00 02 01 00 00 1...7.d......... .......
    [89068.180282] UBIFS error (pid 10517): ubifs_read_node: expected node type 2

    This patch fix the problem by checking *lnum* to guarantee
    the empty leb is not log head leb and return an error if the
    log head leb is incorrectly empty. After this, we could catch
    *log head empty* error in place.

    Signed-off-by: hujianyang
    Signed-off-by: Artem Bityutskiy

    hujianyang
     

28 Jan, 2015

4 commits

  • ... to catch possible memory corruptions.

    Reported-by: Dan Carpenter
    Signed-off-by: Artem Bityutskiy

    Artem Bityutskiy
     
  • This patch adds ubifs_err() output to some error paths to tell the user
    what's going on.

    Artem: improve the messages, rename too long variable

    Signed-off-by: Subodh Nijsure
    Signed-off-by: Marc Kleine-Budde
    Signed-off-by: Ben Shelton
    Acked-by: Brad Mouring
    Acked-by: Terry Wilcox
    Acked-by: Gratian Crisan
    Signed-off-by: Artem Bityutskiy

    Subodh Nijsure
     
  • Artem: rename static functions so that they do not use the "ubifs_" prefix - we
    only use this prefix for non-static functions.
    Artem: remove few junk white-space changes in file.c

    Signed-off-by: Subodh Nijsure
    Signed-off-by: Marc Kleine-Budde
    Signed-off-by: Ben Shelton
    Acked-by: Brad Mouring
    Acked-by: Terry Wilcox
    Acked-by: Gratian Crisan
    Signed-off-by: Artem Bityutskiy

    Subodh Nijsure
     
  • Artem: rename the __ubifs_setxattr() functions to just 'setxattr()'.

    Signed-off-by: Subodh Nijsure
    Signed-off-by: Marc Kleine-Budde
    Signed-off-by: Ben Shelton
    Acked-by: Terry Wilcox
    Acked-by: Gratian Crisan
    Signed-off-by: Artem Bityutskiy

    Subodh Nijsure
     

21 Jan, 2015

2 commits

  • Now that we never use the backing_dev_info pointer in struct address_space
    we can simply remove it and save 4 to 8 bytes in every inode.

    Signed-off-by: Christoph Hellwig
    Acked-by: Ryusuke Konishi
    Reviewed-by: Tejun Heo
    Reviewed-by: Jan Kara
    Signed-off-by: Jens Axboe

    Christoph Hellwig
     
  • Since "BDI: Provide backing device capability information [try #3]" the
    backing_dev_info structure also provides flags for the kind of mmap
    operation available in a nommu environment, which is entirely unrelated
    to it's original purpose.

    Introduce a new nommu-only file operation to provide this information to
    the nommu mmap code instead. Splitting this from the backing_dev_info
    structure allows to remove lots of backing_dev_info instance that aren't
    otherwise needed, and entirely gets rid of the concept of providing a
    backing_dev_info for a character device. It also removes the need for
    the mtd_inodefs filesystem.

    Signed-off-by: Christoph Hellwig
    Reviewed-by: Tejun Heo
    Acked-by: Brian Norris
    Signed-off-by: Jens Axboe

    Christoph Hellwig
     

07 Nov, 2014

2 commits

  • The journal update function did not work for extended attributes properly,
    because extended attribute inodes carry the xattr data, and the size of this
    data was not taken into account.

    Artem: improved commit message, amended the patch a bit.

    Signed-off-by: Subodh Nijsure
    Signed-off-by: Marc Kleine-Budde
    Signed-off-by: Ben Shelton
    Acked-by: Brad Mouring
    Acked-by: Gratian Crisan
    Signed-off-by: Artem Bityutskiy

    Subodh Nijsure
     
  • We forgot to free the budget in 'write_begin_slow()' when 'do_readpage()'
    fails. This patch fixes the issue.

    Suggested-by: Kirill A. Shutemov
    Signed-off-by: Artem Bityutskiy

    Artem Bityutskiy
     

30 Sep, 2014

1 commit


26 Sep, 2014

1 commit


19 Sep, 2014

1 commit

  • This assertion was only correct before UBIFS had xattr support.
    Now with xattr support also a directory node can carry data
    and can act as host node.

    Suggested-by: Artem Bityutskiy
    Signed-off-by: Richard Weinberger
    Signed-off-by: Artem Bityutskiy

    Richard Weinberger
     

08 Sep, 2014

2 commits

  • Hu (hujianyang ) discovered an issue in the
    'empty_log_bytes()' function, which calculates how many bytes are left in the
    log:

    "
    If 'c->lhead_lnum + 1 == c->ltail_lnum' and 'c->lhead_offs == c->leb_size', 'h'
    would equalent to 't' and 'empty_log_bytes()' would return 'c->log_bytes'
    instead of 0.
    "

    At this point it is not clear what would be the consequences of this, and
    whether this may lead to any problems, but this patch addresses the issue just
    in case.

    Cc: stable@vger.kernel.org
    Tested-by: hujianyang
    Reported-by: hujianyang
    Signed-off-by: Artem Bityutskiy

    Artem Bityutskiy
     
  • Hu (hujianyang@huawei.com) discovered a race condition which may lead to a
    situation when UBIFS is unable to mount the file-system after an unclean
    reboot. The problem is theoretical, though.

    In UBIFS, we have the log, which basically a set of LEBs in a certain area. The
    log has the tail and the head.

    Every time user writes data to the file-system, the UBIFS journal grows, and
    the log grows as well, because we append new reference nodes to the head of the
    log. So the head moves forward all the time, while the log tail stays at the
    same position.

    At any time, the UBIFS master node points to the tail of the log. When we mount
    the file-system, we scan the log, and we always start from its tail, because
    this is where the master node points to. The only occasion when the tail of the
    log changes is the commit operation.

    The commit operation has 2 phases - "commit start" and "commit end". The former
    is relatively short, and does not involve much I/O. During this phase we mostly
    just build various in-memory lists of the things which have to be written to
    the flash media during "commit end" phase.

    During the commit start phase, what we do is we "clean" the log. Indeed, the
    commit operation will index all the data in the journal, so the entire journal
    "disappears", and therefore the data in the log become unneeded. So we just
    move the head of the log to the next LEB, and write the CS node there. This LEB
    will be the tail of the new log when the commit operation finishes.

    When the "commit start" phase finishes, users may write more data to the
    file-system, in parallel with the ongoing "commit end" operation. At this point
    the log tail was not changed yet, it is the same as it had been before we
    started the commit. The log head keeps moving forward, though.

    The commit operation now needs to write the new master node, and the new master
    node should point to the new log tail. After this the LEBs between the old log
    tail and the new log tail can be unmapped and re-used again.

    And here is the possible problem. We do 2 operations: (a) We first update the
    log tail position in memory (see 'ubifs_log_end_commit()'). (b) And then we
    write the master node (see the big lock of code in 'do_commit()').

    But nothing prevents the log head from moving forward between (a) and (b), and
    the log head may "wrap" now to the old log tail. And when the "wrap" happens,
    the contends of the log tail gets erased. Now a power cut happens and we are in
    trouble. We end up with the old master node pointing to the old tail, which was
    erased. And replay fails because it expects the master node to point to the
    correct log tail at all times.

    This patch merges the abovementioned (a) and (b) operations by moving the master
    node change code to the 'ubifs_log_end_commit()' function, so that it runs with
    the log mutex locked, which will prevent the log from being changed benween
    operations (a) and (b).

    Cc: stable@vger.kernel.org # 07e19df UBIFS: remove mst_mutex
    Cc: stable@vger.kernel.org
    Reported-by: hujianyang
    Tested-by: hujianyang
    Signed-off-by: Artem Bityutskiy

    Artem Bityutskiy
     

31 Jul, 2014

1 commit

  • We use a circle area to record the log nodes in ubifs. This log area
    should not be overlapped. But after researching the code, I found
    some conditions may lead log head wraps log ltail. Although we've
    fixed the problems discovered, there may be some other issues still
    left.

    This patch adds assertions where lhead changes to next leb to make
    sure ltail is not wrapped.

    Signed-off-by: hujianyang
    Signed-off-by: Artem Bityutskiy

    hujianyang
     

29 Jul, 2014

1 commit


19 Jul, 2014

7 commits