27 Jul, 2016

1 commit

  • Pull core block updates from Jens Axboe:

    - the big change is the cleanup from Mike Christie, cleaning up our
    uses of command types and modified flags. This is what will throw
    some merge conflicts

    - regression fix for the above for btrfs, from Vincent

    - following up to the above, better packing of struct request from
    Christoph

    - a 2038 fix for blktrace from Arnd

    - a few trivial/spelling fixes from Bart Van Assche

    - a front merge check fix from Damien, which could cause issues on
    SMR drives

    - Atari partition fix from Gabriel

    - convert cfq to highres timers, since jiffies isn't granular enough
    for some devices these days. From Jan and Jeff

    - CFQ priority boost fix idle classes, from me

    - cleanup series from Ming, improving our bio/bvec iteration

    - a direct issue fix for blk-mq from Omar

    - fix for plug merging not involving the IO scheduler, like we do for
    other types of merges. From Tahsin

    - expose DAX type internally and through sysfs. From Toshi and Yigal

    * 'for-4.8/core' of git://git.kernel.dk/linux-block: (76 commits)
    block: Fix front merge check
    block: do not merge requests without consulting with io scheduler
    block: Fix spelling in a source code comment
    block: expose QUEUE_FLAG_DAX in sysfs
    block: add QUEUE_FLAG_DAX for devices to advertise their DAX support
    Btrfs: fix comparison in __btrfs_map_block()
    block: atari: Return early for unsupported sector size
    Doc: block: Fix a typo in queue-sysfs.txt
    cfq-iosched: Charge at least 1 jiffie instead of 1 ns
    cfq-iosched: Fix regression in bonnie++ rewrite performance
    cfq-iosched: Convert slice_resid from u64 to s64
    block: Convert fifo_time from ulong to u64
    blktrace: avoid using timespec
    block/blk-cgroup.c: Declare local symbols static
    block/bio-integrity.c: Add #include "blk.h"
    block/partition-generic.c: Remove a set-but-not-used variable
    block: bio: kill BIO_MAX_SIZE
    cfq-iosched: temporarily boost queue priority for idle classes
    block: drbd: avoid to use BIO_MAX_SIZE
    block: bio: remove BIO_MAX_SECTORS
    ...

    Linus Torvalds
     

08 Jun, 2016

3 commits

  • We were passing in &nbd for the private data in debugfs_create_file() for the
    flags entry. We expect it to just be nbd, fix this so we get proper output from
    this debugfs entry.

    Signed-off-by: Josef Bacik
    Signed-off-by: Jens Axboe

    Josef Bacik
     
  • This adds a REQ_OP_FLUSH operation that is sent to request_fn
    based drivers by the block layer's flush code, instead of
    sending requests with the request->cmd_flags REQ_FLUSH bit set.

    Signed-off-by: Mike Christie
    Reviewed-by: Christoph Hellwig
    Reviewed-by: Hannes Reinecke
    Signed-off-by: Jens Axboe

    Mike Christie
     
  • The req operation REQ_OP is separated from the rq_flag_bits
    definition. This converts the block layer drivers to
    use req_op to get the op from the request struct.

    Signed-off-by: Mike Christie
    Reviewed-by: Hannes Reinecke
    Signed-off-by: Jens Axboe

    Mike Christie
     

13 Apr, 2016

1 commit


05 Mar, 2016

1 commit

  • The do_div() macro now checks its arguments for the correct type,
    and refuses anything other than u64, so we get a warning about
    nbd_ioctl passing in an loff_t:

    drivers/block/nbd.c: In function '__nbd_ioctl':
    drivers/block/nbd.c:757:77: error: comparison of distinct pointer types lacks a cast [-Werror]

    This changes the nbd code to use div_s64() instead, which takes
    a signed argument.

    Signed-off-by: Arnd Bergmann
    Fixes: 37091fdd831f ("nbd: Create size change events for userspace")
    Signed-off-by: Jens Axboe

    Arnd Bergmann
     

15 Feb, 2016

1 commit

  • The userspace needs to know when nbd devices are ready for use.
    Currently no events are created for the userspace which doesn't work for
    systemd.

    See the discussion here: https://github.com/systemd/systemd/pull/358

    This patch uses a central point to setup the nbd-internal sizes. A ioctl
    to set a size does not lead to a visible size change. The size of the
    block device will be kept at 0 until nbd is connected. As soon as it
    connects, the size will be changed to the real value and a uevent is
    created. When disconnecting, the blockdevice is set to 0 size and
    another uevent is generated.

    Signed-off-by: Markus Pargmann

    Markus Pargmann
     

