2011-06-22 21:32:10

by J. Bruce Fields

[permalink] [raw]
Subject: autoload rpcsec_gss_krb5

There are three layers of modules required for rpcsec_gss to work:
auth_gss, a mechanism (rpcsec_gss_krb5), and then any crypto algorithms.

We autoload all of those except rpcsec_gss_krb5.

Objections?

(I suppose another option would be to get rid of the gss mechanism layer
entirely, now that we've only got one of them. But I'd rather keep it.)

--b.

commit 027c33f5a292b5a4bbfc1ad9ced19ad4626d056b
Author: J. Bruce Fields <[email protected]>
Date: Wed Jun 22 10:50:08 2011 -0400

rpc: allow autoloading of gss mechanisms

Remove the need for an explicit modprobe of rpcsec_gss_krb5.

Signed-off-by: J. Bruce Fields <[email protected]>

diff --git a/net/sunrpc/auth_gss/gss_krb5_mech.c b/net/sunrpc/auth_gss/gss_krb5_mech.c
index 0a9a2ec..5c33926 100644
--- a/net/sunrpc/auth_gss/gss_krb5_mech.c
+++ b/net/sunrpc/auth_gss/gss_krb5_mech.c
@@ -743,6 +743,13 @@ static struct pf_desc gss_kerberos_pfs[] = {
},
};

+MODULE_ALIAS("rpc-auth-gss-krb5");
+MODULE_ALIAS("rpc-auth-gss-krb5i");
+MODULE_ALIAS("rpc-auth-gss-krb5p");
+MODULE_ALIAS("rpc-auth-gss-390003");
+MODULE_ALIAS("rpc-auth-gss-390004");
+MODULE_ALIAS("rpc-auth-gss-390005");
+
static struct gss_api_mech gss_kerberos_mech = {
.gm_name = "krb5",
.gm_owner = THIS_MODULE,
diff --git a/net/sunrpc/auth_gss/gss_mech_switch.c b/net/sunrpc/auth_gss/gss_mech_switch.c
index e3c36a2..ca8cad8 100644
--- a/net/sunrpc/auth_gss/gss_mech_switch.c
+++ b/net/sunrpc/auth_gss/gss_mech_switch.c
@@ -141,7 +141,7 @@ gss_mech_get(struct gss_api_mech *gm)
EXPORT_SYMBOL_GPL(gss_mech_get);

struct gss_api_mech *
-gss_mech_get_by_name(const char *name)
+_gss_mech_get_by_name(const char *name)
{
struct gss_api_mech *pos, *gm = NULL;

@@ -158,6 +158,17 @@ gss_mech_get_by_name(const char *name)

}

+struct gss_api_mech * gss_mech_get_by_name(const char *name)
+{
+ struct gss_api_mech *gm = NULL;
+
+ gm = _gss_mech_get_by_name(name);
+ if (!gm) {
+ request_module("rpc-auth-gss-%s", name);
+ gm = _gss_mech_get_by_name(name);
+ }
+ return gm;
+}
EXPORT_SYMBOL_GPL(gss_mech_get_by_name);

struct gss_api_mech *
@@ -194,10 +205,9 @@ mech_supports_pseudoflavor(struct gss_api_mech *gm, u32 pseudoflavor)
return 0;
}

