02 Nov, 2017

1 commit

  • Many source files in the tree are missing licensing information, which
    makes it harder for compliance tools to determine the correct license.

    By default all files without license information are under the default
    license of the kernel, which is GPL version 2.

    Update the files which contain no license information with the 'GPL-2.0'
    SPDX license identifier. The SPDX identifier is a legally binding
    shorthand, which can be used instead of the full boiler plate text.

    This patch is based on work done by Thomas Gleixner and Kate Stewart and
    Philippe Ombredanne.

    How this work was done:

    Patches were generated and checked against linux-4.14-rc6 for a subset of
    the use cases:
    - file had no licensing information it it.
    - file was a */uapi/* one with no licensing information in it,
    - file was a */uapi/* one with existing licensing information,

    Further patches will be generated in subsequent months to fix up cases
    where non-standard license headers were used, and references to license
    had to be inferred by heuristics based on keywords.

    The analysis to determine which SPDX License Identifier to be applied to
    a file was done in a spreadsheet of side by side results from of the
    output of two independent scanners (ScanCode & Windriver) producing SPDX
    tag:value files created by Philippe Ombredanne. Philippe prepared the
    base worksheet, and did an initial spot review of a few 1000 files.

    The 4.13 kernel was the starting point of the analysis with 60,537 files
    assessed. Kate Stewart did a file by file comparison of the scanner
    results in the spreadsheet to determine which SPDX license identifier(s)
    to be applied to the file. She confirmed any determination that was not
    immediately clear with lawyers working with the Linux Foundation.

    Criteria used to select files for SPDX license identifier tagging was:
    - Files considered eligible had to be source code files.
    - Make and config files were included as candidates if they contained >5
    lines of source
    - File already had some variant of a license header in it (even if
    Reviewed-by: Philippe Ombredanne
    Reviewed-by: Thomas Gleixner
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

07 Sep, 2017

1 commit

  • Pull file locking updates from Jeff Layton:
    "This pile just has a few file locking fixes from Ben Coddington. There
    are a couple of cleanup patches + an attempt to bring sanity to the
    l_pid value that is reported back to userland on an F_GETLK request.

    After a few gyrations, he came up with a way for filesystems to
    communicate to the VFS layer code whether the pid should be translated
    according to the namespace or presented as-is to userland"

    * tag 'locks-v4.14-1' of git://git.kernel.org/pub/scm/linux/kernel/git/jlayton/linux:
    locks: restore a warn for leaked locks on close
    fs/locks: Remove fl_nspid and use fs-specific l_pid for remote locks
    fs/locks: Use allocation rather than the stack in fcntl_getlk()

    Linus Torvalds
     

08 Aug, 2017

16 commits

  • With commit 0ffdaf5b41cf ("net/sock: add WARN_ON(parent->sk)
    in sock_graft()"), a calltrace happened as follows:

    [ 457.018340] WARNING: CPU: 0 PID: 15623 at ./include/net/sock.h:1703 inet_accept+0x135/0x140
    ...
    [ 457.018381] RIP: 0010:inet_accept+0x135/0x140
    [ 457.018381] RSP: 0018:ffffc90001727d18 EFLAGS: 00010286
    [ 457.018383] RAX: 0000000000000001 RBX: ffff880012413000 RCX: 0000000000000001
    [ 457.018384] RDX: 000000000000018a RSI: 00000000fffffe01 RDI: ffffffff8156fae8
    [ 457.018384] RBP: ffffc90001727d38 R08: 0000000000000000 R09: 0000000000004305
    [ 457.018385] R10: 0000000000000001 R11: 0000000000004304 R12: ffff880035ae7a00
    [ 457.018386] R13: ffff88001282af10 R14: ffff880034e4e200 R15: 0000000000000000
    [ 457.018387] FS: 0000000000000000(0000) GS:ffff88003fc00000(0000) knlGS:0000000000000000
    [ 457.018388] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    [ 457.018389] CR2: 00007fdec22f9000 CR3: 0000000002b5a000 CR4: 00000000000006f0
    [ 457.018395] Call Trace:
    [ 457.018402] tcp_accept_from_sock.part.8+0x12d/0x449 [dlm]
    [ 457.018405] ? vprintk_emit+0x248/0x2d0
    [ 457.018409] tcp_accept_from_sock+0x3f/0x50 [dlm]
    [ 457.018413] process_recv_sockets+0x3b/0x50 [dlm]
    [ 457.018415] process_one_work+0x138/0x370
    [ 457.018417] worker_thread+0x4d/0x3b0
    [ 457.018419] kthread+0x109/0x140
    [ 457.018421] ? rescuer_thread+0x320/0x320
    [ 457.018422] ? kthread_park+0x60/0x60
    [ 457.018424] ret_from_fork+0x25/0x30

    Since newsocket created by sock_create_kern sets it's
    sock by the path:

    sock_create_kern -> __sock_creat
    ->pf->create => inet_create
    -> sock_init_data

    Then WARN_ON is triggered by "con->sock->ops->accept =>
    inet_accept -> sock_graft", it also means newsock->sk
    is leaked since sock_graft will replace it with a new
    sk.

    To resolve the issue, we need to use sock_create_lite
    instead of sock_create_kern, like commit 0933a578cd55
    ("rds: tcp: use sock_create_lite() to create the accept
    socket") did.

    Reported-by: Zhilong Liu
    Signed-off-by: Guoqing Jiang
    Signed-off-by: David Teigland

    Guoqing Jiang
     
  • Can be reproduced when running dlm_controld (tested on 4.4.x, 4.12.4):
    # seq 1 100 | xargs -P0 -n1 dlm_tool join
    # seq 1 100 | xargs -P0 -n1 dlm_tool leave

    misc_register fails due to duplicate sysfs entry, which causes
    dlm_device_register to free ls->ls_device.name.
    In dlm_device_deregister the name was freed again, causing memory
    corruption.

    According to the comment in dlm_device_deregister the name should've been
    set to NULL when registration fails,
    so this patch does that.

    sysfs: cannot create duplicate filename '/dev/char/10:1'
    ------------[ cut here ]------------
    warning: cpu: 1 pid: 4450 at fs/sysfs/dir.c:31 sysfs_warn_dup+0x56/0x70
    modules linked in: msr rfcomm dlm ccm bnep dm_crypt uvcvideo
    videobuf2_vmalloc videobuf2_memops videobuf2_v4l2 videobuf2_core videodev
    btusb media btrtl btbcm btintel bluetooth ecdh_generic intel_rapl
    x86_pkg_temp_thermal intel_powerclamp coretemp kvm_intel kvm
    snd_hda_codec_hdmi irqbypass crct10dif_pclmul crc32_pclmul
    ghash_clmulni_intel thinkpad_acpi pcbc nvram snd_seq_midi
    snd_seq_midi_event aesni_intel snd_hda_codec_realtek snd_hda_codec_generic
    snd_rawmidi aes_x86_64 crypto_simd glue_helper snd_hda_intel snd_hda_codec
    cryptd intel_cstate arc4 snd_hda_core snd_seq snd_seq_device snd_hwdep
    iwldvm intel_rapl_perf mac80211 joydev input_leds iwlwifi serio_raw
    cfg80211 snd_pcm shpchp snd_timer snd mac_hid mei_me lpc_ich mei soundcore
    sunrpc parport_pc ppdev lp parport autofs4 i915 psmouse
    e1000e ahci libahci i2c_algo_bit sdhci_pci ptp drm_kms_helper sdhci
    pps_core syscopyarea sysfillrect sysimgblt fb_sys_fops drm wmi video
    cpu: 1 pid: 4450 comm: dlm_test.exe not tainted 4.12.4-041204-generic
    hardware name: lenovo 232425u/232425u, bios g2et82ww (2.02 ) 09/11/2012
    task: ffff96b0cbabe140 task.stack: ffffb199027d0000
    rip: 0010:sysfs_warn_dup+0x56/0x70
    rsp: 0018:ffffb199027d3c58 eflags: 00010282
    rax: 0000000000000038 rbx: ffff96b0e2c49158 rcx: 0000000000000006
    rdx: 0000000000000000 rsi: 0000000000000086 rdi: ffff96b15e24dcc0
    rbp: ffffb199027d3c70 r08: 0000000000000001 r09: 0000000000000721
    r10: ffffb199027d3c00 r11: 0000000000000721 r12: ffffb199027d3cd1
    r13: ffff96b1592088f0 r14: 0000000000000001 r15: ffffffffffffffef
    fs: 00007f78069c0700(0000) gs:ffff96b15e240000(0000)
    knlgs:0000000000000000
    cs: 0010 ds: 0000 es: 0000 cr0: 0000000080050033
    cr2: 000000178625ed28 cr3: 0000000091d3e000 cr4: 00000000001406e0
    call trace:
    sysfs_do_create_link_sd.isra.2+0x9e/0xb0
    sysfs_create_link+0x25/0x40
    device_add+0x5a9/0x640
    device_create_groups_vargs+0xe0/0xf0
    device_create_with_groups+0x3f/0x60
    ? snprintf+0x45/0x70
    misc_register+0x140/0x180
    device_write+0x6a8/0x790 [dlm]
    __vfs_write+0x37/0x160
    ? apparmor_file_permission+0x1a/0x20
    ? security_file_permission+0x3b/0xc0
    vfs_write+0xb5/0x1a0
    sys_write+0x55/0xc0
    ? sys_fcntl+0x5d/0xb0
    entry_syscall_64_fastpath+0x1e/0xa9
    rip: 0033:0x7f78083454bd
    rsp: 002b:00007f78069bbd30 eflags: 00000293 orig_rax: 0000000000000001
    rax: ffffffffffffffda rbx: 0000000000000006 rcx: 00007f78083454bd
    rdx: 000000000000009c rsi: 00007f78069bee00 rdi: 0000000000000005
    rbp: 00007f77f8000a20 r08: 000000000000fcf0 r09: 0000000000000032
    r10: 0000000000000024 r11: 0000000000000293 r12: 00007f78069bde00
    r13: 00007f78069bee00 r14: 000000000000000a r15: 00007f78069bbd70
    code: 85 c0 48 89 c3 74 12 b9 00 10 00 00 48 89 c2 31 f6 4c 89 ef e8 2c c8
    ff ff 4c 89 e2 48 89 de 48 c7 c7 b0 8e 0c a8 e8 41 e8 ed ff ff 48 89
    df e8 00 d5 f4 ff 5b 41 5c 41 5d 5d c3 66 0f 1f 84
    ---[ end trace 40412246357cc9e0 ]---

    dlm: 59f24629-ae39-44e2-9030-397ebc2eda26: leaving the lockspace group...
    bug: unable to handle kernel null pointer dereference at 0000000000000001
    ip: [] kmem_cache_alloc+0x7a/0x140
    pgd 0
    oops: 0000 [#1] smp
    modules linked in: dlm 8021q garp mrp stp llc openvswitch nf_defrag_ipv6
    nf_conntrack libcrc32c iptable_filter dm_multipath crc32_pclmul dm_mod
    aesni_intel psmouse aes_x86_64 sg ablk_helper cryptd lrw gf128mul
    glue_helper i2c_piix4 nls_utf8 tpm_tis tpm isofs nfsd auth_rpcgss
    oid_registry nfs_acl lockd grace sunrpc xen_wdt ip_tables x_tables autofs4
    hid_generic usbhid hid sr_mod cdrom sd_mod ata_generic pata_acpi 8139too
    serio_raw ata_piix 8139cp mii uhci_hcd ehci_pci ehci_hcd libata
    scsi_dh_rdac scsi_dh_hp_sw scsi_dh_emc scsi_dh_alua scsi_mod ipv6
    cpu: 0 pid: 394 comm: systemd-udevd tainted: g w 4.4.0+0 #1
    hardware name: xen hvm domu, bios 4.7.2-2.2 05/11/2017
    task: ffff880002410000 ti: ffff88000243c000 task.ti: ffff88000243c000
    rip: e030:[] []
    kmem_cache_alloc+0x7a/0x140
    rsp: e02b:ffff88000243fd90 eflags: 00010202
    rax: 0000000000000000 rbx: ffff8800029864d0 rcx: 000000000007b36c
    rdx: 000000000007b36b rsi: 00000000024000c0 rdi: ffff880036801c00
    rbp: ffff88000243fdc0 r08: 0000000000018880 r09: 0000000000000054
    r10: 000000000000004a r11: ffff880034ace6c0 r12: 00000000024000c0
    r13: ffff880036801c00 r14: 0000000000000001 r15: ffffffff8118dcc2
    fs: 00007f0ab77548c0(0000) gs:ffff880036e00000(0000) knlgs:0000000000000000
    cs: e033 ds: 0000 es: 0000 cr0: 0000000080050033
    cr2: 0000000000000001 cr3: 000000000332d000 cr4: 0000000000040660
    stack:
    ffffffff8118dc90 ffff8800029864d0 0000000000000000 ffff88003430b0b0
    ffff880034b78320 ffff88003430b0b0 ffff88000243fdf8 ffffffff8118dcc2
    ffff8800349c6700 ffff8800029864d0 000000000000000b 00007f0ab7754b90
    call trace:
    [] ? anon_vma_fork+0x60/0x140
    [] anon_vma_fork+0x92/0x140
    [] copy_process+0xcae/0x1a80
    [] _do_fork+0x8b/0x2d0
    [] sys_clone+0x19/0x20
    [] entry_syscall_64_fastpath+0x12/0x71
    ] code: f6 75 1c 4c 89 fa 44 89 e6 4c 89 ef e8 a7 e4 00 00 41 f7 c4 00 80
    00 00 49 89 c6 74 47 eb 32 49 63 45 20 48 8d 4a 01 4d 8b 45 00 8b 1c
    06 4c 89 f0 65 49 0f c7 08 0f 94 c0 84 c0 74 ac 49 63
    rip [] kmem_cache_alloc+0x7a/0x140
    rsp
    cr2: 0000000000000001
    --[ end trace 70cb9fd1b164a0e8 ]--

    CC: stable@vger.kernel.org
    Signed-off-by: Edwin Török
    Signed-off-by: David Teigland

    Edwin Török
     
  • Declare kset_uevent_ops structure as const as it is only passed as an
    argument to the function kset_create_and_add. This argument is of type
    const, so declare the structure as const.

    Signed-off-by: Bhumika Goyal
    Signed-off-by: David Teigland

    Bhumika Goyal
     
  • Print a message when a cluster name is not specified by
    the caller. In this case the cluster name configured
    for the dlm is used without any validation that it is
    the cluster expected by the application.

    Signed-off-by: Zhu Lingshan
    Signed-off-by: David Teigland

    Zhu Lingshan
     
  • The local variable "rv" is reassigned by a statement at the beginning.
    Thus omit the explicit initialisation.

    Signed-off-by: Markus Elfring
    Signed-off-by: David Teigland

    Markus Elfring
     
  • Replace the specification of two data structures by pointer dereferences
    as the parameter for the operator "sizeof" to make the corresponding size
    determination a bit safer according to the Linux coding style convention.

    Signed-off-by: Markus Elfring
    Signed-off-by: David Teigland

    Markus Elfring
     
  • * Multiplications for the size determination of memory allocations
    indicated that array data structures should be processed.
    Thus reuse the corresponding function "kcalloc".

    This issue was detected by using the Coccinelle software.

    * Replace the specification of data structures by pointer dereferences
    to make the corresponding size determinations a bit safer according to
    the Linux coding style convention.

    Signed-off-by: Markus Elfring
    Signed-off-by: David Teigland

    Markus Elfring
     
  • * A multiplication for the size determination of a memory allocation
    indicated that an array data structure should be processed.
    Thus use the corresponding function "kmalloc_array".

    This issue was detected by using the Coccinelle software.

    * Replace the specification of a data type by a pointer dereference
    to make the corresponding size determination a bit safer according to
    the Linux coding style convention.

    Signed-off-by: Markus Elfring
    Signed-off-by: David Teigland

    Markus Elfring
     
  • Omit an extra message for a memory allocation failure in this function.

    Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf
    Signed-off-by: Markus Elfring
    Signed-off-by: David Teigland

    Markus Elfring
     
  • Replace the specification of a data structure by a pointer dereference
    as the parameter for the operator "sizeof" to make the corresponding size
    determination a bit safer according to the Linux coding style convention.

    Signed-off-by: Markus Elfring
    Signed-off-by: David Teigland

    Markus Elfring
     
  • A multiplication for the size determination of a memory allocation
    indicated that an array data structure should be processed.
    Thus use the corresponding function "kcalloc".

    This issue was detected by using the Coccinelle software.

    Signed-off-by: Markus Elfring
    Signed-off-by: David Teigland

    Markus Elfring
     
  • Replace the specification of a data structure by a pointer dereference
    as the parameter for the operator "sizeof" to make the corresponding size
    determination a bit safer according to the Linux coding style convention.

    Signed-off-by: Markus Elfring
    Signed-off-by: David Teigland

    Markus Elfring
     
  • The script "checkpatch.pl" pointed information out like the following.

    CHECK: spaces preferred around that '+' (ctx:VxV)

    Thus fix the affected source code places.

    Signed-off-by: Markus Elfring
    Signed-off-by: David Teigland

    Markus Elfring
     
  • Six single characters (line breaks) should be put into a sequence.
    Thus use the corresponding function "seq_putc".

    This issue was detected by using the Coccinelle software.

    Signed-off-by: Markus Elfring
    Signed-off-by: David Teigland

    Markus Elfring
     
  • This change will try to make this error message more clear,
    since the upper applications (e.g. ocfs2) invoke dlm_new_lockspace
    to create a new lockspace with passing a cluster name. Sometimes,
    dlm_new_lockspace return failure while two cluster names dismatch,
    the user is a little confused since this line error message is not
    enough obvious.

    Signed-off-by: Gang He
    Signed-off-by: David Teigland

    Gang He
     
  • Clear the 'unused' field and the uninitialized padding in 'lksb' to
    avoid leaking memory to userland in copy_result_to_user().

    Signed-off-by: Vlad Tsyrklevich
    Signed-off-by: David Teigland

    Vlad Tsyrklevich
     

16 Jul, 2017

1 commit

  • Since commit c69899a17ca4 "NFSv4: Update of VFS byte range lock must be
    atomic with the stateid update", NFSv4 has been inserting locks in rpciod
    worker context. The result is that the file_lock's fl_nspid is the
    kworker's pid instead of the original userspace pid.

    The fl_nspid is only used to represent the namespaced virtual pid number
    when displaying locks or returning from F_GETLK. There's no reason to set
    it for every inserted lock, since we can usually just look it up from
    fl_pid. So, instead of looking up and holding struct pid for every lock,
    let's just look up the virtual pid number from fl_pid when it is needed.
    That means we can remove fl_nspid entirely.

    The translaton and presentation of fl_pid should handle the following four
    cases:

    1 - F_GETLK on a remote file with a remote lock:
    In this case, the filesystem should determine the l_pid to return here.
    Filesystems should indicate that the fl_pid represents a non-local pid
    value that should not be translated by returning an fl_pid
    Signed-off-by: Jeff Layton

    Benjamin Coddington
     

10 Mar, 2017

1 commit

  • Lockdep issues a circular dependency warning when AFS issues an operation
    through AF_RXRPC from a context in which the VFS/VM holds the mmap_sem.

    The theory lockdep comes up with is as follows:

    (1) If the pagefault handler decides it needs to read pages from AFS, it
    calls AFS with mmap_sem held and AFS begins an AF_RXRPC call, but
    creating a call requires the socket lock:

    mmap_sem must be taken before sk_lock-AF_RXRPC

    (2) afs_open_socket() opens an AF_RXRPC socket and binds it. rxrpc_bind()
    binds the underlying UDP socket whilst holding its socket lock.
    inet_bind() takes its own socket lock:

    sk_lock-AF_RXRPC must be taken before sk_lock-AF_INET

    (3) Reading from a TCP socket into a userspace buffer might cause a fault
    and thus cause the kernel to take the mmap_sem, but the TCP socket is
    locked whilst doing this:

    sk_lock-AF_INET must be taken before mmap_sem

    However, lockdep's theory is wrong in this instance because it deals only
    with lock classes and not individual locks. The AF_INET lock in (2) isn't
    really equivalent to the AF_INET lock in (3) as the former deals with a
    socket entirely internal to the kernel that never sees userspace. This is
    a limitation in the design of lockdep.

    Fix the general case by:

    (1) Double up all the locking keys used in sockets so that one set are
    used if the socket is created by userspace and the other set is used
    if the socket is created by the kernel.

    (2) Store the kern parameter passed to sk_alloc() in a variable in the
    sock struct (sk_kern_sock). This informs sock_lock_init(),
    sock_init_data() and sk_clone_lock() as to the lock keys to be used.

    Note that the child created by sk_clone_lock() inherits the parent's
    kern setting.

    (3) Add a 'kern' parameter to ->accept() that is analogous to the one
    passed in to ->create() that distinguishes whether kernel_accept() or
    sys_accept4() was the caller and can be passed to sk_alloc().

    Note that a lot of accept functions merely dequeue an already
    allocated socket. I haven't touched these as the new socket already
    exists before we get the parameter.

    Note also that there are a couple of places where I've made the accepted
    socket unconditionally kernel-based:

    irda_accept()
    rds_rcp_accept_one()
    tcp_accept_from_sock()

    because they follow a sock_create_kern() and accept off of that.

    Whilst creating this, I noticed that lustre and ocfs don't create sockets
    through sock_create_kern() and thus they aren't marked as for-kernel,
    though they appear to be internal. I wonder if these should do that so
    that they use the new set of lock keys.

    Signed-off-by: David Howells
    Signed-off-by: David S. Miller

    David Howells
     

02 Mar, 2017

1 commit


26 Dec, 2016

2 commits

  • No point in going through loops and hoops instead of just comparing the
    values.

    Signed-off-by: Thomas Gleixner
    Cc: Peter Zijlstra

    Thomas Gleixner
     
  • ktime_set(S,N) was required for the timespec storage type and is still
    useful for situations where a Seconds and Nanoseconds part of a time value
    needs to be converted. For anything where the Seconds argument is 0, this
    is pointless and can be replaced with a simple assignment.

    Signed-off-by: Thomas Gleixner
    Cc: Peter Zijlstra

    Thomas Gleixner
     

25 Dec, 2016

1 commit


15 Dec, 2016

1 commit

  • Pull dlm fixes from David Teigland:
    "This set fixes error reporting for dlm sockets, removes the unbound
    property on the dlm callback workqueue to improve performance, and
    includes a couple trivial changes"

    * tag 'dlm-4.10' of git://git.kernel.org/pub/scm/linux/kernel/git/teigland/linux-dlm:
    dlm: fix error return code in sctp_accept_from_sock()
    dlm: don't specify WQ_UNBOUND for the ast callback workqueue
    dlm: remove lock_sock to avoid scheduling while atomic
    dlm: don't save callbacks after accept
    dlm: audit and remove any unnecessary uses of module.h
    dlm: make genl_ops const

    Linus Torvalds
     

28 Oct, 2016

3 commits

  • Now genl_register_family() is the only thing (other than the
    users themselves, perhaps, but I didn't find any doing that)
    writing to the family struct.

    In all families that I found, genl_register_family() is only
    called from __init functions (some indirectly, in which case
    I've add __init annotations to clarifly things), so all can
    actually be marked __ro_after_init.

    This protects the data structure from accidental corruption.

    Signed-off-by: Johannes Berg
    Signed-off-by: David S. Miller

    Johannes Berg
     
  • Instead of providing macros/inline functions to initialize
    the families, make all users initialize them statically and
    get rid of the macros.

    This reduces the kernel code size by about 1.6k on x86-64
    (with allyesconfig).

    Signed-off-by: Johannes Berg
    Signed-off-by: David S. Miller

    Johannes Berg
     
  • Static family IDs have never really been used, the only
    use case was the workaround I introduced for those users
    that assumed their family ID was also their multicast
    group ID.

    Additionally, because static family IDs would never be
    reserved by the generic netlink code, using a relatively
    low ID would only work for built-in families that can be
    registered immediately after generic netlink is started,
    which is basically only the control family (apart from
    the workaround code, which I also had to add code for so
    it would reserve those IDs)

    Thus, anything other than GENL_ID_GENERATE is flawed and
    luckily not used except in the cases I mentioned. Move
    those workarounds into a few lines of code, and then get
    rid of GENL_ID_GENERATE entirely, making it more robust.

    Signed-off-by: Johannes Berg
    Signed-off-by: David S. Miller

    Johannes Berg
     

24 Oct, 2016

1 commit


20 Oct, 2016

5 commits

  • This patch removes the WQ_UNBOUND flag (which implies WQ_HIGHPRI)
    from the DLM's ast work queue, in favor of just WQ_HIGHPRI.
    This has been shown to cause a 19 percent performance increase for
    simultaneous inode creates on GFS2 with fs_mark.

    Signed-off-by: Bob Peterson
    Signed-off-by: David Teigland

    Bob Peterson
     
  • Before this patch, functions save_callbacks and restore_callbacks
    called function lock_sock and release_sock to prevent other processes
    from messing with the struct sock while the callbacks were saved and
    restored. However, function add_sock calls write_lock_bh prior to
    calling it save_callbacks, which disables preempts. So the call to
    lock_sock would try to schedule when we can't schedule.

    Signed-off-by: Bob Peterson
    Signed-off-by: David Teigland

    Bob Peterson
     
  • When DLM calls accept() on a socket, the comm code copies the sk
    after we've saved its callbacks. Afterward, it calls add_sock which
    saves the callbacks a second time. Since the error reporting function
    lowcomms_error_report calls the previous callback too, this results
    in a recursive call to itself. This patch adds a new parameter to
    function add_sock to tell whether to save the callbacks. Function
    tcp_accept_from_sock (and its sctp counterpart) then calls it with
    false to avoid the recursion.

    Signed-off-by: Bob Peterson
    Signed-off-by: David Teigland

    Bob Peterson
     
  • Historically a lot of these existed because we did not have
    a distinction between what was modular code and what was providing
    support to modules via EXPORT_SYMBOL and friends. That changed
    when we forked out support for the latter into the export.h file.
    This means we should be able to reduce the usage of module.h
    in code that is obj-y Makefile or bool Kconfig.

    In the case of some code where it is modular, we can extend that to
    also include files that are building basic support functionality but
    not related to loading or registering the final module; such files
    also have no need whatsoever for module.h

    The advantage in removing such instances is that module.h itself
    sources about 15 other headers; adding significantly to what we feed
    cpp, and it can obscure what headers we are effectively using.

    Since module.h might have been the implicit source for init.h
    (for __init) and for export.h (for EXPORT_SYMBOL) we consider each
    instance for the presence of either and replace as needed.

    In the dlm case, we remove module.h from a global header and only
    introduce it in the files where it is explicitly required, since
    there is nothing modular in dlm_internal.h itself.

    Signed-off-by: Paul Gortmaker
    Signed-off-by: David Teigland

    Paul Gortmaker
     
  • This table contains function points and should be const.

    Signed-off-by: Stephen Hemminger
    Signed-off-by: David Teigland

    Stephen Hemminger
     

10 Oct, 2016

1 commit

  • After backporting commit ee44b4bc054a ("dlm: use sctp 1-to-1 API")
    series to a kernel with an older workqueue which didn't use RCU yet, it
    was noticed that we are freeing the workqueues in dlm_lowcomms_stop()
    too early as free_conn() will try to access that memory for canceling
    the queued works if any.

    This issue was introduced by commit 0d737a8cfd83 as before it such
    attempt to cancel the queued works wasn't performed, so the issue was
    not present.

    This patch fixes it by simply inverting the free order.

    Cc: stable@vger.kernel.org
    Fixes: 0d737a8cfd83 ("dlm: fix race while closing connections")
    Signed-off-by: Marcelo Ricardo Leitner
    Signed-off-by: David Teigland

    Marcelo Ricardo Leitner
     

27 Aug, 2016

1 commit

  • With the current kernel, `dlm_tool lockdebug` fails as below:

    "dlm_tool lockdebug ED0BD86DCE724393918A1AE8FDBF1EE3
    can't open /sys/kernel/debug/dlm/ED0BD86DCE724393918A1AE8FDBF1EE3:
    Operation not permitted"

    This is because table_open() depends on file->f_op to tell which
    seq_file ops should be passed down. But, the original file ops in
    file->f_op is replaced by "debugfs_full_proxy_file_operations" with
    commit 49d200deaa68 ("debugfs: prevent access to removed files'
    private data").

    Currently, I can think up 2 solutions: 1st, replace
    debugfs_create_file() with debugfs_create_file_unsafe();
    2nd, make different table_open#() accordingly. The 1st one
    is neat, but I don't thoroughly understand its risk. Maybe
    someone has a better one.

    Signed-off-by: Eric Ren
    Signed-off-by: David Teigland

    Eric Ren
     

24 Jun, 2016

1 commit

  • Replace calls to kmalloc followed by a memcpy with a direct call to
    kmemdup.

    The Coccinelle semantic patch used to make this change is as follows:
    @@
    expression from,to,size,flag;
    statement S;
    @@

    - to = \(kmalloc\|kzalloc\)(size,flag);
    + to = kmemdup(from,size,flag);
    if (to==NULL || ...) S
    - memcpy(to, from, size);

    Signed-off-by: Amitoj Kaur Chawla
    Signed-off-by: David Teigland

    Amitoj Kaur Chawla
     

21 Jun, 2016

1 commit


05 Apr, 2016

1 commit

  • PAGE_CACHE_{SIZE,SHIFT,MASK,ALIGN} macros were introduced *long* time
    ago with promise that one day it will be possible to implement page
    cache with bigger chunks than PAGE_SIZE.

    This promise never materialized. And unlikely will.

    We have many places where PAGE_CACHE_SIZE assumed to be equal to
    PAGE_SIZE. And it's constant source of confusion on whether
    PAGE_CACHE_* or PAGE_* constant should be used in a particular case,
    especially on the border between fs and mm.

    Global switching to PAGE_CACHE_SIZE != PAGE_SIZE would cause to much
    breakage to be doable.

    Let's stop pretending that pages in page cache are special. They are
    not.

    The changes are pretty straight-forward:

    - << (PAGE_CACHE_SHIFT - PAGE_SHIFT) -> ;

    - >> (PAGE_CACHE_SHIFT - PAGE_SHIFT) -> ;

    - PAGE_CACHE_{SIZE,SHIFT,MASK,ALIGN} -> PAGE_{SIZE,SHIFT,MASK,ALIGN};

    - page_cache_get() -> get_page();

    - page_cache_release() -> put_page();

    This patch contains automated changes generated with coccinelle using
    script below. For some reason, coccinelle doesn't patch header files.
    I've called spatch for them manually.

    The only adjustment after coccinelle is revert of changes to
    PAGE_CAHCE_ALIGN definition: we are going to drop it later.

    There are few places in the code where coccinelle didn't reach. I'll
    fix them manually in a separate patch. Comments and documentation also
    will be addressed with the separate patch.

    virtual patch

    @@
    expression E;
    @@
    - E << (PAGE_CACHE_SHIFT - PAGE_SHIFT)
    + E

    @@
    expression E;
    @@
    - E >> (PAGE_CACHE_SHIFT - PAGE_SHIFT)
    + E

    @@
    @@
    - PAGE_CACHE_SHIFT
    + PAGE_SHIFT

    @@
    @@
    - PAGE_CACHE_SIZE
    + PAGE_SIZE

    @@
    @@
    - PAGE_CACHE_MASK
    + PAGE_MASK

    @@
    expression E;
    @@
    - PAGE_CACHE_ALIGN(E)
    + PAGE_ALIGN(E)

    @@
    expression E;
    @@
    - page_cache_get(E)
    + get_page(E)

    @@
    expression E;
    @@
    - page_cache_release(E)
    + put_page(E)

    Signed-off-by: Kirill A. Shutemov
    Acked-by: Michal Hocko
    Signed-off-by: Linus Torvalds

    Kirill A. Shutemov
     

29 Mar, 2016

1 commit

  • Commit 1ae1602de0 "configfs: switch ->default groups to a linked list"
    left the NULL gps pointer behind after removing the kcalloc() call which
    made it non-NULL. It also left the !gps check in place so make_cluster()
    now fails with ENOMEM. Remove the remaining uses of the gps variable to
    fix that.

    Reviewed-by: Bob Peterson
    Reviewed-by: Andreas Gruenbacher
    Signed-off-by: Andrew Price
    Signed-off-by: David Teigland

    Andrew Price