Compare commits

...
17 Commits
Author SHA1 Message Date
Vitaliy Filippov 74a23dcb63 Release 2.4.1
- Optimize WA - reduce it from 4-5 to 3.x by batching journal writes
- Fix ls-pool showing wrong used % when osds are reweighted (#105)
- Fix vitastor-cli rm sometimes hanging when PGs are down (#99)
- Fix vitastor-cli ls displaying raw used space for all inodes when -p is specified (#101)
- Fix "Cannot set property of undefined" in monitor when deleting pool with live inode op stats (#103)
- Revert vitastor-kv change from 2.2.0 leading to crashes in vitastor-kv-stress (#100)
- Add pg_size change check for XOR pools
- Fix root access to VitastorFS files
- Add IPv6 support to make-etcd
- Fix IPv6 etcd address support in OSD & client library
2025-10-29 01:39:33 +03:00
Flynn049andVitaliy Filippov 93fd23b2bb Fix ls-pool showing wrong used % when osds are reweighted (#105) 2025-10-28 21:01:46 +03:00
Vitaliy Filippov eedc700b83 Do not try executing operations on inactive PGs at all 2025-10-28 01:38:54 +03:00
Vitaliy Filippov c8cc17dbe9 Fix tv_nsec == 1000000000 case in timerfd_manager (#99) 2025-10-27 20:57:29 +03:00
Vitaliy Filippov b55d406386 Fix vitastor-cli ls displaying raw used space for all inodes when -p is specified (fix #101) 2025-10-27 20:55:17 +03:00
Vitaliy Filippov 0c46dbd333 Fix "Cannot set property of undefined" in monitor when deleting pool with live inode op stats (should fix #103) 2025-10-27 20:48:07 +03:00
Vitaliy Filippov ed94aa52cf Ensure that the retry timer is set when checking PG retry (for #99) 2025-10-27 20:19:17 +03:00
Vitaliy Filippov 555ae613c2 Revert commit 2d07449e74 (fixes #100) 2025-10-27 20:12:11 +03:00
Vitaliy Filippov cad6ea0360 Add pg_size change check for XOR pools 2025-10-24 20:53:27 +03:00
Vitaliy Filippov d60709dce1 Init list_retry_time to 0 2025-10-20 20:32:49 +03:00
Vitaliy Filippov a03ffd0d73 Fix prefix in openstack doc 2025-10-14 01:47:05 +03:00
Vitaliy Filippov 89b76a87b6 Fix root access to VitastorFS files 2025-10-09 19:24:05 +03:00
Vitaliy Filippov ceba343ac0 Add [] for ipv6 etcd IPs in make-etcd 2025-10-08 16:39:48 +03:00
Vitaliy Filippov 3bc04d8250 Fix ipv6 parsing in make-etcd 2025-10-08 01:33:11 +03:00
Vitaliy Filippov d228fbfb68 Fix ipv6 port parsing in addr_util 2025-10-08 01:30:00 +03:00
Vitaliy Filippov e3c8fd28b4 Allow to test EC writes with fio_blockstore 2025-09-27 14:12:24 +03:00
Vitaliy Filippov d87e7d1a37 Optimize WA - do not move to the next journal sector until the actual write 2025-09-27 11:23:05 +03:00
36 changed files with 165 additions and 58 deletions
+1 -1
View File
@@ -2,6 +2,6 @@ cmake_minimum_required(VERSION 2.8.12)
project(vitastor)
set(VITASTOR_VERSION "2.4.0")
set(VITASTOR_VERSION "2.4.1")
add_subdirectory(src)
+1 -1
View File
@@ -1,4 +1,4 @@
VITASTOR_VERSION ?= v2.4.0
VITASTOR_VERSION ?= v2.4.1
all: build push
+1 -1
View File
@@ -49,7 +49,7 @@ spec:
capabilities:
add: ["SYS_ADMIN"]
allowPrivilegeEscalation: true
image: vitalif/vitastor-csi:v2.4.0
image: vitalif/vitastor-csi:v2.4.1
args:
- "--node=$(NODE_ID)"
- "--endpoint=$(CSI_ENDPOINT)"
+1 -1
View File
@@ -121,7 +121,7 @@ spec:
privileged: true
capabilities:
add: ["SYS_ADMIN"]
image: vitalif/vitastor-csi:v2.4.0
image: vitalif/vitastor-csi:v2.4.1
args:
- "--node=$(NODE_ID)"
- "--endpoint=$(CSI_ENDPOINT)"
+1 -1
View File
@@ -5,7 +5,7 @@ package vitastor
const (
vitastorCSIDriverName = "csi.vitastor.io"
vitastorCSIDriverVersion = "2.4.0"
vitastorCSIDriverVersion = "2.4.1"
)
// Config struct fills the parameters of request or user input
+1 -1
View File
@@ -1,4 +1,4 @@
vitastor (2.4.0-1) unstable; urgency=medium
vitastor (2.4.1-1) unstable; urgency=medium
* Bugfixes
+1 -1
View File
@@ -1,4 +1,4 @@
VITASTOR_VERSION ?= v2.4.0
VITASTOR_VERSION ?= v2.4.1
all: build push
+1 -1
View File
@@ -4,7 +4,7 @@
#
# Desired Vitastor version
VITASTOR_VERSION=v2.4.0
VITASTOR_VERSION=v2.4.1
# Additional arguments for all containers
# For example, you may want to specify a custom logging driver here
+2 -2
View File
@@ -26,9 +26,9 @@ at Vitastor Kubernetes operator: https://github.com/Antilles7227/vitastor-operat
The instruction is very simple.
1. Download a Docker image of the desired version: \
`docker pull vitalif/vitastor:v2.4.0`
`docker pull vitalif/vitastor:v2.4.1`
2. Install scripts to the host system: \
`docker run --rm -it -v /etc:/host-etc -v /usr/bin:/host-bin vitalif/vitastor:v2.4.0 install.sh`
`docker run --rm -it -v /etc:/host-etc -v /usr/bin:/host-bin vitalif/vitastor:v2.4.1 install.sh`
3. Reload udev rules: \
`udevadm control --reload-rules`
+2 -2
View File
@@ -25,9 +25,9 @@ Vitastor можно установить в Docker/Podman. При этом etcd,
Инструкция по установке максимально простая.
1. Скачайте Docker-образ желаемой версии: \
`docker pull vitalif/vitastor:v2.4.0`
`docker pull vitalif/vitastor:v2.4.1`
2. Установите скрипты в хост-систему командой: \
`docker run --rm -it -v /etc:/host-etc -v /usr/bin:/host-bin vitalif/vitastor:v2.4.0 install.sh`
`docker run --rm -it -v /etc:/host-etc -v /usr/bin:/host-bin vitalif/vitastor:v2.4.1 install.sh`
3. Перезагрузите правила udev: \
`udevadm control --reload-rules`
+1 -1
View File
@@ -30,7 +30,7 @@ volume_backend_name = vitastor-testcluster
image_volume_cache_enabled = True
volume_clear = none
vitastor_etcd_address = 192.168.7.2:2379
vitastor_etcd_prefix =
vitastor_etcd_prefix = /vitastor
vitastor_config_path = /etc/vitastor/vitastor.conf
vitastor_pool_id = 1
image_upload_use_cinder_backend = True
+1 -1
View File
@@ -29,7 +29,7 @@ volume_backend_name = vitastor-testcluster
image_volume_cache_enabled = True
volume_clear = none
vitastor_etcd_address = 192.168.7.2:2379
vitastor_etcd_prefix =
vitastor_etcd_prefix = /vitastor
vitastor_config_path = /etc/vitastor/vitastor.conf
vitastor_pool_id = 1
image_upload_use_cinder_backend = True
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "vitastor-mon",
"version": "2.4.0",
"version": "2.4.1",
"description": "Vitastor SDS monitor service",
"main": "mon-main.js",
"scripts": {
+5 -4
View File
@@ -52,15 +52,16 @@ async function run()
process.exit(1);
}
const etcds = (config.etcd_address instanceof Array ? config.etcd_address : (''+config.etcd_address).split(/,/))
.map(s => (''+s).replace(/^https?:\/\/\[?|\]?(:\d+)?(\/.*)?$/g, '').toLowerCase());
.map(s => (''+s).replace(/^https?:\/\/|(:\d+)?(\/.*)?$/g, '').replace(/^\[(.*)\]$/, '$1').toLowerCase());
const num = select_local_etcd(etcds);
if (num < 0)
{
console.log('No matching IPs in etcd_address from '+config_path);
process.exit(0);
}
const etcd_url = 'http://' + (etcds[num].indexOf(':') >= 0 ? '['+etcds[num]+']' : etcds[num]);
const etcd_name = 'etcd'+etcds[num].replace(/[^0-9a-z_]/ig, '_');
const etcd_cluster = etcds.map(e => `etcd${e.replace(/[^0-9a-z_]/ig, '_')}=http://${e}:2380`).join(',');
const etcd_cluster = etcds.map(e => `etcd${e.replace(/[^0-9a-z_]/ig, '_')}=${etcd_url}:2380`).join(',');
if (in_docker)
{
let etcd_conf = fs.readFileSync("/etc/vitastor/etcd.conf", { encoding: 'utf-8' });
@@ -83,8 +84,8 @@ Wants=network-online.target local-fs.target time-sync.target
Restart=always
Environment=GOGC=50
ExecStart=etcd --name ${etcd_name} --data-dir /var/lib/etcd/vitastor \\
--snapshot-count 10000 --advertise-client-urls http://${etcds[num]}:2379 --listen-client-urls http://${etcds[num]}:2379 \\
--initial-advertise-peer-urls http://${etcds[num]}:2380 --listen-peer-urls http://${etcds[num]}:2380 \\
--snapshot-count 10000 --advertise-client-urls ${etcd_url}:2379 --listen-client-urls ${etcd_url}:2379 \\
--initial-advertise-peer-urls ${etcd_url}:2380 --listen-peer-urls ${etcd_url}:2380 \\
--initial-cluster-token vitastor-etcd-1 --initial-cluster ${etcd_cluster} \\
--initial-cluster-state new --max-txn-ops=100000 --max-request-bytes=104857600 \\
--auto-compaction-retention=10 --auto-compaction-mode=revision
+4
View File
@@ -276,6 +276,10 @@ function sum_inode_stats(state, prev_stats)
}
for (const pool_id in osd_diff.inode_stats)
{
if (!inode_stats[pool_id])
{
continue;
}
for (const inode_num in prev_stats.osd_diff[osd].inode_stats[pool_id])
{
inode_stats[pool_id][inode_num] = inode_stats[pool_id][inode_num] || inode_stub();
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "vitastor",
"version": "2.4.0",
"version": "2.4.1",
"description": "Low-level native bindings to Vitastor client library",
"main": "index.js",
"keywords": [
+1 -1
View File
@@ -50,7 +50,7 @@ from cinder.volume import configuration
from cinder.volume import driver
from cinder.volume import volume_utils
VITASTOR_VERSION = '2.4.0'
VITASTOR_VERSION = '2.4.1'
LOG = logging.getLogger(__name__)
+2 -2
View File
@@ -1,11 +1,11 @@
Name: vitastor
Version: 2.4.0
Version: 2.4.1
Release: 1%{?dist}
Summary: Vitastor, a fast software-defined clustered block storage
License: Vitastor Network Public License 1.1
URL: https://vitastor.io/
Source0: vitastor-2.4.0.el7.tar.gz
Source0: vitastor-2.4.1.el7.tar.gz
BuildRequires: gperftools-devel
BuildRequires: devtoolset-9-gcc-c++
+2 -2
View File
@@ -1,11 +1,11 @@
Name: vitastor
Version: 2.4.0
Version: 2.4.1
Release: 1%{?dist}
Summary: Vitastor, a fast software-defined clustered block storage
License: Vitastor Network Public License 1.1
URL: https://vitastor.io/
Source0: vitastor-2.4.0.el8.tar.gz
Source0: vitastor-2.4.1.el8.tar.gz
BuildRequires: gperftools-devel
BuildRequires: gcc-toolset-9-gcc-c++
+2 -2
View File
@@ -1,11 +1,11 @@
Name: vitastor
Version: 2.4.0
Version: 2.4.1
Release: 1%{?dist}
Summary: Vitastor, a fast software-defined clustered block storage
License: Vitastor Network Public License 1.1
URL: https://vitastor.io/
Source0: vitastor-2.4.0.el9.tar.gz
Source0: vitastor-2.4.1.el9.tar.gz
BuildRequires: gperftools-devel
BuildRequires: gcc-c++
+1 -1
View File
@@ -20,7 +20,7 @@ if("${CMAKE_INSTALL_PREFIX}" MATCHES "^/usr/local/?$")
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
endif()
add_definitions(-DVITASTOR_VERSION="2.4.0")
add_definitions(-DVITASTOR_VERSION="2.4.1")
add_definitions(-D_GNU_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Wall -Wno-sign-compare -Wno-comment -Wno-parentheses -Wno-pointer-arith -fdiagnostics-color=always -fno-omit-frame-pointer -fvisibility=hidden -I ${CMAKE_SOURCE_DIR}/src)
add_link_options(-fno-omit-frame-pointer)
if (${WITH_ASAN})
+2
View File
@@ -229,6 +229,8 @@ void blockstore_impl_t::loop()
{
// Mark journal sector writes as submitted
journal.sector_info[s].submit_id = 0;
if (journal.sector_info[s].submit_id)
journal.sector_info[s].written = true;
}
journal.submitting_sectors.clear();
if ((initial_ring_space - ringloop->space_left()) > 0)
+1 -1
View File
@@ -178,7 +178,7 @@ void blockstore_impl_t::prepare_journal_sector_write(int cur_sector, blockstore_
// Caller must ensure availability of an SQE
assert(sqe != NULL);
ring_data_t *data = ((ring_data_t*)sqe->user_data);
journal.sector_info[cur_sector].written = true;
// <written> flag will be set at the moment of actual submission
journal.sector_info[cur_sector].submit_id = ++journal.submit_id;
assert(journal.submit_id != 0); // check overflow
journal.submitting_sectors.push_back(cur_sector);
+68 -10
View File
@@ -26,6 +26,7 @@
#include "blockstore.h"
#include "epoll_manager.h"
#include "malloc_or_die.h"
#include "json11/json11.hpp"
#include "fio_headers.h"
@@ -37,6 +38,8 @@ struct bs_data
/* The list of completed io_u structs. */
std::vector<io_u*> completed;
int op_n = 0, inflight = 0;
bool ec = false;
bool imm = true;
bool last_sync = false;
bool trace = false;
};
@@ -45,6 +48,7 @@ struct bs_options
{
int __pad;
char *json_config = NULL;
int ec = 0;
int trace = 0;
};
@@ -58,6 +62,16 @@ static struct fio_option options[] = {
.category = FIO_OPT_C_ENGINE,
.group = FIO_OPT_G_FILENAME,
},
{
.name = "ec",
.lname = "Use EC write method",
.type = FIO_OPT_BOOL,
.off1 = offsetof(struct bs_options, ec),
.help = "Use EC write method",
.def = "0",
.category = FIO_OPT_C_ENGINE,
.group = FIO_OPT_G_FILENAME,
},
{
.name = "bs_trace",
.lname = "trace",
@@ -88,6 +102,7 @@ static int bs_setup(struct thread_data *td)
return 1;
}
td->io_ops_data = bsd;
bsd->ec = o->ec;
if (!td->files_index)
{
@@ -148,6 +163,8 @@ static int bs_init(struct thread_data *td)
bsd->ringloop = new ring_loop_t(RINGLOOP_DEFAULT_SIZE);
bsd->epmgr = new epoll_manager_t(bsd->ringloop);
bsd->bs = new blockstore_t(config, bsd->ringloop, bsd->epmgr->tfd);
bsd->imm = config.find("immediate_commit") == config.end() ||
config["immediate_commit"] == "all";
while (1)
{
bsd->ringloop->loop();
@@ -203,7 +220,7 @@ static enum fio_q_status bs_queue(struct thread_data *td, struct io_u *io)
};
break;
case DDIR_WRITE:
op->opcode = BS_OP_WRITE_STABLE;
op->opcode = bsd->ec ? BS_OP_WRITE : BS_OP_WRITE_STABLE;
op->buf = io->xfer_buf;
op->oid = {
.inode = 1,
@@ -212,16 +229,57 @@ static enum fio_q_status bs_queue(struct thread_data *td, struct io_u *io)
op->version = 0; // assign automatically
op->offset = io->offset % bsd->bs->get_block_size();
op->len = io->xfer_buflen;
op->callback = [io, n = bsd->op_n](blockstore_op_t *op)
if (bsd->ec)
{
io->error = op->retval < 0 ? -op->retval : 0;
bs_data *bsd = (bs_data*)io->engine_data;
bsd->inflight--;
bsd->completed.push_back(io);
if (bsd->trace)
printf("--- OP_WRITE %zx n=%d retval=%d\n", (size_t)op, n, op->retval);
delete op;
};
op->callback = [io, n = bsd->op_n](blockstore_op_t *op)
{
bs_data *bsd = (bs_data*)io->engine_data;
if (bsd->trace)
printf("--- OP_WRITE %zx n=%d retval=%d\n", (size_t)op, n, op->retval);
if (op->retval < 0)
{
io->error = op->retval < 0 ? -op->retval : 0;
bsd->inflight--;
bsd->completed.push_back(io);
delete op;
}
else
{
auto stab_op = new blockstore_op_t;
stab_op->opcode = BS_OP_STABLE;
stab_op->buf = malloc_or_die(sizeof(obj_ver_id));
obj_ver_id *ver = (obj_ver_id *)stab_op->buf;
ver[0].oid = op->oid;
ver[0].version = op->version;
stab_op->len = 1;
stab_op->callback = [io, n](blockstore_op_t *op)
{
bs_data *bsd = (bs_data*)io->engine_data;
if (bsd->trace)
printf("--- OP_STABLE %zx n=%d retval=%d\n", (size_t)op, n, op->retval);
io->error = op->retval < 0 ? -op->retval : 0;
bsd->inflight--;
bsd->completed.push_back(io);
delete op;
};
bsd->bs->enqueue_op(stab_op);
delete op;
}
};
}
else
{
op->callback = [io, n = bsd->op_n](blockstore_op_t *op)
{
bs_data *bsd = (bs_data*)io->engine_data;
if (bsd->trace)
printf("--- OP_WRITE_STABLE %zx n=%d retval=%d\n", (size_t)op, n, op->retval);
io->error = op->retval < 0 ? -op->retval : 0;
bsd->inflight--;
bsd->completed.push_back(io);
delete op;
};
}
bsd->last_sync = false;
break;
case DDIR_SYNC:
+2 -1
View File
@@ -1317,7 +1317,8 @@ int cluster_client_t::try_send(cluster_op_t *op, int i)
auto & pool_cfg = st_cli.pool_config.at(INODE_POOL(op->cur_inode));
auto pg_it = pool_cfg.pg_config.find(part->pg_num);
if (pg_it != pool_cfg.pg_config.end() &&
!pg_it->second.pause && pg_it->second.cur_primary)
!pg_it->second.pause && pg_it->second.cur_primary &&
(pg_it->second.cur_state & PG_ACTIVE))
{
osd_num_t primary_osd = pg_it->second.cur_primary;
if (pool_cfg.local_reads != POOL_LOCAL_READ_PRIMARY &&
+1 -1
View File
@@ -127,7 +127,7 @@ public:
ring_consumer_t consumer;
std::vector<std::function<void(void)>> on_ready_hooks;
int list_retry_timeout_id = -1;
timespec list_retry_time;
timespec list_retry_time = {};
std::vector<inode_list_t*> lists;
std::multimap<osd_num_t, osd_op_t*> raw_ops;
int continuing_ops = 0;
+4 -1
View File
@@ -31,7 +31,7 @@ struct inode_list_pg_t
osd_num_t cur_primary = 0;
int state = 0;
int inflight_ops = 0;
timespec wait_until;
timespec wait_until = {};
std::vector<inode_list_osd_t> list_osds;
bool has_unstable = false;
@@ -177,6 +177,9 @@ void cluster_client_t::retry_start_pg_listing(inode_list_pg_t *pg)
if (tv.tv_sec < pg->wait_until.tv_sec ||
tv.tv_sec == pg->wait_until.tv_sec && tv.tv_nsec < pg->wait_until.tv_nsec)
{
// Ensure that the retry timer is set
set_list_retry_timeout(pg->wait_until.tv_sec*1000 - tv.tv_sec*1000 +
(pg->wait_until.tv_nsec - tv.tv_nsec)/1000000, pg->wait_until);
return;
}
}
+1 -1
View File
@@ -6,7 +6,7 @@ includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
Name: Vitastor
Description: Vitastor client library
Version: 2.4.0
Version: 2.4.1
Libs: -L${libdir} -lvitastor_client
Cflags: -I${includedir}
+8 -10
View File
@@ -94,16 +94,14 @@ struct image_lister_t
parent->etcd_txn(json11::Json::object {
{ "success", json11::Json::array {
json11::Json::object {
{ "request_range", json11::Json::object {
{ "key", base64_encode(
parent->cli->st_cli.etcd_prefix+"/pool/stats"+
(list_pool_id ? "/"+std::to_string(list_pool_id) : "")+"/"
) },
{ "range_end", base64_encode(
parent->cli->st_cli.etcd_prefix+"/pool/stats"+
(list_pool_id ? "/"+std::to_string(list_pool_id) : "")+"0"
) },
} },
{ "request_range", (list_pool_id
? json11::Json::object {
{ "key", base64_encode(parent->cli->st_cli.etcd_prefix+"/pool/stats/"+std::to_string(list_pool_id)) },
}
: json11::Json::object {
{ "key", base64_encode(parent->cli->st_cli.etcd_prefix+"/pool/stats/") },
{ "range_end", base64_encode(parent->cli->st_cli.etcd_prefix+"/pool/stats0") },
}) },
},
json11::Json::object {
{ "request_range", json11::Json::object {
+9 -1
View File
@@ -180,7 +180,8 @@ std::string validate_pool_config(json11::Json::object & new_cfg, json11::Json ol
{
return "Changing scheme for an existing pool will lead to data loss. Use --force to proceed";
}
if (etcd_state_client_t::parse_scheme(old_cfg["scheme"].string_value()) == POOL_SCHEME_EC)
auto old_scheme = etcd_state_client_t::parse_scheme(old_cfg["scheme"].string_value());
if (old_scheme == POOL_SCHEME_EC)
{
uint64_t old_data_chunks = old_cfg["pg_size"].uint64_value() - old_cfg["parity_chunks"].uint64_value();
uint64_t new_data_chunks = cfg["pg_size"].uint64_value() - cfg["parity_chunks"].uint64_value();
@@ -189,6 +190,13 @@ std::string validate_pool_config(json11::Json::object & new_cfg, json11::Json ol
return "Changing EC data chunk count for an existing pool will lead to data loss. Use --force to proceed";
}
}
else if (old_scheme != POOL_SCHEME_REPLICATED)
{
if (old_cfg["pg_size"].uint64_value() != cfg["pg_size"].uint64_value())
{
return "Changing XOR data chunk count for an existing pool will lead to data loss. Use --force to proceed";
}
}
if (old_cfg["block_size"] != cfg["block_size"] ||
old_cfg["bitmap_granularity"] != cfg["bitmap_granularity"] ||
old_cfg["immediate_commit"] != cfg["immediate_commit"])
+21 -1
View File
@@ -87,6 +87,16 @@ struct pool_lister_t
) },
} },
},
json11::Json::object {
{ "request_range", json11::Json::object {
{ "key", base64_encode(
parent->cli->st_cli.etcd_prefix+"/config/osd/"
) },
{ "range_end", base64_encode(
parent->cli->st_cli.etcd_prefix+"/config/osd0"
) },
} },
},
} },
});
state = base_state+1;
@@ -115,6 +125,14 @@ resume_1:
// osd/stats/<N>::free
osd_free[osd_num] = value["free"].uint64_value();
});
std::map<uint64_t, double> osd_reweight;
parent->iterate_kvs_1(space_info["responses"][3]["response_range"]["kvs"], "/config/osd/", [&](uint64_t osd_num, json11::Json value)
{
if (value.object_items().find("reweight") != value.object_items().end())
{
osd_reweight[osd_num] = value["reweight"].number_value();
}
});
// Calculate max_avail for each pool
for (auto & pp: parent->cli->st_cli.pool_config)
{
@@ -140,7 +158,9 @@ resume_1:
}
for (auto pg_per_pair: pg_per_osd)
{
uint64_t pg_free = osd_free[pg_per_pair.first] * pool_cfg.real_pg_count / pg_per_pair.second;
uint64_t pg_free = osd_free[pg_per_pair.first] *
(osd_reweight.find(pg_per_pair.first) != osd_reweight.end() ? osd_reweight[pg_per_pair.first] : 1.0) *
pool_cfg.real_pg_count / pg_per_pair.second;
if (pool_avail > pg_free)
{
pool_avail = pg_free;
+1 -1
View File
@@ -873,7 +873,7 @@ static void get_block(kv_db_t *db, uint64_t offset, int cur_level, int recheck_p
}
// Block already in cache, we can proceed
blk->usage = db->usage_counter;
db->cli->msgr.ringloop->set_immediate([=] { cb(0, BLK_UPDATING); });
cb(0, BLK_UPDATING);
return;
}
cluster_op_t *op = new cluster_op_t;
+6
View File
@@ -94,6 +94,10 @@ uint32_t kv_get_access(const authsys_parms & auth_sys, const json11::Json & attr
uint32_t uid = attrs["uid"].uint64_value();
uint32_t gid = attrs["gid"].uint64_value();
uint32_t access = 0;
if (!auth_sys.uid)
{
return (ACCESS3_READ|ACCESS3_LOOKUP|ACCESS3_MODIFY|ACCESS3_EXTEND|ACCESS3_DELETE|ACCESS3_EXECUTE);
}
if (uid == auth_sys.uid)
{
access |= ((mode & (1 << 8)) ? ACCESS3_READ|ACCESS3_LOOKUP : 0);
@@ -120,6 +124,8 @@ uint32_t kv_get_access(const authsys_parms & auth_sys, const json11::Json & attr
bool kv_is_accessible(const authsys_parms & auth_sys, const json11::Json & attrs, uint32_t access)
{
uint32_t mode = attrs["mode"].is_null() ? (attrs["type"] == "dir" ? 0755 : 0644) : attrs["mode"].uint64_value();
if (!auth_sys.uid)
return true;
uint32_t mask = 1 << (access == ACCESS3_EXECUTE ? 0
: (access == ACCESS3_MODIFY || access == ACCESS3_EXTEND || access == ACCESS3_DELETE ? 1 : 2));
if (mode & mask)
+1 -1
View File
@@ -17,7 +17,7 @@ bool string_to_addr(std::string str, bool parse_port, int default_port, struct s
if (parse_port)
{
int p = str.rfind(':');
if (p != std::string::npos && !(str.length() > 0 && str[p-1] == ']')) // "[ipv6]" which contains ':'
if (p != std::string::npos && (str[0] != '[' || p > 0 && str[p-1] == ']')) // "[ipv6]" which contains ':'
{
char null_byte = 0;
int scanned = sscanf(str.c_str()+p+1, "%d%c", &default_port, &null_byte);
+1 -1
View File
@@ -36,7 +36,7 @@ void timerfd_manager_t::inc_timer(timerfd_timer_t & t)
{
t.next.tv_sec += t.micros/1000000;
t.next.tv_nsec += (t.micros%1000000)*1000;
if (t.next.tv_nsec > 1000000000)
if (t.next.tv_nsec >= 1000000000)
{
t.next.tv_sec++;
t.next.tv_nsec -= 1000000000;
+6
View File
@@ -13,6 +13,12 @@ sudo mount localhost:/ ./testdata/nfs -o port=2050,mountport=2050,nfsvers=3,soft
MNT=$(pwd)/testdata/nfs
trap "sudo umount -f $MNT"' || true; kill -9 $(jobs -p)' EXIT
touch ./testdata/nfs/f1
chown 1000:1000 ./testdata/nfs/f1
chmod 600 ./testdata/nfs/f1
sudo cat ./testdata/nfs/f1
rm ./testdata/nfs/f1
# write small file
ls -l ./testdata/nfs
dd if=/dev/urandom of=./testdata/f1 bs=100k count=1