-struct gss_api_mech *
-gss_mech_get_by_pseudoflavor(u32 pseudoflavor)
+struct gss_api_mech *_gss_mech_get_by_pseudoflavor(u32 pseudoflavor)
{
- struct gss_api_mech *pos, *gm = NULL;
+ struct gss_api_mech *gm = NULL, *pos;

spin_lock(&registered_mechs_lock);
list_for_each_entry(pos, &registered_mechs, gm_list) {
@@ -213,6 +223,20 @@ gss_mech_get_by_pseudoflavor(u32 pseudoflavor)
return gm;
}

+struct gss_api_mech *
+gss_mech_get_by_pseudoflavor(u32 pseudoflavor)
+{
+ struct gss_api_mech *gm;
+
+ gm = _gss_mech_get_by_pseudoflavor(pseudoflavor);
+
+ if (!gm) {
+ request_module("rpc-auth-gss-%u", pseudoflavor);
+ gm = _gss_mech_get_by_pseudoflavor(pseudoflavor);
+ }
+ return gm;
+}
+
EXPORT_SYMBOL_GPL(gss_mech_get_by_pseudoflavor);

int gss_mech_list_pseudoflavors(rpc_authflavor_t *array_ptr)


2011-06-23 15:59:48

by J. Bruce Fields

[permalink] [raw]
Subject: Re: autoload rpcsec_gss_krb5

By the way:

On Wed, Jun 22, 2011 at 05:32:09PM -0400, J. Bruce Fields wrote:
> diff --git a/net/sunrpc/auth_gss/gss_krb5_mech.c b/net/sunrpc/auth_gss/gss_krb5_mech.c
> index 0a9a2ec..5c33926 100644
> --- a/net/sunrpc/auth_gss/gss_krb5_mech.c
> +++ b/net/sunrpc/auth_gss/gss_krb5_mech.c
> @@ -743,6 +743,13 @@ static struct pf_desc gss_kerberos_pfs[] = {
> },
> };
>
> +MODULE_ALIAS("rpc-auth-gss-krb5");
> +MODULE_ALIAS("rpc-auth-gss-krb5i");
> +MODULE_ALIAS("rpc-auth-gss-krb5p");
> +MODULE_ALIAS("rpc-auth-gss-390003");
> +MODULE_ALIAS("rpc-auth-gss-390004");
> +MODULE_ALIAS("rpc-auth-gss-390005");

Is there any reason we don't do this for the auth modules, and the pnfs
layout modules? Seems silly to wait for distro's to add it to
modprobe.conf if we don't need to.

--b.

2011-06-24 14:42:36

by J. Bruce Fields

[permalink] [raw]
Subject: Re: autoload rpcsec_gss_krb5

On Fri, Jun 24, 2011 at 10:34:30AM -0400, Trond Myklebust wrote:
> On Fri, 2011-06-24 at 10:01 -0400, J. Bruce Fields wrote:
> > On Thu, Jun 23, 2011 at 07:22:34PM -0700, Boaz Harrosh wrote:
> > > On 06/23/2011 01:30 PM, J. Bruce Fields wrote:
> > > > On Thu, Jun 23, 2011 at 04:11:17PM -0400, J. Bruce Fields wrote:
> > > >> On Thu, Jun 23, 2011 at 10:06:14PM +0200, Tigran Mkrtchyan wrote:
> > > >>> I recall a discussion at connectaton 2010, where Peter Staubach from
> > > >>> RedHat ( at that time )
> > > >>> requested a way to disable pNFS without rebuilding the kernel.
> > > >>>
> > > >>> Probably that's why autoload is not implemented.
> > > >>
> > > >> Well, autoload *is* implemented, you just have to add an alias command
> > > >> to modprobe.conf before it'll work.
> > > >>
> > > >> And if we embed the alias in the module instead, it will still be
> > > >> possible to disable autloading by adding a "backlist <modulename>" to
> > > >> modproble.conf.
> > > >>
> > > >> So I don't *think* that's the issue, unless I've missed something.
> > > >
> > > > So can we just do this? (Untested.)
> > > >
> > > > --b.
> > > >
> > > > commit 8b3065071b5469c428d70052c80f1df3cb398da6
> > > > Author: J. Bruce Fields <[email protected]>
> > > > Date: Thu Jun 23 16:15:39 2011 -0400
> > > >
> > > > pnfs: simplify pnfs files module autoloading
> > > >
> > > > Embed the necessary alias into the module rather than waiting for
> > > > someone to add it to /etc/modprobe.conf
> > > >
> > > > Signed-off-by: J. Bruce Fields <[email protected]>
> > > >
> > > > diff --git a/fs/nfs/nfs4filelayout.c b/fs/nfs/nfs4filelayout.c
> > > > index 4269088..eb65f82 100644
> > > > --- a/fs/nfs/nfs4filelayout.c
> > > > +++ b/fs/nfs/nfs4filelayout.c
> > > > @@ -896,5 +896,7 @@ static void __exit nfs4filelayout_exit(void)
> > > > pnfs_unregister_layoutdriver(&filelayout_type);
> > > > }
> > > >
> > > > +MODULE_ALIAS("nfs-layouttype4-1");
> > > > +
> > > > module_init(nfs4filelayout_init);
> > > > module_exit(nfs4filelayout_exit);
> > > diff --git a/fs/nfs/objlayout/objio_osd.c b/fs/nfs/objlayout/objio_osd.c
> > > index 70272d5..dd6a453 100644
> > > --- a/fs/nfs/objlayout/objio_osd.c
> > > +++ b/fs/nfs/objlayout/objio_osd.c
> > > @@ -1065,5 +1065,7 @@ objlayout_exit(void)
> > > __func__);
> > > }
> > >
> > > +MODULE_ALIAS("nfs-layouttype4-2");
> > > +
> > > module_init(objlayout_init);
> > > module_exit(objlayout_exit);
> > > ---
> > >
> > > nfs-layouttype4-1
> > > nfs-layouttype4-2
> > > ...
> > >
> > > Can we use a name here or it must be the number?
> >
> > Looks like it needs a number; see the request_module() call in
> > set_pnfs_layoutdriver:
> >
> > request_module("%s-%u", LAYOUT_NFSV4_1_MODULE_PREFIX, id);
>
> The title of the thread is "autoload rpcsec_gss_krb5", but the above
> patch only deals with layouts.
>
> Now I'm all confused...

