21 Aug, 2020

1 commit

  • commit 38d51b2dd171ad973afc1f5faab825ed05a2d5e9 upstream.

    Dan Carpenter reported the following static checker warning.

    fs/ocfs2/super.c:1269 ocfs2_parse_options() warn: '(-1)' 65535 can't fit into 32767 'mopt->slot'
    fs/ocfs2/suballoc.c:859 ocfs2_init_inode_steal_slot() warn: '(-1)' 65535 can't fit into 32767 'osb->s_inode_steal_slot'
    fs/ocfs2/suballoc.c:867 ocfs2_init_meta_steal_slot() warn: '(-1)' 65535 can't fit into 32767 'osb->s_meta_steal_slot'

    That's because OCFS2_INVALID_SLOT is (u16)-1. Slot number in ocfs2 can be
    never negative, so change s16 to u16.

    Fixes: 9277f8334ffc ("ocfs2: fix value of OCFS2_INVALID_SLOT")
    Reported-by: Dan Carpenter
    Signed-off-by: Junxiao Bi
    Signed-off-by: Andrew Morton
    Reviewed-by: Joseph Qi
    Reviewed-by: Gang He
    Cc: Mark Fasheh
    Cc: Joel Becker
    Cc: Junxiao Bi
    Cc: Changwei Ge
    Cc: Jun Piao
    Cc:
    Link: http://lkml.kernel.org/r/20200627001259.19757-1-junxiao.bi@oracle.com
    Signed-off-by: Linus Torvalds
    Signed-off-by: Greg Kroah-Hartman

    Junxiao Bi
     

19 Aug, 2020

1 commit

  • [ Upstream commit 57c720d4144a9c2b88105c3e8f7b0e97e4b5cc93 ]

    Based on what fails, function can return with nfs_sync_rwlock either
    locked or unlocked. That can not be right.

    Always return with lock unlocked on error.

    Fixes: 4cd9973f9ff6 ("ocfs2: avoid inode removal while nfsd is accessing it")
    Signed-off-by: Pavel Machek (CIP)
    Signed-off-by: Andrew Morton
    Reviewed-by: Joseph Qi
    Reviewed-by: Andrew Morton
    Cc: Mark Fasheh
    Cc: Joel Becker
    Cc: Junxiao Bi
    Cc: Changwei Ge
    Cc: Gang He
    Cc: Jun Piao
    Link: http://lkml.kernel.org/r/20200724124443.GA28164@duo.ucw.cz
    Signed-off-by: Linus Torvalds
    Signed-off-by: Sasha Levin

    Pavel Machek
     

01 Jul, 2020

