On Saturday, May 27, 2017 05:00:30 PM Konstantin Belousov wrote:
> Author: kib
> Date: Sat May 27 17:00:30 2017
> New Revision: 318997
> URL: https://svnweb.freebsd.org/changeset/base/318997
> 
> Log:
>   Use whole mnt_stat.f_fsid bits for st_dev.
>   
>   Since ino64 expanded dev_t to 64bit, make VOP_GETATTR(9) provide all
>   bits of mnt_stat.f_fsid as va_fsid for vnodes on filesystems which use
>   f_fsid.  In particular, NFSv3 and sometimes NFSv4, and ZFS use this
>   method or reporting st_dev by stat(2).
>   
>   Provide a new helper vn_fsid() to avoid duplicating code to copy
>   f_fsid to va_fsid.
>   
>   Note that the change is mostly cosmetic.  Its motivation is to avoid
>   sign-extension of f_fsid[0] into 64bit dev_t value which happens after
>   dev_t becomes 64bit..
>   
>   Reviewed by:        avg(zfs), rmacklem (nfs) (both for previous version)
>   Sponsored by:       The FreeBSD Foundation
> 
> Modified:
>   head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c
>   head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
>   head/sys/fs/nfsclient/nfs_clport.c
>   head/sys/kern/vfs_vnops.c
>   head/sys/sys/vnode.h
> 
> Modified: head/sys/fs/nfsclient/nfs_clport.c
> ==============================================================================
> --- head/sys/fs/nfsclient/nfs_clport.c        Sat May 27 16:53:39 2017        
> (r318996)
> +++ head/sys/fs/nfsclient/nfs_clport.c        Sat May 27 17:00:30 2017        
> (r318997)
> @@ -490,14 +490,13 @@ nfscl_loadattrcache(struct vnode **vpp, 
>                * from the value used for the top level server volume
>                * in the mounted subtree.
>                */
> -             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()?

-- 
John Baldwin
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to