tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: [PATCH] Re: zero-filed page on VOP_PUTPAGES



YAMAMOTO Takashi <yamt%mwd.biglobe.ne.jp@localhost> wrote:

> do you have a particular idea what semantics might be broken?

Not sure, I am still searching. 

Here is a current posible behaviour:

thread1 puffs_vnop_setattr > dosetattr size1 > SETATTR size1 sent 
thread2 puffs_vnop_write > uvm_vnp_setsize increase to size2
thread2 puffs_vnop_fsync > dosetattr size2 > SETATTR size2 sent
thread1 SETATTR completes, uvm_vnp_setsize size1, file gets truncated
thread2 SETATTR completes, uvm_vnp_setsize size2, but data was lost

Now we prevent uvm_vnp_setsize() calls while a SETATTR is in prorgress.
We get this:

thread1 puffs_vnop_setattr > dosetattr size1 > SETATTR size1 sent 
thread2 puffs_vnop_write, uvm_vnp_setwritesize size2
thread2 puffs_vnop_fsync > dosetattr size2 > SETATTR size2 sent
thread1 SETATTR completes, uvm_vnp_setsize size1
thread2 SETATTR completes, uvm_vnp_setsize size2
thread2 VOP_PUTPAGES called (with mutex held)
thread2 VOP_PUTPAGES returns (releases mutex)
thread2 puffs_vnop_fsync returns

That seems to works.

-- 
Emmanuel Dreyfus
http://hcpnet.free.fr/pubz
manu%netbsd.org@localhost


Home | Main Index | Thread Index | Old Index