Project

General

Profile

Actions

Feature #180

closed

Return ENOTEMPTY when trying to remove a directory which has a snapshot

Added by Wido den Hollander almost 14 years ago. Updated over 13 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
-
Target version:
% Done:

100%

Source:
Tags:
Backport:
Reviewed:
Affected Versions:
Pull request ID:

Description

When the following command sequence is used, valuable data in a snapshot could go lost:

root@ceph-client:~# df -h

Filesystem            Size  Used Avail Use% Mounted on

/dev/sda1              71G  7.7G   60G  12% /

none                  999M  148K  999M   1% /dev

none                 1005M     0 1005M   0% /dev/shm

none                 1005M   64K 1005M   1% /var/run

none                 1005M     0 1005M   0% /var/lock

none                 1005M     0 1005M   0% /lib/init/rw

192.168.6.209:/       2.1T  200G  1.9T  10% /mnt/ceph

root@ceph-client:~# cd /mnt/ceph/

root@ceph-client:/mnt/ceph# mkdir -p alpha/beta

root@ceph-client:/mnt/ceph# cd alpha/beta/

root@ceph-client:/mnt/ceph/alpha/beta# touch randomfile.txt

root@ceph-client:/mnt/ceph/alpha/beta# cd .snap

root@ceph-client:/mnt/ceph/alpha/beta/.snap# mkdir random_snap

root@ceph-client:/mnt/ceph/alpha/beta/.snap# cd /mnt/ceph

root@ceph-client:/mnt/ceph# rm -r alpha/

root@ceph-client:/mnt/ceph# ls -al

total 4

drwxr-xr-x 1 root root    0 2010-06-03 09:56 .

drwxr-xr-x 3 root root 4096 2010-05-26 10:47 ..

root@ceph-client:/mnt/ceph# cd .snap

-bash: cd: .snap: No such file or directory

root@ceph-client:/mnt/ceph#

It would be usefull if a ENOTEMPTY error was given when an attempt is made to remove a directory which holds a snapshot.

Since anybody can create a snapshot, it could become a pain when a sysadmin tries to remove a tree, so for the sysadmin if would be nice if you could easily list all snapshots in a tree.

Actions #1

Updated by Sage Weil almost 14 years ago

  • Target version set to v0.21
Actions #2

Updated by Sage Weil almost 14 years ago

  • Assignee set to Greg Farnum
Actions #3

Updated by Greg Farnum almost 14 years ago

  • Status changed from New to Resolved
  • % Done changed from 0 to 100

As of 2a88e2e54ee0b9449e86cec02315e2809b75ca8b it will return ENOTEMPTY if you try to delete a dir which roots a snapshot. There's nothing set up to find snapshots, but I think you ought to be able to do that with some simple shell scripting? Anyway, we can come back to it if it becomes a problem.

Actions

Also available in: Atom PDF