Presentation is loading. Please wait.

Presentation is loading. Please wait.

4.3 Network File System (NFS)

Similar presentations


Presentation on theme: "4.3 Network File System (NFS)"— Presentation transcript:

1 4.3 Network File System (NFS)
2018/11/14

2 NFS architecture vnodes 2018/11/14

3 Vnode Data fields (struct vnode) Methods (struct vnodeops) inode/rnode
v_flag vfsp v_count v_type v_vfsmountedhere … v_data v_op FS-dependent implementation of vnodeops vop_open vop_lookup vop_read vop_mkdir vop_getaddr … FS-independent part 2018/11/14

4 vnode/vfs framework Client application System call interface vnode
nsf_vnodeops v_data v_ops r-node (contains file handle) RPC call NFS client code RPC client interface RPC reply 2018/11/14

5 NFS server implementation (ufs server)
vnode ufs_vnodeops v_data v_ops ufs-inode NFS server code ufs code RPC call RPC server interface RPC reply local disk 2018/11/14

6 FS ID inode # inode generation #
VFS layer FS ID inode # inode generation # 2018/11/14

7 Server interface (text Fig. 8.9)
lookup(dirfh, path-name)  fh, attr attr= mode (e.g., read-only), user_id, group_id, size, access time, file system ID, etc. create(dirfh, name, attr)  fh, attr Argument and return attr are different sets remove(dirfh, name)  status read(fh, offset, count)  attr, data write(fh, offset, count, data)  attr rename(dirfh, name, 2dirfh, 2name)  status setattr(fh, attr)  attr New in V4 2018/11/14

8 NFS daemons Client Server write( ) User User Kernel Kernel nfsd nfsiod
2 1 User Kernel User Kernel nfsd nfsiod 3 4 5 Disk Asynchronous writes (1,2) at client Write (3) on close, synch, and every 30 sec Server either (a) puts it in cache, or (b) writes-through. Write-through (synchronous writes) (3,4,5) on commit (=close) 2018/11/14

9 Read-ahead and delayed write
2018/11/14

10 Cache consistency 2018/11/14

11 TTL (Time-to-Live) and validation
file TTL=3sec delayed write (< 30sec) Server TTL=30sec write-thru directory 2018/11/14

12 Stateless server (V3) 2018/11/14

13 Pathname lookup in V3 2018/11/14

14 Review: Mounting in vfs/vnode architecture
Root file system Mounted file system rootvfs covers belongs to ROOT mounted here ROOT / /usr / vnode vnode vnode Vnodes for mounted-on directories and mounted roots are kept in MM. nov16 2018/11/14

15 Mounting example Server 1 Server 2 2018/11/14

16 Mounting on top of imported directory
Server 1 (S1) Server 2 (S2) Importing from S1 Importing from S2 2018/11/14

17 Two file systems at the same server
Server1 exports /usr and /usr/local (Exporting /usr doesn’t autom- atically export /usr/local). Similarly for importing. In V3, readdir on fh for local returns its original contents disk0 / usr u1 local f1 f2 / disk1 f3 f4 2018/11/14

18 continued … Lookup for /usr/local/f3 !=
Cannot pass entire path to Server1. f3 f3 / usr u1 local f1 f2 f3 mount –t nfs Server1:/usr /usr mount –t nfs Server2:/local /usr/local 2018/11/14

19 Mount permission 2018/11/14

20 Automount 2018/11/14

21 Automount example /etc/auto_home contains
tiko server1:/export/home/tiko john server2:/export/home/john When /home/tiko is accessed for the first time on any machine (at log-in time), server1:/export/home/tiko is mounted on local /home/tiko This way, I can log on to any machine and have the same /home/tiko environment. 2018/11/14

22 Important NFS V3 properties
2018/11/14

23 Version 4 2018/11/14

24 Version 4 pathname lookup
orange:/export/vol1 Request putrootfh lookup “export/vol1” getfh Get fh for /export/vol1 getattr Response  putrootfh OK CURFH lookup OK CURFH getfh OK getattr OK Returned FH for orange:/export/vol1 can be cached at client’s machine. 2018/11/14

25 Reading orange:/export/vol1/home/data
 putfh fh fh is file handle for /export/vol1 open “home/data” read at 0 for 1024  putfh OK CURFH open OK CURFH read OK (1024 bytes) NFS V4 itself has no concept of mounting. 2018/11/14

26 Pathname lookup failure
ls /export/home/fake putrootfh lookup “export” “home” “fake” getfh getattr If fake doesn’t exist, response would be  putfh OK CURFH lookup FAILED 2018/11/14

27 Component-wise pathname lookup
Client can then resort to component-by-component resolution putrootfh lookup “export” getfh getattr lookup “home” lookup “fake” Response from server putrootfh OK CURFH lookup OK CURFH getfh OK getattr OK lookup FAILED 2018/11/14

28 Component-wise lookup
2018/11/14

29 Compound procedure 2018/11/14

30 V4 file locking lock: lockt: locku: renew: 2018/11/14

31 V4 server crash recovery
2018/11/14

32 Duplicates elimination upon RPC failures
Three situations for handling retransmissions. The request is still in progress The reply has just been returned The reply had been sent some time ago, but was lost. 2018/11/14


Download ppt "4.3 Network File System (NFS)"

Similar presentations


Ads by Google