Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 1 Jan 2010 07:12:37 -0800 (PST)
From:      Richard Mahlerwein <mahlerrd@yahoo.com>
To:        Miroslav Lachman <000.fbsd@quip.cz>
Cc:        freebsd-fs@freebsd.org
Subject:   Samba + Previous Versions
Message-ID:  <884434.85467.qm@web51002.mail.re2.yahoo.com>
In-Reply-To: <4B3C751A.9040909@quip.cz>
References:  <368515.86742.qm@web51005.mail.re2.yahoo.com> <alpine.GSO.2.01.0912301740270.1586@freddy.simplesystems.org> <489290.49450.qm@web51006.mail.re2.yahoo.com> <4B3C751A.9040909@quip.cz>

next in thread | previous in thread | raw e-mail | index | archive | help
>From: Miroslav Lachman <000.fbsd@quip.cz>

>
>Do you see Previous Versions on Samaba shares from FreeBSD? I think you 
>need some tweaks in smb.conf:
>
>http://www.edplese.com/samba-with-zfs.html
>
>http://www.edplese.com/blog/2009/12/02/samba-shadow_copy2-enhancements/
>
>http://www.samba.org/samba/docs/man/Samba-HOWTO-Collection/VFS.html#id2651813
>
>Miroslav Lachman

I applied the patch to my 3.3.9 source and did a make deinstall && make reinstall.  It compiled OK, but it still isn't working properly overall.  Not sure this still belongs in freebsd-fs.  I'd be happy to move or repost the thread elsewhere if that should be the case...

Here's the relevant portion of my smb.conf
[test]
        comment = Testing ZFS and Snapshots
        path=/tank
        root preexec = /usr/bin/snapshot_date.sh tank
        vfs objects = shadow_copy2
        shadow_copy2: snapdir = tank
        shadow_copy2: sort = desc
        shadow_copy2: localtime = yes
        read only = no
        guest ok = yes

For snapdir, I have tried various things; .zfs, /tank, tank, .snap, /tank/snap, /tank/.snap... and another 30 or 40 items.  I have no idea what this should be.  Anyway, to continue.

The preexec is working, as shown by the snapshots with GMT in them (BTW, it's a test VM and I never bothered to set the time zone, so those are GMT tagged but are actually Eastern Time US. :)  Cool!
curie# zfs list
NAME                           USED  AVAIL  REFER  MOUNTPOINT
tank                           178K  2.94G    48K  /tank
tank@snap1                      16K      -    18K  -
tank@GMT-2009.12.31-15.49.36      0      -    48K  -
tank@GMT-2009.12.31-15.54.02      0      -    48K  -
tank@GMT-2010.01.01-09.50.29      0      -    48K  -

And a snip of my /var/log/samba/log.smbd says (you'll note an extra non-standard log line, described below)

[2010/01/01 09:50:29,  1] smbd/service.c:make_connection_snum(1119)
  fcp-rich (192.168.1.100) connect to service test initially as user test (uid=1002, gid=1002) (pid 4835)
[2010/01/01 09:50:30,  0] modules/vfs_shadow_copy2.c:shadow_copy2_get_shadow_copy2_data(647)
  shadow:initializing with snapdir (null)
[2010/01/01 09:50:30,  0] modules/vfs_shadow_copy2.c:shadow_copy2_get_shadow_copy2_data(651)
  shadow:snapdir not found for /tank in get_shadow_copy_data
[2010/01/01 09:50:30,  0] smbd/nttrans.c:call_nt_transact_ioctl(1867)
  FSCTL_GET_SHADOW_COPY_DATA: connectpath /tank, failed.
[2010/01/01 09:50:39,  1] smbd/service.c:close_cnum(1331)
  fcp-rich (192.168.1.100) closed connection to service test

You'll notice I added one extra DEBUG item around line 647 in my source to tell me what snapdir actually was when it fails.
635 static int shadow_copy2_get_shadow_copy2_data(vfs_handle_struct *handle,
636                                               files_struct *fsp,
637                                               SHADOW_COPY_DATA *shadow_copy2_data,
638                                               bool labels)
639 {
640         SMB_STRUCT_DIR *p;
641         const char *snapdir;
642         SMB_STRUCT_DIRENT *d;
643         TALLOC_CTX *tmp_ctx = talloc_new(handle->data);
644         char *snapshot;
645
646         snapdir = shadow_copy2_find_snapdir(tmp_ctx, handle);
647         DEBUG(0,("shadow:initializing with snapdir %s\n", snapdir));
648
649         if (snapdir == NULL) {
650                 DEBUG(0,("shadow:snapdir not found for %s in get_shadow_copy_data\n",
651                          handle->conn->connectpath));

So, question 1.
What do I put for snapdir?
What else am I missing?  I'm sure it's something simple I've overlooked.

Thanks!
Rich Mahlerwein


      



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?884434.85467.qm>