diff mbox

[v2,3/3] fs: ubifs: set s_uuid in super block

Message ID 20170411095055.26328-4-o.rempel@pengutronix.de
State Deferred, archived
Delegated to: Richard Weinberger
Headers show

Commit Message

Oleksij Rempel April 11, 2017, 9:50 a.m. UTC
From: Steffen Trumtrar <s.trumtrar@pengutronix.de>

This is need to provide uuid based integrity functionlity for:
imy_policy (fsuuid option) and  evmctl (--uuid option).

Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
 fs/ubifs/super.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Richard Weinberger April 11, 2017, 8:43 p.m. UTC | #1
Oleksij,

Am 11.04.2017 um 11:50 schrieb Oleksij Rempel:
> From: Steffen Trumtrar <s.trumtrar@pengutronix.de>
> 
> This is need to provide uuid based integrity functionlity for:
> imy_policy (fsuuid option) and  evmctl (--uuid option).
> 
> Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
> ---
>  fs/ubifs/super.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
> index bff1e8d6f7bd..a584b2f2b11d 100644
> --- a/fs/ubifs/super.c
> +++ b/fs/ubifs/super.c
> @@ -2077,6 +2077,7 @@ static int ubifs_fill_super(struct super_block *sb, void *data, int silent)
>  		err = -ENOMEM;
>  		goto out_umount;
>  	}
> +	memcpy(&sb->s_uuid, &c->uuid, sizeof(c->uuid));

Makes sense.

Artem, do you remember why UBIFS didn't set s_uuid in first place?

Thanks,
//richard
Christoph Hellwig April 12, 2017, 5:48 a.m. UTC | #2
On Tue, Apr 11, 2017 at 10:43:26PM +0200, Richard Weinberger wrote:
> Artem, do you remember why UBIFS didn't set s_uuid in first place?

It's an extremely odd field - only a hand full of file systems set it
(e.g. XFS doesn't, although according to Mimi IMA supports XFS), and
it's never even used outside of the IMA/EVM code.

We really need a feature flag that this field is valid that IMA can
check before adding more support for it.
Oleksij Rempel April 12, 2017, 7:15 a.m. UTC | #3
On Tue, Apr 11, 2017 at 10:48:28PM -0700, Christoph Hellwig wrote:
> On Tue, Apr 11, 2017 at 10:43:26PM +0200, Richard Weinberger wrote:
> > Artem, do you remember why UBIFS didn't set s_uuid in first place?
> 
> It's an extremely odd field - only a hand full of file systems set it
> (e.g. XFS doesn't, although according to Mimi IMA supports XFS), and
> it's never even used outside of the IMA/EVM code.
> 
> We really need a feature flag that this field is valid that IMA can
> check before adding more support for it.

It seems to be used by mm/cleancache.c
void __cleancache_init_shared_fs()

but this affects only ocfs2.

So, if some flag should be implemented, who should do it? :)
If me, what flag should be created?
Richard Weinberger April 24, 2017, 3:47 p.m. UTC | #4
Oleksij,

Am 12.04.2017 um 09:15 schrieb Oleksij Rempel:
> On Tue, Apr 11, 2017 at 10:48:28PM -0700, Christoph Hellwig wrote:
>> On Tue, Apr 11, 2017 at 10:43:26PM +0200, Richard Weinberger wrote:
>>> Artem, do you remember why UBIFS didn't set s_uuid in first place?
>>
>> It's an extremely odd field - only a hand full of file systems set it
>> (e.g. XFS doesn't, although according to Mimi IMA supports XFS), and
>> it's never even used outside of the IMA/EVM code.
>>
>> We really need a feature flag that this field is valid that IMA can
>> check before adding more support for it.
> 
> It seems to be used by mm/cleancache.c
> void __cleancache_init_shared_fs()
> 
> but this affects only ocfs2.
> 
> So, if some flag should be implemented, who should do it? :)

I'll not do it for you. ;)

> If me, what flag should be created?

A super block flag that denotes that s_uuid is valid.

Thanks,
//richard
Richard Weinberger April 27, 2017, 10:03 p.m. UTC | #5
Am 24.04.2017 um 17:47 schrieb Richard Weinberger:
>> So, if some flag should be implemented, who should do it? :)
> 
> I'll not do it for you. ;)

Please also see http://marc.info/?l=linux-fsdevel&m=149327990608749&w=2

