Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2903095imu; Wed, 7 Nov 2018 01:18:06 -0800 (PST) X-Google-Smtp-Source: AJdET5f9+QbbV/xMEAKJ0W4T5okQljhavEj5ng+kmZuPMTRbRvx1D86EwSR36RvSck0YkHJcE55P X-Received: by 2002:a62:5e83:: with SMTP id s125-v6mr1092116pfb.232.1541582286358; Wed, 07 Nov 2018 01:18:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541582286; cv=none; d=google.com; s=arc-20160816; b=SCN+k9BKwLcL1GOEtsV5vtIDtfQ79XgQ+iCxJcJ3Azj5DzHnALKmD2YgwlXR1S+RHI MZ2US4fKZswjJ6QqbSN6upHlqn8W/Hqtzn/VWMpKR5kp017MwvmOf8dDLV6cUUTreO7W zhWL8ByieZzCnTXqeij+HfVXsdHGdUEV0IT9T6C4i664bb51DTFyijESRSVuIQIQ1miK TfnMkkChYgUD7En3ttJNK++II6vySpYvKhugSbj71nrfuEWH82mbQZBulq62bFCy/GVv NeVDDtrIzrTuueVCtJiErpGzMPYJHrk+Yexdf2Gmj69ywtlbo3kz5Xf2M/+FWAqq8tLr TKvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=yv1JoQ5Q4u6JnukSJ8B/qDrM60Pa9+B8dF5FUaO3fAg=; b=MGfxg1egHCLS+VRbi0KfCPjdo/59qIfTL4c2SNm5OdyMfnzCi61dlmB4aCz00zBJdQ pgFjgNeIIMh0jqQSKs5RGFIELZKBJytypfniCitHujC4tqvaJZ+AEJF6lnQpTCjQQ0ty G1PvOtCkcRAB14v4ep0kLBLKncu3YoEEYcSkKUbTtqUV2Y+5Zk7wWtGntFMrDoWt85Vc zcWdtps/DEnAylc0U7y6AkIl9LkYQUgGLSUOBc3H70P1htzMtIC2jKWMdISptskFX2VI Is5iA4wmtVGX1DkFXJQaMyxDqrzCMBZCE2GD/gIKQAu6dPXo4TB0RNsmCeX+q391b1k3 s1NA== 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 r199-v6si62392pfr.105.2018.11.07.01.17.51; Wed, 07 Nov 2018 01:18:06 -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 S1728392AbeKGSpZ (ORCPT + 99 others); Wed, 7 Nov 2018 13:45:25 -0500 Received: from mail-wr1-f66.google.com ([209.85.221.66]:38862 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726174AbeKGSpY (ORCPT ); Wed, 7 Nov 2018 13:45:24 -0500 Received: by mail-wr1-f66.google.com with SMTP id d10-v6so16555744wrs.5 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=B+Jqdg2kOGb1W+yMed/YRfe6DmPSqr8ixFI50ppPVjj3kjvaxI4VwEH3625xy8PU+J KjBHWI/lReMFo6l6aovkqDoy1M7iNbf/A5clz7Z43RBx8zUS5QHkieUgH9kk+1pKW2/B LHxVNM68x2Gb4N7p/1W9qlav17EzE3Nd+WbBypGypVQ9MN2U2WgGvI8tP/OZbWX1XXuh SANQohD5MfUmiLw+mpAgEdrbPBDiBD+75nj2v5mIon3LpcG2Eh/HP3vhfOI7iGsNp2iY cIdMatepaxqq47iSModfE3n6Xc0qcpmvj50ws5WGndVQlb0iG8N0NTMcyeGdYMdBDVA3 RdVg== X-Gm-Message-State: AGRZ1gI7J+9OvDSdSCqhemcPJSHhKHeYC+qaREKKsrNHBwl67bIEgh37 VG6C0K6EOtJxY5CCYWfOSg8ogHxlcnk= 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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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) -- 2.14.3