Topic drift, sorry; original patch, which I'll commit to my tree absent
objections:

http://marc.info/?l=linux-nfs&m=130877833918632&w=2

--b.

2011-06-23 20:06:16

by Mkrtchyan, Tigran

[permalink] [raw]
Subject: Re: autoload rpcsec_gss_krb5

On Thu, Jun 23, 2011 at 5:59 PM, J. Bruce Fields <[email protected]> wrote:
> By the way:
>
> On Wed, Jun 22, 2011 at 05:32:09PM -0400, J. Bruce Fields wrote:
>> diff --git a/net/sunrpc/auth_gss/gss_krb5_mech.c b/net/sunrpc/auth_gss/gss_krb5_mech.c
>> index 0a9a2ec..5c33926 100644
>> --- a/net/sunrpc/auth_gss/gss_krb5_mech.c
>> +++ b/net/sunrpc/auth_gss/gss_krb5_mech.c
>> @@ -743,6 +743,13 @@ static struct pf_desc gss_kerberos_pfs[] = {
>>       },
>>  };
>>
>> +MODULE_ALIAS("rpc-auth-gss-krb5");
>> +MODULE_ALIAS("rpc-auth-gss-krb5i");
>> +MODULE_ALIAS("rpc-auth-gss-krb5p");
>> +MODULE_ALIAS("rpc-auth-gss-390003");
>> +MODULE_ALIAS("rpc-auth-gss-390004");
>> +MODULE_ALIAS("rpc-auth-gss-390005");
>
> Is there any reason we don't do this for the auth modules, and the pnfs
> layout modules?  Seems silly to wait for distro's to add it to
> modprobe.conf if we don't need to.
>

I recall a discussion at connectaton 2010, where Peter Staubach from
RedHat ( at that time )
requested a way to disable pNFS without rebuilding the kernel.

Probably that's why autoload is not implemented.

Regards,
Tigran.

> --b.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> the body of a message to [email protected]
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

2011-06-24 14:01:10

by J. Bruce Fields

[permalink] [raw]
Subject: Re: autoload rpcsec_gss_krb5

