Skip to content

nfs_complete_rename() calls d_move() without i_mutex

Benjamin Coddington linux-nfs 4 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest2 patches 0 repliesNew
  2. v32 patches 2 repliesSuperseded
  3. v22 patches 2 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v12 patches7 repliesSuperseded

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2Revert "NFS: nfs_rename() handle -ERESTARTSYS dentry left behind"fs/nfs/dir.c+24 -270 replies
2/2NFS: nfs_rename() - revalidate directories on -ERESTARTSYSfs/nfs/dir.c fs/nfs/unlink.c include/linux/nfs_xdr.h+19 -10 replies

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by.

PatchJeff Layton
1/2R-b
2/2R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v4 thread

Cover letter [PATCH v4 0/2] nfs_complete_rename() calls d_move() without i_mutex

Once commit 920b4530fb80430ff30ef83efe21ba1fa5623731 "NFS: nfs_rename() handle -ERESTARTSYS dentry left behind" moved the local d_move() into the RPC asyncronous context, d_move() could be called without holding the directories' i_mutex.

Let's revert that commit, and a follow-up fix for it in 1/2, and then fix the original problem once more by forcing a revalidation of the old and new directories if we notice that the rename was interrupted in 2/2.

v2: Add memory barrier, hold directory i_locks while revalidating, specify
single-bit field width for cancelled flag.

v3: Add some comments, change cancelled flag to bool.

v4: Where old_dir == new_dir, don't bump revalidation counter twice.

Benjamin Coddington (2):
Revert "NFS: nfs_rename() handle -ERESTARTSYS dentry left behind"
NFS: nfs_rename() - revalidate directories on -ERESTARTSYS

 fs/nfs/dir.c            | 57 +++++++++++++++++++++++++------------------------
 fs/nfs/unlink.c         | 13 +++++++++++
 include/linux/nfs_xdr.h |  1 +
 3 files changed, 43 insertions(+), 28 deletions(-)
Signature · 1 line
2.9.3