Commit 9a7fe9e8 authored by Trond Myklebust's avatar Trond Myklebust
Browse files

NFSv4.1: Minor optimisation in get_layout_by_fh_locked()



If the filehandles match, but the igrab() fails, or the layout is
freed before we can get it, then just return NULL.

Signed-off-by: default avatarTrond Myklebust <trond.myklebust@primarydata.com>
parent 27999f25
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -127,13 +127,13 @@ static struct pnfs_layout_hdr * get_layout_by_fh_locked(struct nfs_client *clp,
				continue;
			ino = igrab(lo->plh_inode);
			if (!ino)
				continue;
				break;
			spin_lock(&ino->i_lock);
			/* Is this layout in the process of being freed? */
			if (NFS_I(ino)->layout != lo) {
				spin_unlock(&ino->i_lock);
				iput(ino);
				continue;
				break;
			}
			pnfs_get_layout_hdr(lo);
			spin_unlock(&ino->i_lock);