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

9 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
     
  • Add locking filter debugfs file, which is used to filter lock resources
    dump from locking_state debugfs file. We use d_filter_secs field to
    filter lock resources dump, the default d_filter_secs(0) value filters
    nothing, otherwise, only dump the last N seconds active lock resources.
    This enhancement can avoid dumping lots of old records. The
    d_filter_secs value can be changed via locking_filter file.

    [akpm@linux-foundation.org: fix undefined reference to `__udivdi3']
    Link: http://lkml.kernel.org/r/20190611015414.27754-2-ghe@suse.com
    Signed-off-by: Gang He
    Reviewed-by: Joseph Qi
    Acked-by: Randy Dunlap [build-tested]
    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
     
  • ocfs2 file system uses locking_state file under debugfs to dump each
    ocfs2 file system's dlm lock resources, but the dlm lock resources in
    memory are becoming more and more after the files were touched by the
    user. it will become a bit difficult to analyze these dlm lock resource
    records in locking_state file by the upper scripts, though some files
    are not active for now, which were accessed long time ago.

    Then, I'd like to add last pr/ex unlock times in locking_state file for
    each dlm lock resource record, the the upper scripts can use last unlock
    time to filter inactive dlm lock resource record.

    Link: http://lkml.kernel.org/r/20190611015414.27754-1-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
     
  • One of the more common cases of allocation size calculations is finding
    the size of a structure that has a zero-sized array at the end, along
    with memory for some number of elements for that array. For example:

    struct dlm_migratable_lockres
    {
    ...
    struct dlm_migratable_lock ml[0]; // 16 bytes each, begins at byte 112
    };

    Make use of the struct_size() helper instead of an open-coded version in
    order to avoid any potential type mistakes.

    So, replace the following form:

    sizeof(struct dlm_migratable_lockres) + (mres->num_locks * sizeof(struct dlm_migratable_lock))

    with:

    struct_size(mres, ml, mres->num_locks)

    Notice that, in this case, variable sz is not necessary, hence it is
    removed.

    This code was detected with the help of Coccinelle.

    Link: http://lkml.kernel.org/r/20190605204926.GA24467@embeddedor
    Signed-off-by: Gustavo A. R. Silva
    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

    Gustavo A. R. Silva
     
  • There are some spelling mistakes in ocfs, fix it.

    Link: http://lkml.kernel.org/r/1558964623-106628-1-git-send-email-cg.chen@huawei.com
    Signed-off-by: ChenGang
    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

    ChenGang
     

01 Jul, 2019

1 commit

  • Create a generic function to check incoming FS_IOC_SETFLAGS flag values
    and later prepare the inode for updates so that we can standardize the
    implementations that follow ext4's flag values.

    Note that the efivarfs implementation no longer fails a no-op SETFLAGS
    without CAP_LINUX_IMMUTABLE since that's the behavior in ext*.

    Signed-off-by: Darrick J. Wong
    Reviewed-by: Jan Kara
    Reviewed-by: Christoph Hellwig
    Acked-by: David Sterba
    Reviewed-by: Bob Peterson

    Darrick J. Wong
     

14 Jun, 2019

1 commit

  • ocfs2_dentry_attach_lock() can be executed in parallel threads against the
    same dentry. Make that race safe. The race is like this:

    thread A thread B

    (A1) enter ocfs2_dentry_attach_lock,
    seeing dentry->d_fsdata is NULL,
    and no alias found by
    ocfs2_find_local_alias, so kmalloc
    a new ocfs2_dentry_lock structure
    to local variable "dl", dl1

    .....

    (B1) enter ocfs2_dentry_attach_lock,
    seeing dentry->d_fsdata is NULL,
    and no alias found by
    ocfs2_find_local_alias so kmalloc
    a new ocfs2_dentry_lock structure
    to local variable "dl", dl2.

    ......

    (A2) set dentry->d_fsdata with dl1,
    call ocfs2_dentry_lock() and increase
    dl1->dl_lockres.l_ro_holders to 1 on
    success.
    ......

    (B2) set dentry->d_fsdata with dl2
    call ocfs2_dentry_lock() and increase
    dl2->dl_lockres.l_ro_holders to 1 on
    success.

    ......

    (A3) call ocfs2_dentry_unlock()
    and decrease
    dl2->dl_lockres.l_ro_holders to 0
    on success.
    ....

    (B3) call ocfs2_dentry_unlock(),
    decreasing
    dl2->dl_lockres.l_ro_holders, but
    see it's zero now, panic

    Link: http://lkml.kernel.org/r/20190529174636.22364-1-wen.gang.wang@oracle.com
    Signed-off-by: Wengang Wang
    Reported-by: Daniel Sobe
    Tested-by: Daniel Sobe
    Reviewed-by: Changwei Ge
    Reviewed-by: Joseph Qi
    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

    Wengang Wang
     

05 Jun, 2019

2 commits

  • Based on 1 normalized pattern(s):

    this program is free software you can redistribute it and or modify
    it under the terms of the gnu general public license version 2 as
    published by the free software foundation this program is
    distributed in the hope that it will be useful but without any
    warranty without even the implied warranty of merchantability or
    fitness for a particular purpose see the gnu general public license
    for more details you should have received a copy of the gnu general
    public license along with this program if not write to the free
    software foundation inc 59 temple place suite 330 boston ma 021110
    1307 usa

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-only

    has been chosen to replace the boilerplate/reference in 5 file(s).

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Armijn Hemel
    Reviewed-by: Allison Randal
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190531190112.221098808@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     
  • Based on 1 normalized pattern(s):

    this program is free software you can redistribute it and or modify
    it under the terms of the gnu general public license as published by
    the free software foundation version 2 this program is distributed
    in the hope that it will be useful but without any warranty without
    even the implied warranty of merchantability or fitness for a
    particular purpose see the gnu general public license for more
    details

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-only

    has been chosen to replace the boilerplate/reference in 97 file(s).

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Allison Randal
    Reviewed-by: Alexios Zavras
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190529141901.025053186@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner