Commit Graph
15 Commits
Author SHA1 Message Date
Guoqing Jiang d7aaeef293 rnbd: no need to set bi_end_io in rnbd_bio_map_kern
Since we always set bi_end_io after call rnbd_bio_map_kern, so the
setting in rnbd_bio_map_kern is redundant.

Signed-off-by: Guoqing Jiang <[email protected]>
Acked-by: Danil Kipnis <[email protected]>
Acked-by: Jack Wang <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
2020-08-06 07:30:04 -06:00
Guoqing Jiang 735d77d4fd rnbd: remove rnbd_dev_submit_io
The function only has one caller, so let's open code it in process_rdma.
Another bonus is we can avoid push/pop stack, since we need to pass 8
arguments to rnbd_dev_submit_io.

Signed-off-by: Guoqing Jiang <[email protected]>
Acked-by: Danil Kipnis <[email protected]>
Acked-by: Jack Wang <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
2020-08-06 07:30:04 -06:00
Danil Kipnis cdb685cb91 RDMA/rnbd: Fix compilation error when CONFIG_MODULES is disabled
module_is_live function is only defined when CONFIG_MODULES is enabled.
Use try_module_get instead to check whether the module is being removed.

When module unload and manuall unmapping is happening in parallel, we can
try removing the symlink twice: rnbd_client_exit
vs. rnbd_clt_unmap_dev_store.

This is probably not the best way to deal with this race in general, but
for now this fixes the compilation issue when CONFIG_MODULES is disabled
and has no functional impact. Regression tests passed.

Fixes: 1eb54f8f5d ("block/rnbd: client: sysfs interface functions")
Link: https://lore.kernel.org/r/[email protected]
Reported-by: Randy Dunlap <[email protected]>
Suggested-by: Guoqing Jiang <[email protected]>
Signed-off-by: Danil Kipnis <[email protected]>
Acked-by: Randy Dunlap <[email protected]>
Signed-off-by: Jason Gunthorpe <[email protected]>
2020-05-22 15:50:22 -03:00
Dan Carpenter 47393fb57b block/rnbd: Fix an IS_ERR() vs NULL check in find_or_create_sess()
The alloc_sess() function returns error pointers, it never returns NULL.

Fixes: f7a7a5c228 ("block/rnbd: client: main functionality")
Link: https://lore.kernel.org/r/20200519120347.GD42765@mwanda
Signed-off-by: Dan Carpenter <[email protected]>
Reviewed-by: Jack Wang <[email protected]>
Signed-off-by: Jason Gunthorpe <[email protected]>
2020-05-22 11:51:36 -03:00
Danil Kipnis d6ea395072 rnbd/rtrs: Pass max segment size from blk user to the rdma library
When Block Device Layer is disabled, BLK_MAX_SEGMENT_SIZE is undefined.
The rtrs is a transport library and should compile independently of the
block layer. The desired max segment size should be passed down by the
user.

Introduce max_segment_size parameter for the rtrs_clt_open() call.