On Thu, Jun 23, 2011 at 07:22:34PM -0700, Boaz Harrosh wrote:
> On 06/23/2011 01:30 PM, J. Bruce Fields wrote:
> > On Thu, Jun 23, 2011 at 04:11:17PM -0400, J. Bruce Fields wrote:
> >> On Thu, Jun 23, 2011 at 10:06:14PM +0200, Tigran Mkrtchyan wrote:
> >>> I recall a discussion at connectaton 2010, where Peter Staubach from
> >>> RedHat ( at that time )
> >>> requested a way to disable pNFS without rebuilding the kernel.
> >>>
> >>> Probably that's why autoload is not implemented.
> >>
> >> Well, autoload *is* implemented, you just have to add an alias command
> >> to modprobe.conf before it'll work.
> >>
> >> And if we embed the alias in the module instead, it will still be
> >> possible to disable autloading by adding a "backlist <modulename>" to
> >> modproble.conf.
> >>
> >> So I don't *think* that's the issue, unless I've missed something.
> >
> > So can we just do this? (Untested.)
> >
> > --b.
> >
> > commit 8b3065071b5469c428d70052c80f1df3cb398da6
> > Author: J. Bruce Fields <[email protected]>
> > Date: Thu Jun 23 16:15:39 2011 -0400
> >
> > pnfs: simplify pnfs files module autoloading
> >
> > Embed the necessary alias into the module rather than waiting for
> > someone to add it to /etc/modprobe.conf
> >
> > Signed-off-by: J. Bruce Fields <[email protected]>
> >
> > diff --git a/fs/nfs/nfs4filelayout.c b/fs/nfs/nfs4filelayout.c
> > index 4269088..eb65f82 100644
> > --- a/fs/nfs/nfs4filelayout.c
> > +++ b/fs/nfs/nfs4filelayout.c
> > @@ -896,5 +896,7 @@ static void __exit nfs4filelayout_exit(void)
> > pnfs_unregister_layoutdriver(&filelayout_type);
> > }
> >
> > +MODULE_ALIAS("nfs-layouttype4-1");
> > +
> > module_init(nfs4filelayout_init);
> > module_exit(nfs4filelayout_exit);
> diff --git a/fs/nfs/objlayout/objio_osd.c b/fs/nfs/objlayout/objio_osd.c
> index 70272d5..dd6a453 100644
> --- a/fs/nfs/objlayout/objio_osd.c
> +++ b/fs/nfs/objlayout/objio_osd.c
> @@ -1065,5 +1065,7 @@ objlayout_exit(void)
> __func__);
> }
>
> +MODULE_ALIAS("nfs-layouttype4-2");
> +
> module_init(objlayout_init);
> module_exit(objlayout_exit);
> ---
>
> nfs-layouttype4-1
> nfs-layouttype4-2
> ...
>
> Can we use a name here or it must be the number?

Looks like it needs a number; see the request_module() call in
set_pnfs_layoutdriver:

request_module("%s-%u", LAYOUT_NFSV4_1_MODULE_PREFIX, id);

--b.

2011-06-24 14:34:32

by Myklebust, Trond

[permalink] [raw]
Subject: Re: autoload rpcsec_gss_krb5

On Fri, 2011-06-24 at 10:01 -0400, J. Bruce Fields wrote:
> On Thu, Jun 23, 2011 at 07:22:34PM -0700, Boaz Harrosh wrote:
> > On 06/23/2011 01:30 PM, J. Bruce Fields wrote:
> > > On Thu, Jun 23, 2011 at 04:11:17PM -0400, J. Bruce Fields wrote:
> > >> On Thu, Jun 23, 2011 at 10:06:14PM +0200, Tigran Mkrtchyan wrote:
> > >>> I recall a discussion at connectaton 2010, where Peter Staubach from
> > >>> RedHat ( at that time )
> > >>> requested a way to disable pNFS without rebuilding the kernel.
> > >>>
> > >>> Probably that's why autoload is not implemented.
> > >>
> > >> Well, autoload *is* implemented, you just have to add an alias command
> > >> to modprobe.conf before it'll work.
> > >>
> > >> And if we embed the alias in the module instead, it will still be
> > >> possible to disable autloading by adding a "backlist <modulename>" to
> > >> modproble.conf.
> > >>
> > >> So I don't *think* that's the issue, unless I've missed something.
> > >
> > > So can we just do this? (Untested.)
> > >
> > > --b.
> > >
> > > commit 8b3065071b5469c428d70052c80f1df3cb398da6
> > > Author: J. Bruce Fields <[email protected]>
> > > Date: Thu Jun 23 16:15:39 2011 -0400
> > >
> > > pnfs: simplify pnfs files module autoloading
> > >
> > > Embed the necessary alias into the module rather than waiting for
> > > someone to add it to /etc/modprobe.conf
> > >
> > > Signed-off-by: J. Bruce Fields <[email protected]>
> > >
> > > diff --git a/fs/nfs/nfs4filelayout.c b/fs/nfs/nfs4filelayout.c
> > > index 4269088..eb65f82 100644
> > > --- a/fs/nfs/nfs4filelayout.c
> > > +++ b/fs/nfs/nfs4filelayout.c
> > > @@ -896,5 +896,7 @@ static void __exit nfs4filelayout_exit(void)
> > > pnfs_unregister_layoutdriver(&filelayout_type);
> > > }
> > >
> > > +MODULE_ALIAS("nfs-layouttype4-1");
> > > +
> > > module_init(nfs4filelayout_init);
> > > module_exit(nfs4filelayout_exit);
> > diff --git a/fs/nfs/objlayout/objio_osd.c b/fs/nfs/objlayout/objio_osd.c
> > index 70272d5..dd6a453 100644
> > --- a/fs/nfs/objlayout/objio_osd.c
> > +++ b/fs/nfs/objlayout/objio_osd.c
> > @@ -1065,5 +1065,7 @@ objlayout_exit(void)
> > __func__);
> > }
> >
> > +MODULE_ALIAS("nfs-layouttype4-2");
> > +
> > module_init(objlayout_init);
> > module_exit(objlayout_exit);
> > ---
> >
> > nfs-layouttype4-1
> > nfs-layouttype4-2
> > ...
> >
> > Can we use a name here or it must be the number?
>
> Looks like it needs a number; see the request_module() call in
> set_pnfs_layoutdriver:
>
> request_module("%s-%u", LAYOUT_NFSV4_1_MODULE_PREFIX, id);