Thanks,
//richard
Amir Goldstein April 28, 2017, 8:53 a.m. UTC | #6
On Fri, Apr 28, 2017 at 1:03 AM, Richard Weinberger <richard@nod.at> wrote:
> Am 24.04.2017 um 17:47 schrieb Richard Weinberger:
>>> So, if some flag should be implemented, who should do it? :)
>>
>> I'll not do it for you. ;)
>
> Please also see http://marc.info/?l=linux-fsdevel&m=149327990608749&w=2
>

Perhaps you meant this:
https://marc.info/?l=linux-fsdevel&m=149328358909709&w=2

There does not seem to be much objections to adding the flag,
so hopefully, we can merge it for v.12 and filesystems and consumers
will pick it up whenever.

Amir.
Oleksij Rempel May 2, 2017, 5:30 a.m. UTC | #7
On 04/28/2017 10:53 AM, Amir Goldstein wrote:
> On Fri, Apr 28, 2017 at 1:03 AM, Richard Weinberger <richard@nod.at> wrote:
>> Am 24.04.2017 um 17:47 schrieb Richard Weinberger:
>>>> So, if some flag should be implemented, who should do it? :)
>>>
>>> I'll not do it for you. ;)
>>
>> Please also see http://marc.info/?l=linux-fsdevel&m=149327990608749&w=2
>>
>
> Perhaps you meant this:
> https://marc.info/?l=linux-fsdevel&m=149328358909709&w=2
>
> There does not seem to be much objections to adding the flag,
> so hopefully, we can merge it for v.12 and filesystems and consumers
> will pick it up whenever.

Ok, thanks.

Then i will need to wait untill your patches is merged and then resent 
updated patch to avoid merge race condition.
Amir Goldstein May 2, 2017, 7:19 a.m. UTC | #8
On Fri, Apr 28, 2017 at 1:03 AM, Richard Weinberger <richard@nod.at> wrote:
> Am 24.04.2017 um 17:47 schrieb Richard Weinberger:
>>> So, if some flag should be implemented, who should do it? :)
>>
>> I'll not do it for you. ;)
>
> Please also see http://marc.info/?l=linux-fsdevel&m=149327990608749&w=2
>

Richard,

Considering the facts that:
1. I proposed the said flag and Al didn't think it was needed [1]
2. ext4 already sets s_uuid without any flag for a long time now
3. A similar patch was queued for v4.12 to set s_uuid for xfs without any flag

I think it would be right to take Oleksij's patch as is.

FYI, my current work on 'constant inode numbers for overlayfs' requires that
underlying filesystem had set a non-zero s_uuid. Not sure if that matters for
ubifs+overlayfs users.

Amir.

[1] https://marc.info/?l=linux-unionfs&m=149352864527985&w=2
Artem Bityutskiy May 2, 2017, 7:23 a.m. UTC | #9
On Tue, 2017-04-11 at 22:43 +0200, Richard Weinberger wrote:
> Makes sense.
> 
> Artem, do you remember why UBIFS didn't set s_uuid in first place?

Just did not notice it I think.
Richard Weinberger May 2, 2017, 7:37 a.m. UTC | #10
Amir,

Am 02.05.2017 um 09:19 schrieb Amir Goldstein:
> On Fri, Apr 28, 2017 at 1:03 AM, Richard Weinberger <richard@nod.at> wrote:
>> Am 24.04.2017 um 17:47 schrieb Richard Weinberger:
>>>> So, if some flag should be implemented, who should do it? :)
>>>
>>> I'll not do it for you. ;)
>>
>> Please also see http://marc.info/?l=linux-fsdevel&m=149327990608749&w=2
>>
> 
> Richard,
> 
> Considering the facts that:
> 1. I proposed the said flag and Al didn't think it was needed [1]
> 2. ext4 already sets s_uuid without any flag for a long time now
> 3. A similar patch was queued for v4.12 to set s_uuid for xfs without any flag
> 
> I think it would be right to take Oleksij's patch as is.
> 
> FYI, my current work on 'constant inode numbers for overlayfs' requires that
> underlying filesystem had set a non-zero s_uuid. Not sure if that matters for
> ubifs+overlayfs users.

If VFS maintainers are fine with that, I'll take it.
From UBIFS' POV it does not matter much. :-)