4 commits

  • commit e5a15e17a78d58f933d17cafedfcf7486a29f5b4 upstream.

    The following kernel panic was captured when running nfs server over
    ocfs2, at that time ocfs2_test_inode_bit() was checking whether one
    inode locating at "blkno" 5 was valid, that is ocfs2 root inode, its
    "suballoc_slot" was OCFS2_INVALID_SLOT(65535) and it was allocted from
    //global_inode_alloc, but here it wrongly assumed that it was got from per
    slot inode alloctor which would cause array overflow and trigger kernel
    panic.

    BUG: unable to handle kernel paging request at 0000000000001088
    IP: [] _raw_spin_lock+0x18/0xf0
    PGD 1e06ba067 PUD 1e9e7d067 PMD 0
    Oops: 0002 [#1] SMP
    CPU: 6 PID: 24873 Comm: nfsd Not tainted 4.1.12-124.36.1.el6uek.x86_64 #2
    Hardware name: Huawei CH121 V3/IT11SGCA1, BIOS 3.87 02/02/2018
    RIP: _raw_spin_lock+0x18/0xf0
    RSP: e02b:ffff88005ae97908 EFLAGS: 00010206
    RAX: ffff88005ae98000 RBX: 0000000000001088 RCX: 0000000000000000
    RDX: 0000000000020000 RSI: 0000000000000009 RDI: 0000000000001088
    RBP: ffff88005ae97928 R08: 0000000000000000 R09: ffff880212878e00
    R10: 0000000000007ff0 R11: 0000000000000000 R12: 0000000000001088
    R13: ffff8800063c0aa8 R14: ffff8800650c27d0 R15: 000000000000ffff
    FS: 0000000000000000(0000) GS:ffff880218180000(0000) knlGS:ffff880218180000
    CS: e033 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 0000000000001088 CR3: 00000002033d0000 CR4: 0000000000042660
    Call Trace:
    igrab+0x1e/0x60
    ocfs2_get_system_file_inode+0x63/0x3a0 [ocfs2]
    ocfs2_test_inode_bit+0x328/0xa00 [ocfs2]
    ocfs2_get_parent+0xba/0x3e0 [ocfs2]
    reconnect_path+0xb5/0x300
    exportfs_decode_fh+0xf6/0x2b0
    fh_verify+0x350/0x660 [nfsd]
    nfsd4_putfh+0x4d/0x60 [nfsd]
    nfsd4_proc_compound+0x3d3/0x6f0 [nfsd]
    nfsd_dispatch+0xe0/0x290 [nfsd]
    svc_process_common+0x412/0x6a0 [sunrpc]
    svc_process+0x123/0x210 [sunrpc]
    nfsd+0xff/0x170 [nfsd]
    kthread+0xcb/0xf0
    ret_from_fork+0x61/0x90
    Code: 83 c2 02 0f b7 f2 e8 18 dc 91 ff 66 90 eb bf 0f 1f 40 00 55 48 89 e5 41 56 41 55 41 54 53 0f 1f 44 00 00 48 89 fb ba 00 00 02 00 0f c1 17 89 d0 45 31 e4 45 31 ed c1 e8 10 66 39 d0 41 89 c6
    RIP _raw_spin_lock+0x18/0xf0
    CR2: 0000000000001088
    ---[ end trace 7264463cd1aac8f9 ]---
    Kernel panic - not syncing: Fatal exception

    Link: http://lkml.kernel.org/r/20200616183829.87211-4-junxiao.bi@oracle.com
    Signed-off-by: Junxiao Bi
    Reviewed-by: Joseph Qi
    Cc: Changwei Ge
    Cc: Gang He
    Cc: Joel Becker
    Cc: Jun Piao
    Cc: Mark Fasheh
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds
    Signed-off-by: Greg Kroah-Hartman

    Junxiao Bi
     
  • commit 9277f8334ffc719fe922d776444d6e4e884dbf30 upstream.

    In the ocfs2 disk layout, slot number is 16 bits, but in ocfs2
    implementation, slot number is 32 bits. Usually this will not cause any
    issue, because slot number is converted from u16 to u32, but
    OCFS2_INVALID_SLOT was defined as -1, when an invalid slot number from
    disk was obtained, its value was (u16)-1, and it was converted to u32.
    Then the following checking in get_local_system_inode will be always
    skipped:

    static struct inode **get_local_system_inode(struct ocfs2_super *osb,
    int type,
    u32 slot)
    {
    BUG_ON(slot == OCFS2_INVALID_SLOT);
    ...
    }

    Link: http://lkml.kernel.org/r/20200616183829.87211-5-junxiao.bi@oracle.com
    Signed-off-by: Junxiao Bi
    Reviewed-by: Joseph Qi
    Cc: Mark Fasheh
    Cc: Joel Becker
    Cc: Changwei Ge
    Cc: Gang He
    Cc: Jun Piao
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds
    Signed-off-by: Greg Kroah-Hartman

    Junxiao Bi
     
  • commit 7569d3c754e452769a5747eeeba488179e38a5da upstream.

    Set global_inode_alloc as OCFS2_FIRST_ONLINE_SYSTEM_INODE, that will
    make it load during mount. It can be used to test whether some
    global/system inodes are valid. One use case is that nfsd will test
    whether root inode is valid.

    Link: http://lkml.kernel.org/r/20200616183829.87211-3-junxiao.bi@oracle.com
    Signed-off-by: Junxiao Bi
    Reviewed-by: Joseph Qi
    Cc: Changwei Ge
    Cc: Gang He
    Cc: Joel Becker
    Cc: Jun Piao
    Cc: Mark Fasheh
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds
    Signed-off-by: Greg Kroah-Hartman

    Junxiao Bi
     
  • commit 4cd9973f9ff69e37dd0ba2bd6e6423f8179c329a upstream.

    Patch series "ocfs2: fix nfsd over ocfs2 issues", v2.

    This is a series of patches to fix issues on nfsd over ocfs2. patch 1
    is to avoid inode removed while nfsd access it patch 2 & 3 is to fix a
    panic issue.

    This patch (of 4):

    When nfsd is getting file dentry using handle or parent dentry of some
    dentry, one cluster lock is used to avoid inode removed from other node,
    but it still could be removed from local node, so use a rw lock to avoid
    this.

    Link: http://lkml.kernel.org/r/20200616183829.87211-1-junxiao.bi@oracle.com
    Link: http://lkml.kernel.org/r/20200616183829.87211-2-junxiao.bi@oracle.com
    Signed-off-by: Junxiao Bi
    Reviewed-by: Joseph Qi
    Cc: Changwei Ge
    Cc: Gang He
    Cc: Joel Becker
    Cc: Jun Piao
    Cc: Mark Fasheh
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds
    Signed-off-by: Greg Kroah-Hartman

    Junxiao Bi
     

06 May, 2020

1 commit


17 Apr, 2020

1 commit

  • commit 783fda856e1034dee90a873f7654c418212d12d7 upstream.

    Linux fallocate(2) with FALLOC_FL_PUNCH_HOLE mode set, its offset can
    exceed the inode size. Ocfs2 now doesn't allow that offset beyond inode
    size. This restriction is not necessary and violates fallocate(2)
    semantics.

    If fallocate(2) offset is beyond inode size, just return success and do
    nothing further.

    Otherwise, ocfs2 will crash the kernel.

    kernel BUG at fs/ocfs2//alloc.c:7264!
    ocfs2_truncate_inline+0x20f/0x360 [ocfs2]
    ocfs2_remove_inode_range+0x23c/0xcb0 [ocfs2]
    __ocfs2_change_file_space+0x4a5/0x650 [ocfs2]
    ocfs2_fallocate+0x83/0xa0 [ocfs2]
    vfs_fallocate+0x148/0x230
    SyS_fallocate+0x48/0x80
    do_syscall_64+0x79/0x170

    Signed-off-by: Changwei Ge
    Signed-off-by: Andrew Morton
    Reviewed-by: Joseph Qi
    Cc: Mark Fasheh
    Cc: Joel Becker
    Cc: Junxiao Bi
    Cc: Changwei Ge
    Cc: Gang He
    Cc: Jun Piao
    Cc:
    Link: http://lkml.kernel.org/r/20200407082754.17565-1-chge@linux.alibaba.com
    Signed-off-by: Linus Torvalds
    Signed-off-by: Greg Kroah-Hartman

    Changwei Ge
     

24 Feb, 2020

2 commits

  • [ Upstream commit 9f16ca48fc818a17de8be1f75d08e7f4addc4497 ]

    I found a NULL pointer dereference in ocfs2_update_inode_fsync_trans(),
    handle->h_transaction may be NULL in this situation:

    ocfs2_file_write_iter
    ->__generic_file_write_iter
    ->generic_perform_write
    ->ocfs2_write_begin
    ->ocfs2_write_begin_nolock
    ->ocfs2_write_cluster_by_desc
    ->ocfs2_write_cluster
    ->ocfs2_mark_extent_written
    ->ocfs2_change_extent_flag
    ->ocfs2_split_extent
    ->ocfs2_try_to_merge_extent
    ->ocfs2_extend_rotate_transaction
    ->ocfs2_extend_trans
    ->jbd2_journal_restart
    ->jbd2__journal_restart
    // handle->h_transaction is NULL here
    ->handle->h_transaction = NULL;
    ->start_this_handle
    /* journal aborted due to storage
    network disconnection, return error */
    ->return -EROFS;
    /* line 3806 in ocfs2_try_to_merge_extent (),
    it will ignore ret error. */
    ->ret = 0;
    ->...
    ->ocfs2_write_end
    ->ocfs2_write_end_nolock
    ->ocfs2_update_inode_fsync_trans
    // NULL pointer dereference
    ->oi->i_sync_tid = handle->h_transaction->t_tid;

    The information of NULL pointer dereference as follows:
    JBD2: Detected IO errors while flushing file data on dm-11-45
    Aborting journal on device dm-11-45.
    JBD2: Error -5 detected when updating journal superblock for dm-11-45.
    (dd,22081,3):ocfs2_extend_trans:474 ERROR: status = -30
    (dd,22081,3):ocfs2_try_to_merge_extent:3877 ERROR: status = -30
    Unable to handle kernel NULL pointer dereference at
    virtual address 0000000000000008
    Mem abort info:
    ESR = 0x96000004
    Exception class = DABT (current EL), IL = 32 bits
    SET = 0, FnV = 0
    EA = 0, S1PTW = 0
    Data abort info:
    ISV = 0, ISS = 0x00000004
    CM = 0, WnR = 0
    user pgtable: 4k pages, 48-bit VAs, pgdp = 00000000e74e1338
    [0000000000000008] pgd=0000000000000000
    Internal error: Oops: 96000004 [#1] SMP
    Process dd (pid: 22081, stack limit = 0x00000000584f35a9)
    CPU: 3 PID: 22081 Comm: dd Kdump: loaded
    Hardware name: Huawei TaiShan 2280 V2/BC82AMDD, BIOS 0.98 08/25/2019
    pstate: 60400009 (nZCv daif +PAN -UAO)
    pc : ocfs2_write_end_nolock+0x2b8/0x550 [ocfs2]
    lr : ocfs2_write_end_nolock+0x2a0/0x550 [ocfs2]
    sp : ffff0000459fba70
    x29: ffff0000459fba70 x28: 0000000000000000
    x27: ffff807ccf7f1000 x26: 0000000000000001
    x25: ffff807bdff57970 x24: ffff807caf1d4000
    x23: ffff807cc79e9000 x22: 0000000000001000
    x21: 000000006c6cd000 x20: ffff0000091d9000
    x19: ffff807ccb239db0 x18: ffffffffffffffff
    x17: 000000000000000e x16: 0000000000000007
    x15: ffff807c5e15bd78 x14: 0000000000000000
    x13: 0000000000000000 x12: 0000000000000000
    x11: 0000000000000000 x10: 0000000000000001
    x9 : 0000000000000228 x8 : 000000000000000c
    x7 : 0000000000000fff x6 : ffff807a308ed6b0
    x5 : ffff7e01f10967c0 x4 : 0000000000000018
    x3 : d0bc661572445600 x2 : 0000000000000000
    x1 : 000000001b2e0200 x0 : 0000000000000000
    Call trace:
    ocfs2_write_end_nolock+0x2b8/0x550 [ocfs2]
    ocfs2_write_end+0x4c/0x80 [ocfs2]
    generic_perform_write+0x108/0x1a8
    __generic_file_write_iter+0x158/0x1c8
    ocfs2_file_write_iter+0x668/0x950 [ocfs2]
    __vfs_write+0x11c/0x190
    vfs_write+0xac/0x1c0
    ksys_write+0x6c/0xd8
    __arm64_sys_write+0x24/0x30
    el0_svc_common+0x78/0x130
    el0_svc_handler+0x38/0x78
    el0_svc+0x8/0xc

    To prevent NULL pointer dereference in this situation, we use
    is_handle_aborted() before using handle->h_transaction->t_tid.

    Link: http://lkml.kernel.org/r/03e750ab-9ade-83aa-b000-b9e81e34e539@huawei.com
    Signed-off-by: Yan Wang
    Reviewed-by: Jun Piao
    Cc: Mark Fasheh
    Cc: Joel Becker
    Cc: Junxiao Bi
    Cc: Joseph Qi
    Cc: Changwei Ge
    Cc: Gang He
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds
    Signed-off-by: Sasha Levin

    wangyan
     
  • [ Upstream commit ca322fb6030956c2337fbf1c1beeb08c5dd5c943 ]

    Gang He reports the failure of building fs/ocfs2/ as an external module
    of the kernel installed on the system:

    $ cd fs/ocfs2
    $ make -C /lib/modules/`uname -r`/build M=`pwd` modules

    If you want to make it work reliably, I'd recommend to remove ccflags-y
    from the Makefiles, and to make header paths relative to the C files. I
    think this is the correct usage of the #include "..." directive.

    Link: http://lkml.kernel.org/r/20191227022950.14804-1-ghe@suse.com
    Signed-off-by: Masahiro Yamada
    Signed-off-by: Gang He
    Reported-by: Gang He
    Reviewed-by: Gang He
    Cc: Mark Fasheh
    Cc: Joel Becker
    Cc: Junxiao Bi
    Cc: Joseph Qi
    Cc: Changwei Ge
    Cc: Jun Piao
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds
    Signed-off-by: Sasha Levin

    Masahiro Yamada
     

11 Feb, 2020

1 commit

  • commit 2d797e9ff95ecbcf0a83d657928ed20579444857 upstream.

    Writing a cloned file triggers a kernel oops and the user-space command
    process is also killed by the system. The bug can be reproduced stably
    via:

    1) create a file under ocfs2 file system directory.

    journalctl -b > aa.txt

    2) create a cloned file for this file.

    reflink aa.txt bb.txt

    3) write the cloned file with dd command.

    dd if=/dev/zero of=bb.txt bs=512 count=1 conv=notrunc

    The dd command is killed by the kernel, then you can see the oops message
    via dmesg command.

    [ 463.875404] BUG: kernel NULL pointer dereference, address: 0000000000000028
    [ 463.875413] #PF: supervisor read access in kernel mode
    [ 463.875416] #PF: error_code(0x0000) - not-present page
    [ 463.875418] PGD 0 P4D 0
    [ 463.875425] Oops: 0000 [#1] SMP PTI
    [ 463.875431] CPU: 1 PID: 2291 Comm: dd Tainted: G OE 5.3.16-2-default
    [ 463.875433] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
    [ 463.875500] RIP: 0010:ocfs2_refcount_cow+0xa4/0x5d0 [ocfs2]
    [ 463.875505] Code: 06 89 6c 24 38 89 eb f6 44 24 3c 02 74 be 49 8b 47 28
    [ 463.875508] RSP: 0018:ffffa2cb409dfce8 EFLAGS: 00010202
    [ 463.875512] RAX: ffff8b1ebdca8000 RBX: 0000000000000001 RCX: ffff8b1eb73a9df0
    [ 463.875515] RDX: 0000000000056a01 RSI: 0000000000000000 RDI: 0000000000000000
    [ 463.875517] RBP: 0000000000000001 R08: ffff8b1eb73a9de0 R09: 0000000000000000
    [ 463.875520] R10: 0000000000000001 R11: 0000000000000000 R12: 0000000000000000
    [ 463.875522] R13: ffff8b1eb922f048 R14: 0000000000000000 R15: ffff8b1eb922f048
    [ 463.875526] FS: 00007f8f44d15540(0000) GS:ffff8b1ebeb00000(0000) knlGS:0000000000000000
    [ 463.875529] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    [ 463.875532] CR2: 0000000000000028 CR3: 000000003c17a000 CR4: 00000000000006e0
    [ 463.875546] Call Trace:
    [ 463.875596] ? ocfs2_inode_lock_full_nested+0x18b/0x960 [ocfs2]
    [ 463.875648] ocfs2_file_write_iter+0xaf8/0xc70 [ocfs2]
    [ 463.875672] new_sync_write+0x12d/0x1d0
    [ 463.875688] vfs_write+0xad/0x1a0
    [ 463.875697] ksys_write+0xa1/0xe0
    [ 463.875710] do_syscall_64+0x60/0x1f0
    [ 463.875743] entry_SYSCALL_64_after_hwframe+0x49/0xbe
    [ 463.875758] RIP: 0033:0x7f8f4482ed44
    [ 463.875762] Code: 00 f7 d8 64 89 02 48 c7 c0 ff ff ff ff eb b7 0f 1f 80 00 00 00
    [ 463.875765] RSP: 002b:00007fff300a79d8 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
    [ 463.875769] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f8f4482ed44
    [ 463.875771] RDX: 0000000000000200 RSI: 000055f771b5c000 RDI: 0000000000000001
    [ 463.875774] RBP: 0000000000000200 R08: 00007f8f44af9c78 R09: 0000000000000003
    [ 463.875776] R10: 000000000000089f R11: 0000000000000246 R12: 000055f771b5c000
    [ 463.875779] R13: 0000000000000200 R14: 0000000000000000 R15: 000055f771b5c000

    This regression problem was introduced by commit e74540b28556 ("ocfs2:
    protect extent tree in ocfs2_prepare_inode_for_write()").

    Link: http://lkml.kernel.org/r/20200121050153.13290-1-ghe@suse.com
    Fixes: e74540b28556 ("ocfs2: protect extent tree in ocfs2_prepare_inode_for_write()").
    Signed-off-by: Gang He
    Reviewed-by: Joseph Qi
    Cc: Mark Fasheh
    Cc: Joel Becker
    Cc: Junxiao Bi
    Cc: Changwei Ge
    Cc: Jun Piao
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds
    Signed-off-by: Greg Kroah-Hartman

    Gang He
     

18 Jan, 2020

1 commit

  • [ Upstream commit 397eac17f86f404f5ba31d8c3e39ec3124b39fd3 ]

    If journal is dirty when mount, it will be replayed but jbd2 sb log tail
    cannot be updated to mark a new start because journal->j_flag has
    already been set with JBD2_ABORT first in journal_init_common.

    When a new transaction is committed, it will be recored in block 1
    first(journal->j_tail is set to 1 in journal_reset). If emergency
    restart happens again before journal super block is updated
    unfortunately, the new recorded trans will not be replayed in the next
    mount.

    The following steps describe this procedure in detail.
    1. mount and touch some files
    2. these transactions are committed to journal area but not checkpointed
    3. emergency restart
    4. mount again and its journals are replayed
    5. journal super block's first s_start is 1, but its s_seq is not updated
    6. touch a new file and its trans is committed but not checkpointed
    7. emergency restart again
    8. mount and journal is dirty, but trans committed in 6 will not be
    replayed.

    This exception happens easily when this lun is used by only one node.
    If it is used by multi-nodes, other node will replay its journal and its
    journal super block will be updated after recovery like what this patch
    does.

    ocfs2_recover_node->ocfs2_replay_journal.

    The following jbd2 journal can be generated by touching a new file after
    journal is replayed, and seq 15 is the first valid commit, but first seq
    is 13 in journal super block.

    logdump:
    Block 0: Journal Superblock
    Seq: 0 Type: 4 (JBD2_SUPERBLOCK_V2)
    Blocksize: 4096 Total Blocks: 32768 First Block: 1
    First Commit ID: 13 Start Log Blknum: 1
    Error: 0
    Feature Compat: 0
    Feature Incompat: 2 block64
    Feature RO compat: 0
    Journal UUID: 4ED3822C54294467A4F8E87D2BA4BC36
    FS Share Cnt: 1 Dynamic Superblk Blknum: 0
    Per Txn Block Limit Journal: 0 Data: 0

    Block 1: Journal Commit Block
    Seq: 14 Type: 2 (JBD2_COMMIT_BLOCK)

    Block 2: Journal Descriptor
    Seq: 15 Type: 1 (JBD2_DESCRIPTOR_BLOCK)
    No. Blocknum Flags
    0. 587 none
    UUID: 00000000000000000000000000000000
    1. 8257792 JBD2_FLAG_SAME_UUID
    2. 619 JBD2_FLAG_SAME_UUID
    3. 24772864 JBD2_FLAG_SAME_UUID
    4. 8257802 JBD2_FLAG_SAME_UUID
    5. 513 JBD2_FLAG_SAME_UUID JBD2_FLAG_LAST_TAG
    ...
    Block 7: Inode
    Inode: 8257802 Mode: 0640 Generation: 57157641 (0x3682809)
    FS Generation: 2839773110 (0xa9437fb6)
    CRC32: 00000000 ECC: 0000
    Type: Regular Attr: 0x0 Flags: Valid
    Dynamic Features: (0x1) InlineData
    User: 0 (root) Group: 0 (root) Size: 7
    Links: 1 Clusters: 0
    ctime: 0x5de5d870 0x11104c61 -- Tue Dec 3 11:37:20.286280801 2019
    atime: 0x5de5d870 0x113181a1 -- Tue Dec 3 11:37:20.288457121 2019
    mtime: 0x5de5d870 0x11104c61 -- Tue Dec 3 11:37:20.286280801 2019
    dtime: 0x0 -- Thu Jan 1 08:00:00 1970
    ...
    Block 9: Journal Commit Block
    Seq: 15 Type: 2 (JBD2_COMMIT_BLOCK)

    The following is journal recovery log when recovering the upper jbd2
    journal when mount again.

    syslog:
    ocfs2: File system on device (252,1) was not unmounted cleanly, recovering it.
    fs/jbd2/recovery.c:(do_one_pass, 449): Starting recovery pass 0
    fs/jbd2/recovery.c:(do_one_pass, 449): Starting recovery pass 1
    fs/jbd2/recovery.c:(do_one_pass, 449): Starting recovery pass 2
    fs/jbd2/recovery.c:(jbd2_journal_recover, 278): JBD2: recovery, exit status 0, recovered transactions 13 to 13

    Due to first commit seq 13 recorded in journal super is not consistent
    with the value recorded in block 1(seq is 14), journal recovery will be
    terminated before seq 15 even though it is an unbroken commit, inode
    8257802 is a new file and it will be lost.

    Link: http://lkml.kernel.org/r/20191217020140.2197-1-li.kai4@h3c.com
    Signed-off-by: Kai Li
    Reviewed-by: Joseph Qi
    Reviewed-by: Changwei Ge
    Cc: Mark Fasheh
    Cc: Joel Becker
    Cc: Junxiao Bi
    Cc: Gang He
    Cc: Jun Piao
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds
    Signed-off-by: Sasha Levin

    Kai Li
     

09 Jan, 2020

1 commit

  • commit b73eba2a867e10b9b4477738677341f3307c07bb upstream.

    Because ocfs2_get_dlm_debug() function is called once less here, ocfs2
    file system will trigger the system crash, usually after ocfs2 file
    system is unmounted.

    This system crash is caused by a generic memory corruption, these crash
    backtraces are not always the same, for exapmle,

    ocfs2: Unmounting device (253,16) on (node 172167785)
    general protection fault: 0000 [#1] SMP PTI
    CPU: 3 PID: 14107 Comm: fence_legacy Kdump:
    Hardware name: QEMU Standard PC (i440FX + PIIX, 1996)
    RIP: 0010:__kmalloc+0xa5/0x2a0
    Code: 00 00 4d 8b 07 65 4d 8b
    RSP: 0018:ffffaa1fc094bbe8 EFLAGS: 00010286
    RAX: 0000000000000000 RBX: d310a8800d7a3faf RCX: 0000000000000000
    RDX: 0000000000000000 RSI: 0000000000000dc0 RDI: ffff96e68fc036c0
    RBP: d310a8800d7a3faf R08: ffff96e6ffdb10a0 R09: 00000000752e7079
    R10: 000000000001c513 R11: 0000000004091041 R12: 0000000000000dc0
    R13: 0000000000000039 R14: ffff96e68fc036c0 R15: ffff96e68fc036c0
    FS: 00007f699dfba540(0000) GS:ffff96e6ffd80000(0000) knlGS:00000
    CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 000055f3a9d9b768 CR3: 000000002cd1c000 CR4: 00000000000006e0
    Call Trace:
    ext4_htree_store_dirent+0x35/0x100 [ext4]
    htree_dirblock_to_tree+0xea/0x290 [ext4]
    ext4_htree_fill_tree+0x1c1/0x2d0 [ext4]
    ext4_readdir+0x67c/0x9d0 [ext4]
    iterate_dir+0x8d/0x1a0
    __x64_sys_getdents+0xab/0x130
    do_syscall_64+0x60/0x1f0
    entry_SYSCALL_64_after_hwframe+0x49/0xbe
    RIP: 0033:0x7f699d33a9fb

    This regression problem was introduced by commit e581595ea29c ("ocfs: no
    need to check return value of debugfs_create functions").

    Link: http://lkml.kernel.org/r/20191225061501.13587-1-ghe@suse.com
    Fixes: e581595ea29c ("ocfs: no need to check return value of debugfs_create functions")
    Signed-off-by: Gang He
    Acked-by: Joseph Qi
    Cc: Mark Fasheh
    Cc: Joel Becker
    Cc: Junxiao Bi
    Cc: Changwei Ge
    Cc: Gang He
    Cc: Jun Piao
    Cc: [5.3+]
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds
    Signed-off-by: Greg Kroah-Hartman

    Gang He
     

05 Jan, 2020

1 commit

  • [ Upstream commit 188c523e1c271d537f3c9f55b6b65bf4476de32f ]

    Fix a static code checker warning:
    fs/ocfs2/acl.c:331
    ocfs2_acl_chmod() warn: passing zero to 'PTR_ERR'

    Link: http://lkml.kernel.org/r/1dee278b-6c96-eec2-ce76-fe6e07c6e20f@linux.alibaba.com
    Fixes: 5ee0fbd50fd ("ocfs2: revert using ocfs2_acl_chmod to avoid inode cluster lock hang")
    Signed-off-by: Ding Xiang
    Reviewed-by: Joseph Qi
    Cc: Mark Fasheh
    Cc: Joel Becker
    Cc: Junxiao Bi
    Cc: Changwei Ge
    Cc: Gang He
    Cc: Jun Piao
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds
    Signed-off-by: Sasha Levin

    Ding Xiang
     

18 Dec, 2019

1 commit

  • commit df4bb5d128e2c44848aeb36b7ceceba3ac85080d upstream.

    There is a race window where quota was redirted once we drop dq_list_lock inside dqput(),
    but before we grab dquot->dq_lock inside dquot_release()

    TASK1 TASK2 (chowner)
    ->dqput()
    we_slept:
    spin_lock(&dq_list_lock)
    if (dquot_dirty(dquot)) {
    spin_unlock(&dq_list_lock);
    dquot->dq_sb->dq_op->write_dquot(dquot);
    goto we_slept
    if (test_bit(DQ_ACTIVE_B, &dquot->dq_flags)) {
    spin_unlock(&dq_list_lock);
    dquot->dq_sb->dq_op->release_dquot(dquot);
    dqget()
    mark_dquot_dirty()
    dqput()
    goto we_slept;
    }
    So dquot dirty quota will be released by TASK1, but on next we_sleept loop
    we detect this and call ->write_dquot() for it.
    XFSTEST: https://github.com/dmonakhov/xfstests/commit/440a80d4cbb39e9234df4d7240aee1d551c36107

    Link: https://lore.kernel.org/r/20191031103920.3919-2-dmonakhov@openvz.org
    CC: stable@vger.kernel.org
    Signed-off-by: Dmitry Monakhov
    Signed-off-by: Jan Kara
    Signed-off-by: Greg Kroah-Hartman

    Dmitry Monakhov
     

23 Nov, 2019

1 commit

  • This reverts commit 56e94ea132bb5c2c1d0b60a6aeb34dcb7d71a53d.

    Commit 56e94ea132bb ("fs: ocfs2: fix possible null-pointer dereferences
    in ocfs2_xa_prepare_entry()") introduces a regression that fail to
    create directory with mount option user_xattr and acl. Actually the
    reported NULL pointer dereference case can be correctly handled by
    loc->xl_ops->xlo_add_entry(), so revert it.

    Link: http://lkml.kernel.org/r/1573624916-83825-1-git-send-email-joseph.qi@linux.alibaba.com
    Fixes: 56e94ea132bb ("fs: ocfs2: fix possible null-pointer dereferences in ocfs2_xa_prepare_entry()")
    Signed-off-by: Joseph Qi
    Reported-by: Thomas Voegtle
    Acked-by: Changwei Ge
    Cc: Jia-Ju Bai
    Cc: Mark Fasheh
    Cc: Joel Becker
    Cc: Junxiao Bi
    Cc: Gang He
    Cc: Jun Piao
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joseph Qi
     

07 Nov, 2019

1 commit

  • When the extent tree is modified, it should be protected by inode
    cluster lock and ip_alloc_sem.

    The extent tree is accessed and modified in the
    ocfs2_prepare_inode_for_write, but isn't protected by ip_alloc_sem.

    The following is a case. The function ocfs2_fiemap is accessing the
    extent tree, which is modified at the same time.

    kernel BUG at fs/ocfs2/extent_map.c:475!
    invalid opcode: 0000 [#1] SMP
    Modules linked in: tun ocfs2 ocfs2_nodemanager configfs ocfs2_stackglue [...]
    CPU: 16 PID: 14047 Comm: o2info Not tainted 4.1.12-124.23.1.el6uek.x86_64 #2
    Hardware name: Oracle Corporation ORACLE SERVER X7-2L/ASM, MB MECH, X7-2L, BIOS 42040600 10/19/2018
    task: ffff88019487e200 ti: ffff88003daa4000 task.ti: ffff88003daa4000
    RIP: ocfs2_get_clusters_nocache.isra.11+0x390/0x550 [ocfs2]
    Call Trace:
    ocfs2_fiemap+0x1e3/0x430 [ocfs2]
    do_vfs_ioctl+0x155/0x510
    SyS_ioctl+0x81/0xa0
    system_call_fastpath+0x18/0xd8
    Code: 18 48 c7 c6 60 7f 65 a0 31 c0 bb e2 ff ff ff 48 8b 4a 40 48 8b 7a 28 48 c7 c2 78 2d 66 a0 e8 38 4f 05 00 e9 28 fe ff ff 0f 1f 00 0b 66 0f 1f 44 00 00 bb 86 ff ff ff e9 13 fe ff ff 66 0f 1f
    RIP ocfs2_get_clusters_nocache.isra.11+0x390/0x550 [ocfs2]
    ---[ end trace c8aa0c8180e869dc ]---
    Kernel panic - not syncing: Fatal exception
    Kernel Offset: disabled

    This issue can be reproduced every week in a production environment.

    This issue is related to the usage mode. If others use ocfs2 in this
    mode, the kernel will panic frequently.

    [akpm@linux-foundation.org: coding style fixes]
    [Fix new warning due to unused function by removing said function - Linus ]
    Link: http://lkml.kernel.org/r/1568772175-2906-2-git-send-email-sunny.s.zhang@oracle.com
    Signed-off-by: Shuning Zhang
    Reviewed-by: Junxiao Bi
    Reviewed-by: Gang He
    Cc: Mark Fasheh
    Cc: Joel Becker
    Cc: Joseph Qi
    Cc: Changwei Ge
    Cc: Jun Piao
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Shuning Zhang
     

19 Oct, 2019

2 commits

  • mount.ocfs2 failed when reading ocfs2 filesystem superblock encounters
    an error. ocfs2_initialize_super() returns before allocating ocfs2_wq.
    ocfs2_dismount_volume() triggers the following panic.

    Oct 15 16:09:27 cnwarekv-205120 kernel: On-disk corruption discovered.Please run fsck.ocfs2 once the filesystem is unmounted.
    Oct 15 16:09:27 cnwarekv-205120 kernel: (mount.ocfs2,22804,44): ocfs2_read_locked_inode:537 ERROR: status = -30
    Oct 15 16:09:27 cnwarekv-205120 kernel: (mount.ocfs2,22804,44): ocfs2_init_global_system_inodes:458 ERROR: status = -30
    Oct 15 16:09:27 cnwarekv-205120 kernel: (mount.ocfs2,22804,44): ocfs2_init_global_system_inodes:491 ERROR: status = -30
    Oct 15 16:09:27 cnwarekv-205120 kernel: (mount.ocfs2,22804,44): ocfs2_initialize_super:2313 ERROR: status = -30
    Oct 15 16:09:27 cnwarekv-205120 kernel: (mount.ocfs2,22804,44): ocfs2_fill_super:1033 ERROR: status = -30
    ------------[ cut here ]------------
    Oops: 0002 [#1] SMP NOPTI
    CPU: 1 PID: 11753 Comm: mount.ocfs2 Tainted: G E
    4.14.148-200.ckv.x86_64 #1
    Hardware name: Sugon H320-G30/35N16-US, BIOS 0SSDX017 12/21/2018
    task: ffff967af0520000 task.stack: ffffa5f05484000
    RIP: 0010:mutex_lock+0x19/0x20
    Call Trace:
    flush_workqueue+0x81/0x460
    ocfs2_shutdown_local_alloc+0x47/0x440 [ocfs2]
    ocfs2_dismount_volume+0x84/0x400 [ocfs2]
    ocfs2_fill_super+0xa4/0x1270 [ocfs2]
    ? ocfs2_initialize_super.isa.211+0xf20/0xf20 [ocfs2]
    mount_bdev+0x17f/0x1c0
    mount_fs+0x3a/0x160

    Link: http://lkml.kernel.org/r/1571139611-24107-1-git-send-email-yili@winhong.com
    Signed-off-by: Yi Li
    Reviewed-by: Joseph Qi
    Cc: Mark Fasheh
    Cc: Joel Becker
    Cc: Junxiao Bi
    Cc: Changwei Ge
    Cc: Gang He
    Cc: Jun Piao
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Yi Li
     
  • Should set transfer_to[USRQUOTA/GRPQUOTA] to NULL on error case before
    jumping to do dqput().

    Link: http://lkml.kernel.org/r/20191010082349.1134-1-cgxu519@mykernel.net
    Signed-off-by: Chengguang Xu
    Reviewed-by: Joseph Qi
    Cc: Mark Fasheh
    Cc: Joel Becker
    Cc: Junxiao Bi
    Cc: Changwei Ge
    Cc: Gang He
    Cc: Jun Piao
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Chengguang Xu
     

08 Oct, 2019

4 commits

  • In ocfs2_info_scan_inode_alloc(), there is an if statement on line 283
    to check whether inode_alloc is NULL:

    if (inode_alloc)

    When inode_alloc is NULL, it is used on line 287:

    ocfs2_inode_lock(inode_alloc, &bh, 0);
    ocfs2_inode_lock_full_nested(inode, ...)
    struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);

    Thus, a possible null-pointer dereference may occur.

    To fix this bug, inode_alloc is checked on line 286.

    This bug is found by a static analysis tool STCheck written by us.

    Link: http://lkml.kernel.org/r/20190726033717.32359-1-baijiaju1990@gmail.com
    Signed-off-by: Jia-Ju Bai
    Reviewed-by: Joseph Qi
    Cc: Mark Fasheh
    Cc: Joel Becker
    Cc: Junxiao Bi
    Cc: Changwei Ge
    Cc: Gang He
    Cc: Jun Piao
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jia-Ju Bai
     
  • In ocfs2_write_end_nolock(), there are an if statement on lines 1976,
    2047 and 2058, to check whether handle is NULL:

    if (handle)

    When handle is NULL, it is used on line 2045:

    ocfs2_update_inode_fsync_trans(handle, inode, 1);
    oi->i_sync_tid = handle->h_transaction->t_tid;

    Thus, a possible null-pointer dereference may occur.

    To fix this bug, handle is checked before calling
    ocfs2_update_inode_fsync_trans().

    This bug is found by a static analysis tool STCheck written by us.

    Link: http://lkml.kernel.org/r/20190726033705.32307-1-baijiaju1990@gmail.com
    Signed-off-by: Jia-Ju Bai
    Reviewed-by: Joseph Qi
    Cc: Mark Fasheh
    Cc: Joel Becker
    Cc: Junxiao Bi
    Cc: Changwei Ge
    Cc: Gang He
    Cc: Jun Piao
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jia-Ju Bai
     
  • In ocfs2_xa_prepare_entry(), there is an if statement on line 2136 to
    check whether loc->xl_entry is NULL:

    if (loc->xl_entry)

    When loc->xl_entry is NULL, it is used on line 2158:

    ocfs2_xa_add_entry(loc, name_hash);
    loc->xl_entry->xe_name_hash = cpu_to_le32(name_hash);
    loc->xl_entry->xe_name_offset = cpu_to_le16(loc->xl_size);

    and line 2164:

    ocfs2_xa_add_namevalue(loc, xi);
    loc->xl_entry->xe_value_size = cpu_to_le64(xi->xi_value_len);
    loc->xl_entry->xe_name_len = xi->xi_name_len;

    Thus, possible null-pointer dereferences may occur.

    To fix these bugs, if loc-xl_entry is NULL, ocfs2_xa_prepare_entry()
    abnormally returns with -EINVAL.

    These bugs are found by a static analysis tool STCheck written by us.

    [akpm@linux-foundation.org: remove now-unused ocfs2_xa_add_entry()]
    Link: http://lkml.kernel.org/r/20190726101447.9153-1-baijiaju1990@gmail.com
    Signed-off-by: Jia-Ju Bai
    Reviewed-by: Joseph Qi
    Cc: Mark Fasheh
    Cc: Joel Becker
    Cc: Junxiao Bi
    Cc: Changwei Ge
    Cc: Gang He
    Cc: Jun Piao
    Cc: Stephen Rothwell
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jia-Ju Bai
     
  • Unused portion of a part-written fs-block-sized block is not set to zero
    in unaligned append direct write.This can lead to serious data
    inconsistencies.

    Ocfs2 manage disk with cluster size(for example, 1M), part-written in
    one cluster will change the cluster state from UN-WRITTEN to WRITTEN,
    VFS(function dio_zero_block) doesn't do the cleaning because bh's state
    is not set to NEW in function ocfs2_dio_wr_get_block when we write a
    WRITTEN cluster. For example, the cluster size is 1M, file size is 8k
    and we direct write from 14k to 15k, then 12k~14k and 15k~16k will
    contain dirty data.

    We have to deal with two cases:
    1.The starting position of direct write is outside the file.
    2.The starting position of direct write is located in the file.

    We need set bh's state to NEW in the first case. In the second case, we
    need mapped twice because bh's state of area out file should be set to
    NEW while area in file not.

    [akpm@linux-foundation.org: coding style fixes]
    Link: http://lkml.kernel.org/r/5292e287-8f1a-fd4a-1a14-661e555e0bed@huawei.com
    Signed-off-by: Jia Guo
    Reviewed-by: Yiwen Jiang
    Cc: Mark Fasheh
    Cc: Joel Becker
    Cc: Junxiao Bi
    Cc: Joseph Qi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jia Guo
     

25 Sep, 2019

11 commits

  • There is a spelling mistake in a mlog_bug_on_msg message. Fix it.

    Link: http://lkml.kernel.org/r/831bdff4-064e-038b-f45d-c4d265cbff1e@linux.alibaba.com
    Signed-off-by: Colin Ian King
    Acked-by: Joseph Qi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Colin Ian King
     
  • Appending truncate log(TA) and and flushing truncate log(TF) are two
    separated transactions. They can be both committed but not checkpointed.
    If crash occurs then, both transaction will be replayed with several
    already released to global bitmap clusters. Then truncate log will be
    replayed resulting in cluster double free.

    To reproduce this issue, just crash the host while punching hole to files.

    Signed-off-by: Changwei Ge
    Reviewed-by: Joseph Qi
    Cc: Mark Fasheh
    Cc: Joel Becker
    Cc: Junxiao Bi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Changwei Ge
     
  • There is a scenario causing ocfs2 umount hang when multiple hosts are
    rebooting at the same time.

    NODE1 NODE2 NODE3
    send unlock requset to NODE2
    dies
    become recovery master
    recover NODE2
    find NODE2 dead
    mark resource RECOVERING
    directly remove lock from grant list
    calculate usage but RECOVERING marked
    **miss the window of purging
    clear RECOVERING

    To reproduce this issue, crash a host and then umount ocfs2
    from another node.

    To solve this, just let unlock progress wait for recovery done.

    Link: http://lkml.kernel.org/r/1550124866-20367-1-git-send-email-gechangwei@live.cn
    Signed-off-by: Changwei Ge
    Reviewed-by: Joseph Qi
    Cc: Mark Fasheh
    Cc: Joel Becker
    Cc: Junxiao Bi
    Cc: Changwei Ge
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Changwei Ge
     
  • brelse() tests whether its argument is NULL and then returns immediately.
    Thus the tests around the shown calls are not needed.

    This issue was detected by using the Coccinelle software.

    Link: http://lkml.kernel.org/r/55cde320-394b-f985-56ce-1a2abea782aa@web.de
    Signed-off-by: Markus Elfring
    Reviewed-by: Joseph Qi
    Cc: Mark Fasheh
    Cc: Joel Becker
    Cc: Junxiao Bi
    Cc: Changwei Ge
    Cc: Gang He
    Cc: Jun Piao
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Markus Elfring
     
  • Fixes gcc '-Wunused-but-set-variable' warning:

    fs/ocfs2/dir.c: In function ocfs2_dx_dir_transfer_leaf:
    fs/ocfs2/dir.c:3653:42: warning: variable new_list set but not used [-Wunused-but-set-variable]

    Link: http://lkml.kernel.org/r/1566522588-63786-4-git-send-email-joseph.qi@linux.alibaba.com
    Signed-off-by: zhengbin
    Signed-off-by: Joseph Qi
    Reported-by: Hulk Robot
    Reviewed-by: Joseph Qi
    Reviewed-by: Changwei Ge
    Cc: Mark Fasheh
    Cc: Joel Becker
    Cc: Junxiao Bi
    Cc: Gang He
    Cc: Jun Piao
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    zhengbin
     
  • Fixes gcc '-Wunused-but-set-variable' warning:

    fs/ocfs2/file.c: In function ocfs2_prepare_inode_for_write:
    fs/ocfs2/file.c:2143:9: warning: variable end set but not used [-Wunused-but-set-variable]

    Link: http://lkml.kernel.org/r/1566522588-63786-3-git-send-email-joseph.qi@linux.alibaba.com
    Signed-off-by: zhengbin
    Signed-off-by: Joseph Qi
    Reported-by: Hulk Robot
    Reviewed-by: Joseph Qi
    Reviewed-by: Changwei Ge
    Cc: Mark Fasheh
    Cc: Joel Becker
    Cc: Junxiao Bi
    Cc: Gang He
    Cc: Jun Piao
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    zhengbin
     
  • Fixes gcc '-Wunused-but-set-variable' warning:

    fs/ocfs2/namei.c: In function ocfs2_create_inode_in_orphan:
    fs/ocfs2/namei.c:2503:23: warning: variable di set but not used [-Wunused-but-set-variable]

    Link: http://lkml.kernel.org/r/1566522588-63786-2-git-send-email-joseph.qi@linux.alibaba.com
    Signed-off-by: zhengbin
    Signed-off-by: Joseph Qi
    Reported-by: Hulk Robot
    Reviewed-by: Joseph Qi
    Reviewed-by: Changwei Ge
    Cc: Mark Fasheh
    Cc: Joel Becker
    Cc: Junxiao Bi
    Cc: Gang He
    Cc: Jun Piao
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    zhengbin
     
  • ocfs2_orphan_scan_exit() is declared but not implemented. Also perform a
    minor cleanup in ocfs2_link_credits()

    Link: http://lkml.kernel.org/r/71604351584F6A4EBAE558C676F37CA4014FC208AC@H3CMLB12-EX.srv.huawei-3com.com
    Signed-off-by: guozhonghua
    Reviewed-by: Andrew Morton
    Cc: Mark Fasheh
    Cc: Joel Becker
    Cc: Junxiao Bi
    Cc: Joseph Qi
    Cc: Changwei Ge
    Cc: Gang He
    Cc: Jun Piao
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Guozhonghua
     
  • ocfs2_calc_tree_trunc_credits() is not called anywhere.

    Link: http://lkml.kernel.org/r/71604351584F6A4EBAE558C676F37CA4014FC2050F@H3CMLB12-EX.srv.huawei-3com.com
    Signed-off-by: guozhonghua
    Reviewed-by: Andrew Morton
    Cc: Mark Fasheh
    Cc: Joel Becker
    Cc: Junxiao Bi
    Cc: Joseph Qi
    Cc: Changwei Ge
    Cc: Gang He
    Cc: Jun Piao
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Guozhonghua
     
  • There is no need to check return value of debugfs_create functions, but
    the last sweep through ocfs missed a number of places where this was
    happening. There is also no need to save the individual dentries for the
    debugfs files, as everything is can just be removed at once when the
    directory is removed.

    By getting rid of the file dentries for the debugfs entries, a bit of
    local memory can be saved as well.

    [colin.king@canonical.com: ensure ret is set to zero before returning]
    Link: http://lkml.kernel.org/r/20190807121929.28918-1-colin.king@canonical.com
    Link: http://lkml.kernel.org/r/20190731132119.GA12603@kroah.com
    Signed-off-by: Greg Kroah-Hartman
    Signed-off-by: Colin Ian King
    Reviewed-by: Joseph Qi
    Cc: Mark Fasheh
    Cc: Joel Becker
    Cc: Jia Guo
    Cc: Junxiao Bi
    Cc: Changwei Ge
    Cc: Gang He
    Cc: Jun Piao
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Greg Kroah-Hartman
     
  • 6ba0e7dc64a5 ("jbd2: introduce jbd2_inode dirty range scoping") allow us
    scoping each of the inode dirty ranges associated with a given
    transaction, and ext4 already does this way.

    Now let's also use the newly introduced jbd2_inode dirty range scoping to
    prevent us from waiting forever when trying to complete a journal
    transaction in ocfs2.

    Link: http://lkml.kernel.org/r/1562977611-8412-1-git-send-email-joseph.qi@linux.alibaba.com
    Signed-off-by: Joseph Qi
    Reviewed-by: Ross Zwisler
    Reviewed-by: Changwei Ge
    Cc: "Theodore Ts'o"
    Cc: Mark Fasheh
    Cc: Joel Becker
    Cc: Junxiao Bi
    Cc: Joseph Qi
    Cc: Gang He
    Cc: Jun Piao
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joseph Qi
     

03 Aug, 2019

1 commit

  • Fixes gcc '-Wunused-but-set-variable' warning:

    fs/ocfs2/xattr.c: In function ocfs2_xattr_bucket_find:
    fs/ocfs2/xattr.c:3828:6: warning: variable last_hash set but not used [-Wunused-but-set-variable]

    It's never used and can be removed.

    Link: http://lkml.kernel.org/r/20190716132110.34836-1-yuehaibing@huawei.com
    Signed-off-by: YueHaibing
    Acked-by: Joseph Qi
    Cc: Mark Fasheh
    Cc: Joel Becker
    Cc: Junxiao Bi
    Cc: Changwei Ge
    Cc: Gang He
    Cc: Jun Piao
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    YueHaibing
     

13 Jul, 2019

5 commits

  • Pull common SETFLAGS/FSSETXATTR parameter checking from Darrick Wong:
    "Here's a patch series that sets up common parameter checking functions
    for the FS_IOC_SETFLAGS and FS_IOC_FSSETXATTR ioctl implementations.

    The goal here is to reduce the amount of behaviorial variance between
    the filesystems where those ioctls originated (ext2 and XFS,
    respectively) and everybody else.

    - Standardize parameter checking for the SETFLAGS and FSSETXATTR
    ioctls (which were the file attribute setters for ext4 and xfs and
    have now been hoisted to the vfs)

    - Only allow the DAX flag to be set on files and directories"

    * tag 'vfs-fix-ioctl-checking-3' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux:
    vfs: only allow FSSETXATTR to set DAX flag on files and dirs
    vfs: teach vfs_ioc_fssetxattr_check to check extent size hints
    vfs: teach vfs_ioc_fssetxattr_check to check project id info
    vfs: create a generic checking function for FS_IOC_FSSETXATTR
    vfs: create a generic checking and prep function for FS_IOC_SETFLAGS

    Linus Torvalds
     
  • kmemdup is introduced to duplicate a region of memory in a neat way.

    Rather than kmalloc/kzalloc + memcpy, which the programmer needs to
    write the size twice (sometimes lead to mistakes), kmemdup improves
    readability, leads to smaller code and also reduce the chances of
    mistakes.

    Suggestion to use kmemdup rather than using kmalloc/kzalloc + memcpy.

    [akpm@linux-foundation.org: coding style fixes]
    Link: http://lkml.kernel.org/r/20190703163147.881-1-huangfq.daxian@gmail.com
    Signed-off-by: Fuqian Huang
    Reviewed-by: Joseph Qi
    Cc: Mark Fasheh
    Cc: Joel Becker
    Cc: Junxiao Bi
    Cc: Changwei Ge
    Cc: Gang He
    Cc: Jun Piao
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Fuqian Huang
     
  • fix below issue reported by coccicheck

    fs/ocfs2/dlmglue.c:4410:5-11: Unneeded variable: "status". Return "0" on line 4428

    We can not change return type of ocfs2_downconvert_thread as its
    registered as callback of kthread_create.

    Link: http://lkml.kernel.org/r/20190702183237.GA13975@hari-Inspiron-1545
    Signed-off-by: Hariprasad Kelam
    Reviewed-by: Joseph Qi
    Cc: Mark Fasheh
    Cc: Joel Becker
    Cc: Junxiao Bi
    Cc: Changwei Ge
    Cc: Gang He
    Cc: Jun Piao
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Hariprasad Kelam
     
  • When calling debugfs functions, there is no need to ever check the
    return value. The function can work or not, but the code logic should
    never do something different based on this.

    Also, because there is no need to save the file dentry, remove all of
    the variables that were being saved, and just recursively delete the
    whole directory when shutting down, saving a lot of logic and local
    variables.

    [gregkh@linuxfoundation.org: v2]
    Link: http://lkml.kernel.org/r/20190613055455.GE19717@kroah.com
    Link: http://lkml.kernel.org/r/20190612152912.GA19151@kroah.com
    Signed-off-by: Greg Kroah-Hartman
    Reviewed-by: Joseph Qi
    Cc: Mark Fasheh
    Cc: Joel Becker
    Cc: Joseph Qi
    Cc: Jia Guo
    Cc: Junxiao Bi
    Cc: Changwei Ge
    Cc: Gang He
    Cc: Jun Piao
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Greg Kroah-Hartman
     
  • ocfs2 file system uses locking_state file under debugfs to dump each
    ocfs2 file system's dlm lock resources, but the users ever encountered
    some hang(deadlock) problems in ocfs2 file system. I'd like to add
    first lock wait time in locking_state file, which can help the upper
    scripts detect these deadlock problems via comparing the first lock wait
    time with the current time.

    Link: http://lkml.kernel.org/r/20190611015414.27754-3-ghe@suse.com
    Signed-off-by: Gang He
    Reviewed-by: Joseph Qi
    Cc: Mark Fasheh
    Cc: Joel Becker
    Cc: Junxiao Bi
    Cc: Changwei Ge
    Cc: Gang He
    Cc: Jun Piao
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Gang He