NFSv4: Don't apply change_info4 twice on rename within a directory
authorTrond Myklebust <trond.myklebust@primarydata.com>
Wed, 11 Jan 2017 17:32:26 +0000 (12:32 -0500)
committerTrond Myklebust <trond.myklebust@primarydata.com>
Thu, 12 Jan 2017 20:51:18 +0000 (15:51 -0500)
If a file is renamed, but stays in the same directory, we will still receive
2 change_info4 structures describing the change to that directory, but we
only want to apply it once.

Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
fs/nfs/nfs4proc.c

index 4010c33151ad73a541d8e2744283ff9e7db7d458..1e797bf74aaf8cdb7df39977e39adf53e5fedaba 100644 (file)
@@ -4159,8 +4159,11 @@ static int nfs4_proc_rename_done(struct rpc_task *task, struct inode *old_dir,
        if (nfs4_async_handle_error(task, res->server, NULL, &data->timeout) == -EAGAIN)
                return 0;
 
-       update_changeattr(old_dir, &res->old_cinfo);
-       update_changeattr(new_dir, &res->new_cinfo);
+       if (task->tk_status == 0) {
+               update_changeattr(old_dir, &res->old_cinfo);
+               if (new_dir != old_dir)
+                       update_changeattr(new_dir, &res->new_cinfo);
+       }
        return 1;
 }