On Tue, Dec 02, 2014 at 10:25:55AM -0500, Zygo Blaxell wrote:
> On Tue, Dec 02, 2014 at 01:52:52PM +0100, David Sterba wrote:
> > > On a side note...only root can delete subvolumes, but non-root users
> > > can create them, which results in...this:
> > > 
> > >   $ /sbin/btrfs sub create foo
> > >   Create subvolume './foo'
> > >   $ date > foo/bar
> > >   $ /sbin/btrfs sub delete foo
> > >   Transaction commit: none (default)
> > >   Delete subvolume '/home/testuser/foo'
> > >   ERROR: cannot delete '/home/testuser/foo' - Operation not permitted
> > >   $ rm -rf foo
> > >   rm: cannot remove `foo': Operation not permitted
> > >   $ cat /proc/version
> > >   Linux version 3.17.1-zb64+ (root@buildbot) (gcc version 4.7.2 (Debian 
> > > 4.7.2-5) ) #1 SMP PREEMPT Tue Oct 21 00:17:49 EDT 2014
> > > 
> > > ...uh oh?
> > 
> > That's how it works now. I'd like to enable the user to delete their
> > subvolumes even without the user_subvol_rm_allowed option someday.
> 
> That seems...odd.  It should be symmetrical, i.e. if you can create a
> subvol you should be able to delete it, and if can't delete a subvol
> then you shouldn't be able to create them either.

It should and I don't know the exact reasons why it's been restricted.
AFAICS it should be safe to enable the user_subvol_rm_allowed mode by
default.

> I can imagine
> quite a bit of havoc could be wrought by an unprivileged user creating
> subvols indiscriminately (or in various specific, targeted locations).

Is this different from creating directories the same way?

There is a difference in metadata consumption between subvolume and
directory, but this would lead to "just" ENOSPC.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to