All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC] Improve subvolume usability for a normal user
@ 2017-12-05  8:25 Misono, Tomohiro
  2017-12-05  8:43 ` Qu Wenruo
  2017-12-05 18:24 ` Goffredo Baroncelli
  0 siblings, 2 replies; 21+ messages in thread
From: Misono, Tomohiro @ 2017-12-05  8:25 UTC (permalink / raw)
  To: linux-btrfs

Hello all,

I want to address some issues of subvolume usability for a normal user.
i.e. a user can create subvolumes, but
 - Cannot delete their own subvolume (by default)
 - Cannot tell subvolumes from directories (in a straightforward way)
 - Cannot check the quota limit when qgroup is enabled

Here I show the initial thoughts and approaches to this problem.
I want to check if this is a right approach or not before I start writing code.

Comments are welcome.
Tomohiro Misono

==========
- Goal and current problem
The goal of this RFC is to give a normal user more control to their own subvolumes.
Currently the control to subvolumes for a normal user is restricted as below: 

+-------------+------+------+
|   command   | root | user |
+-------------+------+------+
| sub create  | Y    | Y    |
| sub snap    | Y    | Y    |
| sub del     | Y    | N    |
| sub list    | Y    | N    |
| sub show    | Y    | N    |
| qgroup show | Y    | N    |
+-------------+------+------+

In short, I want to change this as below in order to improve user's usability:

+-------------+------+--------+
|   command   | root | user   |
+-------------+------+--------+
| sub create  | Y    | Y      |
| sub snap    | Y    | Y      |
| sub del     | Y    | N -> Y |
| sub list    | Y    | N -> Y |
| sub show    | Y    | N -> Y |
| qgroup show | Y    | N -> Y |
+-------------+------+--------+

In words,
(1) allow deletion of subvolume if a user owns it, and 
(2) allow getting subvolume/quota info if a user has read access to it
 (sub list/qgroup show just lists the subvolumes which are readable by the user)

I think other commands not listed above (qgroup limit, send/receive etc.) should
be done by root and not be allowed for a normal user.


- Outside the scope of this RFC
There is a qualitative problem to use qgroup for limiting user disk amount;
quota limit can easily be averted by creating a subvolume. I think that forcing
inheriting quota of parent subvolume is a solution, but I won't address nor
discuss this here. 


- Proposal
 (1) deletion of subvolume

  I want to change the default behavior to allow a user to delete their own
  subvolumes.
  
  This is not the same behavior as when user_subvol_rm_alowed mount option is
  specified; in that case a user can delete the subvolume to which they have
  write+exec right.
  
  Since snapshot creation is already restricted to the subvolume owner, it is
  consistent that only the owner of the subvolume (or root) can delete it.
  
  The implementation should be straightforward.

 (2) getting subvolume/quota info

  TREE_SEARCH ioctl is used to retrieve the subvolume/quota info by btrfs-progs
  (sub show/list, qgroup show etc.). This requires the root permission.
  
  The easiest way to allow a user to get subvolume/quota info is just relaxing
  the permission of TREE_SEARCH. However, since all the tree information (inc.
  file name) will be exposed, this poses a sequrity risk and is not acceptable.
  
  So, I want to introduce 2 ioctls to get subvolume/quota info respectively for
  a normal user, which return only the info readable by the user:
  
   [subvolume info]
    Mainly search ROOT tree for ROOT_ITEM/ROOT_BACKREF, but check its read
   right by searching FS/FILE tree and comparing it with caller's uid.
  
   [quota info]
    Same as above, but mainly search QUOTA tree and only returns level 0 info.
  
  Also, in order to construct subvolume path, permission of INO_LOOKUP ioctl
  needs to be relaxed for the user who has read access to the subvolume.


- Summary of Proposal
 - Change the default behavior to allow a user to delete their own subvolumes
 - Add 2 new non-root ioctls to get subvolume/quota info for accessible subvolumes
==========


^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2017-12-07 13:45 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-05  8:25 [RFC] Improve subvolume usability for a normal user Misono, Tomohiro
2017-12-05  8:43 ` Qu Wenruo
2017-12-05 12:41   ` Austin S. Hemmelgarn
2017-12-05 15:42     ` Graham Cobb
2017-12-05 18:01       ` Goffredo Baroncelli
2017-12-05 18:46         ` Graham Cobb
2017-12-05 19:09           ` Goffredo Baroncelli
2017-12-05 20:17             ` Austin S. Hemmelgarn
2017-12-05 22:08               ` Goffredo Baroncelli
2017-12-06 12:25                 ` Austin S. Hemmelgarn
2017-12-06  4:52     ` Misono, Tomohiro
2017-12-06 12:39       ` Austin S. Hemmelgarn
2017-12-07  2:56         ` Duncan
2017-12-07  7:15           ` Misono, Tomohiro
2017-12-07 11:55             ` Duncan
2017-12-07 12:21               ` Austin S. Hemmelgarn
2017-12-07 13:45                 ` Hugo Mills
2017-12-07  5:27         ` Qu Wenruo
2017-12-07  7:32           ` Marat Khalili
2017-12-07  7:59             ` Qu Wenruo
2017-12-05 18:24 ` Goffredo Baroncelli

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.