The title of the thread is "autoload rpcsec_gss_krb5", but the above
patch only deals with layouts.

Now I'm all confused...

--
Trond Myklebust
Linux NFS client maintainer

NetApp
[email protected]
http://www.netapp.com


2011-06-23 20:30:15

by J. Bruce Fields

[permalink] [raw]
Subject: Re: autoload rpcsec_gss_krb5

On Thu, Jun 23, 2011 at 04:11:17PM -0400, J. Bruce Fields wrote:
> On Thu, Jun 23, 2011 at 10:06:14PM +0200, Tigran Mkrtchyan wrote:
> > I recall a discussion at connectaton 2010, where Peter Staubach from
> > RedHat ( at that time )
> > requested a way to disable pNFS without rebuilding the kernel.
> >
> > Probably that's why autoload is not implemented.
>
> Well, autoload *is* implemented, you just have to add an alias command
> to modprobe.conf before it'll work.
>
> And if we embed the alias in the module instead, it will still be
> possible to disable autloading by adding a "backlist <modulename>" to
> modproble.conf.
>
> So I don't *think* that's the issue, unless I've missed something.

So can we just do this? (Untested.)

--b.

commit 8b3065071b5469c428d70052c80f1df3cb398da6
Author: J. Bruce Fields <[email protected]>
Date: Thu Jun 23 16:15:39 2011 -0400

pnfs: simplify pnfs files module autoloading

Embed the necessary alias into the module rather than waiting for
someone to add it to /etc/modprobe.conf

Signed-off-by: J. Bruce Fields <[email protected]>

diff --git a/fs/nfs/nfs4filelayout.c b/fs/nfs/nfs4filelayout.c
index 4269088..eb65f82 100644
--- a/fs/nfs/nfs4filelayout.c
+++ b/fs/nfs/nfs4filelayout.c
@@ -896,5 +896,7 @@ static void __exit nfs4filelayout_exit(void)
pnfs_unregister_layoutdriver(&filelayout_type);
}

+MODULE_ALIAS("nfs-layouttype4-1");
+
module_init(nfs4filelayout_init);
module_exit(nfs4filelayout_exit);

2011-06-23 20:11:19

by J. Bruce Fields

[permalink] [raw]
Subject: Re: autoload rpcsec_gss_krb5

