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
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?.
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.
Regards
--
Harshavardhana
http://www.gluster.com
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs"
in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
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 ENOTEMPTYYou 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 -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 04/08/2010 06:52 AM, Chris Mason wrote:>> > 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 >Thanks a lot for the inputs sent a patch for that. Regards -- Harshavardhana http://www.gluster.com -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Maybe Matching Threads
- [PATCH] btrfs: return EPERM upon rmdir on a subvolume
- [PATCH] Btrfs: allow subvol deletion by unprivileged user with -o user_subvol_rm_allowed
- [PATCH 1/3] Btrfs-progs: add support to set subvolume/snapshot readonly
- Re: [PATCH 1/6] btrfs: correct words about subvolume and snapshot
- crash when using the cp command to copy files off a striped gluster dir but not when using rsync