linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: ebiederm@xmission.com (Eric W. Biederman)
To: Dave Chinner <david@fromorbit.com>
Cc: linux-fsdevel@vger.kernel.org,
	Linux Containers <containers@lists.linux-foundation.org>,
	linux-kernel@vger.kernel.org,
	"Serge E. Hallyn" <serge@hallyn.com>, Ben Myers <bpm@sgi.com>,
	Alex Elder <elder@kernel.org>
Subject: Re: [PATCH RFC 10/12] userns: Convert xfs to use kuid/kgid/kprojid where appropriate
Date: Wed, 13 Feb 2013 10:13:16 -0800	[thread overview]
Message-ID: <87obfoxetf.fsf@xmission.com> (raw)
In-Reply-To: <20121121195246.GN2822@localhost> (Joel Becker's message of "Wed, 21 Nov 2012 11:52:47 -0800")

Joel Becker <jlbec@evilplan.org> writes:

> On Wed, Nov 21, 2012 at 10:55:24AM +1100, Dave Chinner wrote:
>> > diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
>> > index 2778258..3656b88 100644
>> > --- a/fs/xfs/xfs_inode.c
>> > +++ b/fs/xfs/xfs_inode.c
>> > @@ -570,11 +570,12 @@ xfs_dinode_from_disk(
>> >  	to->di_version = from ->di_version;
>> >  	to->di_format = from->di_format;
>> >  	to->di_onlink = be16_to_cpu(from->di_onlink);
>> > -	to->di_uid = be32_to_cpu(from->di_uid);
>> > -	to->di_gid = be32_to_cpu(from->di_gid);
>> > +	to->di_uid = make_kuid(&init_user_ns, be32_to_cpu(from->di_uid));
>> > +	to->di_gid = make_kgid(&init_user_ns, be32_to_cpu(from->di_gid));
>> 
>> You can't do this, because the incore inode structure is written
>> directly to the log. This is effectively an on-disk format change.
>
> 	Yeah, I don't get this either.  Over in ocfs2, you do the
> correct thing, translating at the boundary from ocfs2_dinode to struct
> inode.

This is the boundary.  The crazy thing is that is that xfs appears to
directly write their incore inode structure into their journal.  I had
missed the journal reference the first time through and simply assumed
since this is where the disk inode to the incore inode coversion
happened that the weird scary comment in the xfs header file was wrong.

I would have no problems with not converting those uids and gids except
they are used directly in comparisons against current_fsuid so it really
isn't ok to not convert those values.

I wish that incore structure was managed more like the lvb in ocfs2.
Even though it is cached in core it is first converted into a specific
byte order and then shoved into a character array.  Keeping anyone from
getting any funny ideas about using those values directly.

I have sent my xfs changes back to the drawing board and am
concentrating on getting my conversions for the rest of the filesystems
merged.  When I get the time I will come back to xfs.  xfs is a very
peculiar filesystem.

Eric

  reply	other threads:[~2013-02-13 18:13 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-20 12:42 [PATCH RFC 0/12] Final userns conversions Eric W. Biederman
2012-11-20 12:43 ` [PATCH RFC 01/12] userns: Support 9p interacting with multiple user namespaces Eric W. Biederman
2012-11-20 12:43   ` [PATCH RFC 02/12] userns: Convert afs to use kuid/kgid where appropriate Eric W. Biederman
2012-11-20 12:43   ` [PATCH RFC 03/12] userns: Convert ceph " Eric W. Biederman
2012-11-20 16:48     ` Sage Weil
2012-11-20 17:15       ` Eric W. Biederman
2012-11-20 12:43   ` [PATCH RFC 04/12] userns: Convert cifs " Eric W. Biederman
     [not found]     ` <CAH2r5mt91Av7w6GQUPNu2A9EGRNbPGGAhMO=EobOMi5Cn8gh5g@mail.gmail.com>
2012-11-20 17:22       ` Eric W. Biederman
2012-11-25 12:47     ` Jeff Layton
2012-11-20 12:43   ` [PATCH RFC 05/12] userns: Convert coda's " Eric W. Biederman
2012-11-20 12:43   ` [PATCH RFC 06/12] userns: Convert gfs2 " Eric W. Biederman
2012-11-22  9:47     ` Steven Whitehouse
2012-11-20 12:43   ` [PATCH RFC 07/12] userns: Convert ncpfs to use kuid and kgid " Eric W. Biederman
2012-11-20 12:43   ` [PATCH RFC 08/12] userns: Convert nfs and nfsd to use kuid/kgid " Eric W. Biederman
2012-11-20 12:43   ` [PATCH RFC 09/12] userns: Convert ocfs2 to use kuid and kgid " Eric W. Biederman
2012-11-21 19:51     ` Joel Becker
2013-02-13 17:12       ` Eric W. Biederman
2012-11-21 19:59     ` Joel Becker
2012-11-20 12:43   ` [PATCH RFC 10/12] userns: Convert xfs to use kuid/kgid/kprojid " Eric W. Biederman
2012-11-20 23:55     ` Dave Chinner
2012-11-21 19:52       ` Joel Becker
2013-02-13 18:13         ` Eric W. Biederman [this message]
2013-02-14  2:19           ` Dave Chinner
2013-02-18  1:25             ` Eric W. Biederman
2013-02-19  3:30               ` Dave Chinner
2012-11-20 12:43   ` [PATCH RFC 11/12] userns: Now that everything has been converted remove the unnecessary infrastructure Eric W. Biederman
2012-11-20 12:43   ` [PATCH RFC 12/12] userns: Remove the EXPERMINTAL kconfig tag Eric W. Biederman
2012-11-21  0:09 ` [PATCH RFC 0/12] Final userns conversions Dave Chinner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87obfoxetf.fsf@xmission.com \
    --to=ebiederm@xmission.com \
    --cc=bpm@sgi.com \
    --cc=containers@lists.linux-foundation.org \
    --cc=david@fromorbit.com \
    --cc=elder@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=serge@hallyn.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).