From owner-freebsd-fs@freebsd.org Wed Mar 20 10:31:16 2019 Return-Path: Delivered-To: freebsd-fs@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 853BE154F4BA for ; Wed, 20 Mar 2019 10:31:16 +0000 (UTC) (envelope-from olevole@olevole.ru) Received: from mail-oi1-x233.google.com (mail-oi1-x233.google.com [IPv6:2607:f8b0:4864:20::233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FF5F8FF41 for ; Wed, 20 Mar 2019 10:31:15 +0000 (UTC) (envelope-from olevole@olevole.ru) Received: by mail-oi1-x233.google.com with SMTP id v7so1351025oie.8 for ; Wed, 20 Mar 2019 03:31:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=olevole-ru.20150623.gappssmtp.com; s=20150623; h=mime-version:from:date:message-id:subject:to; bh=QrdVcQLoThl/V5Qz44zlFtNlNU7bB+3NGQKgafMeh6Q=; b=YLl15HYU3Z8KwhouN2M8V7pMH41A+AUQ9/OKYReInu4vcieGkhz9LmclUpzxB6nRWo mH1zv/PCkT0xHdjlueRDFGYmp0ICnAlUpNaz47qeXwhHIYixlVTuvAsfri+8Ze2STi+c coPd3C1ftwWJBpTCoEuv75BkUKicuJ3JoRX3QZP2so3pZaGyRAmopEezxVU3ZBLtTw91 R/BwAux5dmvVRNzmtARq2EklUhPE0qRIm4hozqYUMFi7BV//RFXepnuvg5WxU/vhpKWT nixVb4oRC0gCQ9qCyUC2jQl+rRm4TKecC4aDA7diHdgByOvKV6hDz9ZvZ5WMkcs/xLkw FgeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=QrdVcQLoThl/V5Qz44zlFtNlNU7bB+3NGQKgafMeh6Q=; b=c88SOAWdLRBa9Cd39zPuVA+6UwoItfwYmSsJWEGEeSVf3jbhhZSUIJmhAhtaOD5f8d 0mH8J+AgIXNr/wvEjJprWX50Zx9jXdY3WKf1m/z3zWKGeuU3OHbnkApM1REGhgV9+WNh LeypkueawTeiQ4fpwLdJ+aUatRDLGUwLcw5g3kdpb4QRkA5rJ3XD2/DM5nlRhnPRSXRO EGn5CFoKcloPr8z/CLrqtVnpmZl3429hxfyuDXiD0hDrqP+RZFNCdqoxJJUqKex3Ytwr C7eazbc5jKuvCL7FUxhIm6e69ZAyMm8rFGPyCwuAGu7dpXfcISLZXd9+LRQ7mROIvxMc +6VQ== X-Gm-Message-State: APjAAAVowGsAoBChd7dnlLKS+7CUVOCfI09eHfxtGqy4MZkn5/G2LN2a Non/a0/o7LXgBeQJdDyXmbYrl3QpIfJL+nMxJ3DPfdUU0mE= X-Google-Smtp-Source: APXvYqzKNabJoc9BCY1pbeyq2qNo9MQ2BckYPqCXLZbe6tzX6fAgpJSMJ1stGY8etBJ0mXySy0IcTJXMVxFmQ0ikERk= X-Received: by 2002:aca:f105:: with SMTP id p5mr4619368oih.172.1553077873789; Wed, 20 Mar 2019 03:31:13 -0700 (PDT) MIME-Version: 1.0 From: Oleg Ginzburg Date: Wed, 20 Mar 2019 13:31:02 +0300 Message-ID: Subject: FreeBSD zfs: clone + resize = dataset is busy To: freebsd-fs@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4FF5F8FF41 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org; dkim=pass header.d=olevole-ru.20150623.gappssmtp.com header.s=20150623 header.b=YLl15HYU X-Spamd-Result: default: False [-6.08 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[olevole-ru.20150623.gappssmtp.com:s=20150623]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-fs@freebsd.org]; TO_DN_NONE(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; DMARC_NA(0.00)[olevole.ru]; DKIM_TRACE(0.00)[olevole-ru.20150623.gappssmtp.com:+]; MX_GOOD(-0.01)[ASPMX.L.GOOGLE.COM,ALT2.ASPMX.L.GOOGLE.COM,ALT1.ASPMX.L.GOOGLE.COM,ASPMX3.GOOGLEMAIL.COM,ASPMX2.GOOGLEMAIL.COM]; RCVD_IN_DNSWL_NONE(0.00)[3.3.2.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; NEURAL_HAM_SHORT(-0.94)[-0.935,0]; R_SPF_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; RCVD_COUNT_TWO(0.00)[2]; IP_SCORE(-2.83)[ip: (-9.19), ipnet: 2607:f8b0::/32(-2.79), asn: 15169(-2.11), country: US(-0.07)] X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Mar 2019 10:31:16 -0000 Hello mailist. I see the following problem on FreeBSD 13.0-CURRENT r345087M amd64, zpool version 28, zfs version 5 If you create a ZVOL, fill in specific data, take a snapshot, clone and resize, you will get a blocked pool (device busy for : export -f, destroy -f ..)--- what i found: a) the problem only appears on clone/snapshot, there is no problem on a simple zvol resize; b) the nature of the data affects the problem: - when zvol no data, problem is missing - If you try to fill zvol with random data, for example: dd if=/dev/random of= there are also no problems. But problem exist if I try to fill in with cloud images data ( http://ftp.freebsd.org/pub/FreeBSD/releases/VM-IMAGES/12.0-RELEASE/amd64/Latest/ , http://cloud-images.ubuntu.com/xenial/current/ ) - in fact, these are raw images of the installed OS. c) The problem only occurs when creating zvol + resizing (in two commands). If you try to do atomically and simultaneously: /sbin/zfs clone -o volsize= ... there is no problem, but with this: /sbin/zfs clone .. /sbin/zfs set volsize= problem exist. Maybe this is not a ZFS problem and GEOM-related ? Step-by-step how to reproduce (where z01 - active ZFS pool): --- % wget http://ftp.freebsd.org/pub/FreeBSD/releases/VM-IMAGES/12.0-RELEASE/amd64/Latest/FreeBSD-12.0-RELEASE-amd64.raw.xz % xz -d FreeBSD-12.0-RELEASE-amd64.raw.xz > ( /usr/bin/stat -f "%z" FreeBSD-12.0-RELEASE-amd64.raw -- get size) > 33286062080 % /sbin/zfs create -sV 33286062080 -o volmode=dev z01/test1 % dd bs=1m if=FreeBSD-12.0-RELEASE-amd64.raw of=/dev/zvol/z01/test1 > 31744+1 records in > 31744+1 records out > 33286062080 bytes transferred in 127.530635 secs (261004441 bytes/sec) % /sbin/zfs snapshot z01/test1@snap % /sbin/zfs clone z01/test1@snap > ( resizing. For example, double up ) > bc -e '33286062080 * 2' > 66572124160 % /sbin/zfs set volsize=66572124160 z01/test2 % /sbin/zfs destroy z01/test2 > cannot destroy 'z01/test2': dataset is busy % zpool export -f z01 > cannot export 'z01': pool is busy --- with truss i can see: .. ioctl(3,0xc0185a15 { IORW 0x5a('Z'), 21, 24 },0x7fffffffcd78) ERR#3 'No such process' ioctl(3,0xc0185a15 { IORW 0x5a('Z'), 21, 24 },0x7fffffffcd78) ERR#3 'No such process' ioctl(6,0xc0185a18 { IORW 0x5a('Z'), 24, 24 },0x7fffffffcdb8) ERR#16 'Device busy' it's around here: .. common/zfs/zfs_ioctl_compat.c: ret = ioctl(fd, _IOWR('Z', ... common/zfs/zfs_ioctl_compat.h: 24, /* 25 ZFS_IOC_DESTROY */ .. Any comments are welcome.