NetBSD Problem Report #55775

From www@netbsd.org  Mon Nov  2 09:53:00 2020
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-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 E536A1A9239
	for <gnats-bugs@gnats.NetBSD.org>; Mon,  2 Nov 2020 09:53:00 +0000 (UTC)
Message-Id: <20201102095259.B47921A9243@mollari.NetBSD.org>
Date: Mon,  2 Nov 2020 09:52:59 +0000 (UTC)
From: support@chalmers.se
Reply-To: support@chalmers.se
To: gnats-bugs@NetBSD.org
Subject: Coda client, its in-kernel part, opens wrong files instead of cache containers
X-Send-Pr-Version: www-1.0

>Number:         55775
>Category:       kern
>Synopsis:       Coda client, its in-kernel part, opens wrong files instead of cache containers#2562547@chalmers.se
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    hannken
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Nov 02 09:55:00 +0000 2020
>Closed-Date:    Tue Nov 17 08:52:02 +0000 2020
>Last-Modified:  Tue Nov 17 08:52:02 +0000 2020
>Originator:     CDAL (to Subject please add "#2562547@chalmers.se")
>Release:        8.0 - 9.1
>Organization:
ITA
>Environment:
i386, tested with out-of-the-box CDROM-install of NetBSD-RELEASE 7.1, 8.0, 8.2, 9.1
>Description:
Venus (Coda filesystem cache manager) properly creates container files and their contents and passes correct device+inode information to the kernel in its downcalls.

Nevertheless the kernel passes to the user space process (at open() on a directory at or below /coda) a file descriptor of some unrelated file on a local file system, instead of the file descriptor of the container file of the directory contents. At the same time /proc/<pid>/fd/<n> of the user process points to the correct venus container cache file, with correct contents.

Some time it is possible to identify the files being erroneously involved, by looking at output of "ls" or at its trace.

NetBSD-7.1 works flawlessly, 8.0 and above are broken in the described way.

The problem seems to be related to some in-kernel caching (?), because sometimes accesses work as supposed.
>How-To-Repeat:
# cd /usr/pkgsrc/net/coda && make install

-- create prerequisites for a local-only Coda server
# sed -i '/127\.0\.0\.1/s/$/ localhost.localdomain/' /etc/hosts
# cp /usr/pkg/share/examples/coda/server.conf /usr/pkg/etc/coda/server.conf.ex
# sed -i '/^#ipaddress=/s//ipaddress=127.0.0.1/' /usr/pkg/etc/coda/server.conf.ex

-- setup and start a local-only Coda server (same results with external ones)
# vice-setup
localdomain
yes
yes
/vice
y
rAndOmT1
RaNdOmT2
randOMT3
y
1
111111
realmadm
y
/vice/LOG
20M
/vice/DATA
32M
y
/vicepa
y
1M
y
=> ...
=> / Coda file server (startserver)
=> ...
=> ... creating the root volume ...
=> Backed Up?
n

-- check
# cat /vice/srv/SrvLog
=> ...
=> File Server started

-- [if the root volume were not created above, then]
# createvol_rep / localhost.localdomain
=> ...
=> Backed Up?
n

-- [to start the server manually]
# codastart
-- [to stop the server manually]
# volutil shutdown

-- setup and start a Coda client
# venus-setup localhost.localdomain
# venus
=> ...
=>  /coda now mounted

-- [to start the client manually]
# venus
-- [to stop the client manually]
# vutil --shutdown

-- get credentials for access to the created realm
-- they expire in 25 hours and also disappear at venus restarts
# clog realmadm
changeme

-- try to access the top level directory (behaves similarly for any level)
# ls -al /coda
=> (hangs with 100% CPU or possibly shows a line from an unrelated local file)

-- to see the actual directory contents:
# od -c /var/lib/coda/cache/00/00/00/01
=> (a directory with . .. localhost.localdomain)

-- venus itself does not have problems to handle directories and pathnames
mkdir /coda/localhost.localdomain/testdir
od -c /var/lib/coda/cache/00/00/00/05
od -c /var/lib/coda/cache/00/00/00/07

