sysfs-class-rnbd-client 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. What: /sys/class/rnbd-client
  2. Date: Feb 2020
  3. KernelVersion: 5.7
  4. Contact: Jack Wang <[email protected]> Danil Kipnis <[email protected]>
  5. Description: Provide information about RNBD-client.
  6. All sysfs files that are not read-only provide the usage information on read:
  7. Example::
  8. # cat /sys/class/rnbd-client/ctl/map_device
  9. > Usage: echo "sessname=<name of the rtrs session> path=<[srcaddr,]dstaddr>
  10. > [path=<[srcaddr,]dstaddr>] device_path=<full path on remote side>
  11. > [access_mode=<ro|rw|migration>] > map_device
  12. >
  13. > addr ::= [ ip:<ipv4> | ip:<ipv6> | gid:<gid> ]
  14. What: /sys/class/rnbd-client/ctl/map_device
  15. Date: Feb 2020
  16. KernelVersion: 5.7
  17. Contact: Jack Wang <[email protected]> Danil Kipnis <[email protected]>
  18. Description: Expected format is the following::
  19. sessname=<name of the rtrs session>
  20. path=<[srcaddr,]dstaddr> [path=<[srcaddr,]dstaddr> ...]
  21. device_path=<full path on remote side>
  22. [access_mode=<ro|rw|migration>]
  23. Where:
  24. sessname:
  25. accepts a string not bigger than 256 chars, which identifies
  26. a given session on the client and on the server.
  27. I.e. "clt_hostname-srv_hostname" could be a natural choice.
  28. path:
  29. describes a connection between the client and the server by
  30. specifying destination and, when required, the source address.
  31. The addresses are to be provided in the following format::
  32. ip:<IPv6>
  33. ip:<IPv4>
  34. gid:<GID>
  35. for example::
  36. path=ip:10.0.0.66
  37. The single addr is treated as the destination.
  38. The connection will be established to this server from any client IP address.
  39. ::
  40. path=ip:10.0.0.66,ip:10.0.1.66
  41. First addr is the source address and the second is the destination.
  42. If multiple "path=" options are specified multiple connection
  43. will be established and data will be sent according to
  44. the selected multipath policy (see RTRS mp_policy sysfs entry description).
  45. device_path:
  46. Path to the block device on the server side. Path is specified
  47. relative to the directory on server side configured in the
  48. 'dev_search_path' module parameter of the rnbd_server.
  49. The rnbd_server prepends the <device_path> received from client
  50. with <dev_search_path> and tries to open the
  51. <dev_search_path>/<device_path> block device. On success,
  52. a /dev/rnbd<N> device file, a /sys/block/rnbd<N>/
  53. directory and an entry in /sys/class/rnbd-client/ctl/devices
  54. will be created.
  55. If 'dev_search_path' contains '%SESSNAME%', then each session can
  56. have different devices namespace, e.g. server was configured with
  57. the following parameter "dev_search_path=/run/rnbd-devs/%SESSNAME%",
  58. client has this string "sessname=blya device_path=sda", then server
  59. will try to open: /run/rnbd-devs/blya/sda.
  60. access_mode:
  61. the access_mode parameter specifies if the device is to be
  62. mapped as "ro" read-only or "rw" read-write. The server allows
  63. a device to be exported in rw mode only once. The "migration"
  64. access mode has to be specified if a second mapping in read-write
  65. mode is desired.
  66. By default "rw" is used.
  67. nr_poll_queues
  68. specifies the number of poll-mode queues. If the IO has HIPRI flag,
  69. the block-layer will send the IO via the poll-mode queue.
  70. For fast network and device the polling is faster than interrupt-base
  71. IO handling because it saves time for context switching, switching to
  72. another process, handling the interrupt and switching back to the
  73. issuing process.
  74. Set -1 if you want to set it as the number of CPUs
  75. By default rnbd client creates only irq-mode queues.
  76. NOTICE: MUST make a unique session for a device using the poll-mode queues.
  77. Exit Codes:
  78. If the device is already mapped it will fail with EEXIST. If the input
  79. has an invalid format it will return EINVAL. If the device path cannot
  80. be found on the server, it will fail with ENOENT.
  81. Finding device file after mapping
  82. ---------------------------------
  83. After mapping, the device file can be found by:
  84. o The symlink /sys/class/rnbd-client/ctl/devices/<device_id>@<session_name>
  85. points to /sys/block/<dev-name>. The last part of the symlink destination
  86. is the same as the device name. By extracting the last part of the
  87. path the path to the device /dev/<dev-name> can be build.
  88. * /dev/block/$(cat /sys/class/rnbd-client/ctl/devices/<device_id>@<session_name>/dev)
  89. How to find the <device_id> of the device is described on the next
  90. section.
  91. What: /sys/class/rnbd-client/ctl/devices/
  92. Date: Feb 2020
  93. KernelVersion: 5.7
  94. Contact: Jack Wang <[email protected]> Danil Kipnis <[email protected]>
  95. Description: For each device mapped on the client a new symbolic link is created as
  96. /sys/class/rnbd-client/ctl/devices/<device_id>@<session_name>, which points
  97. to the block device created by rnbd (/sys/block/rnbd<N>/).
  98. The <device_id> of each device is created as follows:
  99. - If the 'device_path' provided during mapping contains slashes ("/"),
  100. they are replaced by exclamation mark ("!") and used as as the
  101. <device_id>. Otherwise, the <device_id> will be the same as the
  102. "device_path" provided.