From: Steve Dickson <SteveD@redhat.com>
To: Jan Sanislo <oystr@cs.washington.edu>
Cc: linux-nfs@vger.kernel.org
Subject: Re: nfsidmap and NFS key timeouts and quotas
Date: Mon, 22 Oct 2012 07:48:57 -0400 [thread overview]
Message-ID: <508532A9.1040703@RedHat.com> (raw)
In-Reply-To: <1350679987/oystr@maui.cs.washington.edu>
On 19/10/12 16:53, Jan Sanislo wrote:
> The man page for nfsidmap says that it will set a default timeout
> of 600 seconds on keys requested by the NFS client. But the
> keys instantiated are listed a permanent in /proc/keys and it's
> easily possible to run out of key quota in an NFS environment with
> 100s/1000s of uids/gids.
>
> Nfsidmap's call to keyctl_set_timeout fails with a permission
> error because the call is made *after* the key is instantiated
> and permission to modify the key attributes has been revoked as
> a result. The following patch seems to be more effective in
> actually setting the key timeout:
>
> ====================================
>
> --- nfsidmap.c_orig 2012-10-19 11:32:29.806374240 -0700
> +++ nfsidmap.c 2012-10-19 11:40:06.334674363 -0700
> @@ -320,6 +320,16 @@
> key, type, value, timeout);
> }
>
> + /*
> + * Set timeout before instantiation revokes our rights
> + * over the key.
> + */
> + if ( timeout > 0 ) {
> + rc = keyctl_set_timeout(key, timeout);
> + if ( rc != 0 )
> + xlog_warn("keyctl_set_timeout key 0x%x failed: %m",key);
> + }
> +
> if (strcmp(type, "uid") == 0)
> rc = id_lookup(value, key, USER);
> else if (strcmp(type, "gid") == 0)
> @@ -329,10 +339,6 @@
> else if (strcmp(type, "group") == 0)
> rc = name_lookup(value, key, GROUP);
>
> - /* Set timeout to 10 (600 seconds) minutes */
> - if (rc == 0)
> - keyctl_set_timeout(key, timeout);
> -
> free(arg);
> return rc;
> }
>
> ====================================
Is this a proposed patch? If so, could you please add he proper
Signed-off-by lines? The main reason I ask is I'm looking to
do a nfs-utils release in the near future...
steved.
>
> Also, it appears that the check for EDQUOT/ENFILE/ENOMEM after the
> keyctl_instantiate call is ineffective. Those errors seem to be
> handled within the kernel a key_alloc time -- if one of them occurs
> an upcall to nfsidmap is not made.
>
> Finally, the key LRU discard patch: http://lkml.org/lkml/2012/3/28/144
> looks promising for managing key quotas. But it only seems to be
> invoked when a key is linked into a destination keyring. fs/nfs/idmap.c
> uses a call to security/keys/request_key which by default provides an
> NULL dest_keyring. Might consider changing the request_key call in nfs/idmap.c
> to request_key_and_link (although I don't pretend to know all the
> implications of making such a change).
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
next prev parent reply other threads:[~2012-10-22 11:49 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-19 20:53 nfsidmap and NFS key timeouts and quotas Jan Sanislo
2012-10-20 13:46 ` Jeff Layton
2012-10-22 11:48 ` Steve Dickson [this message]
-- strict thread matches above, loose matches on Subject: below --
2012-10-21 20:15 Jan Sanislo
2012-10-22 10:52 ` Jeff Layton
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=508532A9.1040703@RedHat.com \
--to=steved@redhat.com \
--cc=linux-nfs@vger.kernel.org \
--cc=oystr@cs.washington.edu \
/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 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.