-- the problem is possibly limited to directories,
-- but this is unclear, because the results vary in general
echo testdata > /coda/localhost.localdomain/testdir/testfile
od -c /var/lib/coda/cache/00/00/00/09
cat /coda/localhost.localdomain/testdir/testfile
=> testdata
>Fix:
No

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: kern-bug-people->hannken
Responsible-Changed-By: hannken@NetBSD.org
Responsible-Changed-When: Sat, 14 Nov 2020 11:38:50 +0000
Responsible-Changed-Why:
Have a fix.


From: "Juergen Hannken-Illjes" <hannken@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/55775 CVS commit: src/sys/coda
Date: Sat, 14 Nov 2020 11:42:56 +0000

 Module Name:	src
 Committed By:	hannken
 Date:		Sat Nov 14 11:42:56 UTC 2020

 Modified Files:
 	src/sys/coda: coda.h coda_vnops.c

 Log Message:
 Rewrite coda_readdir() to directly process the container file.

 Passing this operation down to the file system holding the container
 cannot work for anything but UFS and UFS doesn't allow reading
 directory from a plain file since ~2015.

 Fixes PR kern/55775 Coda client, its in-kernel part, opens wrong files ...


 To generate a diff of this commit:
 cvs rdiff -u -r1.20 -r1.21 src/sys/coda/coda.h
 cvs rdiff -u -r1.113 -r1.114 src/sys/coda/coda_vnops.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->pending-pullups
State-Changed-By: hannken@NetBSD.org
State-Changed-When: Sat, 14 Nov 2020 12:01:04 +0000
State-Changed-Why:
Fix committed, pullups requested:
pullup-8 #1622 and pullup-9 #1131


From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/55775 CVS commit: [netbsd-8] src/sys/coda
Date: Sat, 14 Nov 2020 12:59:06 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Sat Nov 14 12:59:06 UTC 2020

 Modified Files:
 	src/sys/coda [netbsd-8]: coda.h coda_vnops.c

 Log Message:
 Pull up following revision(s) (requested by hannken in ticket #1622):

 	sys/coda/coda_vnops.c: revision 1.114 (patch)
 	sys/coda/coda.h: revision 1.21 (patch)

 Rewrite coda_readdir() to directly process the container file.

 Passing this operation down to the file system holding the container
 cannot work for anything but UFS and UFS doesn't allow reading
 directory from a plain file since ~2015.

 Fixes PR kern/55775 Coda client, its in-kernel part, opens wrong files ...


 To generate a diff of this commit:
 cvs rdiff -u -r1.19 -r1.19.10.1 src/sys/coda/coda.h
 cvs rdiff -u -r1.106 -r1.106.2.1 src/sys/coda/coda_vnops.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/55775 CVS commit: [netbsd-9] src/sys/coda
Date: Sat, 14 Nov 2020 13:01:56 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Sat Nov 14 13:01:55 UTC 2020

 Modified Files:
 	src/sys/coda [netbsd-9]: coda.h coda_vnops.c

 Log Message:
 Pull up following revision(s) (requested by hannken in ticket #1131):

 	sys/coda/coda_vnops.c: revision 1.114 (patch)
 	sys/coda/coda.h: revision 1.21 (patch)

 Rewrite coda_readdir() to directly process the container file.

 Passing this operation down to the file system holding the container
 cannot work for anything but UFS and UFS doesn't allow reading
 directory from a plain file since ~2015.

 Fixes PR kern/55775 Coda client, its in-kernel part, opens wrong files ...


 To generate a diff of this commit:
 cvs rdiff -u -r1.20 -r1.20.6.1 src/sys/coda/coda.h
 cvs rdiff -u -r1.107 -r1.107.4.1 src/sys/coda/coda_vnops.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: pending-pullups->closed
State-Changed-By: hannken@NetBSD.org
State-Changed-When: Tue, 17 Nov 2020 08:52:02 +0000
State-Changed-Why:
Fixed in tree, pullups complete and autobuilds done.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.