Re: process killed: text file modification

From: Rick Macklem <rmacklem_at_uoguelph.ca>
Date: Thu, 23 Mar 2017 00:55:09 +0000
Konstantin Belousov wrote:
[stuff snipped]
> Below is something to discuss. This is not finished, but it worked for
> the simple tests I performed. Clustering should be somewhat handled by
> the ncl_write() as is. As an additional advantage, I removed the now
> unneeded phys buffer allocation.
>
> If you agree with the approach on principle, I want to ask what to do
> about the commit stuff there (I simply removed that for now).
Wow, this is looking good to me. I had thought that the simple way to make
ncl_putpages() go through the buffer cache was to replace ncl_writerpc() with
VOP_WRITE(). My concern was all the memory<->memory copying that would
go on between the pages being written and the buffers allocated by VOP_WRITE().
If there is a way to avoid some (if not all) of this memory<->memory copying, then
I think it would be a big improvement..

As far as the commit goes, you don't need to do anything if you are calling VOP_WRITE().
(The code below VOP_WRITE() takes care of all of that.)
--> You might want to implement a function like nfs_write(), but with extra arguments.
      If you did that, you could indicate when you want the writes to happen synchronously
      vs. async/delayed and that would decide when FILESYNC would be specified.

As far as I know, the unpatched nc_putpages() is badly broken for the UNSTABLE/commit
case. For UNSTABLE writes, the client is supposed to know how to write the data again
if the server crashes/reboots before a Commit RPC is successfully done for the data.
(The ncl_clearcommit() function is the one called when the server indicates it has
 rebooted and needs this. It makes no sense whatsoever and breaks the client to call
 it in ncl_putpages() when mustcommit is set. All mustcommit being set indicates is
 that the write RPC was done UNSTABLE and the above applies to it. Some servers always
 do FILESYNC, so it isn't ever necessary to do a Commit PRC or redo the write RPCs.)

Summary. If you are calling VOP_WRITE() or a similar call above the buffer cache,
then you don't have to worry about any of this.

> Things that needs to be done is to add missed handling of the IO flags to
> ncl_write().

> +       if (error == 0 || !nfs_keep_dirty_on_error)
>                 vnode_pager_undirty_pages(pages, rtvals, count - uio.uio_resid);
If the data isn't copied, will this data still be available to the NFS buffer cache code,
so that it can redo the writes for the UNSTABLE case, if the server reboots before a
Commit RPC has succeeded?

> -               if (must_commit)
> -                       ncl_clearcommit(vp->v_mount);
No matter what else we do, this should go away. As above, it breaks the NFS client
and basically forces all dirty buffer cache blocks to be rewritten when it shouldn't
be necessary.

rick
Received on Wed Mar 22 2017 - 23:55:13 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:41:10 UTC