Bug 159077 - [zfs] Can't cd .. with latest zfs version
Summary: [zfs] Can't cd .. with latest zfs version
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 8.2-STABLE
Hardware: Any Any
: Normal Affects Only Me
Assignee: FreeBSD bugs mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-07-21 08:10 UTC by Michael Haro
Modified: 2017-12-31 22:29 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Haro freebsd_committer 2011-07-21 08:10:07 UTC
trying to cd up one level using 'cd ..' gives permission denied

Fix: 

unknown
How-To-Repeat: 
use sh or tcsh, not bash...

$ pwd
/home/mharo
$ cd ..
cd: can't cd to ..
$ ls -ald /home
drwxr-xr-x  4 root  wheel  4 Nov 29  2009 /home
$ ls -ald /home/mharo
drwxr-xr-x  3 mharo  users  15 Jul 20 22:49 /home/mharo
$ cd /home
$ pwd
/home
$ ls -ald mharo
drwxr-xr-x  3 mharo  users  15 Jul 20 22:49 mharo
$ cd mharo
$ cd ..
cd: can't cd to ..

so obviously I can cd into /home, just not via ..

$ zfs list -r zroot/home
NAME               USED  AVAIL  REFER  MOUNTPOINT
zroot/home         162K  2.70G    26K  /home
zroot/home/mharo   119K  2.70G  35.5K  /home/mharo

$ zpool get version zroot
NAME   PROPERTY  VALUE    SOURCE
zroot  version   28       default
$ zfs get version zroot/home
NAME        PROPERTY  VALUE    SOURCE
zroot/home  version   3        -
$ zfs get version zroot/home/mharo
NAME              PROPERTY  VALUE    SOURCE
zroot/home/mharo  version   3        -

I don't recall seeing this problem before I upgraded from zpool version 15 and
a 8-stable from january, but that doesn't mean it didn't exist.
Comment 1 Glen Barber 2011-07-21 14:49:34 UTC
Hi,

On 7/21/11 2:37 AM, Michael Haro wrote:
> $ zfs get version zroot/home
> NAME        PROPERTY  VALUE    SOURCE
> zroot/home  version   3        -
> $ zfs get version zroot/home/mharo
> NAME              PROPERTY  VALUE    SOURCE
> zroot/home/mharo  version   3        -
> 

Are your kernel and userland in sync?  I believe with ZFS v28 the ZFS
version should be 4, not 3.  May not be the problem though.

Regards,

-- 
Glen Barber
Comment 2 Mark Linimon freebsd_committer 2011-07-21 16:50:23 UTC
Responsible Changed
From-To: freebsd-bugs->freebsd-fs

Over to maintainer(s).
Comment 3 Michael Haro freebsd_committer 2011-07-22 04:43:28 UTC
On Thu, Jul 21, 2011 at 6:49 AM, Glen Barber <glen.j.barber@gmail.com>wrote:

> Hi,
>
> On 7/21/11 2:37 AM, Michael Haro wrote:
> > $ zfs get version zroot/home
> > NAME        PROPERTY  VALUE    SOURCE
> > zroot/home  version   3        -
> > $ zfs get version zroot/home/mharo
> > NAME              PROPERTY  VALUE    SOURCE
> > zroot/home/mharo  version   3        -
> >
>
> Are your kernel and userland in sync?  I believe with ZFS v28 the ZFS
> version should be 4, not 3.  May not be the problem though.
>

Kernel and userland were both build and installed on the same day; I just
haven't run zfs upgrade yet.  Is that required for cd .. to work?


>
> Regards,
>
> --
> Glen Barber
>
Comment 4 Glen Barber 2011-07-22 14:39:12 UTC
On 7/21/11 11:43 PM, Michael Haro wrote:
>> Are your kernel and userland in sync?  I believe with ZFS v28 the ZFS
>> version should be 4, not 3.  May not be the problem though.
>>
> 
> Kernel and userland were both build and installed on the same day; I just
> haven't run zfs upgrade yet.  Is that required for cd .. to work?
> 

I wouldn't expect it to be, but perhaps that is the cause of the problem
you are seeing.

-- 
Glen Barber
Comment 5 Martin Matuska freebsd_committer 2011-07-23 10:28:55 UTC
It should work with zpl version 3 (no need to do zfs upgrade) and I have
never seen this before.
Is there any way to reproduce this or take a closer look?

-- 
Martin Matuska
FreeBSD committer
http://blog.vx.sk
Comment 6 Fabian Keil 2011-07-23 12:43:26 UTC
Do you have the problem in every directory or only in some?
Can you "cd .." as root?
Does the '..' link exist and is it accessible?

I ask because the problem looks familiar to me:

fk@r500 ~/git/privoxy $/usr/bin/cd ..
cd: ..: No such file or directory

fk@r500 ~/git/privoxy $stat -x ..
stat: ..: stat: Permission denied

fk@r500 ~/git/privoxy $sudo stat -x ..
  File: ".."
  Size: 33           FileType: Directory
  Mode: (0755/drwxr-xr-x)         Uid: ( 1001/      fk)  Gid: ( 1001/      fk)
Device: 113,472580146   Inode: 3    Links: 33
Access: Fri Mar 12 23:05:31 2010
Modify: Sat Jul 23 13:26:27 2011
Change: Sat Jul 23 13:26:27 2011

