Skip to content

nfs: make sure sillyrenames run to completion (try #1)

Jeff Layton linux-nfs 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest9 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/9nfs: eliminate nfs3_renameargsfs/nfs/nfs3proc.c fs/nfs/nfs3xdr.c include/linux/nfs_xdr.h+14 -200 replies
2/9nfs: convert nfs_renameargs to use qstr structsfs/nfs/nfs2xdr.c fs/nfs/nfs3proc.c fs/nfs/nfs3xdr.c +2 more+20 -260 replies
3/9nfs: eliminate nfs4_rename_argfs/nfs/nfs4proc.c fs/nfs/nfs4xdr.c include/linux/nfs_xdr.h+8 -150 replies
4/9nfs: standardize the rename response containerfs/nfs/nfs3proc.c fs/nfs/nfs3xdr.c fs/nfs/nfs4proc.c +2 more+22 -270 replies
5/9nfs: move nfs_sillyrename to unlink.cfs/nfs/dir.c fs/nfs/unlink.c include/linux/nfs_fs.h+85 -720 replies
6/9nfs: eliminate qsilly var from nfs_sillyrenamefs/nfs/unlink.c+2 -40 replies
7/9nfs: add a rename_setup nfs_rpc_op for async renamesfs/nfs/nfs3proc.c fs/nfs/nfs4proc.c fs/nfs/proc.c +1 more+48 -00 replies
8/9nfs: add rename_done nfs_rpc_opfs/nfs/nfs3proc.c fs/nfs/nfs4proc.c fs/nfs/proc.c +1 more+47 -00 replies
9/9nfs: make sillyrename an async operationfs/nfs/unlink.c+182 -90 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/9] nfs: make sure sillyrenames run to completion (try #1)

We had a bug report recently where someone was complaining about silly-renamed files being left around:

https://bugzilla.redhat.com/show_bug.cgi?id=511901

...they attached a reproducer to the bug which involves a pthreads-based program killing a child thread that's unlinking and closing a file.

The unlink triggers a sillyrename (since the file is still open). The parent kills the child thread and if timed just right, the child thread will be killed after the RENAME call is issued but before the reply is processed. The file will end up renamed on the server, but the client won't be aware of it and won't unlink it during dentry_iput.

This patchset is intended to prevent this from happening by having nfs_sillyrename use an asynchronous rename call and simply wait for the call to complete in TASK_KILLABLE sleep before proceeding. If the task is killed while the rename RPC is on the wire, it'll still run to completion even though the thread that initiated it was killed off.

To facilitate this, the set first changes all of the existing rename calls to use standardized argument and response containers. The nfs_sillyrename call is then moved to unlink.c (where the rest of the sillyrename code lives), and then is converted to use an asynchronous RPC call to handle the rename.

I've tested this by running the reproducer in the above bug report in a loop for several hours and never ended up with a leftover .nfs* file.

Jeff Layton (9):
nfs: eliminate nfs3_renameargs
nfs: convert nfs_renameargs to use qstr structs
nfs: eliminate nfs4_rename_arg
nfs: standardize the rename response container
nfs: move nfs_sillyrename to unlink.c
nfs: eliminate qsilly var from nfs_sillyrename
nfs: add a rename_setup nfs_rpc_op for async renames
nfs: add rename_done nfs_rpc_op
nfs: make sillyrename an async operation

 fs/nfs/dir.c            |   70 -------------
 fs/nfs/nfs2xdr.c        |    8 +-
 fs/nfs/nfs3proc.c       |   62 +++++++++---
 fs/nfs/nfs3xdr.c        |   16 ++--
 fs/nfs/nfs4proc.c       |   43 ++++++++-
 fs/nfs/nfs4xdr.c        |    4 +-
 fs/nfs/proc.c           |   30 +++++-
 fs/nfs/unlink.c         |  256 ++++++++++++++++++++++++++++++++++++++++++++++-
 include/linux/nfs_fs.h  |    2 +-
 include/linux/nfs_xdr.h |   64 ++++--------
 10 files changed, 405 insertions(+), 150 deletions(-)