From owner-freebsd-fs@freebsd.org Thu Nov 21 15:08:42 2019 Return-Path: Delivered-To: freebsd-fs@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C353A1C1E6F for ; Thu, 21 Nov 2019 15:08:42 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-ot1-f54.google.com (mail-ot1-f54.google.com [209.85.210.54]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Jjcn6gFlz4X3w for ; Thu, 21 Nov 2019 15:08:41 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-ot1-f54.google.com with SMTP id n23so3150466otr.13 for ; Thu, 21 Nov 2019 07:08:41 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Ir+JBrAx4Ua+8vqaXTGkrvqyspTthcrnOvJ/3UtHojE=; b=IClczj/WLg3ZoW7zp6IMh77DkoSREFA1QRQV6tvd9MNNNugLsmyN4pY/7LJfpSTZhu pvt4nd0hbDPAWoNoRjFc+Y+AWrPskpheDU7Cm9KteF9RlRAxx+ffY4gVLFkssaZhk+73 r/KT6lPr/B5Glkr0PbQOpn6OfRX0PpVLyvOpqjT4xQcf46LmoBwgZghRQZZFtSiVZLhF epJzJ9heb8vBHJlN6wTyzc34VORKfeWLh3ILzk4xFGvEs8iqVbOLnsfcMjv8ZqdxBCsz OJrO6ruDveWr8lRphVpMQMJ2NjsX8e1NZOnfDl7/ENetYlzeaUrW9SIJtkQjISq/NzBu 6eRQ== X-Gm-Message-State: APjAAAXcubJjpBsxnXRX+fHVol8LQWBoewQW6sJYZi3O6cnud1qsbodJ qx4x+6vS00rP5kt9feCWSgQvEkY7I2Wn4iVh90D0PPPo X-Google-Smtp-Source: APXvYqzXaNTcZxY3fDBUbiQ0mj1A5W84/jtyH0UBOuZJdEs5SQgYTWYeiW7KDSC7U7MZwAE9Tzklh+YmtRew+oF295Y= X-Received: by 2002:a9d:604d:: with SMTP id v13mr6909467otj.222.1574348920742; Thu, 21 Nov 2019 07:08:40 -0800 (PST) MIME-Version: 1.0 References: <20191107004635.c6d2e7d464d3d556a0d87465@magnetkern.de> <9B22AD46-BE87-4305-9638-74D23AD4C8CA@sarenet.es> <261FE331-EC5C-48C8-9249-9BCBF887CE38@sarenet.es> <913f7040-6e38-452d-6187-e17fae63b652@sentex.net> <20191120144041.7f916360dc0c69bf509c9bd1@magnetkern.de> <20191120163437.691abd369ab9c0a6d7d45ff2@magnetkern.de> <20191120175803.03401c3316fe756cc46f79f1@magnetkern.de> <3C5DC6DD-C44B-41EE-B7AB-6D8F94E43174@sarenet.es> <201911211259.xALCxShX008743@higson.cam.lispworks.com> <462E2C53-2490-4B8C-BB54-BCE8B75BAEB0@sarenet.es> <51805C8F-75D6-4DA1-A28E-68DAFC8A0276@sarenet.es> In-Reply-To: From: Alan Somers Date: Thu, 21 Nov 2019 08:08:29 -0700 Message-ID: Subject: Re: ZFS snapdir readability (Crosspost) To: Borja Marcos Cc: freebsd-fs X-Rspamd-Queue-Id: 47Jjcn6gFlz4X3w X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of asomers@gmail.com designates 209.85.210.54 as permitted sender) smtp.mailfrom=asomers@gmail.com X-Spamd-Result: default: False [-2.10 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; FROM_HAS_DN(0.00)[]; RWL_MAILSPIKE_GOOD(0.00)[54.210.85.209.rep.mailspike.net : 127.0.0.18]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-fs@freebsd.org]; DMARC_NA(0.00)[freebsd.org]; URI_COUNT_ODD(1.00)[3]; MIME_TRACE(0.00)[0:+,1:+,2:~]; TO_DN_ALL(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; RCVD_IN_DNSWL_NONE(0.00)[54.210.85.209.list.dnswl.org : 127.0.5.0]; TO_MATCH_ENVRCPT_SOME(0.00)[]; IP_SCORE(-1.10)[ip: (-0.30), ipnet: 209.85.128.0/17(-3.17), asn: 15169(-1.97), country: US(-0.05)]; FORGED_SENDER(0.30)[asomers@freebsd.org,asomers@gmail.com]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; FROM_NEQ_ENVFROM(0.00)[asomers@freebsd.org,asomers@gmail.com]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.29 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: Thu, 21 Nov 2019 15:08:42 -0000 On Thu, Nov 21, 2019 at 8:01 AM Borja Marcos wrote: > > > > On 21 Nov 2019, at 15:57, Borja Marcos wrote: > > > > ZFS originally didn=E2=80=99t offer any mechanism to mount snapshots ex= plicitly. > Except by cloning. > > Hmm. Looking at > https://github.com/zfsonfreebsd/ZoF/blob/projects/zfsbsd/cmd/mount_zfs/mo= unt_zfs.c > > snippet 1 > =E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94 > > /* try to open the dataset to access the mount point */ > if ((zhp =3D zfs_open(g_zfs, dataset, > ZFS_TYPE_FILESYSTEM | ZFS_TYPE_SNAPSHOT)) =3D=3D NULL) { > (void) fprintf(stderr, gettext("filesystem '%s' cannot be= " > "mounted, unable to open the dataset\n"), dataset); > libzfs_fini(g_zfs); > return (MOUNT_USAGE); > } > =E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94 > > snippet 2 > =E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94 > > /* treat all snapshots as legacy mount points */ > if (zfs_get_type(zhp) =3D=3D ZFS_TYPE_SNAPSHOT) > (void) strlcpy(prop, ZFS_MOUNTPOINT_LEGACY, > ZFS_MAXPROPLEN); > else > (void) zfs_prop_get(zhp, ZFS_PROP_MOUNTPOINT, prop, > sizeof (prop), NULL, NULL, 0, B_FALSE); > =E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94=E2=80=94= =E2=80=94=E2=80=94=E2=80=94 > > Does this really make sense? Workaround (setting its mountpoint as legacy= ) > in order to break > previous behavior? I don=E2=80=99t see the problem in cloning snapshots i= n order > to mount them. But this > looks like something that can bite back in the future! > No, you're misunderstanding something. Nothing weird is required to manually mount a snapshot. You don't have to change its properties, nor does it happen automatically. The code you're looking at only relates to the in-memory copy of the mountpoint property, a property that snapshots don't have. -Alan