Commit 121e0b90 authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Pavel Emelyanov

sysctl: Make CTL_READ nonfatal

Some entries might be missing and that should not cause
CRIU to stop dumping when we know the entries are safe
to unuse.
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent a1b2b10b
...@@ -5,6 +5,7 @@ struct sysctl_req { ...@@ -5,6 +5,7 @@ struct sysctl_req {
char *name; char *name;
void *arg; void *arg;
int type; int type;
int flags;
}; };
extern int sysctl_op(struct sysctl_req *req, size_t nr_req, int op); extern int sysctl_op(struct sysctl_req *req, size_t nr_req, int op);
...@@ -30,4 +31,9 @@ enum { ...@@ -30,4 +31,9 @@ enum {
#define CTL_LEN(t) ((t) >> CTL_SHIFT) #define CTL_LEN(t) ((t) >> CTL_SHIFT)
#define CTL_TYPE(t) ((t) & ((1 << CTL_SHIFT) - 1)) #define CTL_TYPE(t) ((t) & ((1 << CTL_SHIFT) - 1))
/*
* Some entries might be missing mark them as optional.
*/
#define CTL_FLAGS_OPTIONAL 1
#endif /* __CR_SYSCTL_H__ */ #endif /* __CR_SYSCTL_H__ */
...@@ -104,6 +104,7 @@ static int ipv4_conf_op(char *tgt, int *conf, int op, NetnsEntry **netns) ...@@ -104,6 +104,7 @@ static int ipv4_conf_op(char *tgt, int *conf, int op, NetnsEntry **netns)
req[ri].name = path[i]; req[ri].name = path[i];
req[ri].arg = &conf[i]; req[ri].arg = &conf[i];
req[ri].type = CTL_32; req[ri].type = CTL_32;
req[ri].flags = 0;
ri++; ri++;
} }
......
...@@ -137,6 +137,8 @@ static int __sysctl_op(int dir, struct sysctl_req *req, int op) ...@@ -137,6 +137,8 @@ static int __sysctl_op(int dir, struct sysctl_req *req, int op)
fd = openat(dir, req->name, flags); fd = openat(dir, req->name, flags);
if (fd < 0) { if (fd < 0) {
if (errno == ENOENT && (req->flags & CTL_FLAGS_OPTIONAL))
return 0;
pr_perror("Can't open sysctl %s", req->name); pr_perror("Can't open sysctl %s", req->name);
return -1; return -1;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment