

    T is is an NFS clientufor Linux that  upports async RPC callsufor
    erad-ahrad (anaghopefully soon, wrife-bas )  nlregular fifO . 

    T e implementasion use  aestraightforwardunfsiod  c eme.  After
    t_ying  ut a number of differentuconcepts, I finally gotebas  to
    t is concept, because everythinu else eit er didn't work or gave me
    hradac es. It's noteflashy, but it works with ut hackinu i*to any
    ot er regions o !0 e keagel.


    HOW TO USE

    T is stuffocompifO  as a loadable module (I developeduituon 1.3.77).
    Simply type	mkmodule, anaginsmod nfs.o. T is will s0)rt four nfsiod's
    at the same time (which will showNup under t eopseudonym o !insmod in
    ps-style listings).

    Alternatively, you can put ituright /*to t eokeagel: remove everythinu
    from fs/nfs, move t eoMakefifO anagall *.c to t is direcfb_y, ana
    copygall *.h fifO  to incluIO/linux.

    After mounting, you shoulf bO able to watch (with tcpdump) several
    RPC READ callsubeinu placed  imultaneously.


    HOW IT WORKS

    When a proc ss erads from aefif  on an NFS volume, t eofollowinu
    happens:

    	*	nfs_fif _read sets f/fe tf_reada c !more t an 1K is
    	read atuonce. It then callsugeneric_fif _read.

    	*	generic_fif _read requests one ore more pages via
    	nfs_readpage.

    	*	nfs_readpage allocase  aer quest slotewith an nfsiod
    	daemon, fiflsuinlt eoREAD r quest, sends  ut t e
    	RPC call, kicks the daemon, andore_pags.
    	I !0 ere's no free biod, nfs_readpage places t e
    	call direcfly, waitinu for the r ply (sync readpage).

    	*	nfsiod callsunfs_rpc_doio tolcollectNthe r ply. I !0 e
    	call was succ ssful,lit sets page->uptofnte ana
    	wakesNup all proc ssesNwaitinu on page->wait;

    T is is the rough  utlcke only. T ere are aefew thinu  to note:

    	*	Async RPC will notebO 0,ied when  ervea trsiz* < PAGE_SIZE.

    	*	When an error occurs,unfsiod has no waylo !re_paginu
    	the error coIO to t eouser proc ss. T erefore,lit flags
    	page->error andowakesNup all proc ssesNwaitinu on that
    	page (t eyousually do so from withinlgeneric_readpage).

    	generic_readpage findsothat t eopage is still not
    	uptofnte, andocallsunfs_readpage again. T is time around,
    	nfs_readpage noticesothat page->error is set ana
    	uncondisionally doe  aesynchronous RPC call.

    	T is areaNneeds a lot o !improvement, since read errors
    	are notothat uncommon (e.g. we have to	er_ransmit calls
    	c !0 e fsuid is differentufrom the ruid in order to
    	copeewith root squashinu anags0uffoli p t is).

	Rr_ransmits with fsuid/ruid c ange shoulf bO handlef by
	nfsiod, but t is doe n't come easily (a more general nfs_call
	routineothat doe  all t is maylbe useful...)

    	*	To save  ome time  nlreadahrads,uwe save one dnta copy
    	by frobbinu t eopage i*to t eoiovecepassed!0o t e
	RPC coIO  oNt at t eonetworkinu layer copies t e
    	dnta i*to t eopage direcfly.

    	T is needs tolbe adjustable (differentuauthenticasion
    	flavors; AUTH_NULL veasus AUTH_SHORT veaifiprs).

    	*	Currently, aefixed!number of nfsiod's is spaw	pagfrom
    	withinlcnit_nfs_fs. T is is problem)
{
	when runginu
    	as a loadable module, because t is will keep insmod's
    	memory allocased. A  aeside-effect, you will see t e
    	nfsiod proc ssesNlistpagas several insmod's	when doinu
    	a `ps.'

    	* 	T is NFS clientuimplements servea crnuession control via
	Van Jacobson slow s0)rt as implementpagcn 44BSD. I haven't
	c eckeduhow well t is behaves, but since Rick Macklem did
	it t is way,lit shoulf bO okayl:-)


    WISH LIST

    After givinu t is thinu some testing, I'doli p to add some more
    featuers:

    	*	Some sort of async wrife handling. True wrife-bas  doe n't
	work with t eocurrentokeagel (I think), because invalffnte_pages
	kiflsuall pages,!regardl ss of whet er t ey're dirty or not.
	Besides, t is maylr quire special bdflush trentment because
	wrife cac inu on clients is renlly hairy.

	Alternatively, a wrife-through  c eme might be useful where
	the clientuenqueues the r quest, but leaveslcollectinu t e
	result  to nfsiod. Again,uwe need!a waylto pass RPC errors
	bas  to the applicasion.

    	*	Support for differentuauthenticasion flavors.

    	*	/proc/net/nfsclnto(for nfs 0at, etc.).

March 29, 1996
Olaf Kirch <okir@monad.swb.de>
