From: Colin Ian King <colin.king@canonical.com>
To: "J. Bruce Fields" <bfields@fieldses.org>
Cc: Chuck Lever <chuck.lever@oracle.com>,
"linux-nfs@vger.kernel.org" <linux-nfs@vger.kernel.org>
Subject: Re: nfsd: skip some unnecessary stats in the v4 case
Date: Wed, 25 Nov 2020 16:51:01 +0000 [thread overview]
Message-ID: <5a0b9908-9942-ddca-63f6-a87bb9867855@canonical.com> (raw)
In-Reply-To: <20201125164738.GA7049@fieldses.org>
On 25/11/2020 16:47, J. Bruce Fields wrote:
> On Wed, Nov 25, 2020 at 02:50:51PM +0000, Colin Ian King wrote:
>> Static analysis on today's linux-next has found an issue with the
>> following commit:
>
> Thanks! I'll probably do something like this.
Looks good to me, even if it is a little more convoluted. Thanks.
>
> Though this still all seems slightly more complicated than necessary.
>
> --b.
>
> diff --git a/fs/nfsd/nfs3xdr.c b/fs/nfsd/nfs3xdr.c
> index 8502a493be6d..7eb761801169 100644
> --- a/fs/nfsd/nfs3xdr.c
> +++ b/fs/nfsd/nfs3xdr.c
> @@ -260,13 +260,12 @@ void fill_pre_wcc(struct svc_fh *fhp)
> struct inode *inode;
> struct kstat stat;
> bool v4 = (fhp->fh_maxsize == NFS4_FHSIZE);
> - __be32 err;
>
> if (fhp->fh_pre_saved)
> return;
> inode = d_inode(fhp->fh_dentry);
> if (!v4 || !inode->i_sb->s_export_op->fetch_iversion) {
> - err = fh_getattr(fhp, &stat);
> + __be32 err = fh_getattr(fhp, &stat);
> if (err) {
> /* Grab the times from inode anyway */
> stat.mtime = inode->i_mtime;
> @@ -290,23 +289,23 @@ void fill_post_wcc(struct svc_fh *fhp)
> {
> bool v4 = (fhp->fh_maxsize == NFS4_FHSIZE);
> struct inode *inode = d_inode(fhp->fh_dentry);
> - __be32 err;
>
> if (fhp->fh_post_saved)
> printk("nfsd: inode locked twice during operation.\n");
>
> + fhp->fh_post_saved = true;
>
> - if (!v4 || !inode->i_sb->s_export_op->fetch_iversion)
> - err = fh_getattr(fhp, &fhp->fh_post_attr);
> + if (!v4 || !inode->i_sb->s_export_op->fetch_iversion) {
> + __be32 err = fh_getattr(fhp, &fhp->fh_post_attr);
> + if (err) {
> + fhp->fh_post_saved = false;
> + /* set_change_info might still need this: */
> + fhp->fh_post_attr.ctime = inode->i_ctime;
> + }
> + }
> if (v4)
> fhp->fh_post_change =
> nfsd4_change_attribute(&fhp->fh_post_attr, inode);
> - if (err) {
> - fhp->fh_post_saved = false;
> - /* Grab the ctime anyway - set_change_info might use it */
> - fhp->fh_post_attr.ctime = inode->i_ctime;
> - } else
> - fhp->fh_post_saved = true;
> }
>
> /*
>
prev parent reply other threads:[~2020-11-25 16:51 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-25 14:50 nfsd: skip some unnecessary stats in the v4 case Colin Ian King
2020-11-25 16:47 ` J. Bruce Fields
2020-11-25 16:51 ` Colin Ian King [this message]
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=5a0b9908-9942-ddca-63f6-a87bb9867855@canonical.com \
--to=colin.king@canonical.com \
--cc=bfields@fieldses.org \
--cc=chuck.lever@oracle.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