Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 30 May 2017 20:19:04 +0300
From:      Konstantin Belousov <kostikbel@gmail.com>
To:        John Baldwin <jhb@freebsd.org>
Cc:        Rick Macklem <rmacklem@uoguelph.ca>, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r318997 - in head/sys: cddl/contrib/opensolaris/uts/common/fs/zfs fs/nfsclient kern sys
Message-ID:  <20170530171904.GL82323@kib.kiev.ua>
In-Reply-To: <2187407.D9lHvpEUce@ralph.baldwin.cx>
References:  <201705271700.v4RH0USD004310@repo.freebsd.org> <2187407.D9lHvpEUce@ralph.baldwin.cx>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, May 28, 2017 at 06:48:38AM -0700, John Baldwin wrote:
> On Saturday, May 27, 2017 05:00:30 PM Konstantin Belousov wrote:
> >  		 */
> > -		if (vp->v_mount->mnt_stat.f_fsid.val[0] !=
> > -		    (uint32_t)np->n_vattr.na_filesid[0])
> > -			vap->va_fsid = (uint32_t)np->n_vattr.na_filesid[0];
> > -		else
> > -			vap->va_fsid = (uint32_t)hash32_buf(
> > +		vn_fsid(vp, vap);
> > +		vap->va_fsid = np->n_vattr.na_filesid[0];
> > +		if (vap->va_fsid == np->n_vattr.na_filesid[0])
> > +			vap->va_fsid = hash32_buf(
> >  			    np->n_vattr.na_filesid, 2 * sizeof(uint64_t), 0);
> 
> Won't this always be true now since you've done 'a = b; if (a == b) ...'?
> Also, does the assignment to 'va_fsid' before the 'if' overwrite the work
> of vn_fsid()?

Thank you.
Indeed, the asignment should have been removed.  Below is the proposed
correction.

diff --git a/sys/fs/nfsclient/nfs_clport.c b/sys/fs/nfsclient/nfs_clport.c
index 509c38b8614..44c0eae0179 100644
--- a/sys/fs/nfsclient/nfs_clport.c
+++ b/sys/fs/nfsclient/nfs_clport.c
@@ -491,8 +491,7 @@ nfscl_loadattrcache(struct vnode **vpp, struct nfsvattr *nap, void *nvaper,
 		 * in the mounted subtree.
 		 */
 		vn_fsid(vp, vap);
-		vap->va_fsid = np->n_vattr.na_filesid[0];
-		if (vap->va_fsid == np->n_vattr.na_filesid[0])
+		if ((uint32_t)vap->va_fsid == np->n_vattr.na_filesid[0])
 			vap->va_fsid = hash32_buf(
 			    np->n_vattr.na_filesid, 2 * sizeof(uint64_t), 0);
 	} else



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20170530171904.GL82323>