From nobody Tue Nov 26 10:08:47 2024 X-Original-To: freebsd-hackers@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 4XyJFP6JPBz5fDnB for ; Tue, 26 Nov 2024 10:08:57 +0000 (UTC) (envelope-from pblok@bsd4all.org) Received: from mail.bsd4all.org (mail.bsd4all.org [88.99.169.216]) by mx1.freebsd.org (Postfix) with ESMTP id 4XyJFP0FXQz4m48 for ; Tue, 26 Nov 2024 10:08:56 +0000 (UTC) (envelope-from pblok@bsd4all.org) Authentication-Results: mx1.freebsd.org; dkim=none; spf=pass (mx1.freebsd.org: domain of pblok@bsd4all.org designates 88.99.169.216 as permitted sender) smtp.mailfrom=pblok@bsd4all.org; dmarc=none Received: from mail.bsd4all.org (localhost [127.0.0.1]) by mail.bsd4all.org (Postfix) with ESMTP id C7AD1B340 for ; Tue, 26 Nov 2024 11:08:49 +0100 (CET) X-Virus-Scanned: amavisd-new at bsd4all.org Received: from mail.bsd4all.org ([127.0.0.1]) by mail.bsd4all.org (mail.bsd4all.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id HUMT25hOl-x3 for ; Tue, 26 Nov 2024 11:08:49 +0100 (CET) Received: from smtpclient.apple (geer_ip [81.172.230.56]) by mail.bsd4all.org (Postfix) with ESMTPSA id 1C711B33F for ; Tue, 26 Nov 2024 11:08:49 +0100 (CET) From: Peter Blok Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable List-Id: Technical discussions relating to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-hackers List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-hackers@FreeBSD.org Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.10\)) Subject: flock on directory Message-Id: Date: Tue, 26 Nov 2024 11:08:47 +0100 To: freebsd-hackers@freebsd.org X-Mailer: Apple Mail (2.3696.120.41.1.10) X-Spamd-Result: default: False [-2.68 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_LONG(-1.00)[-0.999]; NEURAL_HAM_SHORT(-0.98)[-0.983]; MV_CASE(0.50)[]; R_SPF_ALLOW(-0.20)[+mx]; MIME_GOOD(-0.10)[text/plain]; RCVD_NO_TLS_LAST(0.10)[]; FROM_HAS_DN(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; ASN(0.00)[asn:24940, ipnet:88.99.0.0/16, country:DE]; RCPT_COUNT_ONE(0.00)[1]; MIME_TRACE(0.00)[0:+]; MID_RHS_MATCH_FROM(0.00)[]; MLMMJ_DEST(0.00)[freebsd-hackers@freebsd.org]; RCVD_COUNT_THREE(0.00)[3]; TO_DN_NONE(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DMARC_NA(0.00)[bsd4all.org]; PREVIOUSLY_DELIVERED(0.00)[freebsd-hackers@freebsd.org]; ARC_NA(0.00)[] X-Rspamd-Queue-Id: 4XyJFP0FXQz4m48 X-Spamd-Bar: -- Hi, I=E2=80=99m trying to run diskless. Both server and client are recent = 14-stable. When running diskless NFSv3 locking doesn=E2=80=99t work, = although everything is setup correctly. ( Will investigate later ). If I = mount with nolockd everything looks ok - no messages. I fixed NFSv4 as a client and it works, but atrun complains about not = being able to flock with LOCK_EX /var/at/jobs, returning EINVAL = According to the manpage this is correct, because the object is not a = file. if ((spool =3D opendir(".")) =3D=3D NULL) perr("cannot read %s", ATJOB_DIR); =20 if (flock(dirfd(spool), LOCK_EX) =3D=3D -1) perr("cannot lock %s", ATJOB_DIR); On a zfs or ufs directory the flock works without returning EINVAL, = which is not in line with the manpage. What would be the approriate thing to change? Should NFS also allow a = flock on a directory, or should we always return EINVAL on any directory = on any file-system? The latter would probably cause some churn Peter