Thanks
//richard
Oleksij Rempel May 9, 2017, 4:13 a.m. UTC | #11
On 05/02/2017 09:37 AM, Richard Weinberger wrote:
> Amir,
>
> Am 02.05.2017 um 09:19 schrieb Amir Goldstein:
>> On Fri, Apr 28, 2017 at 1:03 AM, Richard Weinberger <richard@nod.at> wrote:
>>> Am 24.04.2017 um 17:47 schrieb Richard Weinberger:
>>>>> So, if some flag should be implemented, who should do it? :)
>>>>
>>>> I'll not do it for you. ;)
>>>
>>> Please also see http://marc.info/?l=linux-fsdevel&m=149327990608749&w=2
>>>
>>
>> Richard,
>>
>> Considering the facts that:
>> 1. I proposed the said flag and Al didn't think it was needed [1]
>> 2. ext4 already sets s_uuid without any flag for a long time now
>> 3. A similar patch was queued for v4.12 to set s_uuid for xfs without any flag
>>
>> I think it would be right to take Oleksij's patch as is.
>>
>> FYI, my current work on 'constant inode numbers for overlayfs' requires that
>> underlying filesystem had set a non-zero s_uuid. Not sure if that matters for
>> ubifs+overlayfs users.
>
> If VFS maintainers are fine with that, I'll take it.
> From UBIFS' POV it does not matter much. :-)

Ping to VFS maintainers?
Oleksij Rempel May 9, 2017, 5:52 a.m. UTC | #12
On 05/09/2017 07:37 AM, Amir Goldstein wrote:
>
>
> On Tue, May 9, 2017 at 7:13 AM, Oleksij Rempel <ore@pengutronix.de
> <mailto:ore@pengutronix.de>> wrote:
>
>
>
>     On 05/02/2017 09:37 AM, Richard Weinberger wrote:
>
>         Amir,
>
>         Am 02.05.2017 um 09:19 schrieb Amir Goldstein:
>
>             On Fri, Apr 28, 2017 at 1:03 AM, Richard Weinberger
>             <richard@nod.at <mailto:richard@nod.at>> wrote:
>
>                 Am 24.04.2017 um 17:47 schrieb Richard Weinberger:
>
>                         So, if some flag should be implemented, who
>                         should do it? :)
>
>
>                     I'll not do it for you. ;)
>
>
>                 Please also see
>                 http://marc.info/?l=linux-fsdevel&m=149327990608749&w=2
>                 <http://marc.info/?l=linux-fsdevel&m=149327990608749&w=2>
>
>
>             Richard,
>
>             Considering the facts that:
>             1. I proposed the said flag and Al didn't think it was
>             needed [1]
>             2. ext4 already sets s_uuid without any flag for a long time now
>             3. A similar patch was queued for v4.12 to set s_uuid for
>             xfs without any flag
>
>             I think it would be right to take Oleksij's patch as is.
>
>             FYI, my current work on 'constant inode numbers for
>             overlayfs' requires that
>             underlying filesystem had set a non-zero s_uuid. Not sure if
>             that matters for
>             ubifs+overlayfs users.
>
>
>         If VFS maintainers are fine with that, I'll take it.
>         From UBIFS' POV it does not matter much. :-)
>
>
>     Ping to VFS maintainers?
>
>
> What ping? Al made it clear that a flag is not needed.
> BTW, xfs s_uuid patch was merged to master.


I'm talking about ubifs patch.
Richard Weinberger May 9, 2017, 7:01 a.m. UTC | #13
Oleksij,

Am 09.05.2017 um 07:52 schrieb Oleksij Rempel:
>>
>>         If VFS maintainers are fine with that, I'll take it.
>>         From UBIFS' POV it does not matter much. :-)
>>
>>
>>     Ping to VFS maintainers?
>>
>>
>> What ping? Al made it clear that a flag is not needed.
>> BTW, xfs s_uuid patch was merged to master.
> 
> 
> I'm talking about ubifs patch.

Then we can queue this patch for 4.13.
Please resend and make sure it addresses everything what was also
suggested for the xfs s_uuid patch.

