NetBSD Problem Report #57145

From www@netbsd.org  Thu Dec 29 05:30:15 2022
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 622BF1A923A
	for <gnats-bugs@gnats.NetBSD.org>; Thu, 29 Dec 2022 05:30:15 +0000 (UTC)
Message-Id: <20221229053013.C63331A923B@mollari.NetBSD.org>
Date: Thu, 29 Dec 2022 05:30:13 +0000 (UTC)
From: andrew.cagney@gmail.com
Reply-To: andrew.cagney@gmail.com
To: gnats-bugs@NetBSD.org
Subject: gmake: *** INTERNAL: readdir: Operation not supported.  Stop.
X-Send-Pr-Version: www-1.0

>Number:         57145
>Category:       kern
>Synopsis:       gmake: *** INTERNAL: readdir: Operation not supported.  Stop.
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Dec 29 05:35:01 +0000 2022
>Last-Modified:  Thu Dec 29 17:05:01 +0000 2022
>Originator:     Andrew Cagney
>Release:        10-BETA
>Organization:
>Environment:
etBSD netbsd 10.0_BETA NetBSD 10.0_BETA (GENERIC) #0: Mon Dec 26 11:25:01 UTC 2022
>Description:
A test framework running NetBSD 10 in a VM gets this reproducible behaviour:

kvmsh w.netbsd 27.09: we're in after 0.1 seconds!
kvmsh w.netbsd 28.00: 'cd' to /source
[root@netbsd source]# time gmake install-base -j4
gmake: *** INTERNAL: readdir: Operation not supported.  Stop.

>How-To-Repeat:

filling in the details:

- the VM, running on a Linux host, was built using:

sudo virt-install \
	--connect=qemu:///system --check=path_in_use=off --graphics=none --virt-type=kvm --noreboot --console=pty,target_type=serial --cpu=host-passthrough --network=network:swandefault,model=virtio --rng=type=random,device=/dev/random --security=type=static,model=dac,label='1000:107',relabel=yes \
	--vcpus=3 \
	--memory=2560 \
	--filesystem=target=bench,type=mount,accessmode=squash,source=/home/libreswan/wip-webkvm \
	--filesystem=target=pool,type=mount,accessmode=squash,source=/home/pool \
	--filesystem=target=source,type=mount,accessmode=squash,source=/home/libreswan/wip-webkvm \
	--filesystem=target=testing,type=mount,accessmode=squash,source=/home/libreswan/wip-webkvm/testing \
	--name=w.netbsd \
	--os-variant=netbsd9.0 \
	--disk=cache=writeback,path=/home/pool/w.netbsd.qcow2 \
	--import \
	--noautoconsole

- the i386 NetBSD guest is using automount to -noauto fstab entries:

[root@netbsd source]# cat /etc/fstab
ROOT.a          /               ffs     rw,noatime      1 1
kernfs          /kern           kernfs  rw
ptyfs           /dev/pts        ptyfs   rw
procfs          /proc           procfs  rw
tmpfs           /var/shm        tmpfs   rw,-m1777,-sram%25
tmpfs           /tmp            tmpfs   rw
192.168.234.1:/home/libreswan/wip-webkvm   /source         nfs     rw,noauto
192.168.234.1:/home/libreswan/wip-webkvm/testing  /testing        nfs     rw,noauto

- the VM is cold booted

- on login nothing is nfs mounted

- cd /source - triggering mount of /source

- time gmake install-base -j4 - triggering above error

Presumably there's some sort of race.  Re-entering the make works fine.
>Fix:

>Audit-Trail:
From: Thomas Klausner <wiz@NetBSD.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: kern/57145: gmake: *** INTERNAL: readdir: Operation not
 supported.  Stop.
Date: Thu, 29 Dec 2022 08:40:12 +0100

 On Thu, Dec 29, 2022 at 05:35:01AM +0000, andrew.cagney@gmail.com wrote:
 > >Number:         57145
 > >Category:       kern
 > >Synopsis:       gmake: *** INTERNAL: readdir: Operation not supported.  Stop.

 I saw this too when building emacs28 once:

   ELC      profiler.elc
 gmake[3]: *** INTERNAL: readdir: Invalid argument.  Stop.
 gmake[3]: *** Waiting for unfinished jobs....
   ELC      ps-bdf.elc

 The next build was successful again.
  Thomas

From: Andrew Cagney <andrew.cagney@gmail.com>
To: gnats-bugs@netbsd.org
Cc: kern-bug-people@netbsd.org, gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Subject: Re: kern/57145: gmake: *** INTERNAL: readdir: Operation not
 supported. Stop.
Date: Thu, 29 Dec 2022 10:27:40 -0500

 `touch` also has problems vis:

 Unhappy:

 # set -x ; touch /source/. ; cd /source ; touch /source/. ; time gmake
 install-base -j4
 + touch /source/.
 touch: /source/.: Operation not supported
 + cd /source
 + touch /source/.
 touch: /source/.: Operation not supported
 + gmake install-base -j4
 gmake: *** INTERNAL: readdir: Operation not supported.  Stop.

 Happy:

 # set -x ; ls /source/. ; cd /source ; touch /source/. ; time gmake
 install-base -j4
 + ls /source/.
 .git                      ...
 + cd /source
 + touch /source/.
 + gmake install-base -j4
 ...


 On Thu, 29 Dec 2022 at 02:45, Thomas Klausner <wiz@netbsd.org> wrote:
 >
 > The following reply was made to PR kern/57145; it has been noted by GNATS.
 >
 > From: Thomas Klausner <wiz@NetBSD.org>
 > To: gnats-bugs@netbsd.org
 > Cc:
 > Subject: Re: kern/57145: gmake: *** INTERNAL: readdir: Operation not
 >  supported.  Stop.
 > Date: Thu, 29 Dec 2022 08:40:12 +0100
 >
 >  On Thu, Dec 29, 2022 at 05:35:01AM +0000, andrew.cagney@gmail.com wrote:
 >  > >Number:         57145
 >  > >Category:       kern
 >  > >Synopsis:       gmake: *** INTERNAL: readdir: Operation not supported.  Stop.
 >
 >  I saw this too when building emacs28 once:
 >
 >    ELC      profiler.elc
 >  gmake[3]: *** INTERNAL: readdir: Invalid argument.  Stop.
 >  gmake[3]: *** Waiting for unfinished jobs....
 >    ELC      ps-bdf.elc
 >
 >  The next build was successful again.
 >   Thomas
 >

From: Andrew Cagney <andrew.cagney@gmail.com>
To: kern-bug-people@netbsd.org, gnats-admin@netbsd.org, netbsd-bugs@netbsd.org, 
	gnats-bugs@netbsd.org
Cc: 
Subject: Re: kern/57145: gmake: *** INTERNAL: readdir: Operation not
 supported. Stop.
Date: Thu, 29 Dec 2022 11:11:31 -0500

 The code is doing:

     open(".")
     lseek(here) -> fails with not supported; should succeed
     read(...)
     lseek(here) -> fails with not supported; should fail with invalid

 bad:

   1371   1371 gmake    CALL  __stat50(0x499426,0xbfb07448)
   1371   1371 gmake    NAMI  "."
   1371   1371 gmake    RET   __stat50 0
   1371   1371 gmake    CALL  open(0x499426,0x600004,0xf0)
   1371   1371 gmake    NAMI  "."
   1371   1371 gmake    RET   open 3
   1371   1371 gmake    CALL  __fstatvfs190(3,0xbfb066c0,2)
   1371   1371 gmake    RET   __fstatvfs190 0
   1371   1371 gmake    CALL  lseek(3,0,0,0,1)
   1371   1371 gmake    RET   lseek -1 errno 45 Operation not supported
   1371   1371 gmake    CALL  __getdents30(3,0xbaa98000,0x1000)
   1371   1371 gmake    GIO   fd 3 read 2048 bytes
        ....
   1371   1371 gmake    RET   __getdents30 2048/0x800
   1371   1371 gmake    CALL  lseek(3,0,0,0,1)
   1371   1371 gmake    RET   lseek -1 errno 45 Operation not supported
   1371   1371 gmake    CALL  __getdents30(3,0xbaa98000,0x1000)
   1371   1371 gmake    GIO   fd 3 read 0 bytes
        ""
   1371   1371 gmake    RET   __getdents30 0

 Good:

   1487   1487 gmake    CALL  __stat50(0xf7a426,0xbfb9d0dc)
   1487   1487 gmake    NAMI  "."
   1487   1487 gmake    RET   __stat50 0
   1487   1487 gmake    CALL  open(0xf7a426,0x600004,0xf0)
   1487   1487 gmake    NAMI  "."
   1487   1487 gmake    RET   open 3
   1487   1487 gmake    CALL  __fstatvfs190(3,0xbfb9c354,2)
   1487   1487 gmake    RET   __fstatvfs190 0
   1487   1487 gmake    CALL  lseek(3,0,0,0,1)
   1487   1487 gmake    RET   lseek 0
   1487   1487 gmake    CALL  __getdents30(3,0xbb185000,0x1000)
   1487   1487 gmake    GIO   fd 3 read 2048 bytes
    ...
   1487   1487 gmake    RET   __getdents30 2048/0x800
   1487   1487 gmake    CALL  lseek(3,0,0,0,1)
   1487   1487 gmake    RET   lseek -1 errno 22 Invalid argument
   1487   1487 gmake    CALL  __getdents30(3,0xbb185800,0x800)
   1487   1487 gmake    GIO   fd 3 read 0 bytes
        ""
   1487   1487 gmake    RET   __getdents30 0
   1487   1487 gmake    CALL  close(3)

From: Andrew Cagney <andrew.cagney@gmail.com>
To: kern-bug-people@netbsd.org, gnats-admin@netbsd.org, netbsd-bugs@netbsd.org, 
	gnats-bugs@netbsd.org
Cc: 
Subject: Re: kern/57145: gmake: *** INTERNAL: readdir: Operation not
 supported. Stop.
Date: Thu, 29 Dec 2022 11:23:08 -0500

 LS has the same problem, I guess it just ignores it:

 first invocation is bad:

   1247   1247 ls       CALL  open(0xae776000,0x600004,0xae771060)
   1247   1247 ls       NAMI  "."
   1247   1247 ls       RET   open 5
   1247   1247 ls       CALL  __fstatvfs190(5,0xbfba9f48,2)
   1247   1247 ls       RET   __fstatvfs190 0
 ...
   1247   1247 ls       CALL  lseek(5,0,0,0,1)
   1247   1247 ls       RET   lseek -1 errno 45 Operation not supported
   1247   1247 ls       CALL  __getdents30(5,0xae770000,0x1000)
 ...
   1247   1247 ls       CALL  lseek(5,0,0,0,1)
   1247   1247 ls       RET   lseek -1 errno 45 Operation not supported

 but second is good:

   1328   1328 ls       CALL  open(0xabce7000,0x600004,0xabce2060)
   1328   1328 ls       NAMI  "."
   1328   1328 ls       RET   open 5
 ...
   1328   1328 ls       CALL  lseek(5,0,0,0,1)
   1328   1328 ls       RET   lseek 0
 ...
   1328   1328 ls       CALL  lseek(5,0,0,0,1)
   1328   1328 ls       RET   lseek -1 errno 22 Invalid argument

From: mlelstv@serpens.de (Michael van Elst)
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: kern/57145: gmake: *** INTERNAL: readdir: Operation not supported. Stop.
Date: Thu, 29 Dec 2022 16:50:12 -0000 (UTC)

 andrew.cagney@gmail.com (Andrew Cagney) writes:

 >+ touch /source/.
 >touch: /source/.: Operation not supported

 That's probably an autofs artefact. touch (or a stat) on the mount point
 doesn't trigger the mount operation and autofs itself does not support
 most things.

 When the filesystem got mounted by some other access, the touch operation
 succeeds because its working on the mounted filesystem, not the autofs
 mount point.

From: Andrew Cagney <andrew.cagney@gmail.com>
To: gnats-bugs@netbsd.org
Cc: kern-bug-people@netbsd.org, gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Subject: Re: kern/57145: gmake: *** INTERNAL: readdir: Operation not
 supported. Stop.
Date: Thu, 29 Dec 2022 12:03:56 -0500

 On Thu, 29 Dec 2022 at 11:55, Michael van Elst <mlelstv@serpens.de> wrote:

 >  >+ touch /source/.
 >  >touch: /source/.: Operation not supported
 >
 >  That's probably an autofs artefact. touch (or a stat) on the mount point
 >  doesn't trigger the mount operation and autofs itself does not support
 >  most things.
 >
 >  When the filesystem got mounted by some other access, the touch operation
 >  succeeds because its working on the mounted filesystem, not the autofs
 >  mount point.

 yes, I figured that out while testing the same thing on FreeBSD

 Per my follow-up the problem is with lseek()

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2022 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.