Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
1b05fae7
Commit
1b05fae7
authored
Sep 15, 2020
by
Ilya Dryomov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
libceph: switch to the new "osd blocklist add" command
Signed-off-by:
Ilya Dryomov
<
idryomov@gmail.com
>
parent
0b98acd6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
15 deletions
+52
-15
net/ceph/mon_client.c
net/ceph/mon_client.c
+52
-15
No files found.
net/ceph/mon_client.c
View file @
1b05fae7
...
...
@@ -896,8 +896,9 @@ static void handle_command_ack(struct ceph_mon_client *monc,
ceph_msg_dump
(
msg
);
}
int
ceph_monc_blocklist_add
(
struct
ceph_mon_client
*
monc
,
struct
ceph_entity_addr
*
client_addr
)
static
__printf
(
2
,
0
)
int
do_mon_command_vargs
(
struct
ceph_mon_client
*
monc
,
const
char
*
fmt
,
va_list
ap
)
{
struct
ceph_mon_generic_request
*
req
;
struct
ceph_mon_command
*
h
;
...
...
@@ -925,28 +926,64 @@ int ceph_monc_blocklist_add(struct ceph_mon_client *monc,
h
->
monhdr
.
session_mon_tid
=
0
;
h
->
fsid
=
monc
->
monmap
->
fsid
;
h
->
num_strs
=
cpu_to_le32
(
1
);
len
=
sprintf
(
h
->
str
,
"{
\"
prefix
\"
:
\"
osd blacklist
\"
, \
\"
blacklistop
\"
:
\"
add
\"
, \
\"
addr
\"
:
\"
%pISpc/%u
\"
}"
,
&
client_addr
->
in_addr
,
le32_to_cpu
(
client_addr
->
nonce
));
len
=
vsprintf
(
h
->
str
,
fmt
,
ap
);
h
->
str_len
=
cpu_to_le32
(
len
);
send_generic_request
(
monc
,
req
);
mutex_unlock
(
&
monc
->
mutex
);
ret
=
wait_generic_request
(
req
);
if
(
!
ret
)
/*
* Make sure we have the osdmap that includes the blocklist
* entry. This is needed to ensure that the OSDs pick up the
* new blocklist before processing any future requests from
* this client.
*/
ret
=
ceph_wait_for_latest_osdmap
(
monc
->
client
,
0
);
out:
put_generic_request
(
req
);
return
ret
;
}
static
__printf
(
2
,
3
)
int
do_mon_command
(
struct
ceph_mon_client
*
monc
,
const
char
*
fmt
,
...)
{
va_list
ap
;
int
ret
;
va_start
(
ap
,
fmt
);
ret
=
do_mon_command_vargs
(
monc
,
fmt
,
ap
);
va_end
(
ap
);
return
ret
;
}
int
ceph_monc_blocklist_add
(
struct
ceph_mon_client
*
monc
,
struct
ceph_entity_addr
*
client_addr
)
{
int
ret
;
ret
=
do_mon_command
(
monc
,
"{
\"
prefix
\"
:
\"
osd blocklist
\"
, \
\"
blocklistop
\"
:
\"
add
\"
, \
\"
addr
\"
:
\"
%pISpc/%u
\"
}"
,
&
client_addr
->
in_addr
,
le32_to_cpu
(
client_addr
->
nonce
));
if
(
ret
==
-
EINVAL
)
{
/*
* The monitor returns EINVAL on an unrecognized command.
* Try the legacy command -- it is exactly the same except
* for the name.
*/
ret
=
do_mon_command
(
monc
,
"{
\"
prefix
\"
:
\"
osd blacklist
\"
, \
\"
blacklistop
\"
:
\"
add
\"
, \
\"
addr
\"
:
\"
%pISpc/%u
\"
}"
,
&
client_addr
->
in_addr
,
le32_to_cpu
(
client_addr
->
nonce
));
}
if
(
ret
)
return
ret
;
/*
* Make sure we have the osdmap that includes the blocklist
* entry. This is needed to ensure that the OSDs pick up the
* new blocklist before processing any future requests from
* this client.
*/
return
ceph_wait_for_latest_osdmap
(
monc
->
client
,
0
);
}
EXPORT_SYMBOL
(
ceph_monc_blocklist_add
);
/*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment