From: "J. Bruce Fields" <bfields@fieldses.org>
To: Krishna Kumar <krikku@gmail.com>
Cc: Krishna Kumar <krkumar2@in.ibm.com>,
jlayton@redhat.com, linux-nfs@vger.kernel.org
Subject: Re: [PATCH 3/11] nfsd: CHANGE old function calls to new calls
Date: Wed, 22 Apr 2009 16:05:53 -0400 [thread overview]
Message-ID: <20090422200553.GH9541@fieldses.org> (raw)
In-Reply-To: <20090325133707.16437.66360.sendpatchset-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
On Wed, Mar 25, 2009 at 07:07:07PM +0530, Krishna Kumar wrote:
> @@ -1337,12 +1321,30 @@ nfsd_read(struct svc_rqst *rqstp, struct
> goto out;
> err = nfsd_vfs_read(rqstp, fhp, file, offset, vec, vlen, count);
> } else {
> - err = nfsd_open(rqstp, fhp, S_IFREG, NFSD_MAY_READ, &file);
> - if (err)
> - goto out;
> - err = nfsd_vfs_read(rqstp, fhp, file, offset, vec, vlen, count);
> - nfsd_close(file);
> + struct fhcache *fh;
> +
> + /* Check if this fh is cached */
> + fh = nfsd_get_fhcache(fhp->fh_handle.fh_auth[3]);
How do you know fh_auth[3] is sufficient to identify the file reliably?
This looks very fragile to me.
If the goal is to bypass rqst_exp_find(), exportfs_decode_fh() and
friends--that makes me nervous. We should figure out how to make those
lookups faster instead. Or at the very least, make sure we're keying on
the entire filehandle instead of just part of it.
--b.
> + if (fh && fh->p_filp) {
> + /* Got cached values */
> + file = fh->p_filp;
> + fhp->fh_dentry = file->f_dentry;
> + fhp->fh_export = fh->p_exp;
> + err = fh_verify(rqstp, fhp, S_IFREG, NFSD_MAY_READ);
> + } else {
> + /* Nothing in cache */
> + err = nfsd_open(rqstp, fhp, S_IFREG, NFSD_MAY_READ,
> + &file);
> + }
> +
> + if (!err)
> + err = nfsd_vfs_read(rqstp, fhp, file, offset, vec, vlen,
> + count);
> +
> + /* Update cached values if required, and clean up */
> + fh_cache_upd(fh, file, fhp->fh_export);
> }
> +
> out:
> return err;
> }
next prev parent reply other threads:[~2009-04-22 20:05 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20090325133607.16437.33288.sendpatchset@localhost.localdomain>
[not found] ` <20090325133628.16437.11092.sendpatchset@localhost.localdomain>
[not found] ` <20090325133628.16437.11092.sendpatchset-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2009-04-21 22:48 ` [PATCH 1/11] nfsd: ADD data structure infrastructure J. Bruce Fields
2009-04-22 5:36 ` Krishna Kumar2
2009-04-22 19:43 ` J. Bruce Fields
2009-04-21 23:05 ` J. Bruce Fields
[not found] ` <20090325133607.16437.33288.sendpatchset-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2009-04-17 18:46 ` [PATCH 0/11] nfsd: Summary of "Improve NFS server performance" J. Bruce Fields
2009-04-17 19:30 ` Krishna Kumar2
2009-04-21 22:57 ` J. Bruce Fields
2009-04-22 5:35 ` Krishna Kumar2
2009-04-22 19:41 ` J. Bruce Fields
[not found] ` <20090325133647.16437.59567.sendpatchset@localhost.localdomain>
[not found] ` <20090325133647.16437.59567.sendpatchset-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2009-04-22 2:54 ` [PATCH 2/11] nfsd: ADD new function infrastructure J. Bruce Fields
2009-04-22 5:37 ` Krishna Kumar2
[not found] ` <20090325133707.16437.66360.sendpatchset@localhost.localdomain>
[not found] ` <20090325133707.16437.66360.sendpatchset-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2009-04-22 20:05 ` J. Bruce Fields [this message]
2009-04-23 15:55 ` [PATCH 3/11] nfsd: CHANGE old function calls to new calls Krishna Kumar2
2009-04-23 22:39 ` J. Bruce Fields
2009-04-24 16:17 ` Krishna Kumar2
2009-04-24 16:23 ` J. Bruce Fields
2009-04-24 16:58 ` Krishna Kumar2
2009-04-24 19:25 ` J. Bruce Fields
2009-04-26 11:16 ` Krishna Kumar2
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=20090422200553.GH9541@fieldses.org \
--to=bfields@fieldses.org \
--cc=jlayton@redhat.com \
--cc=krikku@gmail.com \
--cc=krkumar2@in.ibm.com \
--cc=linux-nfs@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