Bug 225793 - pathconf(2) doesn't work in ZFS's .zfs directory
Summary: pathconf(2) doesn't work in ZFS's .zfs directory
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: Alan Somers
URL:
Keywords:
: 153142 (view as bug list)
Depends on:
Blocks:
 
Reported: 2018-02-09 18:32 UTC by Alan Somers
Modified: 2018-03-10 04:11 UTC (History)
1 user (show)

See Also:
asomers: mfc-stable10+
asomers: mfc-stable11+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alan Somers freebsd_committer 2018-02-09 18:32:48 UTC
pathconf(2) doesn't work in the .zfs or .zfs/snapshot directory

[root@tom /tmp]# zpool create foo da0
[root@tom /tmp]# zfs set snapdir=visible foo
[root@tom /tmp]# zfs snapshot foo@1
[root@tom /tmp]# getconf ACL_EXTENDED /foo
0
[root@tom /tmp]# getconf ACL_EXTENDED /foo/.zfs
getconf: pathconf: ACL_EXTENDED: Invalid argument
[root@tom /tmp]# getconf ACL_EXTENDED /foo/.zfs/snapshot
getconf: pathconf: ACL_EXTENDED: Invalid argument
[root@tom /tmp]# getconf ACL_EXTENDED /foo/.zfs/snapshot/1
0
Comment 1 commit-hook freebsd_committer 2018-02-09 21:12:46 UTC
A commit references this bug:

Author: asomers
Date: Fri Feb  9 21:12:38 UTC 2018
New revision: 329082
URL: https://svnweb.freebsd.org/changeset/base/329082

Log:
  Expect failure for snapshot_018_pos

  The ZFS ctldir lacks support for pathconf(2)

  PR:		225793
  Sponsored by:	Spectra Logic Corp

Changes:
  projects/zfsd/head/tests/sys/cddl/zfs/tests/snapshot/snapshot_test.sh
Comment 2 Alan Somers freebsd_committer 2018-02-14 00:19:49 UTC
There is another symptom of this bug: due to an assumption in ls(1) that all files with the same inode will have the same value of _PC_ACL_NFS4, ls will sometimes print "Operation not supported" for entries in the ctldir.  Whether or not it does depends on the order that it prints the entries, but you can always demonstrate it by sorting the entries in both forward and reverse order:

$ ls -ltar /tmp/.zfs
total 145
dr-xr-xr-x   3 root  wheel   3 Dec  9  2015 .
dr-xr-xr-x   2 root  wheel   2 Feb 13 13:21 snapshot
drwxrwxrwt  10 root  wheel  10 Feb 13 17:10 ..
$ ls -lta /tmp/.zfs
total 145
drwxrwxrwt  10 root  wheel  10 Feb 13 17:10 ..
ls: /tmp/.zfs/snapshot: Operation not supported
dr-xr-xr-x   2 root  wheel   2 Feb 13 13:21 snapshot
ls: /tmp/.zfs/.: Operation not supported
dr-xr-xr-x   3 root  wheel   3 Dec  9  2015 .
Comment 3 commit-hook freebsd_committer 2018-02-14 15:49:54 UTC
A commit references this bug:

Author: asomers
Date: Wed Feb 14 15:49:31 UTC 2018
New revision: 329265
URL: https://svnweb.freebsd.org/changeset/base/329265

Log:
  Implement .vop_pathconf and .vop_getacl for the .zfs ctldir

  zfsctl_common_pathconf will report all the same variables that regular ZFS
  volumes report. zfsctl_common_getacl will report an ACL equivalent to 555,
  except that you can't read xattrs or edit attributes.

  Fixes a bug where "ls .zfs" will occasionally print something like:
  ls: .zfs/.: Operation not supported

  PR:		225793
  Reviewed by:	avg
  MFC after:	3 weeks
  Sponsored by:	Spectra Logic Corp
  Differential Revision:	https://reviews.freebsd.org/D14365

Changes:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c
Comment 4 Alan Somers freebsd_committer 2018-02-14 17:10:20 UTC
*** Bug 153142 has been marked as a duplicate of this bug. ***
Comment 5 commit-hook freebsd_committer 2018-02-15 00:01:42 UTC
A commit references this bug:

Author: asomers
Date: Thu Feb 15 00:01:19 UTC 2018
New revision: 329286
URL: https://svnweb.freebsd.org/changeset/base/329286

Log:
  Fix snapshot_018_pos

  tests/sys/cddl/zfs/tests/snapshot/snapshot_018_pos.ksh
  	Delete references to ".zfs/shares".  It no longer exists.

  tests/sys/cddl/zfs/tests/snapshot/snapshot_test.sh
  	Clear the expected failure due to PR 225793

  PR:		225793
  Sponsored by:	Spectra Logic Corp

Changes:
  projects/zfsd/head/tests/sys/cddl/zfs/tests/snapshot/snapshot_018_pos.ksh
  projects/zfsd/head/tests/sys/cddl/zfs/tests/snapshot/snapshot_test.sh
Comment 6 commit-hook freebsd_committer 2018-03-10 03:25:33 UTC
A commit references this bug:

Author: asomers
Date: Sat Mar 10 03:24:59 UTC 2018
New revision: 330732
URL: https://svnweb.freebsd.org/changeset/base/330732

Log:
  MFC r329265, r329384

  r329265:
  Implement .vop_pathconf and .vop_getacl for the .zfs ctldir

  zfsctl_common_pathconf will report all the same variables that regular ZFS
  volumes report. zfsctl_common_getacl will report an ACL equivalent to 555,
  except that you can't read xattrs or edit attributes.

  Fixes a bug where "ls .zfs" will occasionally print something like:
  ls: .zfs/.: Operation not supported

  PR:		225793
  Reviewed by:	avg
  Sponsored by:	Spectra Logic Corp
  Differential Revision:	https://reviews.freebsd.org/D14365

  r329384:
  Handle generic pathconf attributes in the .zfs ctldir

  MFC instructions: change the value of _PC_LINK_MAX to INT_MAX

  Reported by:	jhb
  X-MFC-With:	329265
  Sponsored by:	Spectra Logic Corp

Changes:
_U  stable/11/
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c
Comment 7 commit-hook freebsd_committer 2018-03-10 04:11:23 UTC
A commit references this bug:

Author: asomers
Date: Sat Mar 10 04:10:57 UTC 2018
New revision: 330736
URL: https://svnweb.freebsd.org/changeset/base/330736

Log:
  MFC r329265, r329384

  r329265:
  Implement .vop_pathconf and .vop_getacl for the .zfs ctldir

  zfsctl_common_pathconf will report all the same variables that regular ZFS
  volumes report. zfsctl_common_getacl will report an ACL equivalent to 555,
  except that you can't read xattrs or edit attributes.

  Fixes a bug where "ls .zfs" will occasionally print something like:
  ls: .zfs/.: Operation not supported

  PR:		225793
  Reviewed by:	avg
  Sponsored by:	Spectra Logic Corp
  Differential Revision:	https://reviews.freebsd.org/D14365

  r329384:
  Handle generic pathconf attributes in the .zfs ctldir

  MFC instructions: change the value of _PC_LINK_MAX to INT_MAX

  Reported by:	jhb
  X-MFC-With:	329265
  Sponsored by:	Spectra Logic Corp

Changes:
_U  stable/10/
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c