From owner-freebsd-hackers@FreeBSD.ORG Tue Jun 7 17:32:08 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 90627106566B for ; Tue, 7 Jun 2011 17:32:08 +0000 (UTC) (envelope-from mdf356@gmail.com) Received: from mail-ww0-f50.google.com (mail-ww0-f50.google.com [74.125.82.50]) by mx1.freebsd.org (Postfix) with ESMTP id 1FCC48FC0A for ; Tue, 7 Jun 2011 17:32:07 +0000 (UTC) Received: by wwc33 with SMTP id 33so5263111wwc.31 for ; Tue, 07 Jun 2011 10:32:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:date:x-google-sender-auth :message-id:subject:from:to:content-type; bh=55oAs5w9B15ddHsLTHTa1xSX/Pbkpq9rnm341y1JwpU=; b=DYNr9vrZF3e1piXFBAPM9fLakPItU9s+wMftfIYi8h2gETL3kDKLnMXh7RcxrcC7Zz oLZPZ22B5KaZX4zE56nOJUPho7HB2aosupbDonPKRpz5piuhsl3RoiVos1+6daIvMEUz RSz9AjI4OpdzfUC40+ZTGq7tUCP0kAxmTg0rE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:date:x-google-sender-auth:message-id:subject :from:to:content-type; b=wtdecgnwipswkXfbi3EFi48NS1BuMm+EyqIarVkBsJRnvEOuw/nzql91xSiWqfSGuY zGS+c3Xv5mgIryMk1asRnckUYxLwmv6wuiX8YoryCKkYYwDrIq6/0WY/EAO4GfPRjB5y +796qxSKNmN7TTHQLmitnaCsbSpUdZGyO9Fww= MIME-Version: 1.0 Received: by 10.216.59.83 with SMTP id r61mr5139848wec.5.1307467926946; Tue, 07 Jun 2011 10:32:06 -0700 (PDT) Sender: mdf356@gmail.com Received: by 10.216.93.193 with HTTP; Tue, 7 Jun 2011 10:32:06 -0700 (PDT) Date: Tue, 7 Jun 2011 10:32:06 -0700 X-Google-Sender-Auth: -MoOa9Ifht_9j2d2cnlH_Kf5wKg Message-ID: From: mdf@FreeBSD.org To: freebsd-hackers Content-Type: text/plain; charset=ISO-8859-1 Subject: Check for 0 ino_t in readdir(3) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Jun 2011 17:32:08 -0000 There is a check in the function implementing readdir(3) for a zero inode number: struct dirent * _readdir_unlocked(dirp, skip) DIR *dirp; int skip; { /* ... */ if (dp->d_ino == 0 && skip) continue; /* ... */ } "skip" is 1 except for when coming from _seekdir(3). I don't recall any requirement that a filesystem not use an inode numbered 0, though for obvious reasons it's a poor choice for a file's inode. So... is this code in libc incorrect? Or is there documentation that 0 cannot be a valid inode number for a filesystem? If 0 cannot be a valid inode number, my GSoC mentee Gleb suggested d_fileno == 0 be skipped in dirent_exists() as used by vop_stdvptocnp(9), and also skipped by unionfs. Thanks, matthew