[CRIU] [PATCH] files: check fd flags after restore
Stanislav Kinsburskiу
skinsbursky at odin.com
Tue Dec 15 03:37:12 PST 2015
15 дек. 2015 г. 12:31 PM пользователь Pavel Emelyanov <xemul at parallels.com> написал:
>
> On 12/14/2015 06:19 PM, Stanislav Kinsburskiy wrote:
> > System call sys_fcntl() in _some_ kernels can silently drop some flags during
> > set and return success code.
>
> What are these flags?
>
O_DIRECT and O_SYNC. Feature of openvz kernel.
> > This patch adds double check, that all the fd flags were really set.
> >
> > Signed-off-by: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>
> > ---
> > files.c | 11 +++++++++++
> > 1 file changed, 11 insertions(+)
> >
> > diff --git a/files.c b/files.c
> > index a27667d..751a9a9 100644
> > --- a/files.c
> > +++ b/files.c
> > @@ -741,6 +741,17 @@ int set_fd_flags(int fd, int flags)
> > ret = fcntl(fd, F_SETFL, flags);
> > if (ret < 0)
> > goto err;
> > +
> > + /* Let's check, that now actual flags contains those we need */
> > + ret = fcntl(fd, F_GETFL, 0);
> > + if (ret < 0)
> > + goto err;
> > +
> > + if (ret != flags) {
> > + pr_err("fcntl call on fd %d (flags %#o) succeeded, "
> > + "but some flags were dropped: %#o\n", fd, flags, ret);
> > + return -1;
> > + }
> > return 0;
> >
> > err:
> >
> > _______________________________________________
> > CRIU mailing list
> > CRIU at openvz.org
> > https://lists.openvz.org/mailman/listinfo/criu
> > .
> >
>
More information about the CRIU
mailing list