Fixes: f7a7a5c228 ("block/rnbd: client: main functionality")
Fixes: 6a98d71dae ("RDMA/rtrs: client: main functionality")
Fixes: cb80329c94 ("RDMA/rtrs: client: private header with client structs and functions")
Fixes: b5c27cdb09 ("RDMA/rtrs: public interface header to establish RDMA connections")
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Danil Kipnis <[email protected]>
Reported-by: Randy Dunlap <[email protected]>
Acked-by: Randy Dunlap <[email protected]> # build-tested
Signed-off-by: Jason Gunthorpe <[email protected]>
2020-05-19 20:43:26 -03:00
Jack Wang aa4d16e44f block/rnbd: a bit of documentation
README with description of major sysfs entries, sysfs documentation
are moved to ABI dir as Bart suggested.

Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Danil Kipnis <[email protected]>
Signed-off-by: Jack Wang <[email protected]>
Reviewed-by: Bart Van Assche <[email protected]>
Acked-by: Jens Axboe <[email protected]>
Signed-off-by: Jason Gunthorpe <[email protected]>
2020-05-17 18:57:17 -03:00
Jack Wang bc01885342 block/rnbd: include client and server modules into kernel compilation
Add rnbd Makefile, Kconfig and also corresponding lines into upper block
layer files.

Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Danil Kipnis <[email protected]>
Signed-off-by: Jack Wang <[email protected]>
Reviewed-by: Bart Van Assche <[email protected]>
Acked-by: Jens Axboe <[email protected]>
Signed-off-by: Jason Gunthorpe <[email protected]>
2020-05-17 18:57:17 -03:00
Jack Wang 8cee532f46 block/rnbd: server: sysfs interface functions
This is the sysfs interface to rnbd mapped devices on server side:

  /sys/class/rnbd-server/ctl/devices/<device_name>/
    |- block_dev
    |  *** link pointing to the corresponding block device sysfs entry
    |
    |- sessions/<session-name>/
    |  *** sessions directory
       |
       |- read_only
       |  *** is devices mapped as read only
       |
       |- mapping_path
          *** relative device path provided by the client during mapping

Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Danil Kipnis <[email protected]>
Signed-off-by: Jack Wang <[email protected]>
Reviewed-by: Bart Van Assche <[email protected]>
Acked-by: Jens Axboe <[email protected]>
Signed-off-by: Jason Gunthorpe <[email protected]>
2020-05-17 18:57:17 -03:00
Jack Wang f0aad9baad block/rnbd: server: functionality for IO submitting to block dev
This provides helper functions for IO submitting to block dev.

Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Danil Kipnis <[email protected]>
Signed-off-by: Jack Wang <[email protected]>
Reviewed-by: Bart Van Assche <[email protected]>
Acked-by: Jens Axboe <[email protected]>
Signed-off-by: Jason Gunthorpe <[email protected]>
2020-05-17 18:57:17 -03:00
Jack Wang 2de6c8de19 block/rnbd: server: main functionality
This is main functionality of rnbd-server module, which handles RTRS
events and rnbd protocol requests, like map (open) or unmap (close)
device.  Also server side is responsible for processing incoming IBTRS IO
requests and forward them to local mapped devices.

Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Danil Kipnis <[email protected]>
Signed-off-by: Jack Wang <[email protected]>
Reviewed-by: Bart Van Assche <[email protected]>
Acked-by: Jens Axboe <[email protected]>
Signed-off-by: Jason Gunthorpe <[email protected]>
2020-05-17 18:57:16 -03:00
Jack Wang d4c6957dd0 block/rnbd: server: private header with server structs and functions
This header describes main structs and functions used by rnbd-server
module, namely structs for managing sessions from different clients and
mapped (opened) devices.

Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Danil Kipnis <[email protected]>
Signed-off-by: Jack Wang <[email protected]>
Reviewed-by: Bart Van Assche <[email protected]>
Acked-by: Jens Axboe <[email protected]>
Signed-off-by: Jason Gunthorpe <[email protected]>
2020-05-17 18:57:16 -03:00
Jack Wang 1eb54f8f5d block/rnbd: client: sysfs interface functions
This is the sysfs interface to rnbd block devices on client side:

  /sys/class/rnbd-client/ctl/
    |- map_device
    |  *** maps remote device
    |
    |- devices/
       *** all mapped devices

  /sys/block/rnbd<N>/rnbd/
    |- unmap_device
    |  *** unmaps device
    |
    |- state
    |  *** device state
    |
    |- session
    |  *** session name
    |
    |- mapping_path
       *** path of the dev that was mapped on server

Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Danil Kipnis <[email protected]>
Signed-off-by: Jack Wang <[email protected]>
Reviewed-by: Bart Van Assche <[email protected]>
Acked-by: Jens Axboe <[email protected]>
Signed-off-by: Jason Gunthorpe <[email protected]>
2020-05-17 18:57:16 -03:00
Jack Wang f7a7a5c228 block/rnbd: client: main functionality
This is main functionality of rnbd-client module, which provides interface
to map remote device as local block device /dev/rnbd<N> and feeds RTRS
with IO requests.

Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Danil Kipnis <[email protected]>
Signed-off-by: Jack Wang <[email protected]>
Reviewed-by: Bart Van Assche <[email protected]>
Acked-by: Jens Axboe <[email protected]>
Signed-off-by: Jason Gunthorpe <[email protected]>
2020-05-17 18:57:16 -03:00
Jack Wang 90426e89f5 block/rnbd: client: private header with client structs and functions
This header describes main structs and functions used by rnbd-client
module, mainly for managing RNBD sessions and mapped block devices,
creating and destroying sysfs entries.

Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Danil Kipnis <[email protected]>
Signed-off-by: Jack Wang <[email protected]>
Reviewed-by: Bart Van Assche <[email protected]>
Acked-by: Jens Axboe <[email protected]>
Signed-off-by: Jason Gunthorpe <[email protected]>
2020-05-17 18:57:16 -03:00
Jack Wang 219ace6077 block/rnbd: private headers with rnbd protocol structs and helpers
These are common private headers with rnbd protocol structures, logging,
sysfs and other helper functions, which are used on both client and server
sides.

Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Danil Kipnis <[email protected]>
Signed-off-by: Jack Wang <[email protected]>
Reviewed-by: Bart Van Assche <[email protected]>
Acked-by: Jens Axboe <[email protected]>
Signed-off-by: Jason Gunthorpe <[email protected]>
2020-05-17 18:57:15 -03:00