On Thu, Jun 23, 2011 at 10:06:14PM +0200, Tigran Mkrtchyan wrote:
> On Thu, Jun 23, 2011 at 5:59 PM, J. Bruce Fields <[email protected]> wrote:
> > By the way:
> >
> > On Wed, Jun 22, 2011 at 05:32:09PM -0400, J. Bruce Fields wrote:
> >> diff --git a/net/sunrpc/auth_gss/gss_krb5_mech.c b/net/sunrpc/auth_gss/gss_krb5_mech.c
> >> index 0a9a2ec..5c33926 100644
> >> --- a/net/sunrpc/auth_gss/gss_krb5_mech.c
> >> +++ b/net/sunrpc/auth_gss/gss_krb5_mech.c
> >> @@ -743,6 +743,13 @@ static struct pf_desc gss_kerberos_pfs[] = {
> >>       },
> >>  };
> >>
> >> +MODULE_ALIAS("rpc-auth-gss-krb5");
> >> +MODULE_ALIAS("rpc-auth-gss-krb5i");
> >> +MODULE_ALIAS("rpc-auth-gss-krb5p");
> >> +MODULE_ALIAS("rpc-auth-gss-390003");
> >> +MODULE_ALIAS("rpc-auth-gss-390004");
> >> +MODULE_ALIAS("rpc-auth-gss-390005");
> >
> > Is there any reason we don't do this for the auth modules, and the pnfs
> > layout modules?  Seems silly to wait for distro's to add it to
> > modprobe.conf if we don't need to.
> >
>
> I recall a discussion at connectaton 2010, where Peter Staubach from
> RedHat ( at that time )
> requested a way to disable pNFS without rebuilding the kernel.
>
> Probably that's why autoload is not implemented.

Well, autoload *is* implemented, you just have to add an alias command
to modprobe.conf before it'll work.

And if we embed the alias in the module instead, it will still be
possible to disable autloading by adding a "backlist <modulename>" to
modproble.conf.

So I don't *think* that's the issue, unless I've missed something.

--b.

2011-06-24 02:22:55

by Boaz Harrosh

[permalink] [raw]
Subject: Re: autoload rpcsec_gss_krb5

On 06/23/2011 01:30 PM, J. Bruce Fields wrote:
> On Thu, Jun 23, 2011 at 04:11:17PM -0400, J. Bruce Fields wrote:
>> On Thu, Jun 23, 2011 at 10:06:14PM +0200, Tigran Mkrtchyan wrote:
>>> I recall a discussion at connectaton 2010, where Peter Staubach from
>>> RedHat ( at that time )
>>> requested a way to disable pNFS without rebuilding the kernel.
>>>
>>> Probably that's why autoload is not implemented.
>>
>> Well, autoload *is* implemented, you just have to add an alias command
>> to modprobe.conf before it'll work.
>>
>> And if we embed the alias in the module instead, it will still be
>> possible to disable autloading by adding a "backlist <modulename>" to
>> modproble.conf.
>>
>> So I don't *think* that's the issue, unless I've missed something.
>
> So can we just do this? (Untested.)
>
> --b.
>
> commit 8b3065071b5469c428d70052c80f1df3cb398da6
> Author: J. Bruce Fields <[email protected]>
> Date: Thu Jun 23 16:15:39 2011 -0400
>
> pnfs: simplify pnfs files module autoloading
>
> Embed the necessary alias into the module rather than waiting for
> someone to add it to /etc/modprobe.conf
>
> Signed-off-by: J. Bruce Fields <[email protected]>
>
> diff --git a/fs/nfs/nfs4filelayout.c b/fs/nfs/nfs4filelayout.c
> index 4269088..eb65f82 100644
> --- a/fs/nfs/nfs4filelayout.c
> +++ b/fs/nfs/nfs4filelayout.c
> @@ -896,5 +896,7 @@ static void __exit nfs4filelayout_exit(void)
> pnfs_unregister_layoutdriver(&filelayout_type);
> }
>
> +MODULE_ALIAS("nfs-layouttype4-1");
> +
> module_init(nfs4filelayout_init);
> module_exit(nfs4filelayout_exit);
diff --git a/fs/nfs/objlayout/objio_osd.c b/fs/nfs/objlayout/objio_osd.c
index 70272d5..dd6a453 100644
--- a/fs/nfs/objlayout/objio_osd.c
+++ b/fs/nfs/objlayout/objio_osd.c
@@ -1065,5 +1065,7 @@ objlayout_exit(void)
__func__);
}

+MODULE_ALIAS("nfs-layouttype4-2");
+
module_init(objlayout_init);
module_exit(objlayout_exit);
---

nfs-layouttype4-1
nfs-layouttype4-2
...

Can we use a name here or it must be the number?

Thanks
Boaz

> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html