master - locking: avoid descriptor leak for nonblocking mode
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=5de944420224f3b629e...
Commit: 5de944420224f3b629e843f9c190132ed9ff3dca
Parent: 043ff47b0579bffaa63cb023d8850b0e749eb9ce
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Aug 25 11:59:19 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Aug 25 14:12:55 2017 +0200
locking: avoid descriptor leak for nonblocking mode
When file-locking mode failed on locking, such description was leaked
(typically not an issue since command usually exists afterwards).
So shirt close() at the end of function and use it in all error paths.
Also make sure, when interrrupt is detected, it's really not holding
lock and returns 0.
---
WHATS_NEW | 1 +
lib/misc/lvm-flock.c | 13 ++++++++-----
2 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index c8f072f..ac69c16 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.174 -
=================================
+ Fix leaking of file descriptor for non-blocking filebased locking.
Fix check for 2nd mda at end of disk fits if using pvcreate --restorefile.
Use maximum metadataarea size that fits with pvcreate --restorefile.
Always clear cached bootloaderarea when wiping label e.g. in pvcreate.
diff --git a/lib/misc/lvm-flock.c b/lib/misc/lvm-flock.c
index 22eb128..4196313 100644
--- a/lib/misc/lvm-flock.c
+++ b/lib/misc/lvm-flock.c
@@ -116,17 +116,16 @@ static int _do_flock(const char *file, int *fd, int operation, uint32_t nonblock
old_errno = errno;
if (!nonblock) {
sigint_restore();
- if (sigint_caught())
+ if (sigint_caught()) {
log_error("Giving up waiting for lock.");
+ break;
+ }
}
if (r) {
errno = old_errno;
log_sys_error("flock", file);
- if (close(*fd))
- log_sys_debug("close", file);
- *fd = -1;
- return 0;
+ break;
}
if (!stat(file, &buf1) && !fstat(*fd, &buf2) &&
@@ -134,6 +133,10 @@ static int _do_flock(const char *file, int *fd, int operation, uint32_t nonblock
return 1;
} while (!nonblock);
+ if (close(*fd))
+ log_sys_debug("close", file);
+ *fd = -1;
+
return_0;
}
6 years, 3 months
master - man lvmthin: change fsck references
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=043ff47b0579bffaa63...
Commit: 043ff47b0579bffaa63cb023d8850b0e749eb9ce
Parent: e71c3ff18719f240e92bb641b9b9a01b2619cc93
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Thu Aug 24 10:25:01 2017 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu Aug 24 10:25:01 2017 -0500
man lvmthin: change fsck references
to more generic terms like repair.
---
man/lvmthin.7_main | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/man/lvmthin.7_main b/man/lvmthin.7_main
index 1ebeb65..251ba12 100644
--- a/man/lvmthin.7_main
+++ b/man/lvmthin.7_main
@@ -397,7 +397,7 @@ the pmspare LV.
If thin pool metadata is damaged, it may be repairable.
Checking and repairing thin pool metadata is analagous to
-running fsck on a file system.
+running fsck/repair on a file system.
When a thin pool LV is activated, lvm runs the thin_check command
to check the correctness of the metadata on the pool metadata LV.
@@ -774,7 +774,7 @@ While waiting to be extended, the thin pool will queue writes for up to 60
seconds (the default). If data space has not been extended after this
time, the queued writes will return an error to the caller, e.g. the file
system. This can result in file system corruption for non-journaled file
-systems that may require fsck. When a thin pool returns errors for writes
+systems that may require repair. When a thin pool returns errors for writes
to a thin LV, any file system is subject to losing unsynced user data.
The 60 second timeout can be changed or disabled with the dm-thin-pool
@@ -789,7 +789,7 @@ deadlocks. (The timeout applies to all thin pools on the system.)
Writes to thin LVs immediately return an error, and no writes are queued.
In the case of a file system, this can result in corruption that may
-require fsck (the specific consequences depend on the thin LV user.)
+require fs repair (the specific consequences depend on the thin LV user.)
.I data percent
@@ -858,7 +858,7 @@ repair.
.br
See "Manually manage free metadata space of a thin pool LV".
-4. Check and repair file system with fsck.
+4. Check and repair file system.
.SS Automatic extend settings
6 years, 3 months
master - lvmlockd: fix mutex unlock
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=e71c3ff18719f240e92...
Commit: e71c3ff18719f240e92bb641b9b9a01b2619cc93
Parent: 46ddd5520cd4d5415ee936b6cbdb6e1936bc7d26
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Wed Aug 23 11:30:55 2017 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Wed Aug 23 11:30:55 2017 -0500
lvmlockd: fix mutex unlock
Remove an unwanted pthread_mutex_unlock which would
lead to a double unlock.
---
daemons/lvmlockd/lvmlockd-core.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/daemons/lvmlockd/lvmlockd-core.c b/daemons/lvmlockd/lvmlockd-core.c
index da17b71..36d84e2 100644
--- a/daemons/lvmlockd/lvmlockd-core.c
+++ b/daemons/lvmlockd/lvmlockd-core.c
@@ -3842,8 +3842,9 @@ static int add_lock_action(struct action *act)
pthread_mutex_lock(&lockspaces_mutex);
if (ls_name[0])
ls = find_lockspace_name(ls_name);
- pthread_mutex_unlock(&lockspaces_mutex);
if (!ls) {
+ pthread_mutex_unlock(&lockspaces_mutex);
+
if (act->op == LD_OP_UPDATE && act->rt == LD_RT_VG) {
log_debug("lockspace \"%s\" not found ignored for vg update", ls_name);
return -ENOLS;
6 years, 3 months
master - lvmlockd: add comment about temp ls name
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=46ddd5520cd4d5415ee...
Commit: 46ddd5520cd4d5415ee936b6cbdb6e1936bc7d26
Parent: 539a48a328a7ddd1030dd5809a2f9f0df6c1fe70
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Wed Aug 23 11:25:18 2017 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Wed Aug 23 11:25:18 2017 -0500
lvmlockd: add comment about temp ls name
---
daemons/lvmlockd/lvmlockd-core.c | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/daemons/lvmlockd/lvmlockd-core.c b/daemons/lvmlockd/lvmlockd-core.c
index 6fd4b88..da17b71 100644
--- a/daemons/lvmlockd/lvmlockd-core.c
+++ b/daemons/lvmlockd/lvmlockd-core.c
@@ -2652,8 +2652,14 @@ out_act:
ls->drop_vg = drop_vg;
if (ls->lm_type == LD_LM_DLM && !strcmp(ls->name, gl_lsname_dlm))
global_dlm_lockspace_exists = 0;
- /* Avoid a name collision of the same lockspace is added again before this thread is cleaned up. */
- /* FIXME: detect loss of 4 chars? (use 'size(tmp_name) == (MAX_NAME - 4)' and fail??) */
+
+ /*
+ * Avoid a name collision of the same lockspace is added again before
+ * this thread is cleaned up. We just set ls->name to a "junk" value
+ * for the short period until the struct is freed. We could make it
+ * blank or fill it with garbage, but instead set it to REM:<name>
+ * to make it easier to follow progress of freeing is via log_debug.
+ */
dm_strncpy(tmp_name, ls->name, sizeof(tmp_name));
snprintf(ls->name, sizeof(ls->name), "REM:%s", tmp_name);
pthread_mutex_unlock(&lockspaces_mutex);
6 years, 3 months
master - debug: add stack trace point
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=539a48a328a7ddd1030...
Commit: 539a48a328a7ddd1030dd5809a2f9f0df6c1fe70
Parent: c1e3f96c9764b242898914c282fb273803ba89ae
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Aug 22 10:19:52 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Aug 22 10:23:31 2017 +0200
debug: add stack trace point
---
lib/cache/lvmetad.c | 2 +-
libdm/ioctl/libdm-iface.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/cache/lvmetad.c b/lib/cache/lvmetad.c
index 2e0ee51..1ba844f 100644
--- a/lib/cache/lvmetad.c
+++ b/lib/cache/lvmetad.c
@@ -1281,7 +1281,7 @@ int lvmetad_vg_update_finish(struct volume_group *vg)
if (pvl->pv->dev && !lvmetad_pv_found(vg->cmd, &pvl->pv->id, pvl->pv->dev,
vgu->fid ? vgu->fid->fmt : pvl->pv->fmt,
pvl->pv->label_sector, NULL, NULL, NULL))
- return 0;
+ return_0;
}
vg->lvmetad_update_pending = 0;
diff --git a/libdm/ioctl/libdm-iface.c b/libdm/ioctl/libdm-iface.c
index 63d305b..100d0cc 100644
--- a/libdm/ioctl/libdm-iface.c
+++ b/libdm/ioctl/libdm-iface.c
@@ -273,7 +273,7 @@ static int _create_control(const char *control, uint32_t major, uint32_t minor)
*/
ret = _control_exists(control, major, minor);
if (ret == -1)
- return 0; /* Failed to unlink existing incorrect node */
+ return_0; /* Failed to unlink existing incorrect node */
if (ret)
return 1; /* Already exists and correct */
@@ -284,7 +284,7 @@ static int _create_control(const char *control, uint32_t major, uint32_t minor)
(void) dm_prepare_selinux_context(NULL, 0);
if (!ret)
- return 0;
+ return_0;
log_verbose("Creating device %s (%u, %u)", control, major, minor);
6 years, 3 months
master - lvmcache: check for lvmcache_foreach_mda return code
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=c1e3f96c9764b242898...
Commit: c1e3f96c9764b242898914c282fb273803ba89ae
Parent: d4ce98de4d6c7c3ddeca0e380a18bbdc102e6c3a
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Aug 16 14:29:12 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Aug 22 10:23:31 2017 +0200
lvmcache: check for lvmcache_foreach_mda return code
lvmcache_foreach_mda() can fail for numerous reasons
and failing error code cannot be ignored (out-of-memory...)
TODO: might need more error handling tunning.
---
lib/format_text/text_label.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/lib/format_text/text_label.c b/lib/format_text/text_label.c
index 6edfae7..ad323b6 100644
--- a/lib/format_text/text_label.c
+++ b/lib/format_text/text_label.c
@@ -437,7 +437,9 @@ out:
baton.info = info;
baton.label = *label;
- lvmcache_foreach_mda(info, _update_mda, &baton);
+ if (!lvmcache_foreach_mda(info, _update_mda, &baton))
+ return_0;
+
lvmcache_make_valid(info);
return 1;
6 years, 3 months
master - lvmlockd: shorter code
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=d4ce98de4d6c7c3ddec...
Commit: d4ce98de4d6c7c3ddeca0e380a18bbdc102e6c3a
Parent: 0e42b31dc3be45c29abd90369c02c077d1763ff0
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Aug 16 14:12:48 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Aug 22 10:23:31 2017 +0200
lvmlockd: shorter code
gcc warns here about storring 69 bytes in 64 byte array (losing
potentially 4 bytes from 'ls->name').
lvmlockd-core.c:2657:36: warning: ���%s��� directive output may be truncated writing up to 64 bytes into a region of size 60 [-Wformat-truncation=]
snprintf(tmp_name, MAX_NAME, "REM:%s", ls->name);
^~
lvmlockd-core.c:2657:2: note: ���snprintf��� output between 5 and 69 bytes into a destination of size 64
snprintf(tmp_name, MAX_NAME, "REM:%s", ls->name);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Replaced with slightly better code - but it still misses error path what
to do if the name would be truncated... - so added FIXME.
Also using all bytes for snprintf() buffer size
(as the size is with \0 included)
---
daemons/lvmlockd/lvmlockd-core.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/daemons/lvmlockd/lvmlockd-core.c b/daemons/lvmlockd/lvmlockd-core.c
index aefa98a..6fd4b88 100644
--- a/daemons/lvmlockd/lvmlockd-core.c
+++ b/daemons/lvmlockd/lvmlockd-core.c
@@ -2653,9 +2653,9 @@ out_act:
if (ls->lm_type == LD_LM_DLM && !strcmp(ls->name, gl_lsname_dlm))
global_dlm_lockspace_exists = 0;
/* Avoid a name collision of the same lockspace is added again before this thread is cleaned up. */
- memset(tmp_name, 0, sizeof(tmp_name));
- snprintf(tmp_name, MAX_NAME, "REM:%s", ls->name);
- memcpy(ls->name, tmp_name, MAX_NAME);
+ /* FIXME: detect loss of 4 chars? (use 'size(tmp_name) == (MAX_NAME - 4)' and fail??) */
+ dm_strncpy(tmp_name, ls->name, sizeof(tmp_name));
+ snprintf(ls->name, sizeof(ls->name), "REM:%s", tmp_name);
pthread_mutex_unlock(&lockspaces_mutex);
/* worker_thread will join this thread, and free the ls */
6 years, 3 months
master - libdm: fix errpath for control node creation
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=0e42b31dc3be45c29ab...
Commit: 0e42b31dc3be45c29abd90369c02c077d1763ff0
Parent: df5c2964269895b6f5ce16dbdb70edd57c5aa67d
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Aug 22 10:19:40 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Aug 22 10:23:29 2017 +0200
libdm: fix errpath for control node creation
When control node failure happens, umask was not restored.
Fix it by using common exit path.
---
WHATS_NEW_DM | 1 +
libdm/ioctl/libdm-iface.c | 5 ++---
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index d3cc78c..766eb20 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,5 +1,6 @@
Version 1.02.143 -
=================================
+ Restore umask when creation of node fails.
Add --concise to dmsetup create for many devices with tables in one command.
Accept minor number without major in library when it knows dm major number.
Introduce single-line concise table output format: dmsetup table --concise
diff --git a/libdm/ioctl/libdm-iface.c b/libdm/ioctl/libdm-iface.c
index e32af80..63d305b 100644
--- a/libdm/ioctl/libdm-iface.c
+++ b/libdm/ioctl/libdm-iface.c
@@ -293,13 +293,12 @@ static int _create_control(const char *control, uint32_t major, uint32_t minor)
if (mknod(control, S_IFCHR | S_IRUSR | S_IWUSR,
MKDEV((dev_t)major, (dev_t)minor)) < 0) {
log_sys_error("mknod", control);
- (void) dm_prepare_selinux_context(NULL, 0);
- return 0;
+ ret = 0;
}
umask(old_umask);
(void) dm_prepare_selinux_context(NULL, 0);
- return 1;
+ return ret;
}
#endif
6 years, 3 months
master - lvmlockd: zero extended lvmlock LV
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=df5c2964269895b6f5c...
Commit: df5c2964269895b6f5ce16dbdb70edd57c5aa67d
Parent: 43305ae8da20ac8ab4390a2aa81618f2973753af
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue Aug 15 11:53:21 2017 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Tue Aug 15 11:56:31 2017 -0500
lvmlockd: zero extended lvmlock LV
After the internal lvmlock LV (holding sanlock leases) is
extended to hold more leases, it needs to be zeroed.
sanlock expects to see either zeroed blocks or blocks
initialized with leases.
---
lib/locking/lvmlockd.c | 42 +++++++++++++++++++++++++++++++++++++++++-
1 files changed, 41 insertions(+), 1 deletions(-)
diff --git a/lib/locking/lvmlockd.c b/lib/locking/lvmlockd.c
index 54e3cf6..d85021c 100644
--- a/lib/locking/lvmlockd.c
+++ b/lib/locking/lvmlockd.c
@@ -365,6 +365,9 @@ static int _remove_sanlock_lv(struct cmd_context *cmd, struct volume_group *vg)
static int _extend_sanlock_lv(struct cmd_context *cmd, struct volume_group *vg, int extend_mb)
{
+ struct device *dev;
+ char path[PATH_MAX];
+ uint64_t old_size_bytes, new_size_bytes;
struct logical_volume *lv = vg->sanlock_lv;
struct lvresize_params lp = {
.sign = SIGN_NONE,
@@ -374,12 +377,49 @@ static int _extend_sanlock_lv(struct cmd_context *cmd, struct volume_group *vg,
.force = 1,
};
+ old_size_bytes = lv->size * SECTOR_SIZE;
+
if (!lv_resize(lv, &lp, &vg->pvs)) {
- log_error("Extend LV %s to size %s failed.",
+ log_error("Extend sanlock LV %s to size %s failed.",
display_lvname(lv), display_size(cmd, lp.size));
return 0;
}
+ new_size_bytes = lv->size * SECTOR_SIZE;
+
+ if (dm_snprintf(path, sizeof(path), "%s/mapper/%s-%s", lv->vg->cmd->dev_dir,
+ lv->vg->name, lv->name) < 0) {
+ log_error("Extend sanlock LV %s name too long - extended size not zeroed.",
+ display_lvname(lv));
+ return 0;
+ }
+
+ log_debug("Extend sanlock LV zeroing blocks from offset " FMTu64 " bytes len %u bytes",
+ old_size_bytes, (uint32_t)(new_size_bytes - old_size_bytes));
+
+ log_print("Zeroing %u MiB on extended internal lvmlock LV...", extend_mb);
+
+ if (!(dev = dev_cache_get(path, NULL))) {
+ log_error("Extend sanlock LV %s cannot find device.", display_lvname(lv));
+ return 0;
+ }
+
+ if (!dev_open_quiet(dev)) {
+ log_error("Extend sanlock LV %s cannot open device.", display_lvname(lv));
+ return 0;
+ }
+
+ if (!dev_set(dev, old_size_bytes, new_size_bytes - old_size_bytes, 0)) {
+ log_error("Extend sanlock LV %s cannot zero device.", display_lvname(lv));
+ dev_close_immediate(dev);
+ return 0;
+ }
+
+ dev_flush(dev);
+
+ if (!dev_close_immediate(dev))
+ stack;
+
return 1;
}
6 years, 3 months
master - lvmlockd: reduce io impact for finding sanlock lv free lock offset
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=43305ae8da20ac8ab43...
Commit: 43305ae8da20ac8ab4390a2aa81618f2973753af
Parent: aa75ca633285339a8be50ed5e5a661ea1654f8f7
Author: Zhang Huan <zhanghuan(a)huayun.com>
AuthorDate: Tue Aug 15 10:42:44 2017 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Tue Aug 15 11:56:31 2017 -0500
lvmlockd: reduce io impact for finding sanlock lv free lock offset
currently, lvcreate for sanlock find the free lock offset
from the beginning of the lvmlock every time.
after created thousands of lvs, it will issue thousands of read
ios for lvcreate to find free lock offset.
remeber the last free lock offset will greatly reduce the impact
Signed-off-by: Zhang Huan <zhanghuan(a)huayun.com>
---
daemons/lvmlockd/lvmlockd-core.c | 1 -
daemons/lvmlockd/lvmlockd-sanlock.c | 26 ++++++++++++++++++++++++--
2 files changed, 24 insertions(+), 3 deletions(-)
diff --git a/daemons/lvmlockd/lvmlockd-core.c b/daemons/lvmlockd/lvmlockd-core.c
index 01259c0..aefa98a 100644
--- a/daemons/lvmlockd/lvmlockd-core.c
+++ b/daemons/lvmlockd/lvmlockd-core.c
@@ -3304,7 +3304,6 @@ static int work_init_lv(struct action *act)
lm_type = ls->lm_type;
memcpy(vg_args, ls->vg_args, MAX_ARGS);
free_offset = ls->free_lock_offset;
- ls->free_lock_offset = 0;
}
pthread_mutex_unlock(&lockspaces_mutex);
diff --git a/daemons/lvmlockd/lvmlockd-sanlock.c b/daemons/lvmlockd/lvmlockd-sanlock.c
index aedd506..a10d02f 100644
--- a/daemons/lvmlockd/lvmlockd-sanlock.c
+++ b/daemons/lvmlockd/lvmlockd-sanlock.c
@@ -938,7 +938,9 @@ int lm_find_free_lock_sanlock(struct lockspace *ls, uint64_t *free_offset)
struct lm_sanlock *lms = (struct lm_sanlock *)ls->lm_data;
struct sanlk_resourced rd;
uint64_t offset;
+ uint64_t start_offset;
int rv;
+ int round = 0;
if (daemon_test) {
*free_offset = (1048576 * LV_LOCK_BEGIN) + (1048576 * (daemon_test_lv_count + 1));
@@ -951,9 +953,22 @@ int lm_find_free_lock_sanlock(struct lockspace *ls, uint64_t *free_offset)
rd.rs.num_disks = 1;
strncpy(rd.rs.disks[0].path, lms->ss.host_id_disk.path, SANLK_PATH_LEN-1);
- offset = lms->align_size * LV_LOCK_BEGIN;
+ if (ls->free_lock_offset)
+ offset = ls->free_lock_offset;
+ else
+ offset = lms->align_size * LV_LOCK_BEGIN;
+
+ start_offset = offset;
while (1) {
+ if (offset >= start_offset && round) {
+ /* This indicates the all space are allocated. */
+ log_debug("S %s init_lv_san read back to start offset %llu",
+ ls->name, (unsigned long long)offset);
+ rv = -EMSGSIZE;
+ return rv;
+ }
+
rd.rs.disks[0].offset = offset;
memset(rd.rs.name, 0, SANLK_NAME_LEN);
@@ -963,7 +978,14 @@ int lm_find_free_lock_sanlock(struct lockspace *ls, uint64_t *free_offset)
/* This indicates the end of the device is reached. */
log_debug("S %s find_free_lock_san read limit offset %llu",
ls->name, (unsigned long long)offset);
- return -EMSGSIZE;
+
+ /* remember the NO SPACE offset, if no free area left,
+ * search from this offset after extend */
+ *free_offset = offset;
+
+ offset = lms->align_size * LV_LOCK_BEGIN;
+ round = 1;
+ continue;
}
/*
6 years, 3 months