]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
pNFS: Fix a reference leak in _pnfs_return_layout
authorTrond Myklebust <trond.myklebust@primarydata.com>
Thu, 26 Jan 2017 20:50:41 +0000 (15:50 -0500)
committerTrond Myklebust <trond.myklebust@primarydata.com>
Thu, 26 Jan 2017 20:50:41 +0000 (15:50 -0500)
IF NFS_LAYOUT_RETURN_REQUESTED is not set, then we currently exit
without freeing the list of invalidated layout segments, leading
to a reference leak.

Reported-by: Olga Kornievskaia <aglo@umich.edu>
Fixes: 24408f5282 ("pNFS: Fix bugs in _pnfs_return_layout")
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
fs/nfs/pnfs.c

index 59554f3adf2948a10dd945b5f8441c236f53e9f2..dd042498ce7c67df24b4919c2e98dc8f48db13ca 100644 (file)
@@ -1200,10 +1200,10 @@ _pnfs_return_layout(struct inode *ino)
 
        send = pnfs_prepare_layoutreturn(lo, &stateid, NULL);
        spin_unlock(&ino->i_lock);
-       pnfs_free_lseg_list(&tmp_list);
        if (send)
                status = pnfs_send_layoutreturn(lo, &stateid, IOMODE_ANY, true);
 out_put_layout_hdr:
+       pnfs_free_lseg_list(&tmp_list);
        pnfs_put_layout_hdr(lo);
 out:
        dprintk("<-- %s status: %d\n", __func__, status);