05 Feb, 2016

5 commits

  • Make the "Attempted send on closed socket" error messages generated in
    nbd_request_handler() ratelimited.

    When the nbd socket is shutdown, the nbd_request_handler() function emits
    an error message for every request remaining in its queue. If the queue
    is large, this will spam a large amount of messages to the log. There's
    no need for a separate error message for each request, so this patch
    ratelimits it.

    In the specific case this was found, the system was virtual and the error
    messages were logged to the serial port, which overwhelmed it.

    Fixes: 4d48a542b427 ("nbd: fix I/O hang on disconnected nbds")
    Signed-off-by: Dan Streetman
    Signed-off-by: Markus Pargmann

    Dan Streetman
     
  • nbd changes properties of the blockdevice depending on flags that were
    received. This patch moves this flag parsing into a separate function
    nbd_parse_flags().

    Signed-off-by: Markus Pargmann

    Markus Pargmann
     
  • Group all variables that are reset after a disconnect into reset
    functions. This patch adds two of these functions, nbd_reset() and
    nbd_bdev_reset().

    Signed-off-by: Markus Pargmann

    Markus Pargmann
     
  • It may be useful to know in the client that a connection timed out. The
    current code returns success for a timeout.

    This patch reports the error code -ETIMEDOUT for a timeout.

    Signed-off-by: Markus Pargmann

    Markus Pargmann
     
  • As discussed on the mailing list, the usage of signals for timeout
    handling has a lot of potential issues. The nbd driver used for some
    time signals for timeouts. These signals where able to get the threads
    out of the blocking socket operations.

    This patch removes all signal usage and uses a socket shutdown instead.
    The socket descriptor itself is cleared later when the whole nbd device
    is closed.

    The tasks_lock is removed as we do not depend on this anymore. Instead
    a new lock for the socket is introduced so we can safely work with the
    socket in the timeout handler outside of the two main threads.

    Cc: Oleg Nesterov
    Cc: Christoph Hellwig
    Signed-off-by: Markus Pargmann
    Reviewed-by: Christoph Hellwig

    Markus Pargmann
     

03 Feb, 2016

1 commit

  • Static checker complains about the implemented error handling. It is
    indeed wrong. We don't care about the return values of created debugfs
    files.

    We only have to check the return values of created dirs for NULL
    pointer. If we use a null pointer as parent directory for files, this
    may lead to debugfs files in wrong places.

    Signed-off-by: Markus Pargmann

    Markus Pargmann
     

09 Jan, 2016

1 commit


07 Nov, 2015

1 commit

  • 1. Rename dequeue_signal_lock() to kernel_dequeue_signal(). This
    matches another "for kthreads only" kernel_sigaction() helper.

    2. Remove the "tsk" and "mask" arguments, they are always current
    and current->blocked. And it is simply wrong if tsk != current.

    3. We could also remove the 3rd "siginfo_t *info" arg but it looks
    potentially useful. However we can simplify the callers if we
    change kernel_dequeue_signal() to accept info => NULL.

    4. Remove _irqsave, it is never called from atomic context.

    Signed-off-by: Oleg Nesterov
    Reviewed-by: Tejun Heo
    Cc: David Woodhouse
    Cc: Felipe Balbi
    Cc: Markus Pargmann
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Oleg Nesterov
     

09 Oct, 2015

1 commit

  • The timeout handling introduced in
    7e2893a16d3e (nbd: Fix timeout detection)
    introduces a race condition which may lead to killing of tasks that are
    not in nbd context anymore. This was not observed or reproducable yet.

    This patch adds locking to critical use of task_recv and task_send to
    avoid killing tasks that already left the NBD thread functions. This
    lock is only acquired if a timeout occures or the nbd device
    starts/stops.

    Reported-by: Ben Hutchings
    Signed-off-by: Markus Pargmann
    Reviewed-by: Ben Hutchings
    Fixes: 7e2893a16d3e ("nbd: Fix timeout detection")
    Signed-off-by: Jens Axboe

    Markus Pargmann
     

17 Aug, 2015

