Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 251ec410 authored by Trond Myklebust's avatar Trond Myklebust
Browse files

NFSv4.1: Fix another refcount issue in pnfs_find_alloc_layout

parent ae2bb032
Loading
Loading
Loading
Loading
+8 −7
Original line number Diff line number Diff line
@@ -907,18 +907,19 @@ pnfs_find_alloc_layout(struct inode *ino,

	dprintk("%s Begin ino=%p layout=%p\n", __func__, ino, nfsi->layout);

	if (nfsi->layout) {
		pnfs_get_layout_hdr(nfsi->layout);
		return nfsi->layout;
	}
	if (nfsi->layout != NULL)
		goto out_existing;
	spin_unlock(&ino->i_lock);
	new = alloc_init_layout_hdr(ino, ctx, gfp_flags);
	spin_lock(&ino->i_lock);

	if (likely(nfsi->layout == NULL))	/* Won the race? */
	if (likely(nfsi->layout == NULL)) {	/* Won the race? */
		nfsi->layout = new;
	else
		return new;
	}
	pnfs_free_layout_hdr(new);
out_existing:
	pnfs_get_layout_hdr(nfsi->layout);
	return nfsi->layout;
}