Package: zfs-fuse
Version: 0.7.0-12
Severity: important
Tags: upstream patch

Dear Maintainer,

I see exactly the behavior described in 
https://groups.google.com/forum/#!topic/zfs-fuse/-BtjGFUPOyk:

Removing the com.sun:auto-snapshot-desc property as descibed in the 
command by user hornowitz did not help for me, though.

# zfs list -r -t snapshot -H zpool | wc -l
504

# zdb -d zpool | grep "^Dataset .*@"  | wc -l
913

I can list any property of the missing snapshots if I name the snapshot 
on the command line, it exists but is just missing in the output of "zfs 
list -t snapshot <fs>".

After some debugging, I found the root cause in src/lib/libzfs/libzfs_dataset.c:

2425 static int
2426 zfs_do_list_ioctl(zfs_handle_t *zhp, int arg, zfs_cmd_t *zc)
2427 {
2428     int rc;
2429     uint64_t    orig_cookie;
2430
2431     orig_cookie = zc->zc_cookie;
2432 top:
2433     (void) strlcpy(zc->zc_name, zhp->zfs_name, sizeof (zc->zc_name));
2434     rc = ioctl(zhp->zfs_hdl->libzfs_fd, arg, zc);
2435
2436     if (rc == -1) {
2437         switch (errno) {
2438         case ENOMEM:
2439             /* expand nvlist memory and try again */
2440             if (zcmd_expand_dst_nvlist(zhp->zfs_hdl, zc) != 0) {
2441                 zcmd_free_nvlists(zc);
2442                 return (-1);
2443             }


This code assumes ioctl() returns either 0 or -1, but I'm occasionally getting
12 (=ENOMEM) here.  After changing the condition in line 2436 to just "if (rc)"
and recompiling the zfs command the output of "zfs list -r -t snapshot" matches
the output of zdb.


Kind regards,
Michael




-- System Information:
Debian Release: 7.8
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: armhf (armv7l)

Kernel: Linux 3.4.104+ (SMP w/2 CPU cores; PREEMPT)
Locale: LANG=C, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages zfs-fuse depends on:
ii  fuse         2.9.0-2+deb7u1
ii  libaio1      0.3.109-3
ii  libc6        2.13-38+deb7u8
ii  libfuse2     2.9.0-2+deb7u1
ii  libgcc1      1:4.7.2-5
ii  libssl1.0.0  1.0.1e-2+deb7u14
ii  lsb-base     4.1+Debian8+deb7u1
ii  zlib1g       1:1.2.7.dfsg-13

zfs-fuse recommends no packages.

Versions of packages zfs-fuse suggests:
pn  kpartx             <none>
ii  nfs-kernel-server  1:1.2.6-4

-- Configuration Files:
/etc/zfs/zfsrc changed [not included]

-- no debconf information
--- ./src/lib/libzfs/libzfs_dataset.c.orig	2015-03-11 21:36:13.000000000 +0100
+++ ./src/lib/libzfs/libzfs_dataset.c	2015-03-11 21:36:24.000000000 +0100
@@ -2433,7 +2433,7 @@
 	(void) strlcpy(zc->zc_name, zhp->zfs_name, sizeof (zc->zc_name));
 	rc = ioctl(zhp->zfs_hdl->libzfs_fd, arg, zc);
 
-    if (rc == -1) {
+    if (rc) {
 		switch (errno) {
 		case ENOMEM:
 			/* expand nvlist memory and try again */

Reply via email to