Re: [PATCH] Send quota messages via netlink

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Jan Kara <jack@...>
Cc: Andrew Morton <akpm@...>, <linux-kernel@...>, Balbir Singh <balbir@...>, Serge E. Hallyn <serue@...>, <containers@...>
Date: Wednesday, August 29, 2007 - 2:31 pm

Jan Kara <jack@suse.cz> writes:



For non networking stuff netlink is a pain to use in this area.

Although if we are very careful we may be ok.  But this requires
some thinking through.

In principle the uid that corresponds to a struct user depends
on which user namespace you are in.

Now there is a cheap trick we can play.  A traditional filesystem
belongs to exactly one user namespace. So we can return the uid
in the filesystems user namespace.

Wait you are returning current->user->uid?  Shouldn't we return
the user who's quota is exceeded?  I.e. if alice owns a file
and makes it world writable.  And bob writes to the file wouldn't
that file still be billed to alice's quota?  So shouldn't we complain
about alice and not bob?

Anyway if the goal is to return a user who maps to the filesystem we
can just always return uids in the filesystems uid namespace.

Although if filesystems start supporting multiple user namespaces
natively we might have a challenge on our hands.

Let me see if I can think of a concrete example here.

We have a nfs server with quotas.
We have clients who mount the nfs filesystem without synchronizing
their /etc/password files, so we have separate user namespaces.

What are the ways to make this work?
- Everyone who has right access to the NFS mount on all
  machines must have their uid synchronized across all machines
  (the easiest case).

- Each different kernel has a mapping from it's local uids to
  the uids of the nfs filesystem. (ick if we do much more the
  root squash).

- The nfs filesystem knows about the situation and remembers the
  uid source (the uid namespace) as well as the uid when storing
  owners of files.  NFSv4 allows for this by treating users
  as user@domain.

Generally synchronizing uid namespaces (with possibly a root squash
exception) is the sanest and simplest thing to do in a case like this,
but it isn't always what is done.

As long as we are returning the filesystems idea of users we
shouldn't have to worry much about uid namespaces.  However
for non-traditional filesystems that don't store the user
as just a uid, say 9p and NFSv4, this implies that we want
to use the filesystems string identifier.  However I don't think
the quota system supports these filesystems yet.  So that
isn't an issue just yet.

However I'm still confused about the use of current->user.  If that
is what we really want and not the user who's quota will be charged
it gets to be a really trick business, because potentially the uid
we want to deliver varies depending on who opened the netlink socket.

Eric
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] Send quota messages via netlink, Jan Kara, (Tue Aug 28, 10:13 am)
Re: [PATCH] Send quota messages via netlink, Andrew Morton, (Wed Aug 29, 12:51 am)
Re: [PATCH] Send quota messages via netlink, Jan Kara, (Mon Sep 3, 10:43 am)
Re: [PATCH] Send quota messages via netlink, Randy Dunlap, (Mon Sep 3, 1:12 pm)
Re: [PATCH] Send quota messages via netlink, Jan Kara, (Mon Sep 3, 1:48 pm)
Re: [PATCH] Send quota messages via netlink, Andrew Morton, (Mon Sep 3, 2:41 pm)
Re: [PATCH] Send quota messages via netlink, Jan Kara, (Wed Aug 29, 6:03 am)
Re: [PATCH] Send quota messages via netlink, Andrew Morton, (Wed Aug 29, 12:13 am)
Re: [PATCH] Send quota messages via netlink, Eric W. Biederman, (Wed Aug 29, 1:41 am)
Re: [PATCH] Send quota messages via netlink, Balbir Singh, (Wed Aug 29, 2:30 am)
Re: [PATCH] Send quota messages via netlink, Jan Kara, (Wed Aug 29, 8:46 am)
Re: [PATCH] Send quota messages via netlink, Balbir Singh, (Fri Aug 31, 2:59 am)
Re: [PATCH] Send quota messages via netlink, Jan Kara, (Mon Sep 3, 6:18 am)
Re: [PATCH] Send quota messages via netlink, Jan Kara, (Wed Aug 29, 8:26 am)
Re: [PATCH] Send quota messages via netlink, Eric W. Biederman, (Wed Aug 29, 2:31 pm)
Re: [PATCH] Send quota messages via netlink, Jan Kara, (Wed Aug 29, 3:26 pm)
Re: [PATCH] Send quota messages via netlink, Eric W. Biederman, (Wed Aug 29, 5:06 pm)
Re: [PATCH] Send quota messages via netlink, Jan Kara, (Thu Aug 30, 5:25 am)
Re: [PATCH] Send quota messages via netlink, Eric W. Biederman, (Thu Aug 30, 1:33 pm)
Re: [PATCH] Send quota messages via netlink, Serge E. Hallyn, (Thu Aug 30, 3:18 pm)
Re: [PATCH] Send quota messages via netlink, Serge E. Hallyn, (Thu Aug 30, 2:54 pm)
Re: [PATCH] Send quota messages via netlink, Serge E. Hallyn, (Thu Aug 30, 3:10 pm)
Re: [PATCH] Send quota messages via netlink, Jan Kara, (Thu Aug 30, 6:18 pm)
Re: [PATCH] Send quota messages via netlink, Serge E. Hallyn, (Thu Aug 30, 6:14 pm)
Re: [PATCH] Send quota messages via netlink, Jan Kara, (Mon Sep 3, 10:21 am)
Re: [PATCH] Send quota messages via netlink, Serge E. Hallyn, (Tue Sep 4, 5:32 pm)
Re: [PATCH] Send quota messages via netlink, Jan Kara, (Tue Sep 4, 6:49 pm)
Re: [PATCH] Send quota messages via netlink, Serge E. Hallyn, (Tue Sep 4, 7:48 pm)
Re: [PATCH] Send quota messages via netlink, Jan Kara, (Wed Sep 5, 9:32 am)
Re: [PATCH] Send quota messages via netlink, Serge E. Hallyn, (Wed Sep 5, 10:28 am)
Re: [PATCH] Send quota messages via netlink, Randy Dunlap, (Wed Aug 29, 11:57 am)
Re: [PATCH] Send quota messages via netlink, David Miller, (Wed Aug 29, 12:54 am)