This is an automated email from the git hooks/post-receive script.
teigland pushed a change to branch master
in repository sanlock.
from 3d9162b sanlock: fix the lack of random_r in musl
new 63fc9a8 sanlock: clear preset sector/align flags
new b501ca4 sanlock: add sector/align sizes to client read output
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
src/delta_lease.c | 4 ++++
src/main.c | 14 +++++++++++---
src/paxos_lease.c | 4 ++++
src/sanlock.8 | 11 ++++-------
src/sizeflags.c | 28 ++++++++++++++++++++++++++++
src/sizeflags.h | 4 ++++
6 files changed, 55 insertions(+), 10 deletions(-)
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
Show replies by date
This is an automated email from the git hooks/post-receive script.
teigland pushed a commit to branch master
in repository sanlock.
commit 63fc9a80ee25f384579c700097ab3044f02a50b6
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Mon Oct 22 15:10:10 2018 -0500
sanlock: clear preset sector/align flags
The user may set sector/align flags when reading
the lockspace or resource (sanlock may use them
as hints.) The user-supplied flags may be wrong,
so clear them before returning the actual flags.
---
src/delta_lease.c | 4 ++++
src/paxos_lease.c | 4 ++++
src/sizeflags.c | 28 ++++++++++++++++++++++++++++
src/sizeflags.h | 4 ++++
4 files changed, 40 insertions(+)
diff --git a/src/delta_lease.c b/src/delta_lease.c
index 6859f1f..5616432 100644
--- a/src/delta_lease.c
+++ b/src/delta_lease.c
@@ -197,6 +197,10 @@ int delta_read_lockspace(struct task *task,
if (!align_size)
align_size = sector_size_to_align_size_old(leader.sector_size);
+ /* The flags set by the user may not have been correct. */
+ sanlk_lsf_sector_flags_clear(&ls->flags);
+ sanlk_lsf_align_flags_clear(&ls->flags);
+
ls->flags |= sanlk_lsf_sector_size_to_flag(leader.sector_size);
ls->flags |= sanlk_lsf_align_size_to_flag(align_size);
}
diff --git a/src/paxos_lease.c b/src/paxos_lease.c
index 7b51a10..4573b63 100644
--- a/src/paxos_lease.c
+++ b/src/paxos_lease.c
@@ -1089,6 +1089,10 @@ int paxos_read_resource(struct task *task,
token->sector_size = leader.sector_size;
token->align_size = align_size;
+ /* The flags set by the user may be wrong. */
+ sanlk_res_sector_flags_clear(&res->flags);
+ sanlk_res_align_flags_clear(&res->flags);
+
res->flags |= sanlk_res_sector_size_to_flag(leader.sector_size);
res->flags |= sanlk_res_align_size_to_flag(align_size);
} else if (tmp_sector_size) {
diff --git a/src/sizeflags.c b/src/sizeflags.c
index 3780f0f..94d59cd 100644
--- a/src/sizeflags.c
+++ b/src/sizeflags.c
@@ -158,6 +158,20 @@ uint32_t sanlk_lsf_sector_size_to_flag(int sector_size)
return 0;
}
+void sanlk_lsf_sector_flags_clear(uint32_t *flags)
+{
+ *flags &= ~SANLK_LSF_SECTOR512;
+ *flags &= ~SANLK_LSF_SECTOR4K;
+}
+
+void sanlk_lsf_align_flags_clear(uint32_t *flags)
+{
+ *flags &= ~SANLK_LSF_ALIGN1M;
+ *flags &= ~SANLK_LSF_ALIGN2M;
+ *flags &= ~SANLK_LSF_ALIGN4M;
+ *flags &= ~SANLK_LSF_ALIGN8M;
+}
+
int sanlk_lsf_align_flag_to_size(uint32_t flags)
{
if (flags & SANLK_LSF_ALIGN1M)
@@ -208,6 +222,20 @@ uint32_t sanlk_res_sector_size_to_flag(int sector_size)
return 0;
}
+void sanlk_res_sector_flags_clear(uint32_t *flags)
+{
+ *flags &= ~SANLK_RES_SECTOR512;
+ *flags &= ~SANLK_RES_SECTOR4K;
+}
+
+void sanlk_res_align_flags_clear(uint32_t *flags)
+{
+ *flags &= ~SANLK_RES_ALIGN1M;
+ *flags &= ~SANLK_RES_ALIGN2M;
+ *flags &= ~SANLK_RES_ALIGN4M;
+ *flags &= ~SANLK_RES_ALIGN8M;
+}
+
int sanlk_res_align_flag_to_size(uint32_t flags)
{
if (flags & SANLK_RES_ALIGN1M)
diff --git a/src/sizeflags.h b/src/sizeflags.h
index 76428ac..56035c9 100644
--- a/src/sizeflags.h
+++ b/src/sizeflags.h
@@ -28,11 +28,15 @@ int sanlk_lsf_sector_flag_to_size(uint32_t flags);
uint32_t sanlk_lsf_sector_size_to_flag(int sector_size);
int sanlk_lsf_align_flag_to_size(uint32_t flags);
uint32_t sanlk_lsf_align_size_to_flag(int align_size);
+void sanlk_lsf_sector_flags_clear(uint32_t *flags);
+void sanlk_lsf_align_flags_clear(uint32_t *flags);
int sanlk_res_sector_flag_to_size(uint32_t flags);
uint32_t sanlk_res_sector_size_to_flag(int sector_size);
int sanlk_res_align_flag_to_size(uint32_t flags);
uint32_t sanlk_res_align_size_to_flag(int align_size);
+void sanlk_res_sector_flags_clear(uint32_t *flags);
+void sanlk_res_align_flags_clear(uint32_t *flags);
int sanlk_rif_sector_flag_to_size(uint32_t flags);
uint32_t sanlk_rif_sector_size_to_flag(int sector_size);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
This is an automated email from the git hooks/post-receive script.
teigland pushed a commit to branch master
in repository sanlock.
commit b501ca4439ec7e92e05ee5b1de9ab69feb0ecbe5
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Mon Oct 22 15:20:34 2018 -0500
sanlock: add sector/align sizes to client read output
enabled with -D
---
src/main.c | 14 +++++++++++---
src/sanlock.8 | 11 ++++-------
2 files changed, 15 insertions(+), 10 deletions(-)
diff --git a/src/main.c b/src/main.c
index 7a62b1d..1767328 100644
--- a/src/main.c
+++ b/src/main.c
@@ -2040,8 +2040,7 @@ static void print_usage(void)
printf("sanlock client log_dump\n");
printf("sanlock client shutdown [-f 0|1] [-w 0|1]\n");
printf("sanlock client init -s LOCKSPACE | -r RESOURCE [-z 0|1] [-Z 512|4096 -A
1M|2M|4M|8M]\n");
- printf("sanlock client read -s LOCKSPACE | -r RESOURCE\n");
- printf("sanlock client align -s LOCKSPACE\n");
+ printf("sanlock client read -s LOCKSPACE | -r RESOURCE [-D]\n");
printf("sanlock client add_lockspace -s LOCKSPACE\n");
printf("sanlock client inq_lockspace -s LOCKSPACE\n");
printf("sanlock client rem_lockspace -s LOCKSPACE\n");
@@ -2798,7 +2797,11 @@ static int do_client_read(void)
(unsigned long long)com.lockspace.host_id,
com.lockspace.host_id_disk.path,
(unsigned long long)com.lockspace.host_id_disk.offset);
- log_tool("io_timeout %u", io_timeout);
+ if (com.debug) {
+ log_tool("io_timeout %u", io_timeout);
+ log_tool("sector_size %d",
sanlk_lsf_sector_flag_to_size(com.lockspace.flags));
+ log_tool("align_size %d",
sanlk_lsf_align_flag_to_size(com.lockspace.flags));
+ }
goto out;
}
@@ -2810,6 +2813,11 @@ static int do_client_read(void)
log_tool("r %s", res_str);
+ if (com.debug) {
+ log_tool("sector_size %d",
sanlk_res_sector_flag_to_size(com.res_args[0]->flags));
+ log_tool("align_size %d",
sanlk_res_align_flag_to_size(com.res_args[0]->flags));
+ }
+
free(res_str);
if (!hss)
diff --git a/src/sanlock.8 b/src/sanlock.8
index aeb016d..7f5f4b7 100644
--- a/src/sanlock.8
+++ b/src/sanlock.8
@@ -674,20 +674,17 @@ size, and both should be set together.
Tell the sanlock daemon to read a lockspace from disk. Only the
LOCKSPACE path and offset are required. If host_id is zero, the first
-record at offset (host_id 1) is used. The complete LOCKSPACE and io
-timeout are printed.
+record at offset (host_id 1) is used. The complete LOCKSPACE is printed.
+Add -D to print other details.
+(Also see sanlock direct read_leader.)
.BR "sanlock client read -r" " RESOURCE"
Tell the sanlock daemon to read a resource lease from disk. Only the
RESOURCE path and offset are required. The complete RESOURCE is printed.
+Add -D to print other details.
(Also see sanlock direct read_leader.)
-.BR "sanlock client align -s" " LOCKSPACE"
-
-Tell the sanlock daemon to report the required lease alignment for a storage
-path. Only path is used from the LOCKSPACE argument.
-
.BR "sanlock client add_lockspace -s" " LOCKSPACE"
Tell the sanlock daemon to acquire the specified host_id in the lockspace.
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.