fk@r500 ~/git/privoxy $stat -x ~/git/
  File: "/home/fk/git/"
  Size: 33           FileType: Directory
  Mode: (0755/drwxr-xr-x)         Uid: ( 1001/      fk)  Gid: ( 1001/      fk)
Device: 113,472580146   Inode: 3    Links: 33
Access: Fri Mar 12 23:05:31 2010
Modify: Sat Jul 23 13:26:27 2011
Change: Sat Jul 23 13:26:27 2011

fk@r500 ~/git/privoxy $stat -x ~/git/curl/..
  File: "/home/fk/git/curl/.."
  Size: 33           FileType: Directory
  Mode: (0755/drwxr-xr-x)         Uid: ( 1001/      fk)  Gid: ( 1001/      fk)
Device: 113,472580146   Inode: 3    Links: 33
Access: Fri Mar 12 23:05:31 2010
Modify: Sat Jul 23 13:26:27 2011
Change: Sat Jul 23 13:26:27 2011

fk@r500 ~/git/privoxy $stat -x ~/git/privoxy/..
stat: /home/fk/git/privoxy/..: stat: Permission denied

So somehow as a user I'm allowed to access "~/git" but not "~/git/privoxy/..".

bash's builtin cd doesn't seem to use '..', so it continues to work.

~/git, ~/git/privoxy and ~/git/curl are different datasets.

Scrubbing the pool doesn't show any issues.

If I send/receive a snapshot of ~/git/privoxy, the copy doesn't
have the problem.

As far as I know, I only have the problem with "~/git/privoxy/..".
The problem survived several ZFS updates so far, and at least in
may case it's neither a regression in ZFSv28 nor serious.

Fabian
Comment 7 gpalmer freebsd_committer 2011-07-25 17:25:34 UTC
On Wed, Jul 20, 2011 at 11:37:21PM -0700, Michael Haro wrote:
> 
> >Number:         159077
> >Category:       kern
> >Synopsis:       Can't cd .. with latest zfs version
> >Confidential:   no
> >Severity:       serious
> >Priority:       medium
> >Responsible:    freebsd-bugs
> >State:          open
> >Quarter:        
> >Keywords:       
> >Date-Required:
> >Class:          sw-bug
> >Submitter-Id:   current-users
> >Arrival-Date:   Thu Jul 21 07:10:07 UTC 2011
> >Closed-Date:
> >Last-Modified:
> >Originator:     Michael Haro
> >Release:        FreeBSD 8.2-STABLE amd64
> >Organization:
> >Environment:
> System: FreeBSD backups.mtv.bitsurf.net 8.2-STABLE FreeBSD 8.2-STABLE #1: Sat Jul 16 19:26:28 PDT 2011 root@backups.mtv.bitsurf.net:/usr/obj/usr/src/sys/KERNEL amd64
> 
> 
> freebsd 8.2 stable as of july 16th
> zpool version 28
> zfs version 3
> 
> >Description:
> 
> trying to cd up one level using 'cd ..' gives permission denied
> 	
> >How-To-Repeat:
> 
> use sh or tcsh, not bash...
> 
> $ pwd
> /home/mharo
> $ cd ..
> cd: can't cd to ..
> $ ls -ald /home
> drwxr-xr-x  4 root  wheel  4 Nov 29  2009 /home
> $ ls -ald /home/mharo
> drwxr-xr-x  3 mharo  users  15 Jul 20 22:49 /home/mharo
> $ cd /home
> $ pwd
> /home
> $ ls -ald mharo
> drwxr-xr-x  3 mharo  users  15 Jul 20 22:49 mharo
> $ cd mharo
> $ cd ..
> cd: can't cd to ..
> 
> so obviously I can cd into /home, just not via ..
> 
> $ zfs list -r zroot/home
> NAME               USED  AVAIL  REFER  MOUNTPOINT
> zroot/home         162K  2.70G    26K  /home
> zroot/home/mharo   119K  2.70G  35.5K  /home/mharo

It may be worth unmounting /home/mharo and checking the permissions
of the directory underneath the mount point.  e.g.

% mkdir /tmp/159077
% chmod 0 /tmp/159077
% ls -la /tmp/159077
total 274
d---------   2 root  wheel     512 Jul 25 17:22 .
drwxrwxrwt  57 root  wheel  249344 Jul 25 17:22 ..
% mount /dev/md0 /tmp/159077
% ls -la /tmp/159077
total 276
drwxr-xr-x   3 root  wheel        512 Jul 25 17:21 .
drwxrwxrwt  57 root  wheel     249344 Jul 25 17:22 ..
drwxrwxr-x   2 root  operator     512 Jul 25 17:21 .snap
%

and then as a regular user:

$ cd /tmp/159077/
$ pwd
/tmp/159077
$ ls -la
ls: ..: Permission denied
total 4
drwxr-xr-x  3 root  wheel     512 Jul 25 17:21 .
drwxrwxr-x  2 root  operator  512 Jul 25 17:21 .snap
$ ls -la ..
ls: ..: Permission denied
$ cd ..
cd: can't cd to ..
$ 

Regards

Gary
Comment 8 Marcelo Araujo freebsd_committer 2012-05-02 18:35:52 UTC
State Changed
From-To: open->feedback

Do you still have this issue? THave you tried the solution mentioned by 
Gary Palmer? Shall we close this PR?
Comment 9 Marcelo Araujo freebsd_committer 2012-05-02 18:42:44 UTC
State Changed
From-To: feedback->open

Keep the PR open!
Comment 10 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 08:01:44 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped