NFSv4.1/pNFS: Fix a race in initiate_file_draining()
authorTrond Myklebust <trond.myklebust@primarydata.com>
Mon, 4 Jan 2016 16:28:11 +0000 (11:28 -0500)
committerTrond Myklebust <trond.myklebust@primarydata.com>
Mon, 4 Jan 2016 17:36:12 +0000 (12:36 -0500)
Peng Tao points out that the call to pnfs_mark_matching_lsegs_return()
could race with pnfs_put_lseg(), in which case the layout segment is
cleared, but no layoutreturn will be sent.
Fix is to replace the call to pnfs_mark_matching_lsegs_invalid().

Reported-by: Peng Tao <tao.peng@primarydata.com>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
fs/nfs/callback_proc.c

index 2be8b252e3b1bcc6dbba5f198362113711e2c65e..f0939d097406a21b3f77d3ad2b8eec96807fa39c 100644 (file)
@@ -216,11 +216,8 @@ static u32 initiate_file_draining(struct nfs_client *clp,
                goto unlock;
        }
 
-       if (pnfs_mark_matching_lsegs_invalid(lo, &free_me_list,
+       if (pnfs_mark_matching_lsegs_return(lo, &free_me_list,
                                        &args->cbl_range)) {
-               pnfs_mark_matching_lsegs_return(lo,
-                               &free_me_list,
-                               &args->cbl_range);
                rv = NFS4_OK;
                goto unlock;
        }