Received: by 2002:ac0:8c8e:0:0:0:0:0 with SMTP id r14csp353261ima; Wed, 6 Feb 2019 00:53:49 -0800 (PST) X-Google-Smtp-Source: AHgI3IbY0u1bj52t8qr024NFK0zXNclu0rNLdCY20jmawIdfknPo5IvLmHs2We5imoGDserktMXz X-Received: by 2002:a62:57c4:: with SMTP id i65mr9482670pfj.106.1549443228961; Wed, 06 Feb 2019 00:53:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549443228; cv=none; d=google.com; s=arc-20160816; b=b2AB2Vg+UTX/WUhKE1gr4zhxRwDQmyVfR2t/Vmvy9ugMfoxfbyFvtr7NjDfXPtoOuX ErnmrqSC1mrOqYOobQtOg68rZsRQGNMIU8GeJxDlBMG6Dit+AwzmeF2+xFhr8G9G0Uri uGuJN339DF46BxNHbIUBWOiXTNwhmBz7jxeqzhDKrotWUm0tahPD2V3cXTtyuyuzgTJU uV2/TFouc3+auH2NMxQcaLKMS1W24K4fpzBEDlq1gJ4/5FZbLUhHmQlubmCZQdz4HJQa YGOjzon/lK6AwLOQLhz9l6V33kFd/Yq4fF4widV9Z8jl9cyM4Ok9MSW1Fn4SRo70yxvu nXzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=pKp9pLyHx+s34EKHeLUFMMbpdPnaYczVbQqBa/dSsJw=; b=vExao0XqZ5CQmpdAEGzrBtLN99fvsV93Bau6B9/0CVAW3SEAU9Sychbj29vidfgqak sXiwOkLI0NGsW0AU6dJoL7Gq/b2XRYxmYc6q9eUoiWwPtQKLipMnJ32lBdHFy2qsA6Bx pRR/VUqgCe4bpYe1NIX7LZt7uSgXVqCRlYuB2YNbJM+/kwkX/G2BaRKVzuP5xGEtETMM oMvfHsbVGLHQztPZyR5b7LTtf+ZZnRCo3cODAxIeE3XFCa2AtROqGeQGkSWr8pq1DWHi rpaiszk3g8vfGSBfYoEnunC1XzsXs/XutS1VSnH7L13Jh0UkBLGYD20KUNlncDuSry55 vQIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="PRk/rHuD"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d8si5271231pgl.386.2019.02.06.00.53.33; Wed, 06 Feb 2019 00:53:48 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="PRk/rHuD"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728600AbfBFIwM (ORCPT + 99 others); Wed, 6 Feb 2019 03:52:12 -0500 Received: from mail-lj1-f195.google.com ([209.85.208.195]:45194 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727150AbfBFIwM (ORCPT ); Wed, 6 Feb 2019 03:52:12 -0500 Received: by mail-lj1-f195.google.com with SMTP id s5-v6so5262255ljd.12; Wed, 06 Feb 2019 00:52:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=pKp9pLyHx+s34EKHeLUFMMbpdPnaYczVbQqBa/dSsJw=; b=PRk/rHuDWh+nDDJEoyODDEyyEfm7kwn4gIuKZe99o8iJP+UykIahyQm6dFaOxEoHIo KtYtXk9FvDaWfn0E8HR6oEH6umHYRd0E3PAkL7r6XtglMFQRGsf1DC95sYW2cFvfC5n9 ynCxsxM0FqWpVHW4AqPmRnVxUHdxzTbobAAD+GrlSXAZzSLF5ptDdY0QvkdSaPIH8T94 QpnukKqGcAFUZcFtVqn7P6v7jQ2IS1vjZR3Re6hEisgDAexW9pWQNhskY6Wy/w9/qUV2 20GUMIdBWzgkF3CwE5PubSppM8VNo4KkfiuFbK0bgPODMMkRxWGKYh3izxciqtWxZnso /+yw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=pKp9pLyHx+s34EKHeLUFMMbpdPnaYczVbQqBa/dSsJw=; b=SwvGdoCXtaSlwfXulfR+b1wyYv6utXnqAYCuyQKvuJS7v6TQOU/2nVDE1FKu/IoK2U jn+0G62IcMeM7E9KmMQ6wOOBU7tAW1HeOIHRuycvG6ySNjOaz3MAjEbMuThO8jT1xU3f 5qF3CzQkIPliyA1PHc17pvE5I/vBvwR6RHkAsSdBGqplw09jS2SZLtXWwqTYTKvdnQDL TKy1TFvfLDaj6SvAlQQGC7uDB0Z8YLYiduWJTSZ9cHCc/UaNB7PsPvcvlY7PXsZW7Zgd ZBKvgq0LVr4DZHC7rgMF2UEJHDjy61GsSTw4RmYlXQaZVNiUqmDcnCcYH7TVETFOWTV7 2ZRA== X-Gm-Message-State: AHQUAub+P4AKvMYpmahGQ1KApfeul7b/dicGG3uKyif6b31wkU0OvdTT MuHhReLA5NIIPZem7HWQ+ZA= X-Received: by 2002:a2e:8795:: with SMTP id n21-v6mr1228421lji.109.1549443129630; Wed, 06 Feb 2019 00:52:09 -0800 (PST) Received: from uranus.localdomain ([5.18.103.226]) by smtp.gmail.com with ESMTPSA id x21sm4202240lfe.6.2019.02.06.00.52.08 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 06 Feb 2019 00:52:08 -0800 (PST) Received: by uranus.localdomain (Postfix, from userid 1000) id 63C584606E4; Wed, 6 Feb 2019 11:52:03 +0300 (MSK) Date: Wed, 6 Feb 2019 11:52:03 +0300 From: Cyrill Gorcunov To: Dmitry Safonov Cc: linux-kernel@vger.kernel.org, Andrei Vagin , Adrian Reber , Andrei Vagin , Andy Lutomirski , Andy Tucker , Arnd Bergmann , Christian Brauner , Dmitry Safonov <0x7f454c46@gmail.com>, "Eric W. Biederman" , "H. Peter Anvin" , Ingo Molnar , Jeff Dike , Oleg Nesterov , Pavel Emelyanov , Shuah Khan , Thomas Gleixner , containers@lists.linux-foundation.org, criu@openvz.org, linux-api@vger.kernel.org, x86@kernel.org Subject: Re: [PATCH 05/32] timerfd/timens: Take into account ns clock offsets Message-ID: <20190206085203.GB25251@uranus> References: <20190206001107.16488-1-dima@arista.com> <20190206001107.16488-6-dima@arista.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190206001107.16488-6-dima@arista.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 06, 2019 at 12:10:39AM +0000, Dmitry Safonov wrote: > From: Andrei Vagin > > Make timerfd respect timens offsets. > Provide two helpers timens_clock_to_host() timens_clock_from_host() that > are useful to wire up timens to different kernel subsystems. > Following patches will use timens_clock_from_host(), added here for > completeness. > > Signed-off-by: Andrei Vagin > Co-developed-by: Dmitry Safonov > Signed-off-by: Dmitry Safonov > --- > fs/timerfd.c | 16 +++++++++++----- > 1 file changed, 11 insertions(+), 5 deletions(-) > > diff --git a/fs/timerfd.c b/fs/timerfd.c > index 803ca070d42e..c7ae1e371912 100644 > --- a/fs/timerfd.c > +++ b/fs/timerfd.c > @@ -26,6 +26,7 @@ > #include > #include > #include > +#include > > struct timerfd_ctx { > union { > @@ -433,22 +434,27 @@ SYSCALL_DEFINE2(timerfd_create, int, clockid, int, flags) > } > > static int do_timerfd_settime(int ufd, int flags, > - const struct itimerspec64 *new, > + struct itimerspec64 *new, > struct itimerspec64 *old) > { > struct fd f; > struct timerfd_ctx *ctx; > int ret; > > - if ((flags & ~TFD_SETTIME_FLAGS) || > - !itimerspec64_valid(new)) > - return -EINVAL; Please don't defer this early test of a @flags value. Otherwise if @flags is invalid you continue fget/put/clock-to-host even if result will be dropped out then.