diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-09-20 17:31:43 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-09-28 16:03:14 -0400 |
commit | 9c6263819f25254f2ed48f076b50096dd5893dfb (patch) | |
tree | d95527cbeba0d44973f286602a35ff2c21c811bd /fs/nfs/callback_proc.c | |
parent | 6622c3ea059b2fed49924b74db41d1e0f065fbd3 (diff) |
NFSv4.1: Clean up the removal of pnfs_layout_hdr from the server list
Move the code into pnfs_free_layout_hdr(), and add checks to
get_layout_by_fh_locked to ensure that they don't reference a layout
that is being freed.
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/callback_proc.c')
-rw-r--r-- | fs/nfs/callback_proc.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/fs/nfs/callback_proc.c b/fs/nfs/callback_proc.c index 24252fea2c9c..76b4a7a3e559 100644 --- a/fs/nfs/callback_proc.c +++ b/fs/nfs/callback_proc.c | |||
@@ -122,7 +122,15 @@ static struct pnfs_layout_hdr * get_layout_by_fh_locked(struct nfs_client *clp, | |||
122 | ino = igrab(lo->plh_inode); | 122 | ino = igrab(lo->plh_inode); |
123 | if (!ino) | 123 | if (!ino) |
124 | continue; | 124 | continue; |
125 | spin_lock(&ino->i_lock); | ||
126 | /* Is this layout in the process of being freed? */ | ||
127 | if (NFS_I(ino)->layout != lo) { | ||
128 | spin_unlock(&ino->i_lock); | ||
129 | iput(ino); | ||
130 | continue; | ||
131 | } | ||
125 | pnfs_get_layout_hdr(lo); | 132 | pnfs_get_layout_hdr(lo); |
133 | spin_unlock(&ino->i_lock); | ||
126 | return lo; | 134 | return lo; |
127 | } | 135 | } |
128 | } | 136 | } |
@@ -196,9 +204,18 @@ static u32 initiate_bulk_draining(struct nfs_client *clp, | |||
196 | continue; | 204 | continue; |
197 | 205 | ||
198 | list_for_each_entry(lo, &server->layouts, plh_layouts) { | 206 | list_for_each_entry(lo, &server->layouts, plh_layouts) { |
199 | if (!igrab(lo->plh_inode)) | 207 | ino = igrab(lo->plh_inode); |
208 | if (ino) | ||
209 | continue; | ||
210 | spin_lock(&ino->i_lock); | ||
211 | /* Is this layout in the process of being freed? */ | ||
212 | if (NFS_I(ino)->layout != lo) { | ||
213 | spin_unlock(&ino->i_lock); | ||
214 | iput(ino); | ||
200 | continue; | 215 | continue; |
216 | } | ||
201 | pnfs_get_layout_hdr(lo); | 217 | pnfs_get_layout_hdr(lo); |
218 | spin_unlock(&ino->i_lock); | ||
202 | BUG_ON(!list_empty(&lo->plh_bulk_recall)); | 219 | BUG_ON(!list_empty(&lo->plh_bulk_recall)); |
203 | list_add(&lo->plh_bulk_recall, &recall_list); | 220 | list_add(&lo->plh_bulk_recall, &recall_list); |
204 | } | 221 | } |