From owner-freebsd-fs@FreeBSD.ORG Thu Feb 4 12:57:33 2010 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CFCE5106566C for ; Thu, 4 Feb 2010 12:57:33 +0000 (UTC) (envelope-from gleb.kurtsou@gmail.com) Received: from mail-ew0-f211.google.com (mail-ew0-f211.google.com [209.85.219.211]) by mx1.freebsd.org (Postfix) with ESMTP id 5AE588FC26 for ; Thu, 4 Feb 2010 12:57:33 +0000 (UTC) Received: by ewy3 with SMTP id 3so307938ewy.13 for ; Thu, 04 Feb 2010 04:57:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:references:mime-version:content-type:content-disposition :in-reply-to:user-agent; bh=mbZJIGIJB1gtJ6pShBTxJYUyS3UYKw1EzqraJpqWrXw=; b=U5nVCijjlPYAMtqqlhQ6/X14rICJc15lL6nOLahLNTPwHhdhfSPQ7n+2GuAvXKcUK3 nGA+VQyTXutkfIGaJKPCDjSyTCKhWJrDW06EN4Nuj0/o+TVkwDGnqfpwaNpgVyxaX5TI qeNSeb9BTrwbceP9FQllH2C69EfkCjiKxfxuU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=xtPaUtRJlsZ94RYKnbLmbCdf0HizXLpyTVcOV9Pedp8L0l/E+BxATBDbEinnWjlEcv Zf8/ayC0J7/QFGoBiI7D+FSn1INDJkU5QSqZkDOlYnCTYjNKgoYehGci8c74xuKBm0pq oTWxX/3PeX1zcnI2drLr97ty8FO+9NT2y8j78= Received: by 10.213.107.69 with SMTP id a5mr937868ebp.73.1265288251951; Thu, 04 Feb 2010 04:57:31 -0800 (PST) Received: from localhost (lan-78-157-90-54.vln.skynet.lt [78.157.90.54]) by mx.google.com with ESMTPS id 14sm66226ewy.3.2010.02.04.04.57.30 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 04 Feb 2010 04:57:31 -0800 (PST) Date: Thu, 4 Feb 2010 14:57:26 +0200 From: Gleb Kurtsou To: Freddie Cash Message-ID: <20100204125726.GB5784@tops.skynet.lt> References: <4b473c1f1002032014y4da8c0f0xcb74c749332cced3@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) Cc: freebsd-fs@freebsd.org Subject: Re: Unable to pwd in ZFS snapshot X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Feb 2010 12:57:33 -0000 On (03/02/2010 21:00), Freddie Cash wrote: > On Wed, Feb 3, 2010 at 8:14 PM, Randy Sofia wrote: > > > `pwd` returns "No such file or directory" when browsing snapshot files. > > This > > was addressed in: > > http://lists.freebsd.org/pipermail/fr > > > >> > >> --randy > > eebsd-fs/2009-February/005675.html but > > remains the same as of 8.0-RELEASE. > > > > I am wondering if this is the expected behavior or if this was left by the > > wayside. > > > > A work around is available as per the previous discussion: > > zfs set snapdir=visible volume > > > > Reproducible behavior: > > CANAAN# zfs snapshot pithos/media@0_day_ago > > CANAAN# cd /pithos/media/.zfs/snapshot/0_day_ago/ > > CANAAN# pwd > > pwd: .: No such file or directory > > CANAAN# uname -a > > FreeBSD CANAAN 8.0-RELEASE FreeBSD 8.0-RELEASE #0: Fri Dec 18 00:38:33 UTC > > 2009 root@:/usr/obj/usr/src/sys/CANAAN amd64 > > > > I believe this is a "bug" in csh, in that it doesn't have a pwd shell > built-in, and uses /bin/pwd. The real issue lies in /bin/pwd. > > It works correctly in sh, zsh, and bash, which each have pwd built-ins. As > a workaround, use a non-csh-based shell. :) /bin/pwd is absolutely correct! It's filesystems that fail to set inode numbers correctly. Try using pwd in fuse-sshfs (it completely ignores inode numbers). pwd builtins cache current working directory, thus just work. All inode numbers are the same for snapshot entries. I'll try to find time to look into it on the weekend. On my machine: /home/.zfs/snapshot % ls 2009-12-05 2009-12-25 2010-02-04 /home/.zfs/snapshot % stat -s * st_dev=735101931 st_ino=3 st_mode=040755 st_nlink=4 st_uid=0 st_gid=0 st_rdev=0 st_size=4 st_atime=1259939945 st_mtime=1259945157 st_ctime=1259945157 st_birthtime=1259939945 st_blksize=4096 st_blocks=3 st_flags=0 st_dev=2095450778 st_ino=3 st_mode=040755 st_nlink=5 st_uid=0 st_gid=0 st_rdev=0 st_size=5 st_atime=1259939945 st_mtime=1260923930 st_ctime=1260923930 st_birthtime=1259939945 st_blksize=4096 st_blocks=3 st_flags=0 st_dev=2506498978 st_ino=3 st_mode=040755 st_nlink=5 st_uid=0 st_gid=0 st_rdev=0 st_size=5 st_atime=1259939945 st_mtime=1263206215 st_ctime=1263206215 st_birthtime=1259939945 st_blksize=4096 st_blocks=3 st_flags=0 > > Doing a truss on /bin/pwd when in /home/.zfs/snapshot/2009-12-31 (I snapshot > /home daily) gives the following with snapdir=hidden: > > __getcwd(0x28201400,1024) ERR#2 'No such file or > directory' > stat("/",{ mode=drwxr-xr-x ,inode=2,size=512,blksize=4096 }) = 0 (0x0) > lstat(".",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0 (0x0) > stat("..",{ mode=dr-xr-xr-x ,inode=2,size=24,blksize=4096 }) = 0 (0x0) > open("..",O_NONBLOCK,05001200603) = 3 (0x3) > fstat(3,{ mode=dr-xr-xr-x ,inode=2,size=24,blksize=4096 }) = 0 (0x0) > fcntl(3,F_SETFD,FD_CLOEXEC) = 0 (0x0) > __sysctl(0x84bfe6a8,0x2,0x281994bc,0x84bfe6b0,0x0,0x0) = 0 (0x0) > fstatfs(0x3,0x84bfe780,0x1,0x0,0x3,0x28073c94) = 0 (0x0) > fstat(3,{ mode=dr-xr-xr-x ,inode=2,size=24,blksize=4096 }) = 0 (0x0) > getdirentries(0x3,0x2820e000,0x1000,0x2820d054,0x484328eb,0x28086400) = 1164 > (0x48c) > lstat("../2010-01-26",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0 > (0x0) > lstat("../2009-12-26",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0 > (0x0) > lstat("../2010-01-14",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0 > (0x0) > lstat("../2009-12-14",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0 > (0x0) > lstat("../2010-01-07",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0 > (0x0) > lstat("../2010-01-13",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0 > (0x0) > lstat("../2010-01-19",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0 > (0x0) > lstat("../2009-12-21",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0 > (0x0) > lstat("../2010-01-21",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0 > (0x0) > lstat("../2009-12-25",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0 > (0x0) > lstat("../2010-01-25",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0 > (0x0) > lstat("../2010-02-03",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0 > (0x0) > lstat("../2009-12-17",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0 > (0x0) > lstat("../2010-01-17",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0 > (0x0) > lstat("../2009-12-04",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0 > (0x0) > lstat("../2010-01-04",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0 > (0x0) > lstat("../2010-01-03",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0 > (0x0) > lstat("../2010-01-09",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0 > (0x0) > lstat("../2009-12-09",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0 > (0x0) > lstat("../2009-12-03",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0 > (0x0) > lstat("../2010-01-31",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0 > (0x0) > lstat("../2009-12-31",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0 > (0x0) > lseek(3,0x0,SEEK_SET) = 0 (0x0) > close(3) = 0 (0x0) > lstat("../",{ mode=dr-xr-xr-x ,inode=2,size=24,blksize=4096 }) = 0 (0x0) > stat("../..",{ mode=dr-xr-xr-x ,inode=1,size=3,blksize=4096 }) = 0 (0x0) > open("../..",O_NONBLOCK,05001200603) = 3 (0x3) > fstat(3,{ mode=dr-xr-xr-x ,inode=1,size=3,blksize=4096 }) = 0 (0x0) > fcntl(3,F_SETFD,FD_CLOEXEC) = 0 (0x0) > fstatfs(0x3,0x84bfe780,0x1,0x0,0x3,0x28073c94) = 0 (0x0) > fstat(3,{ mode=dr-xr-xr-x ,inode=1,size=3,blksize=4096 }) = 0 (0x0) > getdirentries(0x3,0x2820e000,0x1000,0x2820d054,0x484328eb,0x6cd7212) = 44 > (0x2c) > lseek(3,0x0,SEEK_SET) = 0 (0x0) > close(3) = 0 (0x0) > lstat("../../",{ mode=dr-xr-xr-x ,inode=1,size=3,blksize=4096 }) = 0 (0x0) > stat("../../..",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0 (0x0) > open("../../..",O_NONBLOCK,03777777) = 3 (0x3) > fstat(3,{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0 (0x0) > fcntl(3,F_SETFD,FD_CLOEXEC) = 0 (0x0) > fstatfs(0x3,0x84bfe780,0x1,0x0,0x3,0x28073c94) = 0 (0x0) > fstat(3,{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0 (0x0) > getdirentries(0x3,0x2820e000,0x1000,0x2820d054,0x484328eb,0x6cd7212) = 56 > (0x38) > getdirentries(0x3,0x2820e000,0x1000,0x2820d054,0x484328eb,0x6cd7212) = 0 > (0x0) > lseek(3,0x0,SEEK_SET) = 0 (0x0) > close(3) = 0 (0x0) > > > And gives the following when snapdir=visible: > __getcwd(0x28201400,1024) ERR#2 'No such file or > directory' > stat("/",{ mode=drwxr-xr-x ,inode=2,size=512,blksize=4096 }) = 0 > (0x0) > lstat(".",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0 > (0x0) > stat("..",{ mode=dr-xr-xr-x ,inode=2,size=24,blksize=4096 }) = 0 > (0x0) > open("..",O_NONBLOCK,05001200603) = 3 > (0x3) > fstat(3,{ mode=dr-xr-xr-x ,inode=2,size=24,blksize=4096 }) = 0 > (0x0) > fcntl(3,F_SETFD,FD_CLOEXEC) = 0 > (0x0) > __sysctl(0x84bfe6f8,0x2,0x281994bc,0x84bfe700,0x0,0x0) = 0 > (0x0) > fstatfs(0x3,0x84bfe7d0,0x1,0x0,0x3,0x28073c94) = 0 > (0x0) > fstat(3,{ mode=dr-xr-xr-x ,inode=2,size=24,blksize=4096 }) = 0 > (0x0) > getdirentries(0x3,0x2820e000,0x1000,0x2820d054,0x484328eb,0x28086400) = 1164 > (0x48c) > lstat("../2010-01-26",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0 > (0x0) > lstat("../2009-12-26",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0 > (0x0) > lstat("../2010-01-14",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0 > (0x0) > lstat("../2009-12-14",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0 > (0x0) > lstat("../2010-01-07",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0 > (0x0) > lstat("../2010-01-13",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0 > (0x0) > lstat("../2010-01-19",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0 > (0x0) > lstat("../2009-12-21",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0 > (0x0) > lstat("../2010-01-21",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0 > (0x0) > lstat("../2009-12-25",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0 > (0x0) > lstat("../2010-01-25",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0 > (0x0) > lstat("../2010-02-03",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0 > (0x0) > lstat("../2009-12-17",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0 > (0x0) > lstat("../2010-01-17",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0 > (0x0) > lstat("../2009-12-04",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0 > (0x0) > lstat("../2010-01-04",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0 > (0x0) > lstat("../2010-01-03",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0 > (0x0) > lstat("../2010-01-09",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0 > (0x0) > lstat("../2009-12-09",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0 > (0x0) > lstat("../2009-12-03",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0 > (0x0) > lstat("../2010-01-31",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0 > (0x0) > lstat("../2009-12-31",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0 > (0x0) > lseek(3,0x0,SEEK_SET) = 0 > (0x0) > close(3) = 0 > (0x0) > lstat("../",{ mode=dr-xr-xr-x ,inode=2,size=24,blksize=4096 }) = 0 > (0x0) > stat("../..",{ mode=dr-xr-xr-x ,inode=1,size=3,blksize=4096 }) = 0 > (0x0) > open("../..",O_NONBLOCK,05001200603) = 3 > (0x3) > fstat(3,{ mode=dr-xr-xr-x ,inode=1,size=3,blksize=4096 }) = 0 > (0x0) > fcntl(3,F_SETFD,FD_CLOEXEC) = 0 > (0x0) > fstatfs(0x3,0x84bfe7d0,0x1,0x0,0x3,0x28073c94) = 0 > (0x0) > fstat(3,{ mode=dr-xr-xr-x ,inode=1,size=3,blksize=4096 }) = 0 > (0x0) > getdirentries(0x3,0x2820e000,0x1000,0x2820d054,0x484328eb,0x6cd7212) = 44 > (0x2c) > lseek(3,0x0,SEEK_SET) = 0 > (0x0) > close(3) = 0 > (0x0) > lstat("../../",{ mode=dr-xr-xr-x ,inode=1,size=3,blksize=4096 }) = 0 > (0x0) > stat("../../..",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0 > (0x0) > open("../../..",O_NONBLOCK,03777777) = 3 > (0x3) > fstat(3,{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0 > (0x0) > fcntl(3,F_SETFD,FD_CLOEXEC) = 0 > (0x0) > fstatfs(0x3,0x84bfe7d0,0x1,0x0,0x3,0x28073c94) = 0 > (0x0) > fstat(3,{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0 > (0x0) > getdirentries(0x3,0x2820e000,0x1000,0x2820d054,0x484328eb,0x6cd7212) = 72 > (0x48) > lseek(3,0x0,SEEK_SET) = 0 > (0x0) > close(3) = 0 > (0x0) > lstat("../../../",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = 0 > (0x0) > stat("../../../..",{ mode=drwxr-xr-x ,inode=2,size=512,blksize=4096 }) = 0 > (0x0) > open("../../../..",O_NONBLOCK,03777777) = 3 > (0x3) > fstat(3,{ mode=drwxr-xr-x ,inode=2,size=512,blksize=4096 }) = 0 > (0x0) > fcntl(3,F_SETFD,FD_CLOEXEC) = 0 > (0x0) > fstatfs(0x3,0x84bfe7d0,0x1,0x0,0x3,0x28073c94) = 0 > (0x0) > fstat(3,{ mode=drwxr-xr-x ,inode=2,size=512,blksize=4096 }) = 0 > (0x0) > getdirentries(0x3,0x2820e000,0x1000,0x2820d054,0x489629aa,0x0) = 512 > (0x200) > lstat("../../../../.snap",{ mode=drwxrwxr-x ,inode=3,size=512,blksize=4096 > }) = 0 (0x0) > lstat("../../../../dev",{ mode=dr-xr-xr-x ,inode=2,size=512,blksize=4096 }) > = 0 (0x0) > lstat("../../../../etc",{ mode=drwxr-xr-x > ,inode=141312,size=2560,blksize=4096 }) = 0 (0x0) > lstat("../../../../cdrom",{ mode=drwxr-xr-x > ,inode=211968,size=512,blksize=4096 }) = 0 (0x0) > lstat("../../../../bin",{ mode=drwxr-xr-x > ,inode=23552,size=1024,blksize=4096 }) = 0 (0x0) > lstat("../../../../boot",{ mode=drwxr-xr-x > ,inode=164864,size=1024,blksize=4096 }) = 0 (0x0) > lstat("../../../../lib",{ mode=drwxr-xr-x > ,inode=70656,size=2048,blksize=4096 }) = 0 (0x0) > lstat("../../../../libexec",{ mode=drwxr-xr-x > ,inode=117760,size=512,blksize=4096 }) = 0 (0x0) > lstat("../../../../media",{ mode=drwxr-xr-x > ,inode=94208,size=512,blksize=4096 }) = 0 (0x0) > lstat("../../../../mnt",{ mode=drwxr-xr-x > ,inode=188416,size=512,blksize=4096 }) = 0 (0x0) > lstat("../../../../proc",{ mode=dr-xr-xr-x > ,inode=117763,size=512,blksize=4096 }) = 0 (0x0) > lstat("../../../../rescue",{ mode=drwxr-xr-x > ,inode=23590,size=2560,blksize=4096 }) = 0 (0x0) > lstat("../../../../root",{ mode=drwxr-xr-x > ,inode=211969,size=1024,blksize=4096 }) = 0 (0x0) > lstat("../../../../sbin",{ mode=drwxr-xr-x > ,inode=47105,size=2560,blksize=4096 }) = 0 (0x0) > lstat("../../../../tmp",{ mode=drwxrwxrwt ,inode=3,size=26,blksize=4096 }) = > 0 (0x0) > lstat("../../../../usr",{ mode=drwxr-xr-x ,inode=11,size=512,blksize=4096 }) > = 0 (0x0) > lstat("../../../../var",{ mode=drwxr-xr-x ,inode=3,size=25,blksize=4096 }) = > 0 (0x0) > lstat("../../../../restoresymtable",{ mode=-rw------- > ,inode=4,size=1948892,blksize=4096 }) = 0 (0x0) > lstat("../../../../sys",{ mode=lrwxr-xr-x ,inode=8,size=11,blksize=4096 }) = > 0 (0x0) > lstat("../../../../COPYRIGHT",{ mode=-r--r--r-- > ,inode=12,size=6198,blksize=4096 }) = 0 (0x0) > lstat("../../../../compat",{ mode=lrwxrwxrwx ,inode=7,size=10,blksize=4096 > }) = 0 (0x0) > lstat("../../../../home",{ mode=drwxr-xr-x ,inode=3,size=4,blksize=4096 }) = > 0 (0x0) > lseek(3,0x0,SEEK_SET) = 0 > (0x0) > close(3) = 0 > (0x0) > lstat("../../../../",{ mode=drwxr-xr-x ,inode=2,size=512,blksize=4096 }) = 0 > (0x0) > fstat(1,{ mode=crw--w---- ,inode=145,size=0,blksize=4096 }) = 0 > (0x0) > ioctl(1,TIOCGETA,0x84bfea10) = 0 > (0x0) > /home/.zfs/snapshot/2009-12-31 > > write(1,"/home/.zfs/snapshot/2009-12-31\n",31) = 31 > (0x1f) > > > -- > Freddie Cash > fjwcash@gmail.com