> From the man page for stat(), I would expect to get
> the same values from stat()calls for the st_dev and
> st_ino fields regardless of which host runs a program
> containing a stat() call provided, of course, that
> the path argument refers to the same physical file.
> For example, my home directory points to the same
> physical drive from several hosts. In this case, the
> path name to a given text file is the same
> everywhere. When I run the attached program on 3
> different hosts, I get the same st_ino values but 3
> different st_dev values. In one case, the file is ufs
> mounted since that host is actually connected to the
> hard drive. In the other two, the file is nfs
> mounted.

actually despite all my former attempts to read the code differently, your 
observation
is correct, debugging this same scenario leads to the fact, yes Mark you were 
correct,
bo doubt !
that whats used on the NFS client is the dev_t for the NFS clients mounted file 
system
(and not the remote file systems device id)
ie. at rnode creation time we must stuff the NFS clients mount vfs_dev into
the rnodes attributes va_fsid (though I still have not found this place...).

if you have only 1 real NFS server hosting the file then the va_nodeid, ie. 
st_ino 
the inode number will be unique across all NFS clients and the local host as 
long
as the file lives under that name and has not been deleted or renamed and the 
inode
number got re-used on the server.


So indeed over NFS you get different dev_t then the local one.

client_A (onnv_98_amd) -> server_A (s10u5_sparc) NFSv4 / UFS

opteron.batschul./mnt/export/home/batschul.=> /site/sw/getinode act.0
inode = 1153, device = 53c00061

     opteron -> blade        NFS C 4 (open        ) PUTFH FH=5C4E OPEN act.0 
OT=NC SQ=6 CT=N AC=R DN=N OO=001B GETFH GETATTR 10011a b0a23a
       blade -> opteron      NFS R 4 (open        ) NFS4_OK PUTFH NFS4_OK OPEN 
NFS4_OK ST=1855:1 RF=CF,PL DT=R DST=1DD5:0 GETFH NFS4_OK FH=4A79 GETATTR NFS4_OK
     opteron -> blade        NFS C 4 (open_confirm) PUTFH FH=4A79 OPEN_CONFIRM 
SQ=7 OST=1855:1
       blade -> opteron      NFS R 4 (open_confirm) NFS4_OK PUTFH NFS4_OK 
OPEN_CONFIRM NFS4_OK OST=1855:2
     opteron -> blade        NFS C 4 (close       ) PUTFH FH=4A79 GETATTR 
10011a b0a23a CLOSE SQ=8 OST=1855:2
       blade -> opteron      NFS R 4 (close       ) NFS4_OK PUTFH NFS4_OK 
GETATTR NFS4_OK CLOSE OST=1855:3
     opteron -> blade        NFS C 4 (lookup valid) PUTFH FH=5C4E NVERIFY 
GETATTR 10011a b0a23a ACCESS rd,lk,mo,ext,dl LOOKUP act.0 GETFH GETATTR 100...
       blade -> opteron      NFS R 4 (lookup valid) NFS4_OK PUTFH NFS4_OK 
NVERIFY NFS4_OK GETATTR NFS4_OK ACCESS NFS4_OK Supp=rd,lk,mo,ext,dl 
Allow=rd,lk,mo,...
     opteron -> blade        TCP D=2049 S=1021 Ack=252701753 Seq=3958462686 
Len=0 Win=32806 Options=<nop,nop,tstamp 2946433 106390>

