Explorar o código

pNFS: Don't mark the layout as freed if the last lseg is marked for return

Address another memory leak.

Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Trond Myklebust %!s(int64=9) %!d(string=hai) anos
pai
achega
abb3e1c877
Modificáronse 1 ficheiros con 2 adicións e 0 borrados
  1. 2 0
      fs/nfs/pnfs.c

+ 2 - 0
fs/nfs/pnfs.c

@@ -455,6 +455,8 @@ pnfs_layout_remove_lseg(struct pnfs_layout_hdr *lo,
 	list_del_init(&lseg->pls_list);
 	list_del_init(&lseg->pls_list);
 	/* Matched by pnfs_get_layout_hdr in pnfs_layout_insert_lseg */
 	/* Matched by pnfs_get_layout_hdr in pnfs_layout_insert_lseg */
 	atomic_dec(&lo->plh_refcount);
 	atomic_dec(&lo->plh_refcount);
+	if (test_bit(NFS_LSEG_LAYOUTRETURN, &lseg->pls_flags))
+		return;
 	if (list_empty(&lo->plh_segs) &&
 	if (list_empty(&lo->plh_segs) &&
 	    !test_bit(NFS_LAYOUT_RETURN_REQUESTED, &lo->plh_flags) &&
 	    !test_bit(NFS_LAYOUT_RETURN_REQUESTED, &lo->plh_flags) &&
 	    !test_bit(NFS_LAYOUT_RETURN, &lo->plh_flags)) {
 	    !test_bit(NFS_LAYOUT_RETURN, &lo->plh_flags)) {