* [PATCH v2] Btrfs: return EPERM when deleting a default subvolume
@ 2014-03-11 18:24 Guangyu Sun
2014-03-12 7:58 ` Duncan
2014-03-12 12:33 ` David Sterba
0 siblings, 2 replies; 3+ messages in thread
From: Guangyu Sun @ 2014-03-11 18:24 UTC (permalink / raw)
To: linux-btrfs; +Cc: David Sterba, koen.de.wit
The error message is confusing:
# btrfs sub delete /mnt/mysub/
Delete subvolume '/mnt/mysub'
ERROR: cannot delete '/mnt/mysub' - Directory not empty
The error message does not make sense to me: It's not about deleting a
directory but it's a subvolume, and it doesn't matter if the subvolume is
empty or not.
Maybe EPERM or is more appropriate in this case, combined with an explanatory
kernel log message. (e.g. "subvolume with ID 123 cannot be deleted because
it is configured as default subvolume.")
Reported-by: Koen De Wit <koen.de.wit@oracle.com>
Signed-off-by: Guangyu Sun <guangyu.sun@oracle.com>
---
fs/btrfs/ioctl.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index a6d8efa..0751c0f 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -1797,7 +1797,9 @@ static noinline int may_destroy_subvol(struct btrfs_root *root)
if (di && !IS_ERR(di)) {
btrfs_dir_item_key_to_cpu(path->nodes[0], di, &key);
if (key.objectid == root->root_key.objectid) {
- ret = -ENOTEMPTY;
+ ret = -EPERM;
+ btrfs_err(root->fs_info, "deleting default subvolume "
+ "%llu is not allowed", key.objectid);
goto out;
}
btrfs_release_path(path);
--
1.7.9.5
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH v2] Btrfs: return EPERM when deleting a default subvolume
2014-03-11 18:24 [PATCH v2] Btrfs: return EPERM when deleting a default subvolume Guangyu Sun
@ 2014-03-12 7:58 ` Duncan
2014-03-12 12:33 ` David Sterba
1 sibling, 0 replies; 3+ messages in thread
From: Duncan @ 2014-03-12 7:58 UTC (permalink / raw)
To: linux-btrfs
Guangyu Sun posted on Tue, 11 Mar 2014 11:24:18 -0700 as excerpted:
> The error message does not make sense to me: [snip]
The subject says v2, which explains why I was getting deja vu reading the
description, but there's no listing of what changed from v1, as is
customary when a revision is posted. See pretty much any other patch
with multiple revisions.
--
Duncan - List replies preferred. No HTML msgs.
"Every nonfree program has a lord, a master --
and if you use the program, he is your master." Richard Stallman
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] Btrfs: return EPERM when deleting a default subvolume
2014-03-11 18:24 [PATCH v2] Btrfs: return EPERM when deleting a default subvolume Guangyu Sun
2014-03-12 7:58 ` Duncan
@ 2014-03-12 12:33 ` David Sterba
1 sibling, 0 replies; 3+ messages in thread
From: David Sterba @ 2014-03-12 12:33 UTC (permalink / raw)
To: Guangyu Sun; +Cc: linux-btrfs, koen.de.wit
On Tue, Mar 11, 2014 at 11:24:18AM -0700, Guangyu Sun wrote:
> The error message is confusing:
>
> # btrfs sub delete /mnt/mysub/
> Delete subvolume '/mnt/mysub'
> ERROR: cannot delete '/mnt/mysub' - Directory not empty
>
> The error message does not make sense to me: It's not about deleting a
> directory but it's a subvolume, and it doesn't matter if the subvolume is
> empty or not.
>
> Maybe EPERM or is more appropriate in this case, combined with an explanatory
> kernel log message. (e.g. "subvolume with ID 123 cannot be deleted because
> it is configured as default subvolume.")
>
> Reported-by: Koen De Wit <koen.de.wit@oracle.com>
> Signed-off-by: Guangyu Sun <guangyu.sun@oracle.com>
Reviewed-by: David Sterba <dsterba@suse.cz>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-03-12 12:33 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-11 18:24 [PATCH v2] Btrfs: return EPERM when deleting a default subvolume Guangyu Sun
2014-03-12 7:58 ` Duncan
2014-03-12 12:33 ` David Sterba
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox