Intended to be used to abort all SUNRPC operations. For example in case of
fast stop with unreachable network.

Signed-off-by: Stanislav Kinsburskiy <skinsbur...@virtuozzo.com>
---
 include/linux/ve.h |    3 +++
 kernel/ve/ve.c     |   15 ++++++++++++++-
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/include/linux/ve.h b/include/linux/ve.h
index 2d8eca6..0eb893d 100644
--- a/include/linux/ve.h
+++ b/include/linux/ve.h
@@ -122,6 +122,9 @@ struct ve_struct {
        int                     netns_max_nr;
        atomic_t                netif_avail_nr;
        int                     netif_max_nr;
+
+       bool                    sunrpc_abort;
+
        /* Number of mounts. May become unbalanced if VE0 mounts something
         * and the VE unmounts it. This is acceptable.
         */
diff --git a/kernel/ve/ve.c b/kernel/ve/ve.c
index 7cb47fa..7bb02e2 100644
--- a/kernel/ve/ve.c
+++ b/kernel/ve/ve.c
@@ -1216,6 +1216,7 @@ enum {
        VE_CF_NETNS_NR,
        VE_CF_NETIF_MAX_NR,
        VE_CF_NETIF_NR,
+       VE_CF_SUNRPC_ABORT,
 };
 
 static int ve_ts_read(struct cgroup *cg, struct cftype *cft, struct seq_file 
*m)
@@ -1289,6 +1290,9 @@ static u64 ve_read_u64(struct cgroup *cg, struct cftype 
*cft)
                return cgroup_ve(cg)->netif_max_nr;
        else if (cft->private == VE_CF_NETIF_NR)
                return atomic_read(&cgroup_ve(cg)->netif_avail_nr);
+       else if (cft->private == VE_CF_SUNRPC_ABORT)
+               return cgroup_ve(cg)->sunrpc_abort;
+
        return 0;
 }
 
@@ -1380,7 +1384,9 @@ static int _ve_write_u64(struct cgroup *cg, struct cftype 
*cft,
 
                ve->netif_max_nr = value;
                atomic_add(delta, &ve->netif_avail_nr);
-       }
+       } else if (cft->private == VE_CF_SUNRPC_ABORT)
+               ve->sunrpc_abort = (bool)value;
+
        up_write(&ve->op_sem);
        return 0;
 }
@@ -1497,6 +1503,13 @@ static struct cftype ve_cftypes[] = {
                .read_u64               = ve_read_u64,
                .private                = VE_CF_NETIF_NR,
        },
+       {
+               .name                   = "sunrpc_abort",
+               .flags                  = CFTYPE_NOT_ON_ROOT,
+               .read_u64               = ve_read_u64,
+               .write_u64              = ve_write_running_u64,
+               .private                = VE_CF_SUNRPC_ABORT,
+       },
        { }
 };
 

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to