10 commits

  • The flags variable is used as u32 variable. This patch changes the type
    to be u32.

    Signed-off-by: Markus Pargmann
    Signed-off-by: Jens Axboe

    Markus Pargmann
     
  • This patch renames functions so that it is clear what the function does.
    Otherwise it is not directly understandable what for example 'do_it' means.

    Signed-off-by: Markus Pargmann
    Signed-off-by: Jens Axboe

    Markus Pargmann
     
  • Signed-off-by: Markus Pargmann
    Acked-by: Pavel Machek
    Signed-off-by: Jens Axboe

    Markus Pargmann
     
  • Add some debugfs files that help to understand the internal state of
    NBD. This exports the different sizes, flags, tasks and so on.

    Signed-off-by: Markus Pargmann
    Signed-off-by: Jens Axboe

    Markus Pargmann
     
  • This patch uses nbd->task_recv to determine the value of the previously
    used variable 'pid' for sysfs.

    Signed-off-by: Markus Pargmann
    Signed-off-by: Jens Axboe

    Markus Pargmann
     
  • This message was a warning without a reason. This patch moves it into
    nbd_clear_que and transforms it to a debug message.

    Signed-off-by: Markus Pargmann
    Signed-off-by: Jens Axboe

    Markus Pargmann
     
  • Instead of a variable 'harderror' we can simply try to correctly
    propagate errors to the userspace.

    This patch removes the harderror variable and passes errors through
    error pointers and nbd_do_it back to the userspace.

    Signed-off-by: Markus Pargmann
    Acked-by: Pavel Machek
    Signed-off-by: Jens Axboe

    Markus Pargmann
     
  • This patch restructures sock_shutdown to avoid having the main code path
    in an if block.

    Signed-off-by: Markus Pargmann
    Acked-by: Pavel Machek
    Signed-off-by: Jens Axboe

    Markus Pargmann
     
  • Move the conditional lock from sock_shutdown into the surrounding code.

    Signed-off-by: Markus Pargmann
    Acked-by: Pavel Machek
    Signed-off-by: Jens Axboe

    Markus Pargmann
     
  • At the moment the nbd timeout just detects hanging tcp operations. This
    is not enough to detect a hanging or bad connection as expected of a
    timeout.

    This patch redesigns the timeout detection to include some more cases.
    The timeout is now in relation to replies from the server. If the server
    does not send replies within the timeout the connection will be shut
    down.

    The patch adds a continous timer 'timeout_timer' that is setup in one of
    two cases:
    - The request list is empty and we are sending the first request out to
    the server. We want to have a reply within the given timeout,
    otherwise we consider the connection to be dead.
    - A server response was received. This means the server is still
    communicating with us. The timer is reset to the timeout value.

    The timer is not stopped if the list becomes empty. It will just trigger
    a timeout which will directly leave the handling routine again as the
    request list is empty.

    The whole patch does not use any additional explicit locking. The
    list_empty() calls are safe to be used concurrently. The timer is locked
    internally as we just use mod_timer and del_timer_sync().

    The patch is based on the idea of Michal Belczyk with a previous
    different implementation.

    Cc: Michal Belczyk
    Cc: Hermann Lauer
    Signed-off-by: Markus Pargmann
    Tested-by: Hermann Lauer
    Signed-off-by: Jens Axboe

    Markus Pargmann
     

17 Jul, 2015

1 commit


20 May, 2015

1 commit


06 May, 2015

2 commits


03 Apr, 2015

7 commits


05 Mar, 2015

1 commit


05 Oct, 2014

1 commit

  • Clear QUEUE_FLAG_ADD_RANDOM in all block drivers that set
    QUEUE_FLAG_NONROT.

    Historically, all block devices have automatically made entropy
    contributions. But as previously stated in commit e2e1a148 ("block: add
    sysfs knob for turning off disk entropy contributions"):
    - On SSD disks, the completion times aren't as random as they
    are for rotational drives. So it's questionable whether they
    should contribute to the random pool in the first place.
    - Calling add_disk_randomness() has a lot of overhead.

    There are more reliable sources for randomness than non-rotational block
    devices. From a security perspective it is better to err on the side of
    caution than to allow entropy contributions from unreliable "random"
    sources.

    Signed-off-by: Mike Snitzer
    Signed-off-by: Jens Axboe

    Mike Snitzer
     

07 Jun, 2014

1 commit

  • Len field is already set to zero, but not the from field which is sent
    as 0xfffffffffffffe00. This makes no sense, and may cause confuse
    server implementations doing sanity checks (qemu-nbd is an example.)

    Signed-off-by: Hani Benhabiles
    Cc: Paul Clements
    Cc: Paul Clements
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Hani Benhabiles