[lkml]   [2021]   [Feb]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH v5 6/6] docs: device-mapper: 'noexcl' option for dm-linear
New 'noexcl' option allow to open underlying block-device
without FMODE_EXCL flag.

Signed-off-by: Sergei Shtepa <>
.../admin-guide/device-mapper/linear.rst | 26 ++++++++++++++++---
1 file changed, 23 insertions(+), 3 deletions(-)

diff --git a/Documentation/admin-guide/device-mapper/linear.rst b/Documentation/admin-guide/device-mapper/linear.rst
index 9d17fc6e64a9..f035cd7ad78c 100644
--- a/Documentation/admin-guide/device-mapper/linear.rst
+++ b/Documentation/admin-guide/device-mapper/linear.rst
@@ -6,12 +6,22 @@ Device-Mapper's "linear" target maps a linear range of the Device-Mapper
device onto a linear range of another device. This is the basic building
block of logical volume managers.

-Parameters: <dev path> <offset>
+Parameters: <dev path> <offset> [<options>]
<dev path>:
- Full pathname to the underlying block-device, or a
+ Full pathname to the underlying block-device, or a
"major:minor" device-number.
- Starting sector within the device.
+ Starting sector within the device.
+ <options>:
+ Options allow to set the exclusivity mode. The exclusivity mode
+ can be 'excl' and 'noexcl'. By default, then options is not set,
+ the 'excl' mode is used. 'noexcl' mode allow to open device
+ without FMODE_EXCL flag. This allow to create liner device with
+ underlying block-device that are already used by the system. For
+ example, the file system on this device is already mounted.
+ The 'noexcl' option should be used when creating dm devices that
+ will be used as acceptor when connecting the device mapper to an
+ existing block device with the 'dmsetup remap' command.

Example scripts
@@ -61,3 +71,13 @@ Example scripts

`echo \"$table\" | dmsetup create $name`;
+ #!/bin/sh
+ # Create linear device and remap all requests from the original device
+ # to new linear.
+ DEV=$1
+ echo "0 `blockdev --getsz $DEV` linear $DEV 0 noexcl" | dmsetup create dm-noexcl
+ dmsetup remap start dm-noexcl $DEV
 \ /
  Last update: 2021-02-09 15:34    [W:0.113 / U:1.076 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site