> ::dnlc !grep act.0
ffffff01b07f3a80 ffffff01af826b00 act.0
> ffffff01b07f3a80::print vnode_t
{
    v_lock = {
        _opaque = [ 0 ]
    }
    v_flag = 0
    v_count = 0x1
    v_data = 0xffffff01b305f7e0
    v_vfsp = 0xffffff01afaf6838
    v_path = 0xffffff01ae737988 "/mnt/export/home/batschul/act.0"
}
> 0xffffff01b305f7e0::print rnode4_t
{
    r_attr = {
        va_mask = 0xbfff
        va_type = 1 (VREG)
        va_mode = 0x1a4
        va_uid = 0xea61
        va_gid = 0xea61
        va_fsid = 0x14f00000006
        va_nodeid = 0x1153
        va_nlink = 0x1
        va_size = 0x534af
        va_atime = {
            tv_sec = 2008 May  9 04:31:16
            tv_nsec = 0x111e9d38
        }
        va_mtime = {
            tv_sec = 2007 Feb 16 16:17:43
            tv_nsec = 0
        }
        va_ctime = {
            tv_sec = 2008 May  2 04:03:50
            tv_nsec = 0x3a36c178
        }
        va_rdev = 0
        va_blksize = 0x2000
        va_nblocks = 0x2b0
        va_seq = 0
    }
    r_time_attr_saved = 0x1ad80a7bf097
    r_time_attr_inval = 0x1af6791897f5

    r_mntd_fid = 0x1153

> 0xffffff01afaf6838::print vfs_t  (nfs mount on the client)
{
    vfs_next = root
    vfs_prev = 0xffffff01afaf6908
    vfs_op = vfssw+0xd38
    vfs_vnodecovered = 0xffffff01af827080
    vfs_flag = 0x2400
    vfs_bsize = 0x8000
    vfs_fstype = 0x7
    vfs_fsid = {
        val = [ 0x53c0006, 0x1a ]
    }
    vfs_data = 0xffffff01b2d23000
    vfs_dev = 0x14f00000006 

=============================

local server_A (s10u5_sparc) UFS

blade.batschul./export/home/batschul.=> ./getinode act.0
inode = 1153, device = 1d800071

> ::dnlc!grep act.0
00000600140c8440 0000060013ffba40 act.0

> 00000600140c8440::print vnode_t
{
    v_lock = {
        _opaque = [ 0 ]
    }
    v_flag = 0x10000
    v_count = 0x2
    v_data = 0x600140cc478
    v_vfsp = 0x6001082c840
    v_path = 0x600117a8e60 "/export/home/batschul/act.0"
}

> 0x600140cc478::print inode_t
{
    i_dev = 0x7600000007

> 000006001082c840::print vfs_t
{
    vfs_next = 0x6001082d2c0
    vfs_prev = 0x6001082d200
    vfs_op = vfssw+0x138
    vfs_vnodecovered = 0x600121dbe00
    vfs_flag = 0x2420
    vfs_bsize = 0x2000
    vfs_fstype = 0x2
    vfs_fsid = {
        val = [ 0x1d80007, 0x2 ]
    }
    vfs_data = 0x600127e8040
    vfs_dev = 0x7600000007

=========================================

client_C (s10u4 sparc) -> server_A (s10u5 sparc) NFSv4 / UFS

kira.batschul./mnt/batschul.=> /export/home/batschul/getinode act.0
inode = 1153, device = 51c0003l

> 0000030003a9bb00::print vnode_t
{
    v_lock = {
        _opaque = [ 0 ]
    }
    v_flag = 0
    v_count = 0x1
    v_data = 0x30003aa4f08
    v_vfsp = 0x300000a7840
    v_path = 0x30002435da0 "/mnt/batschul/act.0"
}
> 0x300000a7840::print vfs_t
{
    vfs_next = root
    vfs_prev = 0x300000a7540
    vfs_op = vfssw+0xb38
    vfs_vnodecovered = 0x30003aad8c0
    vfs_flag = 0x2400
    vfs_bsize = 0x8000
    vfs_fstype = 0x7
    vfs_fsid = {
        val = [ 0x51c0003, 0x16 ]
    }
    vfs_data = 0x3000170a000
    vfs_dev = 0x14700000003

> 0x30003aa4f08::print rnode4_t
{
    r_attr = {
        va_mask = 0xbfff
        va_type = 1 (VREG)
        va_mode = 0x1a4
        va_uid = 0xbd3f
        va_gid = 0x1
        va_fsid = 0x14700000003
        va_nodeid = 0x1153
        va_nlink = 0x1
        va_size = 0x534af
        va_atime = {
            tv_sec = 2008 May  9 04:31:16
            tv_nsec = 0x111e9d38
        }
        va_mtime = {
            tv_sec = 2007 Feb 16 16:17:43
            tv_nsec = 0
        }
        va_ctime = {
            tv_sec = 2008 May  2 04:03:50
            tv_nsec = 0x3a36c178
        }
        va_rdev = 0
        va_blksize = 0x2000
        va_nblocks = 0x2b0
        va_seq = 0
    }
    r_time_attr_saved = 0x52e2c5e816
    r_time_attr_inval = 0x5395d27a30

    r_mntd_fid = 0x1153
--
This message posted from opensolaris.org

Reply via email to