mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Myklebust, Trond" <Trond.Myklebust@netapp.com>
To: "Joe Korty" <joe.korty@ccur.com>
Cc: "Linux Kernel" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] NFSv3: cached permissions subset enhancement
Date: Thu, 28 Aug 2008 09:03:47 -0700	[thread overview]
Message-ID: <2BBFD074-16C3-4640-8F3D-DF604F4146A7@netapp.com> (raw)
In-Reply-To: <20080827142820.GA22661@tsunami.ccur.com>

On Aug 27, 2008, at 7:28, "Joe Korty" <joe.korty@ccur.com> wrote:

> [NFSv3] cached permissions subset enhancement.
>
> NFSv3 allows file permissions to be cached on the client
> side.  The Linux client, when fetching these permissions,
> makes the request for all permissions (rwx) in a single
> operation.  However, for some NFSv3 server implementations
> (the only one currently known is PowerMAX OS), an incoming
> request for all rwx permissions in a single request,
> when all are not actually set in the file, returns an
> NFSERR_ACCES failure code to the client, rather than
> the subset of permissions actually available for that file.
>
> This patch modifies the Linux client side code to
> individually fetch the r, w, and x permissions (combining
> these for storage into the cache), if the original
> single-request method fails.
>
> This slower method will not affect performance of those
> client/server pairs for which the original single-request
> method works.  In particular there is no performance
> penalty for linux/linux NFSv3 connections.
>
> Author: Linda Dunaphant <ldunaphant@comcast.net>
> Signed-off-by: Joe Korty <joe.korty@ccur.com>
>
> Index: 2.6.27-rc4-git4/fs/nfs/dir.c
> ===================================================================
> --- 2.6.27-rc4-git4.orig/fs/nfs/dir.c    2008-08-26 17:44:34.000000000 -0400
> +++ 2.6.27-rc4-git4/fs/nfs/dir.c    2008-08-26 18:21:27.000000000  
> -0400
> @@ -1870,6 +1870,8 @@
> {
>    struct nfs_access_entry cache;
>    int status;
> +    int i;
> +    int cmask = 0;
>
>    status = nfs_access_get_cached(inode, cred, &cache);
>    if (status == 0)
> @@ -1880,8 +1882,27 @@
>    cache.cred = cred;
>    cache.jiffies = jiffies;
>    status = NFS_PROTO(inode)->access(inode, &cache);
> -    if (status != 0)
> +    if (status == -NFSERR_ACCES) {
> +        //
> +        // Try again - one mode at a time & combine at the end
> +        //
> +        for (i = 0; i <= MAY_READ; i++) {
> +            cache.mask = 1 << i;
> +            status = NFS_PROTO(inode)->access(inode, &cache);
> +            if (status == 0)
> +                cmask |= cache.mask;
> +            else if (status != -NFSERR_ACCES) {
> +                return status;
> +            }
> +        }
> +
> +        if (!cmask)
> +            return -NFSERR_ACCES;
> +
> +        cache.mask = cmask;
> +    } else if (status)
>        return status;
> +
>    nfs_access_add_cache(inode, &cache);
> out:
>    if ((mask & ~cache.mask & (MAY_READ | MAY_WRITE | MAY_EXEC)) == 0)

This isn't a good solution. The correct thing to do here is to resend  
the request for just those permissions that the VFS requested.

Cheers
   Trond

  reply	other threads:[~2008-08-28 16:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-27 14:28 Joe Korty
2008-08-28 16:03 ` Myklebust, Trond [this message]
2008-08-28 18:28   ` [PATCH] NFSv3: cached permissions subset enhancement, v2 Joe Korty
2008-08-28 20:57     ` Joe Korty
2008-08-28 22:00       ` Peter Staubach

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=2BBFD074-16C3-4640-8F3D-DF604F4146A7@netapp.com \
    --to=trond.myklebust@netapp.com \
    --cc=joe.korty@ccur.com \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®