Thanks,
//richard
Amir Goldstein May 9, 2017, 7:08 a.m. UTC | #14
On Tue, May 9, 2017 at 10:01 AM, Richard Weinberger <richard@nod.at> wrote:
>
> Oleksij,
>
> Am 09.05.2017 um 07:52 schrieb Oleksij Rempel:
> >>
> >>         If VFS maintainers are fine with that, I'll take it.
> >>         From UBIFS' POV it does not matter much. :-)
> >>
> >>
> >>     Ping to VFS maintainers?
> >>
> >>
> >> What ping? Al made it clear that a flag is not needed.
> >> BTW, xfs s_uuid patch was merged to master.
> >
> >
> > I'm talking about ubifs patch.

Me too.

>
> Then we can queue this patch for 4.13.
> Please resend and make sure it addresses everything what was also
> suggested for the xfs s_uuid patch.
>

Just to be clear, the xfs s_uuid patch is just a memcpy,
no different from Oleksij's patch.

Thanks,
Amir.
Oleksij Rempel May 9, 2017, 7:35 a.m. UTC | #15
On 05/09/2017 09:08 AM, Amir Goldstein wrote:
> On Tue, May 9, 2017 at 10:01 AM, Richard Weinberger <richard@nod.at> wrote:
>>
>> Oleksij,
>>
>> Am 09.05.2017 um 07:52 schrieb Oleksij Rempel:
>>>>
>>>>         If VFS maintainers are fine with that, I'll take it.
>>>>         From UBIFS' POV it does not matter much. :-)
>>>>
>>>>
>>>>     Ping to VFS maintainers?
>>>>
>>>>
>>>> What ping? Al made it clear that a flag is not needed.
>>>> BTW, xfs s_uuid patch was merged to master.
>>>
>>>
>>> I'm talking about ubifs patch.
>
> Me too.

:) ok

>>
>> Then we can queue this patch for 4.13.
>> Please resend and make sure it addresses everything what was also
>> suggested for the xfs s_uuid patch.
>>
>
> Just to be clear, the xfs s_uuid patch is just a memcpy,
> no different from Oleksij's patch.

So, should i change something?

here is the patch:
https://patchwork.kernel.org/patch/9674817/
Richard Weinberger May 9, 2017, 7:35 a.m. UTC | #16
Amir,

Am 09.05.2017 um 09:08 schrieb Amir Goldstein:
>> Then we can queue this patch for 4.13.
>> Please resend and make sure it addresses everything what was also
>> suggested for the xfs s_uuid patch.
>>
> 
> Just to be clear, the xfs s_uuid patch is just a memcpy,
> no different from Oleksij's patch.

Wasn't there a huge discussion about LE/BE/uniqueness and more details
on UUID that hurt my brain.

Thanks,
//richard
Amir Goldstein May 9, 2017, 7:50 a.m. UTC | #17
On Tue, May 9, 2017 at 10:35 AM, Richard Weinberger <richard@nod.at> wrote:
> Amir,
>
> Am 09.05.2017 um 09:08 schrieb Amir Goldstein:
>>> Then we can queue this patch for 4.13.
>>> Please resend and make sure it addresses everything what was also
>>> suggested for the xfs s_uuid patch.
>>>
>>
>> Just to be clear, the xfs s_uuid patch is just a memcpy,
>> no different from Oleksij's patch.

See upstream commit
8f720d9 xfs: publish UUID in struct super_block


>
> Wasn't there a huge discussion about LE/BE/uniqueness and more details
> on UUID that hurt my brain.
>

LE/BE discussions are more about which variants of uuid helpers should be
created, among other things, for consumers of s_uuid to check that s_uuid
was filled by fs.
Converting s_uuid type to uuid_t or whatever is for the far future.

uniqueness of s_uuid does not exist with current filesystems,
so no reason whatsoever to act differently with ubifs.
Fixing uniqueness of s_uuid (if at all is needed) is a future VFS task.

Bottom line, for Oleksij's original patch:

Reviewed-by: Amir Goldstein <amir73il@gmail.com>

If it's not too late for 4.12 that could be nice, because then
ubifs+overlayfs would gain a new feature (constant inode numbers)
diff mbox

Patch

diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
index bff1e8d6f7bd..a584b2f2b11d 100644
--- a/fs/ubifs/super.c
+++ b/fs/ubifs/super.c
@@ -2077,6 +2077,7 @@  static int ubifs_fill_super(struct super_block *sb, void *data, int silent)
 		err = -ENOMEM;
 		goto out_umount;
 	}
+	memcpy(&sb->s_uuid, &c->uuid, sizeof(c->uuid));
 
 	mutex_unlock(&c->umount_mutex);
 	return 0;