Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3423823imu; Wed, 7 Nov 2018 10:06:11 -0800 (PST) X-Google-Smtp-Source: AJdET5dep2Z1Bpc0rZhe/JihMZD5zwkAFZcvq82UXL6NSzffw7xntJrqMH8RnCRnzjcNUHiUVdJv X-Received: by 2002:a17:902:6b82:: with SMTP id p2-v6mr1245448plk.50.1541613971578; Wed, 07 Nov 2018 10:06:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541613971; cv=none; d=google.com; s=arc-20160816; b=MhpmvZSKa+Yi7jNTYO0L0GYIdGQHc5iZPo7GirtuLFMC1KR+51ZKVt7VzRhpG7grIj DijLmR8ZR1o8YX+Hwbx/x5B/j6RPI+MEGhGHWxh/YAhYeYO572jw5v+Uj4IxImeUOlwg xoyZk+tSxUFwLu8XxRSDHLru2Nxno9pugyHZ2lDt8Xklhbm7JXrDbE2zNRCb+IWvpDFc 2Ri4nNMo6ehdDFqXcmtSPeGeWDcWrjYYmU4+jDFGeAXlHSKQ2RBK+kTsnlnUa9Iwl6/e JWk+Z0mSLNu76fg1vqhqfW36ap2cvFRpPiH+bjDooeYYZUemFN93u2BxtZSkapt3MWqf sNaw== 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; bh=v5DCyuy7eeGENVcK2tIqz3yec3M+04f4v2gQLFHvQos=; b=QyXX6IIFcRtjiZtzequoQNW4gNczwhsQmgHmYFYOEUNRRIB3fkWw1eczMXaABFYQDv XC4ZNxfENd/G5xSnwechU72UpG5Kw27VSHVwjD4/M9BW1Eq8gSkfAGtk6q60kfVKwl5w zsKu0A3nHvrpGxK1HqTon9HyKKNbYLNWdk8qUI99g5RaWDbCOTPYxrCV7ogXaPJCKFwV Vq+6Bk/ptqv9uEgiv8/qHcgXvNL6P4QkGUx/zUtq5YgOr2AFDe8sGu5JBmS+Ep/Ol+tY /geYARtnzrmc8+NN52qy5TSmgziZeO7Kk+DCQZsLeywPMMdaFycmsxnBA696eQvCjyFR PDrw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y5-v6si1347913pfg.52.2018.11.07.10.05.55; Wed, 07 Nov 2018 10:06:11 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728059AbeKHDgq (ORCPT + 99 others); Wed, 7 Nov 2018 22:36:46 -0500 Received: from mx1.redhat.com ([209.132.183.28]:33780 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727604AbeKHDgq (ORCPT ); Wed, 7 Nov 2018 22:36:46 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id ECBF0307EA8F; Wed, 7 Nov 2018 18:05:15 +0000 (UTC) Received: from horse.redhat.com (unknown [10.18.25.234]) by smtp.corp.redhat.com (Postfix) with ESMTP id A5B6C2654F; Wed, 7 Nov 2018 18:05:15 +0000 (UTC) Received: by horse.redhat.com (Postfix, from userid 10451) id 3D2632239AE; Wed, 7 Nov 2018 13:05:15 -0500 (EST) Date: Wed, 7 Nov 2018 13:05:15 -0500 From: Vivek Goyal To: Miklos Szeredi Cc: Al Viro , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] utimensat: AT_EMPTY_PATH support Message-ID: <20181107180515.GA28296@redhat.com> References: <20181107091552.17100-1-mszeredi@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181107091552.17100-1-mszeredi@redhat.com> User-Agent: Mutt/1.9.1 (2017-09-22) X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Wed, 07 Nov 2018 18:05:16 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 07, 2018 at 10:15:52AM +0100, Miklos Szeredi wrote: > This makes it possible to use utimensat on an O_PATH file (including > symlinks). > > It supersedes the nonstandard utimensat(fd, NULL, ...) form. > > Signed-off-by: Miklos Szeredi Thanks for fixing this Miklos. It seems to work for me for following use case I have where I want to change time on symlink opened with O_PATH. symfd = open("foo-symlink.txt", O_PATH | O_NOFOLLOW); utimensat(fd, "", NULL, AT_EMPTY_PATH | AT_SYMLINK_NOFOLLOW); Thanks Vivek > --- > fs/utimes.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/fs/utimes.c b/fs/utimes.c > index bdcf2daf39c1..f9c7ebad19d7 100644 > --- a/fs/utimes.c > +++ b/fs/utimes.c > @@ -97,13 +97,13 @@ long do_utimes(int dfd, const char __user *filename, struct timespec64 *times, > goto out; > } > > - if (flags & ~AT_SYMLINK_NOFOLLOW) > + if (flags & ~(AT_SYMLINK_NOFOLLOW | AT_EMPTY_PATH)) > goto out; > > if (filename == NULL && dfd != AT_FDCWD) { > struct fd f; > > - if (flags & AT_SYMLINK_NOFOLLOW) > + if (flags) > goto out; > > f = fdget(dfd); > @@ -119,6 +119,8 @@ long do_utimes(int dfd, const char __user *filename, struct timespec64 *times, > > if (!(flags & AT_SYMLINK_NOFOLLOW)) > lookup_flags |= LOOKUP_FOLLOW; > + if (flags & AT_EMPTY_PATH) > + lookup_flags |= LOOKUP_EMPTY; > retry: > error = user_path_at(dfd, filename, lookup_flags, &path); > if (error) > -- > 2.14.3 >