diff options
| author | Trond Myklebust <trond.myklebust@primarydata.com> | 2014-02-12 08:17:00 -0500 |
|---|---|---|
| committer | Trond Myklebust <trond.myklebust@primarydata.com> | 2014-02-19 21:21:06 -0500 |
| commit | 9a7fe9e8900baad5f6643000ea48b91aee895165 (patch) | |
| tree | 2e83b086f8824df9d4ebe4d8bcd502a1c4aba1da | |
| parent | 27999f253010bd64fd63dc80c99f8e926e2b110d (diff) | |
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: Trond Myklebust <trond.myklebust@primarydata.com>
| -rw-r--r-- | fs/nfs/callback_proc.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/nfs/callback_proc.c b/fs/nfs/callback_proc.c index 570c8a1d2f3d..41db5258e7a7 100644 --- a/fs/nfs/callback_proc.c +++ b/fs/nfs/callback_proc.c | |||
| @@ -127,13 +127,13 @@ static struct pnfs_layout_hdr * get_layout_by_fh_locked(struct nfs_client *clp, | |||
| 127 | continue; | 127 | continue; |
| 128 | ino = igrab(lo->plh_inode); | 128 | ino = igrab(lo->plh_inode); |
| 129 | if (!ino) | 129 | if (!ino) |
| 130 | continue; | 130 | break; |
| 131 | spin_lock(&ino->i_lock); | 131 | spin_lock(&ino->i_lock); |
| 132 | /* Is this layout in the process of being freed? */ | 132 | /* Is this layout in the process of being freed? */ |
| 133 | if (NFS_I(ino)->layout != lo) { | 133 | if (NFS_I(ino)->layout != lo) { |
| 134 | spin_unlock(&ino->i_lock); | 134 | spin_unlock(&ino->i_lock); |
| 135 | iput(ino); | 135 | iput(ino); |
| 136 | continue; | 136 | break; |
| 137 | } | 137 | } |
| 138 | pnfs_get_layout_hdr(lo); | 138 | pnfs_get_layout_hdr(lo); |
| 139 | spin_unlock(&ino->i_lock); | 139 | spin_unlock(&ino->i_lock); |
