From patchwork Wed Nov 7 09:15:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miklos Szeredi X-Patchwork-Id: 10672015 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 862DB13BF for ; Wed, 7 Nov 2018 09:15:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7704928EC8 for ; Wed, 7 Nov 2018 09:15:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6B52A2B851; Wed, 7 Nov 2018 09:15:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI,SUBJ_OBFU_PUNCT_FEW autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2379728EC8 for ; Wed, 7 Nov 2018 09:15:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728486AbeKGSpZ (ORCPT ); Wed, 7 Nov 2018 13:45:25 -0500 Received: from mail-wr1-f66.google.com ([209.85.221.66]:43324 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726097AbeKGSpZ (ORCPT ); Wed, 7 Nov 2018 13:45:25 -0500 Received: by mail-wr1-f66.google.com with SMTP id y3-v6so16241135wrh.10 for ; Wed, 07 Nov 2018 01:15:56 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=yv1JoQ5Q4u6JnukSJ8B/qDrM60Pa9+B8dF5FUaO3fAg=; b=k16kt3KlCGtghcRAAn9fVNGGepcFx2aVoPaGC/O8L2BELzaMYrSKC97jrUjcYHQJQx ZG6vIvAMWKIs0M+ueSPbcmjXZFpUEKl0fNx1/9/dmejDP9EVBMSNsHVfyNPjetSfXyM4 HLdvVtNQ5xVs4mfL1HToSve5o7U14u045gBP6kRO/JQKPdmtVJbAkBjv2G0T4C0vlzSF Z3UaCCOuVO7JJppXv+bk5wGMLje9E4tLMSc1Hj6RjNdjhMUjr8t/EAFXbbMey/2KnRa8 AT6p2WZLlqTkKSp8mF0CxMkWuDXNYYBHohuYnmqovDlFKTH5U79FtCnBjBqO0yi9iIhG WNHg== X-Gm-Message-State: AGRZ1gJrN5njFPxTJTRwo6zOwEXFeIYMwkTAJxLc+ed7ZF0K2tVD6mLt qJb+Q60UF9yFkWa9xjb3qxYSlQ== X-Google-Smtp-Source: AJdET5f/WaJGI5i4Ec06++vQYUVoc2XViMeE2PA8B8DUuTIL1aSYovHqF29CZqQE+PPVZyQQ4YgbrQ== X-Received: by 2002:adf:fdc8:: with SMTP id i8-v6mr1147367wrs.276.1541582155417; Wed, 07 Nov 2018 01:15:55 -0800 (PST) Received: from veci.piliscsaba.redhat.com (catv-212-96-48-140.catv.broadband.hu. [212.96.48.140]) by smtp.gmail.com with ESMTPSA id j203-v6sm329969wmd.46.2018.11.07.01.15.54 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 07 Nov 2018 01:15:54 -0800 (PST) From: Miklos Szeredi To: Al Viro Cc: Vivek Goyal , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] utimensat: AT_EMPTY_PATH support Date: Wed, 7 Nov 2018 10:15:52 +0100 Message-Id: <20181107091552.17100-1-mszeredi@redhat.com> X-Mailer: git-send-email 2.14.3 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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)