On Fri, Oct 16, 2009 at 01:42:49PM +0200, Sander Smeenk wrote:
> Recently i switched on 'snapdir=visible' on one of the zfs volumes to
> easily expose the available snapshots and then i noticed rsync -removes-
> snapshots even though i am not able to do so myself, even as root, with
> plain /bin/rm.

I never liked this interface.  I want snapshots to be immutable to
operations within the filesystem itself.

> What's the deal here. :)
> 
> I was under the impression that rsync uses unlink() like 'rm' does?
> How come rsync -can- remove the snapshot directory when exposed with
> 'snapdir=visible' and i can't do it with /bin/rm?

I think you mean 'rmdir' rather than unlink.

My assumption is that 'rm' is being smart and won't attempt to remove a
directory that it thinks has data (which would normally fail).  In
looking at a 'truss' of /bin/rm <snap>, it never issued an unlink or
rmdir, just complained that the directory wasn't empty.

/bin/rmdir on the other hand did do a rmdir(2), and that does destroy
the snapshot.

Although I see sometimes the rmdir fails.  If I've been doing
"something" in a snapshot (sometimes some stats are enough), then it
seems to "lock" the snapshot and the rmdir fails (with EBUSY).

-- 
Darren
_______________________________________________
zfs-discuss mailing list
zfs-discuss@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/zfs-discuss

Reply via email to