linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chris Mason <chris.mason@oracle.com>
To: Harshavardhana <harsha@gluster.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: ENOTEMPTY on "rm -rf" for snapshot and subvolume
Date: Thu, 8 Apr 2010 09:52:16 -0400	[thread overview]
Message-ID: <20100408135216.GE1400@think> (raw)
In-Reply-To: <4BBD26E4.7070106@gluster.com>

On Wed, Apr 07, 2010 at 05:44:20PM -0700, Harshavardhana wrote:
> Hi Everyone,
> 
>      Recently i created a snapshot of an existing volume which had
> some amount of data.
>      Now that after creating the snapshot i have tried deleting the
> same snapshot.  But i am
>      getting ENOTEMPTY for "rmdir". But when i see the actual files
> inside are deleted
>      not the parent directory.
> 
>      From the code it looks like
> 
>      if (inode->i_size > BTRFS_EMPTY_DIR_SIZE ||
>             inode->i_ino == BTRFS_FIRST_FREE_OBJECTID)
>                 return -ENOTEMPTY;
> 
>      Why would "unlink" succeeds for the files inside the
> directory?, yet returning ENOTEMPTY

You need to use the snapshot deletion ioctl to actually delete the
snapshot.

> 
>      This looks odd after this, i  went ahead and tried deleting the
> the existing volume itself
>      same result.
> 
>      So i was wondering if at all this is supposed to work this way,
> do i need to use "btrfs"
>      commands to delete subvolumes always? and their relative snapshots?.

Yes.  We could add support for doing this inside rm, it isn't a huge
amount of code.

> 
>      But either in that case too returning ENOTEMPTY does confuse a
> user a lot. Isn't it valid
>      just by returning EPERM will explain a lot to users saying that
> this is a snapshot of a
>      subvolume or a parent subvolume which is not supposed to be
> deleted this way.

Good point, eperm might be more intuitive.

-chris

  reply	other threads:[~2010-04-08 13:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-08  0:44 ENOTEMPTY on "rm -rf" for snapshot and subvolume Harshavardhana
2010-04-08 13:52 ` Chris Mason [this message]
2010-04-08 21:14   ` Harshavardhana

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100408135216.GE1400@think \
    --to=chris.mason@oracle.com \
    --cc=harsha@gluster.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).