The commit is pushed to "branch-rh9-5.14.0-427.35.1.vz9.76.x-ovz" and will appear at g...@bitbucket.org:openvz/vzkernel.git after rh9-5.14.0-427.35.1.vz9.76.4 ------> commit a92f22f9e2bfd0465311a4e01d2344a37533cfec Author: Alexey Kuznetsov <kuz...@virtuozzo.com> Date: Wed Oct 2 02:47:57 2024 +0800
fs: fuse: pcs: implement missing fuse control points It is strange, I was sure I did this ages ago. User space _uses_ them for years. It looks like the patch has been lost. No problem, they are used only for problem solving and experiments, I found this loss trying to do this and failing. Signed-off-by: Alexey Kuznetsov <kuz...@virtuozzo.com> Feature: vStorage --- fs/fuse/kio/pcs/fuse_stat.c | 159 ++++++++++++++++++++++++++++++++----- fs/fuse/kio/pcs/fuse_stat.h | 2 +- fs/fuse/kio/pcs/pcs_cluster.c | 21 ++--- fs/fuse/kio/pcs/pcs_cluster.h | 2 +- fs/fuse/kio/pcs/pcs_cluster_core.c | 21 ++--- fs/fuse/kio/pcs/pcs_cs.c | 2 +- fs/fuse/kio/pcs/pcs_cs_accel.c | 4 - fs/fuse/kio/pcs/pcs_map.c | 35 ++++---- fs/fuse/kio/pcs/pcs_req.h | 17 ++-- fs/fuse/kio/pcs/pcs_rpc.h | 3 - fs/fuse/kio/pcs/pcs_rpc_clnt.c | 2 +- fs/fuse/kio/pcs/pcs_sock_conn.c | 30 +++++++ 12 files changed, 207 insertions(+), 91 deletions(-) diff --git a/fs/fuse/kio/pcs/fuse_stat.c b/fs/fuse/kio/pcs/fuse_stat.c index 48a68640e946..6fe43247c4a7 100644 --- a/fs/fuse/kio/pcs/fuse_stat.c +++ b/fs/fuse/kio/pcs/fuse_stat.c @@ -407,13 +407,14 @@ static const struct file_operations pcs_fuse_cs_stats_ops = { .release = single_release, }; -static ssize_t pcs_fuse_storage_version_read(struct file *file, - char __user *buf, size_t len, - loff_t *ppos) +static ssize_t pcs_fuse_uintvar_read(struct file *file, + char __user *buf, size_t len, + loff_t *ppos, + unsigned int get_value(struct pcs_cluster_core *)) { struct pcs_fuse_stat *stat; struct pcs_cluster_core *cc; - char ver[32]; + char kbuf[32]; size_t size; ssize_t ret = 0; @@ -424,9 +425,8 @@ static ssize_t pcs_fuse_storage_version_read(struct file *file, goto out; cc = container_of(stat, struct pcs_cluster_core, stat); - size = snprintf(ver, sizeof(ver), "%d\n", - atomic_read(&cc->storage_version)); - ret = simple_read_from_buffer(buf, len, ppos, ver, size); + size = snprintf(kbuf, sizeof(kbuf), "%u\n", (*get_value)(cc)); + ret = simple_read_from_buffer(buf, len, ppos, kbuf, size); out: mutex_unlock(&fuse_mutex); @@ -434,30 +434,34 @@ static ssize_t pcs_fuse_storage_version_read(struct file *file, return ret; } -static ssize_t pcs_fuse_storage_version_write(struct file *file, - const char __user *buf, - size_t count, loff_t *ppos) +static ssize_t pcs_fuse_uintvar_write(struct file *file, + const char __user *buf, + size_t count, loff_t *ppos, + int set_value(struct pcs_cluster_core *, unsigned int)) { struct pcs_fuse_stat *stat; struct pcs_cluster_core *cc; - unsigned int ver; + unsigned int val; int err; if (*ppos) return -EINVAL; - err = kstrtouint_from_user(buf, count, 0, &ver); + err = kstrtouint_from_user(buf, count, 0, &val); if (err) return err; mutex_lock(&fuse_mutex); stat = file_inode(file)->i_private; - if (!stat) + if (!stat) { + count = -EINVAL; goto out; + } cc = container_of(stat, struct pcs_cluster_core, stat); - pcs_cc_update_storage_versions(cc, ver); + if (set_value(cc, val)) + count = -EINVAL; out: mutex_unlock(&fuse_mutex); @@ -465,13 +469,64 @@ static ssize_t pcs_fuse_storage_version_write(struct file *file, return count; } -static const struct file_operations pcs_fuse_storage_version_ops = { - .owner = THIS_MODULE, - .open = nonseekable_open, - .read = pcs_fuse_storage_version_read, - .write = pcs_fuse_storage_version_write, - .llseek = no_llseek, -}; +#define DEFINE_UINTVAR(name) \ +static ssize_t pcs_fuse_##name##_read(struct file *file, \ + char __user *buf, size_t len, \ + loff_t *ppos) \ +{ \ + return pcs_fuse_uintvar_read(file, buf, len, ppos, get_##name); \ +} \ +static ssize_t pcs_fuse_##name##_write(struct file *file, \ + const char __user *buf, \ + size_t count, loff_t *ppos) \ +{ \ + return pcs_fuse_uintvar_write(file, buf, count, ppos, set_##name); \ +} \ +static const struct file_operations pcs_fuse_##name##_ops = { \ + .owner = THIS_MODULE, \ + .open = nonseekable_open, \ + .read = pcs_fuse_##name##_read, \ + .write = pcs_fuse_##name##_write, \ + .llseek = no_llseek, \ +} + +static unsigned int get_storage_version(struct pcs_cluster_core *cc) +{ + return atomic_read(&cc->storage_version); +} + +static int set_storage_version(struct pcs_cluster_core *cc, unsigned int val) +{ + pcs_cc_update_storage_versions(cc, val); + return 0; +} + +DEFINE_UINTVAR(storage_version); + +#define DEFINE_CFG_UINTVAR(name) \ +static unsigned int get_##name(struct pcs_cluster_core *cc) \ +{ \ + return READ_ONCE(cc->cfg.name); \ +} \ +static int set_##name(struct pcs_cluster_core *cc, unsigned int val) \ +{ \ + WRITE_ONCE(cc->cfg.name, val); \ + return 0; \ +} \ +DEFINE_UINTVAR(name) + +DEFINE_CFG_UINTVAR(wmss); +DEFINE_CFG_UINTVAR(rmss); +DEFINE_CFG_UINTVAR(lmss); +DEFINE_CFG_UINTVAR(io_locality); +DEFINE_CFG_UINTVAR(io_tweaks); +DEFINE_CFG_UINTVAR(tcp_sndbuf); +DEFINE_CFG_UINTVAR(tcp_rcvbuf); +DEFINE_CFG_UINTVAR(local_sndbuf); +DEFINE_CFG_UINTVAR(fail_on_nospace); +DEFINE_CFG_UINTVAR(iolat_cutoff); +DEFINE_CFG_UINTVAR(netlat_cutoff); +DEFINE_CFG_UINTVAR(use_unix_socket); static void fuse_kio_fstat_lat_itr(struct fuse_file *ff, struct pcs_dentry_info *di, void *ctx) @@ -938,8 +993,68 @@ int pcs_fuse_stat_init(struct pcs_fuse_stat *stat) &pcs_fuse_cs_stats_ops, stat) || !fuse_stat_add_dentry(kio_stat, stat, "storage_version", - S_IFREG | S_IRUSR | S_IWUSR, 1, NULL, + S_IFREG | 0600, 1, NULL, &pcs_fuse_storage_version_ops, + stat) || + !fuse_stat_add_dentry(fc->conn_ctl, stat, + "fail-on-nospace", + S_IFREG | 0600, 1, NULL, + &pcs_fuse_fail_on_nospace_ops, + stat) || + !fuse_stat_add_dentry(fc->conn_ctl, stat, + "io_locality", + S_IFREG | 0600, 1, NULL, + &pcs_fuse_io_locality_ops, + stat) || + !fuse_stat_add_dentry(fc->conn_ctl, stat, + "io_tweaks", + S_IFREG | 0600, 1, NULL, + &pcs_fuse_io_tweaks_ops, + stat) || + !fuse_stat_add_dentry(fc->conn_ctl, stat, + "tcp_sndbuf", + S_IFREG | 0600, 1, NULL, + &pcs_fuse_tcp_sndbuf_ops, + stat) || + !fuse_stat_add_dentry(fc->conn_ctl, stat, + "tcp_rcvbuf", + S_IFREG | 0600, 1, NULL, + &pcs_fuse_tcp_rcvbuf_ops, + stat) || + !fuse_stat_add_dentry(fc->conn_ctl, stat, + "local_sndbuf", + S_IFREG | 0600, 1, NULL, + &pcs_fuse_local_sndbuf_ops, + stat) || + !fuse_stat_add_dentry(fc->conn_ctl, stat, + "iolat_cutoff", + S_IFREG | 0600, 1, NULL, + &pcs_fuse_iolat_cutoff_ops, + stat) || + !fuse_stat_add_dentry(fc->conn_ctl, stat, + "netlat_cutoff", + S_IFREG | 0600, 1, NULL, + &pcs_fuse_netlat_cutoff_ops, + stat) || + !fuse_stat_add_dentry(fc->conn_ctl, stat, + "use_unix_socket", + S_IFREG | 0600, 1, NULL, + &pcs_fuse_use_unix_socket_ops, + stat) || + !fuse_stat_add_dentry(fc->conn_ctl, stat, + "wmss", + S_IFREG | 0600, 1, NULL, + &pcs_fuse_wmss_ops, + stat) || + !fuse_stat_add_dentry(fc->conn_ctl, stat, + "rmss", + S_IFREG | 0600, 1, NULL, + &pcs_fuse_rmss_ops, + stat) || + !fuse_stat_add_dentry(fc->conn_ctl, stat, + "lmss", + S_IFREG | 0600, 1, NULL, + &pcs_fuse_lmss_ops, stat)) goto fail_dentries; diff --git a/fs/fuse/kio/pcs/fuse_stat.h b/fs/fuse/kio/pcs/fuse_stat.h index 9e0e0dc1fc15..15bc9733786c 100644 --- a/fs/fuse/kio/pcs/fuse_stat.h +++ b/fs/fuse/kio/pcs/fuse_stat.h @@ -9,7 +9,7 @@ #define _FUSE_STAT_H_ 1 #define STAT_TIMER_PERIOD 5 -#define STAT_NUM_DENTRIES 7 +#define STAT_NUM_DENTRIES 19 struct pcs_msg; struct pcs_int_request; diff --git a/fs/fuse/kio/pcs/pcs_cluster.c b/fs/fuse/kio/pcs/pcs_cluster.c index a19a5597dea6..0a1c8dbc5227 100644 --- a/fs/fuse/kio/pcs/pcs_cluster.c +++ b/fs/fuse/kio/pcs/pcs_cluster.c @@ -521,18 +521,10 @@ static void ireq_on_error_(struct pcs_int_request *ireq) */ ireq_notify_err(ireq, &ireq->error); switch (ireq->error.value) { - /* This can happen if we lost connection for long time and lease has been lost. - * We should try to reacquire lock. Server must reject reacquisition, if someone - * took the lock after us. - */ - case PCS_ERR_LEASE_REQUIRED: - case PCS_ERR_LEASE_EXPIRED: - case PCS_ERR_INTEGRITY_FAIL: { - /* TODO: tag ireq->dentry with EIO here */ - } case PCS_ERR_CSD_LACKING: - /* To be completely equivalent to user space we should add option fail_on_nospace here */ - break; + if (!ireq->dentry->cluster->cfg.fail_on_nospace) + break; + fallthrough; case PCS_ERR_INV_PARAMS: case PCS_ERR_NOT_FOUND: case PCS_ERR_NON_EMPTY_DIR: @@ -540,14 +532,15 @@ static void ireq_on_error_(struct pcs_int_request *ireq) case PCS_ERR_IS_DIR: case PCS_ERR_NO_STORAGE: case PCS_ERR_UNAVAIL: + case PCS_ERR_LEASE_REQUIRED: + case PCS_ERR_LEASE_EXPIRED: + case PCS_ERR_INTEGRITY_FAIL: + case PCS_ERR_LEASE_CONFLICT: TRACE("fatal error:%d ireq->type:%d nodeid:%llu\n", ireq->error.value, ireq->type, ireq->dentry->inode->nodeid); ireq->flags |= IREQ_F_FATAL; break; - case PCS_ERR_LEASE_CONFLICT: - WARN_ON_ONCE(1); - break; default: break; } diff --git a/fs/fuse/kio/pcs/pcs_cluster.h b/fs/fuse/kio/pcs/pcs_cluster.h index a69fb6f0d531..8693d1bf38d7 100644 --- a/fs/fuse/kio/pcs/pcs_cluster.h +++ b/fs/fuse/kio/pcs/pcs_cluster.h @@ -137,7 +137,7 @@ void pcs_zero_fill_read_resp(struct fuse_req * req, unsigned int start, unsigned static inline void pcs_cc_set_abort_timeout(struct pcs_cluster_core *cc, int timeout) { - cc->cfg.def.abort_timeout = cc->cfg.curr.abort_timeout = timeout; + cc->cfg.abort_timeout = timeout; } struct crypto_sync_skcipher; diff --git a/fs/fuse/kio/pcs/pcs_cluster_core.c b/fs/fuse/kio/pcs/pcs_cluster_core.c index 6df2ccee9a1f..86fe185684be 100644 --- a/fs/fuse/kio/pcs/pcs_cluster_core.c +++ b/fs/fuse/kio/pcs/pcs_cluster_core.c @@ -83,14 +83,13 @@ static void pcs_mapset_fini(struct pcs_map_set *maps) list_lru_destroy(&maps->dirty_lru); } -static void init_def_mss(struct pcs_cluster_core *cc) +static void init_cfg_mss(struct pcs_cluster_core *cc) { - cc->cfg.def.wmss = PCS_DFLT_MSS_WRITE; - cc->cfg.def.rmss = PCS_DFLT_MSS_READ; - cc->cfg.def.lmss = PCS_DFLT_MSS_LOCAL; + cc->cfg.wmss = PCS_DFLT_MSS_WRITE; + cc->cfg.rmss = PCS_DFLT_MSS_READ; + cc->cfg.lmss = PCS_DFLT_MSS_LOCAL; } - static void cc_workqueue_handler(struct work_struct *w) { LIST_HEAD(queue); @@ -193,15 +192,11 @@ int pcs_cc_init(struct pcs_cluster_core *cc, struct workqueue_struct *wq, memset(&cc->cfg, 0, sizeof(cc->cfg)); memset(&cc->op, 0, sizeof(cc->op)); - init_def_mss(cc); - cc->cfg.def.kernel_cache_en = 1; - cc->cfg.curr = cc->cfg.def; - cc->cfg.sn = PCS_CONFIG_SEQ_ANY; + init_cfg_mss(cc); - cc->io_tweaks = 0; - cc->netlat_cutoff = PCS_MAX_NETWORK_LATENCY*1000; - cc->iolat_cutoff = PCS_MAX_IO_LATENCY*1000; - cc->abort_callback = NULL; + cc->cfg.netlat_cutoff = PCS_MAX_NETWORK_LATENCY*1000; + cc->cfg.iolat_cutoff = PCS_MAX_IO_LATENCY*1000; + cc->cfg.use_unix_socket = 1; TRACE("Ok cc->{ cl_id:" CLUSTER_ID_FMT ", node_id:" NODE_FMT ", f:%x}\n", CLUSTER_ID_ARGS(cc->eng.cluster_id), NODE_ARGS(cc->eng.local_id), diff --git a/fs/fuse/kio/pcs/pcs_cs.c b/fs/fuse/kio/pcs/pcs_cs.c index efa69cd352ab..7bf6288ac9fb 100644 --- a/fs/fuse/kio/pcs/pcs_cs.c +++ b/fs/fuse/kio/pcs/pcs_cs.c @@ -225,7 +225,7 @@ struct pcs_cs *pcs_cs_find_create(struct pcs_cs_set *csset, PCS_NODE_ID_T *id, P } } } - if (flags & CS_FL_LOCAL_SOCK) + if ((flags & CS_FL_LOCAL_SOCK) && cc_from_csset(csset)->cfg.use_unix_socket) rpc->flags |= PCS_RPC_F_LOCAL; else rpc->flags &= ~PCS_RPC_F_LOCAL; diff --git a/fs/fuse/kio/pcs/pcs_cs_accel.c b/fs/fuse/kio/pcs/pcs_cs_accel.c index 37e97826456e..6e8efaeabc7b 100644 --- a/fs/fuse/kio/pcs/pcs_cs_accel.c +++ b/fs/fuse/kio/pcs/pcs_cs_accel.c @@ -1352,10 +1352,6 @@ int pcs_csa_register(struct pcs_cluster_core * cc, PCS_NODE_ID_T cs_id, struct c cs->csa_ctx = csa_ctx; spin_unlock(&cs->lock); fd_install(fd, file); - - /* Not good, but handy, people will forget this, no doubts */ - if (!cs_io_locality) - cs_io_locality = 1; return fd; out: diff --git a/fs/fuse/kio/pcs/pcs_map.c b/fs/fuse/kio/pcs/pcs_map.c index fc707c9dcb65..4aba8e7e22f9 100644 --- a/fs/fuse/kio/pcs/pcs_map.c +++ b/fs/fuse/kio/pcs/pcs_map.c @@ -1440,7 +1440,8 @@ static int worth_to_grow(struct pcs_int_request *ireq, struct pcs_cs * cs) if (ireq->type == PCS_IREQ_FLUSH) return 0; - return ktime_to_us(ktime_sub(ktime_get(), ireq->ts_sent)) < cc_from_csset(cs->css)->netlat_cutoff; + return ktime_to_us(ktime_sub(ktime_get(), ireq->ts_sent)) < + cc_from_csset(cs->css)->cfg.netlat_cutoff; } static void pcs_cs_deaccount(struct pcs_int_request *ireq, struct pcs_cs * cs, int error) @@ -1458,7 +1459,7 @@ static void pcs_cs_deaccount(struct pcs_int_request *ireq, struct pcs_cs * cs, i cost = PCS_CS_FLUSH_WEIGHT; if (!error) { - int iolat_cutoff = cc_from_csset(cs->css)->iolat_cutoff; + int iolat_cutoff = cc_from_csset(cs->css)->cfg.iolat_cutoff; if (cs->last_latency > iolat_cutoff && ireq->type != PCS_IREQ_FLUSH) { unsigned int clamp; @@ -1756,22 +1757,16 @@ static int get_io_locality(struct pcs_cluster_core *cc) { int io_locality; - io_locality = cs_io_locality; + io_locality = READ_ONCE(cs_io_locality); if (io_locality == 0) - io_locality = cc->cfg.curr.io_locality; + io_locality = READ_ONCE(cc->cfg.io_locality); return io_locality; } static unsigned int get_io_tweaks(struct pcs_cluster_core *cc) { - unsigned int io_tweaks; - - io_tweaks = cc->io_tweaks; - if (io_tweaks == 0) - io_tweaks = cc->cfg.curr.io_tweaks; - - return io_tweaks; + return READ_ONCE(cc->cfg.io_tweaks); } static int select_cs_for_read(struct pcs_cluster_core *cc, struct pcs_cs_list * csl, int is_seq, unsigned int pos, PCS_NODE_ID_T banned_cs) @@ -2039,13 +2034,14 @@ static int pcs_cslist_submit_read(struct pcs_int_request *ireq, struct pcs_cs_li return 0; } - if (allot < ireq->dentry->cluster->cfg.curr.lmss) - allot = ireq->dentry->cluster->cfg.curr.lmss; + iochunk = READ_ONCE(ireq->dentry->cluster->cfg.lmss); + if (allot < iochunk) + allot = iochunk; if (test_bit(CS_SF_LOCAL, &cs->state)) - iochunk = ireq->dentry->cluster->cfg.curr.lmss; + iochunk = READ_ONCE(ireq->dentry->cluster->cfg.lmss); else - iochunk = ireq->dentry->cluster->cfg.curr.rmss; + iochunk = READ_ONCE(ireq->dentry->cluster->cfg.rmss); for (;;) { struct pcs_int_request * sreq = ireq; @@ -2161,11 +2157,12 @@ static int pcs_cslist_submit_write(struct pcs_int_request *ireq, struct pcs_cs_l unsigned int iochunk; int i; int allot; + unsigned int lmss; struct pcs_cs * congested_cs = NULL; u64 congested = 0; ireq->iochunk.cs_index = 0; - iochunk = ireq->dentry->cluster->cfg.curr.lmss; + iochunk = lmss = READ_ONCE(ireq->dentry->cluster->cfg.lmss); restart: allot = ireq->iochunk.size; @@ -2196,11 +2193,11 @@ static int pcs_cslist_submit_write(struct pcs_int_request *ireq, struct pcs_cs_l ireq->tok_reserved |= (1ULL << i); if (!(test_bit(CS_SF_LOCAL, &cs->state))) - iochunk = ireq->dentry->cluster->cfg.curr.wmss; + iochunk = READ_ONCE(ireq->dentry->cluster->cfg.wmss); } - if (allot < ireq->dentry->cluster->cfg.curr.lmss) - allot = ireq->dentry->cluster->cfg.curr.lmss; + if (allot < lmss) + allot = lmss; if (congested) { int queued; diff --git a/fs/fuse/kio/pcs/pcs_req.h b/fs/fuse/kio/pcs/pcs_req.h index ce3a976b5661..e43d28e790f4 100644 --- a/fs/fuse/kio/pcs/pcs_req.h +++ b/fs/fuse/kio/pcs/pcs_req.h @@ -272,6 +272,10 @@ struct pcs_clnt_config int local_sndbuf; int tcp_sndbuf; int tcp_rcvbuf; + int iolat_cutoff; + int netlat_cutoff; + int use_unix_socket; + int fail_on_nospace; }; struct pcs_cluster_core @@ -297,17 +301,7 @@ struct pcs_cluster_core struct pcs_fuse_stat stat; - struct { - struct pcs_clnt_config def; - struct pcs_clnt_config curr; - PCS_CONFIG_SEQ_T sn; - int in_progress; - } cfg; - - int io_tweaks; - int iolat_cutoff; - int netlat_cutoff; - int use_unix_socket; + struct pcs_clnt_config cfg; /* * Our cluster core may be integrated onto the various implementations by customizing the following request processing methods. @@ -319,7 +313,6 @@ struct pcs_cluster_core int (*ireq_check_redo)(struct pcs_int_request *); } op; - int (*abort_callback)(struct pcs_cluster_core *cc, struct pcs_int_request *ireq); struct fuse_conn *fc; spinlock_t lock; diff --git a/fs/fuse/kio/pcs/pcs_rpc.h b/fs/fuse/kio/pcs/pcs_rpc.h index 613b711c7822..f13274300f3e 100644 --- a/fs/fuse/kio/pcs/pcs_rpc.h +++ b/fs/fuse/kio/pcs/pcs_rpc.h @@ -184,9 +184,6 @@ struct pcs_rpc_engine u64 mem_pressure_thresh; u64 mem_limit; - int local_sndbuf; - int tcp_sndbuf; - int tcp_rcvbuf; struct delayed_work stat_work; int max_connections; int max_gc_index; diff --git a/fs/fuse/kio/pcs/pcs_rpc_clnt.c b/fs/fuse/kio/pcs/pcs_rpc_clnt.c index cfc81c053254..81b6101acfa7 100644 --- a/fs/fuse/kio/pcs/pcs_rpc_clnt.c +++ b/fs/fuse/kio/pcs/pcs_rpc_clnt.c @@ -154,7 +154,7 @@ struct pcs_rpc *pcs_rpc_clnt_create(struct pcs_rpc_engine *eng, PCS_NODE_ID_T *p pcs_rpc_set_peer_id(ep, peer_id, PCS_NODE_ROLE_CS); pcs_rpc_set_address(ep, peer_addr); - if (flags & CS_FL_LOCAL_SOCK) + if ((flags & CS_FL_LOCAL_SOCK) && cc_from_rpc(eng)->cfg.use_unix_socket) ep->flags |= PCS_RPC_F_LOCAL; else ep->flags &= ~PCS_RPC_F_LOCAL; diff --git a/fs/fuse/kio/pcs/pcs_sock_conn.c b/fs/fuse/kio/pcs/pcs_sock_conn.c index 13823da22a9d..bce2d898fe5d 100644 --- a/fs/fuse/kio/pcs/pcs_sock_conn.c +++ b/fs/fuse/kio/pcs/pcs_sock_conn.c @@ -33,6 +33,35 @@ static inline void pcs_sock_cork(struct socket *sock) tcp_sock_set_cork(sock->sk, true); } +static inline void set_sock_parameters(struct socket *sock, struct pcs_cluster_core *cc) +{ + if (sock->sk->sk_family == PF_INET || sock->sk->sk_family == PF_INET6) { + unsigned int sndbuf = READ_ONCE(cc->cfg.tcp_sndbuf); + unsigned int rcvbuf = READ_ONCE(cc->cfg.tcp_rcvbuf); + + if (sndbuf || rcvbuf) { + lock_sock(sock->sk); + if (sndbuf) { + sock->sk->sk_userlocks |= SOCK_SNDBUF_LOCK; + WRITE_ONCE(sock->sk->sk_sndbuf, + max_t(int, sndbuf * 2, SOCK_MIN_SNDBUF)); + } + if (rcvbuf) { + sock->sk->sk_userlocks |= SOCK_RCVBUF_LOCK; + WRITE_ONCE(sock->sk->sk_rcvbuf, + max_t(int, rcvbuf * 2, SOCK_MIN_RCVBUF)); + } + release_sock(sock->sk); + } + } else if (sock->sk->sk_family == PF_UNIX) { + unsigned int sndbuf = READ_ONCE(cc->cfg.local_sndbuf); + + if (sndbuf) + WRITE_ONCE(sock->sk->sk_sndbuf, + max_t(int, sndbuf * 2, SOCK_MIN_SNDBUF)); + } +} + void pcs_sockconnect_start(struct pcs_rpc *ep) { struct pcs_sockio *sio; @@ -75,6 +104,7 @@ void pcs_sockconnect_start(struct pcs_rpc *ep) pcs_sock_cork(sock); sio->flags |= PCS_SOCK_F_CORK; } + set_sock_parameters(sock, container_of(ep->eng, struct pcs_cluster_core, eng)); TRACE(PEER_FMT " ->state:%d sock:%p\n", PEER_ARGS(ep), ep->state, sock); cancel_delayed_work(&ep->timer_work); _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel