1. 31 5月, 2018 1 次提交
    • K
      nbd: clear DISCONNECT_REQUESTED flag once disconnection occurs. · 5e3c3a7e
      Kevin Vigor 提交于
      When a userspace client requests a NBD device be disconnected, the
      DISCONNECT_REQUESTED flag is set. While this flag is set, the driver
      will not inform userspace when a connection is closed.
      
      Unfortunately the flag was never cleared, so once a disconnect was
      requested the driver would thereafter never tell userspace about a
      closed connection. Thus when connections failed due to timeout, no
      attempt to reconnect was made and eventually the device would fail.
      
      Fix by clearing the DISCONNECT_REQUESTED flag (and setting the
      DISCONNECTED flag) once all connections are closed.
      Reviewed-by: NJosef Bacik <josef@toxicpanda.com>
      Signed-off-by: NKevin Vigor <kvigor@fb.com>
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      5e3c3a7e
  2. 29 5月, 2018 4 次提交
  3. 25 5月, 2018 1 次提交
  4. 24 5月, 2018 1 次提交
  5. 23 5月, 2018 1 次提交
  6. 17 5月, 2018 6 次提交
  7. 15 5月, 2018 1 次提交
  8. 14 5月, 2018 2 次提交
  9. 12 5月, 2018 4 次提交
  10. 10 5月, 2018 1 次提交
  11. 09 5月, 2018 1 次提交
  12. 08 5月, 2018 1 次提交
  13. 17 4月, 2018 8 次提交
    • F
      block/swim: Select appropriate drive on device open · b3906535
      Finn Thain 提交于
      The driver supports internal and external FDD units so the floppy_open
      function must not hard-code the drive location.
      
      Cc: Laurent Vivier <lvivier@redhat.com>
      Cc: Jens Axboe <axboe@kernel.dk>
      Cc: stable@vger.kernel.org # v4.14+
      Tested-by: NStan Johnson <userm57@yahoo.com>
      Signed-off-by: NFinn Thain <fthain@telegraphics.com.au>
      Acked-by: NLaurent Vivier <lvivier@redhat.com>
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      b3906535
    • F
      block/swim: Fix IO error at end of medium · 5a13388d
      Finn Thain 提交于
      Reading to the end of a 720K disk results in an IO error instead of EOF
      because the block layer thinks the disk has 2880 sectors. (Partly this
      is a result of inverted logic of the ONEMEG_MEDIA bit that's now fixed.)
      
      Initialize the density and head count in swim_add_floppy() to agree
      with the device size passed to set_capacity() during drive probe.
      
      Call set_capacity() again upon device open, after refreshing the density
      and head count values.
      
      Cc: Laurent Vivier <lvivier@redhat.com>
      Cc: Jens Axboe <axboe@kernel.dk>
      Cc: stable@vger.kernel.org # v4.14+
      Tested-by: NStan Johnson <userm57@yahoo.com>
      Signed-off-by: NFinn Thain <fthain@telegraphics.com.au>
      Acked-by: NLaurent Vivier <lvivier@redhat.com>
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      5a13388d
    • F
      block/swim: Check drive type · 8a500df6
      Finn Thain 提交于
      The SWIM chip is compatible with GCR-mode Sony 400K/800K drives but
      this driver only supports MFM mode. Therefore only Sony FDHD drives
      are supported. Skip incompatible drives.
      
      Cc: Laurent Vivier <lvivier@redhat.com>
      Cc: Jens Axboe <axboe@kernel.dk>
      Cc: stable@vger.kernel.org # v4.14+
      Tested-by: NStan Johnson <userm57@yahoo.com>
      Signed-off-by: NFinn Thain <fthain@telegraphics.com.au>
      Acked-by: NLaurent Vivier <lvivier@redhat.com>
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      8a500df6
    • F
      block/swim: Rename macros to avoid inconsistent inverted logic · 56a1c5ee
      Finn Thain 提交于
      The Sony drive status bits use active-low logic. The swim_readbit()
      function converts that to 'C' logic for readability. Hence, the
      sense of the names of the status bit macros should not be inverted.
      
      Mostly they are correct. However, the TWOMEG_DRIVE, MFM_MODE and
      TWOMEG_MEDIA macros have inverted sense (like MkLinux). Fix this
      inconsistency and make the following patches less confusing.
      
      The same problem affects swim3.c so fix that too.
      
      No functional change.
      
      The FDHD drive status bits are documented in sonydriv.cpp from MAME
      and in swimiii.h from MkLinux.
      
      Cc: Laurent Vivier <lvivier@redhat.com>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: linuxppc-dev@lists.ozlabs.org
      Cc: Jens Axboe <axboe@kernel.dk>
      Cc: stable@vger.kernel.org # v4.14+
      Tested-by: NStan Johnson <userm57@yahoo.com>
      Signed-off-by: NFinn Thain <fthain@telegraphics.com.au>
      Acked-by: NLaurent Vivier <lvivier@redhat.com>
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      56a1c5ee
    • F
      block/swim: Don't log an error message for an invalid ioctl · 8e2ab5a4
      Finn Thain 提交于
      The 'eject' shell command may send various different ioctl commands.
      This leads to error messages on the console even though the FDEJECT
      ioctl succeeds.
      
      ~# eject floppy
      SWIM floppy_ioctl: unknown cmd 21257
      SWIM floppy_ioctl: unknown cmd 1
      
      Don't log an error message for an invalid ioctl, just do as the
      swim3 driver does and return -ENOTTY.
      
      Cc: Laurent Vivier <lvivier@redhat.com>
      Cc: Jens Axboe <axboe@kernel.dk>
      Cc: stable@vger.kernel.org # v4.14+
      Tested-by: NStan Johnson <userm57@yahoo.com>
      Signed-off-by: NFinn Thain <fthain@telegraphics.com.au>
      Acked-by: NLaurent Vivier <lvivier@redhat.com>
      Reviewed-by: NGeert Uytterhoeven <geert@linux-m68k.org>
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      8e2ab5a4
    • F
      block/swim: Remove extra put_disk() call from error path · c1d6207c
      Finn Thain 提交于
      Cc: Laurent Vivier <lvivier@redhat.com>
      Cc: Jens Axboe <axboe@kernel.dk>
      Cc: stable@vger.kernel.org # v4.14+
      Fixes: 103db8b2 ("[PATCH] swim: stop sharing request queue across multiple gendisks")
      Tested-by: NStan Johnson <userm57@yahoo.com>
      Signed-off-by: NFinn Thain <fthain@telegraphics.com.au>
      Acked-by: NLaurent Vivier <lvivier@redhat.com>
      Reviewed-by: NGeert Uytterhoeven <geert@linux-m68k.org>
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      c1d6207c
    • F
      block/swim: Fix array bounds check · 7ae6a2b6
      Finn Thain 提交于
      In the floppy_find() function in swim.c is a call to
      get_disk(swd->unit[drive].disk). The actual parameter to this call
      can be a NULL pointer when drive == swd->floppy_count. This causes
      an oops in get_disk().
      
      Data read fault at 0x00000198 in Super Data (pc=0x1be5b6)
      BAD KERNEL BUSERR
      Oops: 00000000
      Modules linked in: swim_mod ipv6 mac8390
      PC: [<001be5b6>] get_disk+0xc/0x76
      SR: 2004  SP: 9a078bc1  a2: 0213ed90
      d0: 00000000    d1: 00000000    d2: 00000000    d3: 000000ff
      d4: 00000002    d5: 02983590    a0: 02332e00    a1: 022dfd64
      Process dd (pid: 285, task=020ab25b)
      Frame format=B ssw=074d isc=4a88 isb=6732 daddr=00000198 dobuf=00000000
      baddr=001be5bc dibuf=bfffffff ver=f
      Stack from 022dfca4:
              00000000 0203fc00 0213ed90 022dfcc0 02982936 00000000 00200000 022dfd08
              0020f85a 00200000 022dfd64 02332e00 004040fc 00000014 001be77e 022dfd64
              00334e4a 001be3f8 0800001d 022dfd64 01c04b60 01c04b70 022aba80 029828f8
              02332e00 022dfd2c 001be7ac 0203fc00 00200000 022dfd64 02103a00 01c04b60
              01c04b60 0200e400 022dfd68 000e191a 00200000 022dfd64 02103a00 0800001d
              00000000 00000003 000b89de 00500000 02103a00 01c04b60 02103a08 01c04c2e
      Call Trace: [<02982936>] floppy_find+0x3e/0x4a [swim_mod]
       [<00200000>] uart_remove_one_port+0x1a2/0x260
       [<0020f85a>] kobj_lookup+0xde/0x132
       [<00200000>] uart_remove_one_port+0x1a2/0x260
       [<001be77e>] get_gendisk+0x0/0x130
       [<00334e4a>] mutex_lock+0x0/0x2e
       [<001be3f8>] disk_block_events+0x0/0x6c
       [<029828f8>] floppy_find+0x0/0x4a [swim_mod]
       [<001be7ac>] get_gendisk+0x2e/0x130
       [<00200000>] uart_remove_one_port+0x1a2/0x260
       [<000e191a>] __blkdev_get+0x32/0x45a
       [<00200000>] uart_remove_one_port+0x1a2/0x260
       [<000b89de>] complete_walk+0x0/0x8a
       [<000e1e22>] blkdev_get+0xe0/0x29a
       [<000e1fdc>] blkdev_open+0x0/0xb0
       [<000b89de>] complete_walk+0x0/0x8a
       [<000e1fdc>] blkdev_open+0x0/0xb0
       [<000e01cc>] bd_acquire+0x74/0x8a
       [<000e205c>] blkdev_open+0x80/0xb0
       [<000e1fdc>] blkdev_open+0x0/0xb0
       [<000abf24>] do_dentry_open+0x1a4/0x322
       [<00020000>] __do_proc_douintvec+0x22/0x27e
       [<000b89de>] complete_walk+0x0/0x8a
       [<000baa62>] link_path_walk+0x0/0x48e
       [<000ba3f8>] inode_permission+0x20/0x54
       [<000ac0e4>] vfs_open+0x42/0x78
       [<000bc372>] path_openat+0x2b2/0xeaa
       [<000bc0c0>] path_openat+0x0/0xeaa
       [<0004463e>] __irq_wake_thread+0x0/0x4e
       [<0003a45a>] task_tick_fair+0x18/0xc8
       [<000bd00a>] do_filp_open+0xa0/0xea
       [<000abae0>] do_sys_open+0x11a/0x1ee
       [<00020000>] __do_proc_douintvec+0x22/0x27e
       [<000abbf4>] SyS_open+0x1e/0x22
       [<00020000>] __do_proc_douintvec+0x22/0x27e
       [<00002b40>] syscall+0x8/0xc
       [<00020000>] __do_proc_douintvec+0x22/0x27e
       [<0000c00b>] dyadic+0x1/0x28
      Code: 4e5e 4e75 4e56 fffc 2f0b 2f02 266e 0008 <206b> 0198 4a88 6732 2428 002c 661e 486b 0058 4eb9 0032 0b96 588f 4a88 672c 2008
      Disabling lock debugging due to kernel taint
      
      Fix the array index bounds check to avoid this.
      
      Cc: Laurent Vivier <lvivier@redhat.com>
      Cc: Jens Axboe <axboe@kernel.dk>
      Cc: stable@vger.kernel.org # v4.14+
      Fixes: 8852ecd9 ("[PATCH] m68k: mac - Add SWIM floppy support")
      Tested-by: NStan Johnson <userm57@yahoo.com>
      Signed-off-by: NFinn Thain <fthain@telegraphics.com.au>
      Acked-by: NLaurent Vivier <lvivier@redhat.com>
      Reviewed-by: NGeert Uytterhoeven <geert@linux-m68k.org>
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      7ae6a2b6
    • F
      m68k/mac: Don't remap SWIM MMIO region · b64576cb
      Finn Thain 提交于
      For reasons I don't understand, calling ioremap() then iounmap() on
      the SWIM MMIO region causes a hang on 68030 (but not on 68040).
      
      ~# modprobe swim_mod
      SWIM floppy driver Version 0.2 (2008-10-30)
      SWIM device not found !
      watchdog: BUG: soft lockup - CPU#0 stuck for 23s! [modprobe:285]
      Modules linked in: swim_mod(+)
      Format 00  Vector: 0064  PC: 000075aa  Status: 2000    Not tainted
      ORIG_D0: ffffffff  D0: d00c0000  A2: 007c2370  A1: 003f810c
      A0: 00040000  D5: d0096800  D4: d0097e00
      D3: 00000001  D2: 00000003  D1: 00000000
      Non-Maskable Interrupt
      Modules linked in: swim_mod(+)
      PC: [<000075ba>] __iounmap+0x24/0x10e
      SR: 2000  SP: 007abc48  a2: 007c2370
      d0: d00c0000    d1: 000001a0    d2: 00000019    d3: 00000001
      d4: d0097e00    d5: d0096800    a0: 00040000    a1: 003f810c
      Process modprobe (pid: 285, task=007c2370)
      Frame format=0
      Stack from 007abc7c:
              ffffffed 00000000 006a4060 004712e0 007abca0 000076ea d0080000 00080000
              010bb4b8 007abcd8 010ba542 d0096000 00000000 00000000 00000001 010bb59c
              00000000 007abf30 010bb4b8 0047760a 0047763c 00477612 00616540 007abcec
              0020a91a 00477600 0047760a 010bb4cc 007abd18 002092f2 0047760a 00333b06
              007abd5c 00000000 0047760a 010bb4cc 00404f90 004776b8 00000001 007abd38
              00209446 010bb4cc 0047760a 010bb4cc 0020938e 0031f8be 00616540 007abd64
      Call Trace: [<000076ea>] iounmap+0x46/0x5a
       [<00080000>] shrink_page_list+0x7f6/0xe06
       [<010ba542>] swim_probe+0xe4/0x496 [swim_mod]
       [<0020a91a>] platform_drv_probe+0x20/0x5e
       [<002092f2>] driver_probe_device+0x21c/0x2b8
       [<00333b06>] mutex_lock+0x0/0x2e
       [<00209446>] __driver_attach+0xb8/0xce
       [<0020938e>] __driver_attach+0x0/0xce
       [<0031f8be>] klist_next+0x0/0xa0
       [<00207562>] bus_for_each_dev+0x74/0xba
       [<000344c0>] blocking_notifier_call_chain+0x0/0x20
       [<00333b06>] mutex_lock+0x0/0x2e
       [<00208e44>] driver_attach+0x1a/0x1e
       [<0020938e>] __driver_attach+0x0/0xce
       [<00207e26>] bus_add_driver+0x188/0x234
       [<000344c0>] blocking_notifier_call_chain+0x0/0x20
       [<00209894>] driver_register+0x58/0x104
       [<000344c0>] blocking_notifier_call_chain+0x0/0x20
       [<010bd000>] swim_init+0x0/0x2c [swim_mod]
       [<0020a7be>] __platform_driver_register+0x38/0x3c
       [<010bd028>] swim_init+0x28/0x2c [swim_mod]
       [<000020dc>] do_one_initcall+0x38/0x196
       [<000344c0>] blocking_notifier_call_chain+0x0/0x20
       [<003331cc>] mutex_unlock+0x0/0x3e
       [<00333b06>] mutex_lock+0x0/0x2e
       [<003331cc>] mutex_unlock+0x0/0x3e
       [<00333b06>] mutex_lock+0x0/0x2e
       [<003331cc>] mutex_unlock+0x0/0x3e
       [<00333b06>] mutex_lock+0x0/0x2e
       [<003331cc>] mutex_unlock+0x0/0x3e
       [<00333b06>] mutex_lock+0x0/0x2e
       [<00075008>] __free_pages+0x0/0x38
       [<000045c0>] mangle_kernel_stack+0x30/0xda
       [<000344c0>] blocking_notifier_call_chain+0x0/0x20
       [<003331cc>] mutex_unlock+0x0/0x3e
       [<00333b06>] mutex_lock+0x0/0x2e
       [<0005ced4>] do_init_module+0x42/0x266
       [<010bd000>] swim_init+0x0/0x2c [swim_mod]
       [<000344c0>] blocking_notifier_call_chain+0x0/0x20
       [<0005eda0>] load_module+0x1a30/0x1e70
       [<0000465d>] mangle_kernel_stack+0xcd/0xda
       [<00331c64>] __generic_copy_from_user+0x0/0x46
       [<0033256e>] _cond_resched+0x0/0x32
       [<00331b9c>] memset+0x0/0x98
       [<0033256e>] _cond_resched+0x0/0x32
       [<0005f25c>] SyS_init_module+0x7c/0x112
       [<00002000>] _start+0x0/0x8
       [<00002000>] _start+0x0/0x8
       [<00331c82>] __generic_copy_from_user+0x1e/0x46
       [<0005f2b2>] SyS_init_module+0xd2/0x112
       [<0000465d>] mangle_kernel_stack+0xcd/0xda
       [<00002b40>] syscall+0x8/0xc
       [<0000465d>] mangle_kernel_stack+0xcd/0xda
       [<0008c00c>] pcpu_balance_workfn+0xb2/0x40e
      Code: 2200 7419 e4a9 e589 2841 d9fc 0000 1000 <2414> 7203 c282 7602 b681 6600 0096 0242 fe00 0482 0000 0000 e9c0 11c3 ed89 2642
      
      There's no need to call ioremap() for the SWIM address range, as it lies
      within the usual IO device region at 0x5000 0000, which has already been
      mapped by head.S.
      
      Remove the redundant ioremap() and iounmap() calls to fix the hang.
      
      Cc: Laurent Vivier <lvivier@redhat.com>
      Cc: stable@vger.kernel.org # v4.14+
      Tested-by: NStan Johnson <userm57@yahoo.com>
      Signed-off-by: NFinn Thain <fthain@telegraphics.com.au>
      Acked-by: NLaurent Vivier <lvivier@redhat.com>
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      b64576cb
  14. 16 4月, 2018 5 次提交
  15. 15 4月, 2018 2 次提交
    • J
      loop: handle short DIO reads · f9de14bc
      Jens Axboe 提交于
      We ran into an issue with loop and btrfs, where btrfs would complain about
      checksum errors. It turns out that is because we don't handle short reads
      at all, we just zero fill the remainder. Worse than that, we don't handle
      the filling properly, which results in loop trying to advance a single
      bio by much more than its size, since it doesn't take chaining into
      account.
      
      Handle short reads appropriately, by simply retrying at the new correct
      offset. End the remainder of the request with EIO, if we get a 0 read.
      
      Fixes: bc07c10a ("block: loop: support DIO & AIO")
      Reviewed-by: NMing Lei <ming.lei@redhat.com>
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      f9de14bc
    • J
      loop: remove cmd->rq member · 1894e916
      Jens Axboe 提交于
      We can always get at the request from the payload, no need to store
      a pointer to it.
      Reviewed-by: NMing Lei <ming.lei@redhat.com>
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      1894e916
  16. 10 4月, 2018 1 次提交
    • O
      loop: fix LOOP_GET_STATUS lock imbalance · bdac616d
      Omar Sandoval 提交于
      Commit 2d1d4c1e made loop_get_status() drop lo_ctx_mutex before
      returning, but the loop_get_status_old(), loop_get_status64(), and
      loop_get_status_compat() wrappers don't call loop_get_status() if the
      passed argument is NULL. The callers expect that the lock is dropped, so
      make sure we drop it in that case, too.
      
      Reported-by: syzbot+31e8daa8b3fc129e75f2@syzkaller.appspotmail.com
      Fixes: 2d1d4c1e ("loop: don't call into filesystem while holding lo_ctl_mutex")
      Signed-off-by: NOmar Sandoval <osandov@fb.com>
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      bdac616d