From nobody Tue May 02 20:01:40 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Q9rZG0xfYz49Lvb; Tue, 2 May 2023 20:01:42 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-ot1-x330.google.com (mail-ot1-x330.google.com [IPv6:2607:f8b0:4864:20::330]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Q9rZF6Plyz49LJ; Tue, 2 May 2023 20:01:41 +0000 (UTC) (envelope-from mjguzik@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-ot1-x330.google.com with SMTP id 46e09a7af769-6a5f602a8f7so3105890a34.1; Tue, 02 May 2023 13:01:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1683057701; x=1685649701; h=cc:to:subject:message-id:date:from:references:in-reply-to :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=yFuDDd06LpxUrx8g3W+vRpHtVpySvJzkfErEWSvwpA0=; b=LOmOtyINgaI6Vx1Ks8Xpa23Y2CBAHK33NepHmjI8npaBmKHDwxJMNnxODWfmxhRQxu djuIOZJT0Pxv+YOTdz58/9lrTYEXoku9VNDEqJOevzT1sdbr74mLnCbGAK+ihoS8PA3P 0YwLQ4mG9KSiUAhf7sDK/VLK/QokYpMlSSxyOCqGQu6V349OQCSyO02OBlyJrcyvMfdE 8oDs2l2lE5cRU3VdZkiaR3+yzjag1MBTFNsB1z1TFQjstI5osSQiqLsvuPdYxYrmKdCc TZ86JIiLNKbGt65vr50xps8A4p1ZgyC2hdohlaTGyT66ct1T0NJAPMjItAv8SIDdR2Ek ExWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683057701; x=1685649701; h=cc:to:subject:message-id:date:from:references:in-reply-to :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=yFuDDd06LpxUrx8g3W+vRpHtVpySvJzkfErEWSvwpA0=; b=HeRC4h9Jwec5ePVlJ0ezNcf3EiuoVI3U2yrC86/7Kdt9kClHoHPaONm+IZD+7fniid EIQD9BXaPNifqGulv89YPKLAw1xJ3BUlGWKm+UUJfagMVX+jx83EMnUwyu8vl5V5//6H 6ejygQ/6RHR2E182UpTx4lsc5Z05PB+P48Bm1cJ7byWqolP/fkIKI4HwsySNfsQz2hpD /qXEo7O0FKsGmxrz3+9lmXmEjWXLPPRC9kYBvcDsOXh2bwUMCMBcAWP80nqcj+sAOiPv B1rLoKUAs1DtT01kPUDe60zXlvPipQhxhoI6izoX0jq8BuVD1VdwHCqlwS/Em73Sdlzi Avpw== X-Gm-Message-State: AC+VfDxZI5NwpE8KQQHYWEq2a8H9TKK41jaz/KS/YnFZDUmdRt3ZDWnG 6f0Fm7gx6wE2lJZK10Ax9rjW/oX4EUYRRW+cFP+Zuuby X-Google-Smtp-Source: ACHHUZ7iFazPlot0hVO6Jim7FOpTqJh+QOWgMMLIvZMnxFLEigvlqlEbsiQet+3AKL9u3vg3acdDBEPsvapGLyn0Mt8= X-Received: by 2002:a9d:65c1:0:b0:6a5:f682:44c2 with SMTP id z1-20020a9d65c1000000b006a5f68244c2mr8528101oth.14.1683057700724; Tue, 02 May 2023 13:01:40 -0700 (PDT) List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Received: by 2002:ac9:799a:0:b0:4d4:94b:7266 with HTTP; Tue, 2 May 2023 13:01:40 -0700 (PDT) In-Reply-To: References: <202305021512.342FCpbN056202@gitrepo.freebsd.org> From: Mateusz Guzik Date: Tue, 2 May 2023 22:01:40 +0200 Message-ID: Subject: Re: git: a1d71cebc05c - main - fstatat(2): restore AT_EMPTY_PATH handling To: Dmitry Chagin Cc: Mark Johnston , Konstantin Belousov , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4Q9rZF6Plyz49LJ X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US] X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-ThisMailContainsUnwantedMimeParts: N right, this should do it diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index e4977392349f..b583eed5e249 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -4435,6 +4435,7 @@ cache_fplookup_dirfd(struct cache_fpl *fpl, struct vnode **vpp) if ((*vpp)->v_type != VDIR) { if (!((cnp->cn_flags & EMPTYPATH) != 0 && cnp->cn_pnbuf[0] == '\0')) { cache_fpl_smr_exit(fpl); + ndp->ni_resflags |= NIRES_EMPTYPATH; return (cache_fpl_handled_error(fpl, ENOTDIR)); } } On 5/2/23, Dmitry Chagin wrote: > On Tue, May 02, 2023 at 03:04:37PM -0400, Mark Johnston wrote: >> On Tue, May 02, 2023 at 08:00:01PM +0300, Dmitry Chagin wrote: >> > On Tue, May 02, 2023 at 03:12:51PM +0000, Konstantin Belousov wrote: >> > > The branch main has been updated by kib: >> > > >> > > URL: >> > > https://cgit.FreeBSD.org/src/commit/?id=a1d71cebc05ccfeedf95f2db3e94b17270167888 >> > > >> > > commit a1d71cebc05ccfeedf95f2db3e94b17270167888 >> > > Author: Konstantin Belousov >> > > AuthorDate: 2023-05-02 15:11:39 +0000 >> > > Commit: Konstantin Belousov >> > > CommitDate: 2023-05-02 15:11:39 +0000 >> > > >> > > fstatat(2): restore AT_EMPTY_PATH handling >> > > >> > > Fixes: cb858340dcbf214cc4c4d78dbb741620d7b3a252 >> > > Reported by: markj >> > > Sponsored by: The FreeBSD Foundation >> > > --- >> > > sys/kern/vfs_syscalls.c | 6 +++++- >> > > 1 file changed, 5 insertions(+), 1 deletion(-) >> > > >> > > diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c >> > > index 5c0a291e3b0b..d68af4ea4d51 100644 >> > > --- a/sys/kern/vfs_syscalls.c >> > > +++ b/sys/kern/vfs_syscalls.c >> > > @@ -2438,8 +2438,12 @@ kern_statat(struct thread *td, int flag, int >> > > fd, const char *path, >> > > AT_SYMLINK_NOFOLLOW | AT_EMPTY_PATH) | LOCKSHARED | LOCKLEAF | >> > > AUDITVNODE1, pathseg, path, fd, &cap_fstat_rights); >> > > >> > > - if ((error = namei(&nd)) != 0) >> > > + if ((error = namei(&nd)) != 0) { >> > > + if (error == ENOTDIR && >> > > + (nd.ni_resflags & NIRES_EMPTYPATH) != 0) >> > > + error = kern_fstat(td, fd, sbp); >> > > return (error); >> > > + } >> > >> > cache_fplookup_dirfd() doesnt set the NIRES_EMPTYPATH flag >> >> It doesn't, but for an AT_EMPTY_PATH lookup it aborts the lookup and >> returns ENOTDIR to namei(), which sets NIRES_EMPTYPATH before passing >> the error up. >> > > it call cache_fpl_handled_error() which is set status to > CACHE_FPL_STATUS_HADLED, namei() simply return error in that path > > >> > > error = VOP_STAT(nd.ni_vp, sbp, td->td_ucred, NOCRED); >> > > NDFREE_PNBUF(&nd); >> > > vput(nd.ni_vp); >> > > -- Mateusz Guzik